Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -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 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * DOC: wlan_hdd_wext.c |
| 30 | * |
| 31 | * Linux Wireless Extensions Implementation |
| 32 | */ |
| 33 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 34 | /* denote that this file does not allow legacy hddLog */ |
| 35 | #define HDD_DISALLOW_LEGACY_HDDLOG 1 |
| 36 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 37 | #include <linux/version.h> |
| 38 | #include <linux/module.h> |
| 39 | #include <linux/kernel.h> |
| 40 | #include <linux/init.h> |
| 41 | #include <linux/wireless.h> |
| 42 | #include <mac_trace.h> |
| 43 | #include <wlan_hdd_includes.h> |
| 44 | #include <cds_api.h> |
| 45 | #include <net/arp.h> |
Manjunathappa Prakash | 3454fd6 | 2016-04-01 08:52:06 -0700 | [diff] [blame] | 46 | #include <cdp_txrx_stats.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "sir_params.h" |
| 48 | #include "csr_api.h" |
| 49 | #include "csr_inside_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "sme_rrm_internal.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #include <ani_global.h> |
| 52 | #include "dot11f.h" |
| 53 | #include <wlan_hdd_wowl.h> |
| 54 | #include <wlan_hdd_cfg.h> |
| 55 | #include <wlan_hdd_wmm.h> |
| 56 | #include "utils_api.h" |
| 57 | #include "wlan_hdd_p2p.h" |
| 58 | #ifdef FEATURE_WLAN_TDLS |
| 59 | #include "wlan_hdd_tdls.h" |
| 60 | #endif |
| 61 | |
| 62 | #include "cds_ieee80211_common.h" |
| 63 | #include "ol_if_athvar.h" |
| 64 | #include "dbglog_host.h" |
| 65 | #include "wma.h" |
| 66 | |
| 67 | #include "wlan_hdd_power.h" |
| 68 | #include "qwlan_version.h" |
| 69 | #include "wlan_hdd_host_offload.h" |
| 70 | |
| 71 | #include <linux/wireless.h> |
| 72 | #include <net/cfg80211.h> |
| 73 | |
| 74 | #include "wlan_hdd_misc.h" |
| 75 | |
| 76 | #include "qc_sap_ioctl.h" |
| 77 | #include "sme_api.h" |
| 78 | #include "wma_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 79 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | #include "wlan_hdd_assoc.h" |
| 81 | #include "wlan_hdd_ioctl.h" |
| 82 | #include "wlan_hdd_scan.h" |
| 83 | #include "sme_power_save_api.h" |
| 84 | #include "cds_concurrency.h" |
| 85 | #include "wlan_hdd_conc_ut.h" |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 86 | #include "wlan_hdd_tsf.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | #include "wlan_hdd_ocb.h" |
| 88 | #include "wlan_hdd_napi.h" |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 89 | #include "cdp_txrx_flow_ctrl_legacy.h" |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 90 | #include "wlan_hdd_nan_datapath.h" |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 91 | #include "wlan_hdd_stats.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 92 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 93 | #include "wlan_hdd_driver_ops.h" |
| 94 | #include "hif.h" |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 95 | #include "pld_common.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 96 | #endif |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_lro.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 98 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | #define HDD_FINISH_ULA_TIME_OUT 800 |
| 100 | #define HDD_SET_MCBC_FILTERS_TO_FW 1 |
| 101 | #define HDD_DELETE_MCBC_FILTERS_FROM_FW 0 |
| 102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | static int ioctl_debug; |
| 104 | module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |
| 105 | |
| 106 | /* To Validate Channel against the Frequency and Vice-Versa */ |
| 107 | static const hdd_freq_chan_map_t freq_chan_map[] = { |
| 108 | {2412, 1}, {2417, 2}, {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, |
| 109 | {2442, 7}, {2447, 8}, {2452, 9}, {2457, 10}, {2462, 11}, {2467, 12}, |
| 110 | {2472, 13}, {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, |
| 111 | {4980, 252}, {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, |
| 112 | {5200, 40}, {5220, 44}, {5240, 48}, {5260, 52}, {5280, 56}, |
| 113 | {5300, 60}, {5320, 64}, {5500, 100}, {5520, 104}, {5540, 108}, |
| 114 | {5560, 112}, {5580, 116}, {5600, 120}, {5620, 124}, {5640, 128}, |
| 115 | {5660, 132}, {5680, 136}, {5700, 140}, {5720, 144}, {5745, 149}, |
| 116 | {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165}, {5852, 170}, |
| 117 | {5855, 171}, {5860, 172}, {5865, 173}, {5870, 174}, {5875, 175}, |
| 118 | {5880, 176}, {5885, 177}, {5890, 178}, {5895, 179}, {5900, 180}, |
| 119 | {5905, 181}, {5910, 182}, {5915, 183}, {5920, 184} }; |
| 120 | |
| 121 | #define FREQ_CHAN_MAP_TABLE_SIZE \ |
| 122 | (sizeof(freq_chan_map) / sizeof(freq_chan_map[0])) |
| 123 | |
| 124 | /* Private ioctls and their sub-ioctls */ |
| 125 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 126 | #define WE_SET_11D_STATE 1 |
| 127 | #define WE_WOWL 2 |
| 128 | #define WE_SET_POWER 3 |
| 129 | #define WE_SET_MAX_ASSOC 4 |
| 130 | #define WE_SET_SCAN_DISABLE 5 |
| 131 | #define WE_SET_DATA_INACTIVITY_TO 6 |
| 132 | #define WE_SET_MAX_TX_POWER 7 |
| 133 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 134 | #define WE_SET_TM_LEVEL 9 |
| 135 | #define WE_SET_PHYMODE 10 |
| 136 | #define WE_SET_NSS 11 |
| 137 | #define WE_SET_LDPC 12 |
| 138 | #define WE_SET_TX_STBC 13 |
| 139 | #define WE_SET_RX_STBC 14 |
| 140 | #define WE_SET_SHORT_GI 15 |
| 141 | #define WE_SET_RTSCTS 16 |
| 142 | #define WE_SET_CHWIDTH 17 |
| 143 | #define WE_SET_ANI_EN_DIS 18 |
| 144 | #define WE_SET_ANI_POLL_PERIOD 19 |
| 145 | #define WE_SET_ANI_LISTEN_PERIOD 20 |
| 146 | #define WE_SET_ANI_OFDM_LEVEL 21 |
| 147 | #define WE_SET_ANI_CCK_LEVEL 22 |
| 148 | #define WE_SET_DYNAMIC_BW 23 |
| 149 | #define WE_SET_TX_CHAINMASK 24 |
| 150 | #define WE_SET_RX_CHAINMASK 25 |
| 151 | #define WE_SET_11N_RATE 26 |
| 152 | #define WE_SET_AMPDU 27 |
| 153 | #define WE_SET_AMSDU 28 |
| 154 | #define WE_SET_TXPOW_2G 29 |
| 155 | #define WE_SET_TXPOW_5G 30 |
| 156 | /* Private ioctl for firmware debug log */ |
| 157 | #define WE_DBGLOG_LOG_LEVEL 31 |
| 158 | #define WE_DBGLOG_VAP_ENABLE 32 |
| 159 | #define WE_DBGLOG_VAP_DISABLE 33 |
| 160 | #define WE_DBGLOG_MODULE_ENABLE 34 |
| 161 | #define WE_DBGLOG_MODULE_DISABLE 35 |
| 162 | #define WE_DBGLOG_MOD_LOG_LEVEL 36 |
| 163 | #define WE_DBGLOG_TYPE 37 |
| 164 | #define WE_SET_TXRX_FWSTATS 38 |
| 165 | #define WE_SET_VHT_RATE 39 |
| 166 | #define WE_DBGLOG_REPORT_ENABLE 40 |
| 167 | #define WE_TXRX_FWSTATS_RESET 41 |
| 168 | #define WE_SET_MAX_TX_POWER_2_4 42 |
| 169 | #define WE_SET_MAX_TX_POWER_5_0 43 |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 170 | #define WE_SET_PKTLOG 44 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | /* Private ioctl for packet powe save */ |
| 172 | #define WE_PPS_PAID_MATCH 45 |
| 173 | #define WE_PPS_GID_MATCH 46 |
| 174 | #define WE_PPS_EARLY_TIM_CLEAR 47 |
| 175 | #define WE_PPS_EARLY_DTIM_CLEAR 48 |
| 176 | #define WE_PPS_EOF_PAD_DELIM 49 |
| 177 | #define WE_PPS_MACADDR_MISMATCH 50 |
| 178 | #define WE_PPS_DELIM_CRC_FAIL 51 |
| 179 | #define WE_PPS_GID_NSTS_ZERO 52 |
| 180 | #define WE_PPS_RSSI_CHECK 53 |
| 181 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 54 |
| 182 | #define WE_SET_HTSMPS 55 |
| 183 | /* Private ioctl for QPower */ |
| 184 | #define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56 |
| 185 | #define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57 |
| 186 | #define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58 |
| 187 | #define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59 |
| 188 | |
| 189 | #define WE_SET_BURST_ENABLE 60 |
| 190 | #define WE_SET_BURST_DUR 61 |
| 191 | /* GTX Commands */ |
| 192 | #define WE_SET_GTX_HT_MCS 62 |
| 193 | #define WE_SET_GTX_VHT_MCS 63 |
| 194 | #define WE_SET_GTX_USRCFG 64 |
| 195 | #define WE_SET_GTX_THRE 65 |
| 196 | #define WE_SET_GTX_MARGIN 66 |
| 197 | #define WE_SET_GTX_STEP 67 |
| 198 | #define WE_SET_GTX_MINTPC 68 |
| 199 | #define WE_SET_GTX_BWMASK 69 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame^] | 200 | |
| 201 | /* |
| 202 | * <ioctl> |
| 203 | * setMccLatency - Sets the MCC latency value during STA-P2P concurrency |
| 204 | * |
| 205 | * @INPUT: set_value |
| 206 | * |
| 207 | * @OUTPUT: None |
| 208 | * |
| 209 | * This IOCTL is used to set the MCC latency value in milliseconds |
| 210 | * during STA-P2P concurrency. |
| 211 | * |
| 212 | * If 0ms latency is provided, then FW will set to a default. |
| 213 | * Otherwise, latency must be at least 30ms. |
| 214 | * |
| 215 | * @E.g: iwpriv wlan0 setMccLatency 40 |
| 216 | * |
| 217 | * |
| 218 | * Supported Feature: Concurrency |
| 219 | * |
| 220 | * Usage: Internal/External |
| 221 | * |
| 222 | * </ioctl> |
| 223 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 224 | #define WE_MCC_CONFIG_LATENCY 70 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame^] | 225 | |
| 226 | /* |
| 227 | * <ioctl> |
| 228 | * setMccQuota- Set the quota for P2P cases |
| 229 | * |
| 230 | * @INPUT: set_value [0,100] |
| 231 | * |
| 232 | * @OUTPUT: None |
| 233 | * |
| 234 | * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA. |
| 235 | * |
| 236 | * Currently used to set time quota for 2 MCC vdevs/adapters using |
| 237 | * (operating channel, quota) for each mode. |
| 238 | * The info is provided run time using iwpriv command: |
| 239 | * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>. |
| 240 | * Note: the quota provided in command is for the same mode in cmd. |
| 241 | * HDD checks if MCC mode is active, gets the second mode and its |
| 242 | * operating chan. |
| 243 | * Quota for the 2nd role is calculated as 100 - quota of first mode. |
| 244 | * |
| 245 | * @E.g: iwpriv wlan0 setMccQuota 50 |
| 246 | * iwpriv p2p0 setMccQuota 50 |
| 247 | * |
| 248 | * Supported Feature: Concurrency |
| 249 | * |
| 250 | * Usage: Internal/External |
| 251 | * |
| 252 | * </ioctl> |
| 253 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 254 | #define WE_MCC_CONFIG_QUOTA 71 |
| 255 | /* Private IOCTL for debug connection issues */ |
| 256 | #define WE_SET_DEBUG_LOG 72 |
| 257 | #ifdef WE_SET_TX_POWER |
| 258 | #undef WE_SET_TX_POWER |
| 259 | #endif |
| 260 | #define WE_SET_TX_POWER 74 |
| 261 | /* Private ioctl for earlyrx power save feature */ |
| 262 | #define WE_SET_EARLY_RX_ADJUST_ENABLE 75 |
| 263 | #define WE_SET_EARLY_RX_TGT_BMISS_NUM 76 |
| 264 | #define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77 |
| 265 | #define WE_SET_EARLY_RX_SLOP_STEP 78 |
| 266 | #define WE_SET_EARLY_RX_INIT_SLOP 79 |
| 267 | #define WE_SET_EARLY_RX_ADJUST_PAUSE 80 |
| 268 | #define WE_SET_MC_RATE 81 |
| 269 | #define WE_SET_EARLY_RX_DRIFT_SAMPLE 82 |
| 270 | /* Private ioctl for packet power save */ |
| 271 | #define WE_PPS_5G_EBT 83 |
| 272 | #define WE_SET_CTS_CBW 84 |
| 273 | #define WE_DUMP_STATS 85 |
| 274 | #define WE_CLEAR_STATS 86 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 275 | /* Private sub ioctl for starting/stopping the profiling */ |
| 276 | #define WE_START_FW_PROFILE 87 |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 277 | #define WE_SET_CHANNEL 88 |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 278 | #define WE_SET_CONC_SYSTEM_PREF 89 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | |
| 280 | /* Private ioctls and their sub-ioctls */ |
| 281 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 282 | #define WE_GET_11D_STATE 1 |
| 283 | #define WE_IBSS_STATUS 2 |
| 284 | #define WE_SET_SAP_CHANNELS 3 |
| 285 | #define WE_GET_WLAN_DBG 4 |
| 286 | #define WE_GET_MAX_ASSOC 6 |
| 287 | /* 7 is unused */ |
| 288 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame^] | 289 | |
| 290 | /* |
| 291 | * <ioctl> |
| 292 | * getconcurrency - Get concurrency mode |
| 293 | * |
| 294 | * @INPUT: None |
| 295 | * |
| 296 | * @OUTPUT: It shows concurrency value |
| 297 | * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO |
| 298 | * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device |
| 299 | * 8:OCB 9:EPPING 10:QVIT 11:NDI |
| 300 | * |
| 301 | * This IOCTL is used to retrieve concurrency mode. |
| 302 | * |
| 303 | * @E.g: iwpriv wlan0 getconcurrency |
| 304 | * wlan0 getconcurrency:5 |
| 305 | * Above value shows STA+P2P_Client |
| 306 | * |
| 307 | * Supported Feature: Concurrency |
| 308 | * |
| 309 | * Usage: Internal/External |
| 310 | * |
| 311 | * </ioctl> |
| 312 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | #define WE_GET_CONCURRENCY_MODE 9 |
| 314 | #define WE_GET_NSS 11 |
| 315 | #define WE_GET_LDPC 12 |
| 316 | #define WE_GET_TX_STBC 13 |
| 317 | #define WE_GET_RX_STBC 14 |
| 318 | #define WE_GET_SHORT_GI 15 |
| 319 | #define WE_GET_RTSCTS 16 |
| 320 | #define WE_GET_CHWIDTH 17 |
| 321 | #define WE_GET_ANI_EN_DIS 18 |
| 322 | #define WE_GET_ANI_POLL_PERIOD 19 |
| 323 | #define WE_GET_ANI_LISTEN_PERIOD 20 |
| 324 | #define WE_GET_ANI_OFDM_LEVEL 21 |
| 325 | #define WE_GET_ANI_CCK_LEVEL 22 |
| 326 | #define WE_GET_DYNAMIC_BW 23 |
| 327 | #define WE_GET_TX_CHAINMASK 24 |
| 328 | #define WE_GET_RX_CHAINMASK 25 |
| 329 | #define WE_GET_11N_RATE 26 |
| 330 | #define WE_GET_AMPDU 27 |
| 331 | #define WE_GET_AMSDU 28 |
| 332 | #define WE_GET_TXPOW_2G 29 |
| 333 | #define WE_GET_TXPOW_5G 30 |
Rajeev Kumar | 1bcfd63 | 2015-12-07 11:38:51 -0800 | [diff] [blame] | 334 | /* 31 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | #define WE_GET_PPS_PAID_MATCH 32 |
| 336 | #define WE_GET_PPS_GID_MATCH 33 |
| 337 | #define WE_GET_PPS_EARLY_TIM_CLEAR 34 |
| 338 | #define WE_GET_PPS_EARLY_DTIM_CLEAR 35 |
| 339 | #define WE_GET_PPS_EOF_PAD_DELIM 36 |
| 340 | #define WE_GET_PPS_MACADDR_MISMATCH 37 |
| 341 | #define WE_GET_PPS_DELIM_CRC_FAIL 38 |
| 342 | #define WE_GET_PPS_GID_NSTS_ZERO 39 |
| 343 | #define WE_GET_PPS_RSSI_CHECK 40 |
| 344 | /* Private ioctl for QPower */ |
| 345 | #define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41 |
| 346 | #define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42 |
| 347 | #define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43 |
| 348 | #define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44 |
| 349 | #define WE_GET_BURST_ENABLE 45 |
| 350 | #define WE_GET_BURST_DUR 46 |
| 351 | /* GTX Commands */ |
| 352 | #define WE_GET_GTX_HT_MCS 47 |
| 353 | #define WE_GET_GTX_VHT_MCS 48 |
| 354 | #define WE_GET_GTX_USRCFG 49 |
| 355 | #define WE_GET_GTX_THRE 50 |
| 356 | #define WE_GET_GTX_MARGIN 51 |
| 357 | #define WE_GET_GTX_STEP 52 |
| 358 | #define WE_GET_GTX_MINTPC 53 |
| 359 | #define WE_GET_GTX_BWMASK 54 |
| 360 | #define WE_GET_TEMPERATURE 56 |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 361 | #define WE_CAP_TSF 58 |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 362 | #define WE_GET_ROAM_SYNCH_DELAY 59 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | |
| 364 | /* Private ioctls and their sub-ioctls */ |
| 365 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 366 | |
| 367 | /* Private ioctls and their sub-ioctls */ |
| 368 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 369 | #define WE_WOWL_ADD_PTRN 1 |
| 370 | #define WE_WOWL_DEL_PTRN 2 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 371 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | #define WE_SET_AP_WPS_IE 4 /* This is called in station mode to set probe rsp ie. */ |
| 373 | #define WE_SET_CONFIG 5 |
| 374 | |
| 375 | /* Private ioctls and their sub-ioctls */ |
| 376 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 377 | #define WE_SET_WLAN_DBG 1 |
| 378 | #define WE_SET_DP_TRACE 2 |
| 379 | #define WE_SET_SAP_CHANNELS 3 |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 380 | #define WE_SET_FW_TEST 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 381 | |
| 382 | /* Private ioctls and their sub-ioctls */ |
| 383 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 384 | #define WE_WLAN_VERSION 1 |
| 385 | #define WE_GET_STATS 2 |
| 386 | #define WE_GET_CFG 3 |
| 387 | #define WE_GET_WMM_STATUS 4 |
| 388 | #define WE_GET_CHANNEL_LIST 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 389 | #define WE_GET_RSSI 6 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | #ifdef FEATURE_WLAN_TDLS |
| 391 | #define WE_GET_TDLS_PEERS 8 |
| 392 | #endif |
| 393 | #ifdef WLAN_FEATURE_11W |
| 394 | #define WE_GET_11W_INFO 9 |
| 395 | #endif |
| 396 | #define WE_GET_STATES 10 |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 397 | #define WE_GET_IBSS_STA_INFO 11 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 398 | #define WE_GET_PHYMODE 12 |
| 399 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 400 | #define WE_GET_OEM_DATA_CAP 13 |
| 401 | #endif |
| 402 | #define WE_GET_SNR 14 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 403 | #define WE_LIST_FW_PROFILE 15 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 404 | |
| 405 | /* Private ioctls and their sub-ioctls */ |
| 406 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
| 407 | #define WE_SET_REASSOC_TRIGGER 8 |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 408 | #define WE_IBSS_GET_PEER_INFO_ALL 10 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 409 | #define WE_DUMP_AGC_START 11 |
| 410 | #define WE_DUMP_AGC 12 |
| 411 | #define WE_DUMP_CHANINFO_START 13 |
| 412 | #define WE_DUMP_CHANINFO 14 |
| 413 | #define WE_DUMP_WATCHDOG 15 |
| 414 | #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG |
| 415 | #define WE_DUMP_PCIE_LOG 16 |
| 416 | #endif |
| 417 | #define WE_GET_RECOVERY_STAT 17 |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 418 | #define WE_GET_FW_PROFILE_DATA 18 |
| 419 | #define WE_STOP_OBSS_SCAN 19 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 420 | |
| 421 | /* Private ioctls and their sub-ioctls */ |
| 422 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 423 | |
| 424 | #define WE_P2P_NOA_CMD 2 |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 425 | /* subcommands 3 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 426 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 427 | #define WE_MAC_PWR_DEBUG_CMD 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | |
| 429 | #ifdef FEATURE_WLAN_TDLS |
| 430 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 431 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 432 | #define WE_IBSS_GET_PEER_INFO 6 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 433 | #define WE_UNIT_TEST_CMD 7 |
| 434 | |
| 435 | #define WE_MTRACE_DUMP_CMD 8 |
| 436 | #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 |
| 437 | |
| 438 | |
| 439 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 440 | #define WE_LED_FLASHING_PARAM 10 |
| 441 | #endif |
| 442 | |
| 443 | #define WE_POLICY_MANAGER_CLIST_CMD 11 |
| 444 | #define WE_POLICY_MANAGER_DLIST_CMD 12 |
| 445 | #define WE_POLICY_MANAGER_DBS_CMD 13 |
| 446 | #define WE_POLICY_MANAGER_PCL_CMD 14 |
| 447 | #define WE_POLICY_MANAGER_CINFO_CMD 15 |
| 448 | #define WE_POLICY_MANAGER_ULIST_CMD 16 |
| 449 | #define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17 |
| 450 | #define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18 |
| 451 | #define WE_POLICY_MANAGER_SCENARIO_CMD 19 |
| 452 | #define WE_POLICY_SET_HW_MODE_CMD 20 |
| 453 | |
| 454 | #define WE_SET_DUAL_MAC_SCAN_CONFIG 21 |
| 455 | #define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22 |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 456 | #define WE_SET_MON_MODE_CHAN 23 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 457 | |
| 458 | #ifdef FEATURE_WLAN_TDLS |
| 459 | #undef MAX_VAR_ARGS |
| 460 | #define MAX_VAR_ARGS 11 |
| 461 | #else |
| 462 | #undef MAX_VAR_ARGS |
| 463 | #define MAX_VAR_ARGS 9 |
| 464 | #endif |
| 465 | |
| 466 | /* Private ioctls (with no sub-ioctls) */ |
| 467 | /* note that they must be odd so that they have "get" semantics */ |
| 468 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
| 469 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
| 470 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 471 | |
| 472 | /* (SIOCIWFIRSTPRIV + 8) is currently unused */ |
| 473 | /* (SIOCIWFIRSTPRIV + 10) is currently unused */ |
| 474 | /* (SIOCIWFIRSTPRIV + 12) is currently unused */ |
| 475 | /* (SIOCIWFIRSTPRIV + 14) is currently unused */ |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 476 | #define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15) |
| 477 | #define WE_GET_TSF 1 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | /* (SIOCIWFIRSTPRIV + 16) is currently unused */ |
| 479 | /* (SIOCIWFIRSTPRIV + 17) is currently unused */ |
| 480 | /* (SIOCIWFIRSTPRIV + 19) is currently unused */ |
| 481 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 482 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 483 | |
| 484 | /* Private ioctl for setting the host offload feature */ |
| 485 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 486 | |
| 487 | /* Private ioctl to get the statistics */ |
| 488 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 489 | |
| 490 | /* Private ioctl to set the Keep Alive Params */ |
| 491 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 492 | |
| 493 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 494 | /* Private ioctl to set the packet filtering params */ |
| 495 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 496 | #endif |
| 497 | |
| 498 | |
| 499 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 500 | /* Private ioctl to get the statistics */ |
| 501 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 502 | #endif |
| 503 | |
| 504 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) |
| 505 | |
| 506 | /* (SIOCIWFIRSTPRIV + 26) is currently unused */ |
| 507 | /* (SIOCIWFIRSTPRIV + 27) is currently unused */ |
| 508 | |
| 509 | /* Private ioctls and their sub-ioctls */ |
| 510 | #define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28) |
| 511 | #define WE_SET_SMPS_PARAM 1 |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 512 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | #define WE_SET_FW_CRASH_INJECT 2 |
| 514 | #endif |
| 515 | #define WE_DUMP_DP_TRACE_LEVEL 3 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 516 | /* Private sub ioctl for enabling and setting histogram interval of profiling */ |
| 517 | #define WE_ENABLE_FW_PROFILE 4 |
| 518 | #define WE_SET_FW_PROFILE_HIST_INTVL 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 520 | /* Private sub-ioctl for initiating WoW suspend without Apps suspend */ |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 521 | #define WE_SET_WLAN_SUSPEND 6 |
| 522 | #define WE_SET_WLAN_RESUME 7 |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 523 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 524 | /* (SIOCIWFIRSTPRIV + 29) is currently unused */ |
| 525 | |
| 526 | /* 802.11p IOCTL */ |
| 527 | #define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30) |
| 528 | |
| 529 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 530 | |
| 531 | #define WLAN_STATS_INVALID 0 |
| 532 | #define WLAN_STATS_RETRY_CNT 1 |
| 533 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 534 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 535 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 536 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 537 | #define WLAN_STATS_FAIL_CNT 6 |
| 538 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 539 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 540 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 541 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 542 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 543 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 544 | |
| 545 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 546 | #define WLAN_STATS_RX_RATE 14 |
| 547 | #define WLAN_STATS_TX_RATE 15 |
| 548 | |
| 549 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 550 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 551 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 552 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 553 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 554 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 555 | |
| 556 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 557 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \ |
| 558 | *__p++ = __type; \ |
| 559 | *__p++ = __size; \ |
| 560 | memcpy(__p, __val, __size); \ |
| 561 | __p += __size; \ |
| 562 | __tlen += __size + 2; \ |
| 563 | } else { \ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 564 | hdd_err("FILL_TLV Failed!!!"); \ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 565 | } \ |
| 566 | } while (0) |
| 567 | |
| 568 | #define VERSION_VALUE_MAX_LEN 32 |
| 569 | |
| 570 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 571 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 572 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 573 | |
| 574 | #define WLAN_ADAPTER 0 |
| 575 | #define P2P_ADAPTER 1 |
| 576 | |
| 577 | /** |
| 578 | * mem_alloc_copy_from_user_helper - copy from user helper |
| 579 | * @wrqu_data: wireless extensions request data |
| 580 | * @len: length of @wrqu_data |
| 581 | * |
| 582 | * Helper function to allocate buffer and copy user data. |
| 583 | * |
| 584 | * Return: On success return a pointer to a kernel buffer containing a |
| 585 | * copy of the userspace data (with an additional NUL character |
| 586 | * appended for safety). On failure return %NULL. |
| 587 | */ |
| 588 | void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len) |
| 589 | { |
| 590 | u8 *ptr = NULL; |
| 591 | |
| 592 | /* in order to protect the code, an extra byte is post |
| 593 | * appended to the buffer and the null termination is added. |
| 594 | * However, when allocating (len+1) byte of memory, we need to |
| 595 | * make sure that there is no uint overflow when doing |
| 596 | * addition. In theory check len < UINT_MAX protects the uint |
| 597 | * overflow. For wlan private ioctl, the buffer size is much |
| 598 | * less than UINT_MAX, as a good guess, now, it is assumed |
| 599 | * that the private command buffer size is no greater than 4K |
| 600 | * (4096 bytes). So we use 4096 as the upper boundary for now. |
| 601 | */ |
| 602 | if (len > MAX_USER_COMMAND_SIZE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 603 | hdd_err("Invalid length"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | return NULL; |
| 605 | } |
| 606 | |
| 607 | ptr = kmalloc(len + 1, GFP_KERNEL); |
| 608 | if (NULL == ptr) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 609 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 610 | return NULL; |
| 611 | } |
| 612 | |
| 613 | if (copy_from_user(ptr, wrqu_data, len)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 614 | hdd_err("failed to copy data to user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | kfree(ptr); |
| 616 | return NULL; |
| 617 | } |
| 618 | ptr[len] = '\0'; |
| 619 | return ptr; |
| 620 | } |
| 621 | |
| 622 | /** |
| 623 | * hdd_priv_get_data() - Get pointer to ioctl private data |
| 624 | * @p_priv_data: pointer to iw_point struct to be filled |
| 625 | * @wrqu: Pointer to IOCTL Data received from userspace |
| 626 | * |
| 627 | * Helper function to get compatible struct iw_point passed to ioctl |
| 628 | * |
| 629 | * Return - 0 if p_priv_data successfully filled, error otherwise |
| 630 | */ |
| 631 | int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu) |
| 632 | { |
| 633 | if ((NULL == p_priv_data) || (NULL == wrqu)) { |
| 634 | return -EINVAL; |
| 635 | } |
| 636 | #ifdef CONFIG_COMPAT |
| 637 | if (is_compat_task()) { |
| 638 | struct compat_iw_point *p_compat_priv_data; |
| 639 | |
| 640 | /* Compat task: |
| 641 | * typecast to compat structure and copy the members. |
| 642 | */ |
| 643 | p_compat_priv_data = (struct compat_iw_point *)&wrqu->data; |
| 644 | |
| 645 | p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer); |
| 646 | p_priv_data->length = p_compat_priv_data->length; |
| 647 | p_priv_data->flags = p_compat_priv_data->flags; |
| 648 | } else { |
| 649 | #endif /* #ifdef CONFIG_COMPAT */ |
| 650 | |
| 651 | /* Non compat task: directly copy the structure. */ |
| 652 | memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point)); |
| 653 | |
| 654 | #ifdef CONFIG_COMPAT |
| 655 | } |
| 656 | #endif /* #ifdef CONFIG_COMPAT */ |
| 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | |
| 662 | /** |
| 663 | * hdd_wlan_get_stats() - Get txrx stats in SAP mode |
| 664 | * @pAdapter: Pointer to the hdd adapter. |
| 665 | * @length: Size of the data copied |
| 666 | * @buffer: Pointer to char buffer. |
| 667 | * @buf_len: Length of the char buffer. |
| 668 | * |
| 669 | * This function called when the "iwpriv wlan0 get_stats" command is given. |
| 670 | * It used to collect the txrx stats when the device is configured in SAP mode. |
| 671 | * |
| 672 | * Return - none |
| 673 | */ |
| 674 | void hdd_wlan_get_stats(hdd_adapter_t *pAdapter, uint16_t *length, |
| 675 | char *buffer, uint16_t buf_len) |
| 676 | { |
| 677 | hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 678 | uint32_t len = 0; |
| 679 | uint32_t total_rx_pkt = 0, total_rx_dropped = 0; |
| 680 | uint32_t total_rx_delv = 0, total_rx_refused = 0; |
| 681 | int i = 0; |
| 682 | |
| 683 | for (; i < NUM_CPUS; i++) { |
| 684 | total_rx_pkt += pStats->rxPackets[i]; |
| 685 | total_rx_dropped += pStats->rxDropped[i]; |
| 686 | total_rx_delv += pStats->rxDelivered[i]; |
| 687 | total_rx_refused += pStats->rxRefused[i]; |
| 688 | } |
| 689 | |
| 690 | len = scnprintf(buffer, buf_len, |
| 691 | "\nTransmit" |
| 692 | "\ncalled %u, dropped %u," |
| 693 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 694 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 695 | "\ncompleted %u," |
| 696 | "\n\nReceive Total" |
| 697 | "\n packets %u, dropped %u, delivered %u, refused %u" |
| 698 | "\n", |
| 699 | pStats->txXmitCalled, |
| 700 | pStats->txXmitDropped, |
| 701 | |
| 702 | pStats->txXmitDroppedAC[SME_AC_BK], |
| 703 | pStats->txXmitDroppedAC[SME_AC_BE], |
| 704 | pStats->txXmitDroppedAC[SME_AC_VI], |
| 705 | pStats->txXmitDroppedAC[SME_AC_VO], |
| 706 | |
| 707 | pStats->txXmitClassifiedAC[SME_AC_BK], |
| 708 | pStats->txXmitClassifiedAC[SME_AC_BE], |
| 709 | pStats->txXmitClassifiedAC[SME_AC_VI], |
| 710 | pStats->txXmitClassifiedAC[SME_AC_VO], |
| 711 | |
| 712 | pStats->txCompleted, |
| 713 | total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused |
| 714 | ); |
| 715 | |
| 716 | for (i = 0; i < NUM_CPUS; i++) { |
| 717 | len += scnprintf(buffer + len, buf_len - len, |
| 718 | "\nReceive CPU: %d" |
| 719 | "\n packets %u, dropped %u, delivered %u, refused %u", |
| 720 | i, pStats->rxPackets[i], pStats->rxDropped[i], |
| 721 | pStats->rxDelivered[i], pStats->rxRefused[i]); |
| 722 | } |
| 723 | |
| 724 | len += scnprintf(buffer + len, buf_len - len, |
| 725 | "\n\nTX_FLOW" |
| 726 | "\nCurrent status: %s" |
| 727 | "\ntx-flow timer start count %u" |
| 728 | "\npause count %u, unpause count %u", |
| 729 | (pStats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"), |
| 730 | pStats->txflow_timer_cnt, |
| 731 | pStats->txflow_pause_cnt, |
| 732 | pStats->txflow_unpause_cnt); |
| 733 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 734 | len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 735 | pAdapter->sessionId, &buffer[len], (buf_len - len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | |
| 737 | len += hdd_napi_stats(buffer + len, buf_len - len, |
| 738 | NULL, hdd_napi_get_all()); |
| 739 | |
| 740 | *length = len + 1; |
| 741 | } |
| 742 | |
| 743 | /** |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 744 | * hdd_wlan_list_fw_profile() - Get fw profiling points |
| 745 | * @length: Size of the data copied |
| 746 | * @buffer: Pointer to char buffer. |
| 747 | * @buf_len: Length of the char buffer. |
| 748 | * |
| 749 | * This function called when the "iwpriv wlan0 listProfile" command is given. |
| 750 | * It is used to get the supported profiling points in FW. |
| 751 | * |
| 752 | * Return - none |
| 753 | */ |
| 754 | void hdd_wlan_list_fw_profile(uint16_t *length, |
| 755 | char *buffer, uint16_t buf_len) |
| 756 | { |
| 757 | uint32_t len = 0; |
| 758 | |
| 759 | len = scnprintf(buffer, buf_len, |
| 760 | "PROF_CPU_IDLE: %u\n" |
| 761 | "PROF_PPDU_PROC: %u\n" |
| 762 | "PROF_PPDU_POST: %u\n" |
| 763 | "PROF_HTT_TX_INPUT: %u\n" |
| 764 | "PROF_MSDU_ENQ: %u\n" |
| 765 | "PROF_PPDU_POST_HAL: %u\n" |
| 766 | "PROF_COMPUTE_TX_TIME: %u\n", |
| 767 | PROF_CPU_IDLE, |
| 768 | PROF_PPDU_PROC, |
| 769 | PROF_PPDU_POST, |
| 770 | PROF_HTT_TX_INPUT, |
| 771 | PROF_MSDU_ENQ, |
| 772 | PROF_PPDU_POST_HAL, |
| 773 | PROF_COMPUTE_TX_TIME); |
| 774 | |
| 775 | *length = len + 1; |
| 776 | } |
| 777 | |
| 778 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 779 | * hdd_wlan_dump_stats() - display dump Stats |
| 780 | * @adapter: adapter handle |
| 781 | * @value: value from user |
| 782 | * |
| 783 | * Return: none |
| 784 | */ |
| 785 | void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value) |
| 786 | { |
| 787 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 788 | |
| 789 | switch (value) { |
| 790 | |
| 791 | case WLAN_TXRX_HIST_STATS: |
| 792 | wlan_hdd_display_tx_rx_histogram(hdd_ctx); |
| 793 | break; |
| 794 | case WLAN_HDD_NETIF_OPER_HISTORY: |
| 795 | wlan_hdd_display_netif_queue_history(hdd_ctx); |
| 796 | break; |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 797 | case WLAN_HIF_STATS: |
| 798 | hdd_display_hif_stats(); |
| 799 | break; |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 800 | case WLAN_LRO_STATS: |
| 801 | hdd_lro_display_stats(hdd_ctx); |
| 802 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 803 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 804 | cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC), value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 805 | break; |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | /** |
| 810 | * hdd_wlan_get_version() - Get driver version information |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 811 | * @hdd_ctx: Global HDD context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 812 | * @wrqu: Pointer to IOCTL REQUEST Data. |
| 813 | * @extra: Pointer to destination buffer |
| 814 | * |
| 815 | * This function is used to get Wlan Driver, Firmware, & Hardware |
| 816 | * Version information. If @wrqu and @extra are specified, then the |
| 817 | * version string is returned. Otherwise it is simply printed to the |
| 818 | * kernel log. |
| 819 | * |
| 820 | * Return: none |
| 821 | */ |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 822 | void hdd_wlan_get_version(hdd_context_t *hdd_ctx, union iwreq_data *wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 823 | char *extra) |
| 824 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 825 | tSirVersionString wcnss_sw_version; |
| 826 | const char *swversion; |
| 827 | const char *hwversion; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 828 | uint32_t msp_id = 0, mspid = 0, siid = 0, crmid = 0, sub_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 829 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 830 | if (!hdd_ctx) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 831 | hdd_err("Invalid context, HDD context is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 832 | goto error; |
| 833 | } |
| 834 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 835 | snprintf(wcnss_sw_version, sizeof(wcnss_sw_version), "%08x", |
| 836 | hdd_ctx->target_fw_version); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 837 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 838 | swversion = wcnss_sw_version; |
| 839 | msp_id = (hdd_ctx->target_fw_version & 0xf0000000) >> 28; |
| 840 | mspid = (hdd_ctx->target_fw_version & 0xf000000) >> 24; |
| 841 | siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20; |
| 842 | crmid = hdd_ctx->target_fw_version & 0x7fff; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 843 | sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 845 | hwversion = hdd_ctx->target_hw_name; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 846 | |
| 847 | if (wrqu && extra) { |
| 848 | wrqu->data.length = |
| 849 | scnprintf(extra, WE_MAX_STR_LEN, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 850 | "Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 851 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 852 | msp_id, mspid, siid, crmid, |
| 853 | sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 854 | } else { |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 855 | pr_info("Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s\n", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 857 | msp_id, mspid, siid, crmid, sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | } |
| 859 | error: |
| 860 | return; |
| 861 | } |
| 862 | |
| 863 | /** |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 864 | * hdd_wlan_get_ibss_mac_addr_from_staid() - Get IBSS MAC address |
| 865 | * @pAdapter: Adapter upon which the IBSS client is active |
| 866 | * @staIdx: Station index of the IBSS peer |
| 867 | * |
| 868 | * Return: a pointer to the MAC address of the IBSS peer if the peer is |
| 869 | * found, otherwise %NULL. |
| 870 | */ |
| 871 | struct qdf_mac_addr * |
| 872 | hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter, |
| 873 | uint8_t staIdx) |
| 874 | { |
| 875 | uint8_t idx; |
| 876 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 877 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 878 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 879 | if (0 != pHddStaCtx->conn_info.staId[idx] && |
| 880 | staIdx == pHddStaCtx->conn_info.staId[idx]) { |
| 881 | return &pHddStaCtx->conn_info.peerMacAddress[idx]; |
| 882 | } |
| 883 | } |
| 884 | return NULL; |
| 885 | } |
| 886 | |
| 887 | /** |
| 888 | * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information |
| 889 | * @pAdapter: Adapter upon which the IBSS client is active |
| 890 | * @staIdx: Station index of the IBSS peer |
| 891 | * |
| 892 | * Return: QDF_STATUS_STATUS if the peer was found and displayed, |
| 893 | * otherwise an appropriate QDF_STATUS_E_* failure code. |
| 894 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 895 | static QDF_STATUS hdd_wlan_get_ibss_peer_info(hdd_adapter_t *pAdapter, |
| 896 | uint8_t staIdx) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 897 | { |
| 898 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 899 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 900 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 901 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 902 | |
| 903 | status = |
| 904 | sme_request_ibss_peer_info(hHal, pAdapter, hdd_get_ibss_peer_info_cb, |
| 905 | false, staIdx); |
| 906 | |
| 907 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
| 908 | |
| 909 | if (QDF_STATUS_SUCCESS == status) { |
| 910 | unsigned long rc; |
| 911 | rc = wait_for_completion_timeout |
| 912 | (&pAdapter->ibss_peer_info_comp, |
| 913 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 914 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 915 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 916 | return QDF_STATUS_E_FAILURE; |
| 917 | } |
| 918 | |
| 919 | /** Print the peer info */ |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 920 | hdd_info("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 921 | { |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 922 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 923 | uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 924 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 925 | qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0]. |
| 926 | mac_addr, sizeof(mac_addr)); |
| 927 | hdd_info("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
| 928 | mac_addr, (int)tx_rate, |
| 929 | (int)pPeerInfo->peerInfoParams[0].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 930 | } |
| 931 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 932 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 933 | } |
| 934 | |
| 935 | return status; |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers |
| 940 | * @pAdapter: Adapter upon which the IBSS clients are active |
| 941 | * |
| 942 | * Return: QDF_STATUS_STATUS if the peer information was retrieved and |
| 943 | * displayed, otherwise an appropriate QDF_STATUS_E_* failure code. |
| 944 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 945 | static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(hdd_adapter_t *pAdapter) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 946 | { |
| 947 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 948 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 949 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 950 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 951 | int i; |
| 952 | |
| 953 | status = |
| 954 | sme_request_ibss_peer_info(hHal, pAdapter, hdd_get_ibss_peer_info_cb, |
| 955 | true, 0xFF); |
| 956 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
| 957 | |
| 958 | if (QDF_STATUS_SUCCESS == status) { |
| 959 | unsigned long rc; |
| 960 | rc = wait_for_completion_timeout |
| 961 | (&pAdapter->ibss_peer_info_comp, |
| 962 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 963 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 964 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 965 | return QDF_STATUS_E_FAILURE; |
| 966 | } |
| 967 | |
| 968 | /** Print the peer info */ |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 969 | hdd_info("pPeerInfo->numIBSSPeers = %d ", |
| 970 | (int)pPeerInfo->numPeers); |
| 971 | for (i = 0; i < pPeerInfo->numPeers; i++) { |
| 972 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 973 | uint32_t tx_rate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 974 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 975 | tx_rate = pPeerInfo->peerInfoParams[i].txRate; |
| 976 | qdf_mem_copy(mac_addr, |
| 977 | pPeerInfo->peerInfoParams[i].mac_addr, |
| 978 | sizeof(mac_addr)); |
| 979 | |
| 980 | hdd_info(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
| 981 | mac_addr, (int)tx_rate, |
| 982 | (int)pPeerInfo->peerInfoParams[i].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 983 | } |
| 984 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 985 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 986 | } |
| 987 | |
| 988 | return status; |
| 989 | } |
| 990 | |
| 991 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | * hdd_wlan_get_rts_threshold() - Get RTS threshold |
| 993 | * @pAdapter: adapter upon which the request was received |
| 994 | * @wrqu: pointer to the ioctl request |
| 995 | * |
| 996 | * This function retrieves the current RTS threshold value and stores |
| 997 | * it in the ioctl request structure |
| 998 | * |
| 999 | * Return: 0 if valid data was returned, non-zero on error |
| 1000 | */ |
| 1001 | int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 1002 | { |
| 1003 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1004 | uint32_t threshold = 0; |
| 1005 | hdd_context_t *hdd_ctx; |
| 1006 | int ret = 0; |
| 1007 | |
| 1008 | ENTER(); |
| 1009 | |
| 1010 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1011 | hdd_err("Adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | return -EINVAL; |
| 1013 | } |
| 1014 | |
| 1015 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 1016 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 1017 | if (0 != ret) |
| 1018 | return ret; |
| 1019 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1020 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1021 | sme_cfg_get_int(hHal, WNI_CFG_RTS_THRESHOLD, &threshold)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1022 | hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | return -EIO; |
| 1024 | } |
| 1025 | wrqu->rts.value = threshold; |
| 1026 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1027 | hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1028 | |
| 1029 | EXIT(); |
| 1030 | |
| 1031 | return 0; |
| 1032 | } |
| 1033 | |
| 1034 | /** |
| 1035 | * hdd_wlan_get_frag_threshold() - Get fragmentation threshold |
| 1036 | * @pAdapter: adapter upon which the request was received |
| 1037 | * @wrqu: pointer to the ioctl request |
| 1038 | * |
| 1039 | * This function retrieves the current fragmentation threshold value |
| 1040 | * and stores it in the ioctl request structure |
| 1041 | * |
| 1042 | * Return: 0 if valid data was returned, non-zero on error |
| 1043 | */ |
| 1044 | int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, |
| 1045 | union iwreq_data *wrqu) |
| 1046 | { |
| 1047 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1048 | uint32_t threshold = 0, status = 0; |
| 1049 | hdd_context_t *hdd_ctx; |
| 1050 | |
| 1051 | ENTER(); |
| 1052 | |
| 1053 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1054 | hdd_err("Adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | return -EINVAL; |
| 1056 | } |
| 1057 | |
| 1058 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 1059 | status = wlan_hdd_validate_context(hdd_ctx); |
| 1060 | if (0 != status) |
| 1061 | return status; |
| 1062 | |
| 1063 | if (sme_cfg_get_int(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1064 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1065 | hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1066 | return -EIO; |
| 1067 | } |
| 1068 | wrqu->frag.value = threshold; |
| 1069 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1070 | hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1071 | |
| 1072 | EXIT(); |
| 1073 | |
| 1074 | return 0; |
| 1075 | } |
| 1076 | |
| 1077 | /** |
| 1078 | * hdd_wlan_get_freq() - Convert channel to frequency |
| 1079 | * @channel: channel to be converted |
| 1080 | * @pfreq: where to store the frequency |
| 1081 | * |
| 1082 | * Return: 1 on success, otherwise a negative errno |
| 1083 | */ |
| 1084 | int hdd_wlan_get_freq(uint32_t channel, uint32_t *pfreq) |
| 1085 | { |
| 1086 | int i; |
| 1087 | if (channel > 0) { |
| 1088 | for (i = 0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) { |
| 1089 | if (channel == freq_chan_map[i].chan) { |
| 1090 | *pfreq = freq_chan_map[i].freq; |
| 1091 | return 1; |
| 1092 | } |
| 1093 | } |
| 1094 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1095 | hdd_notice("Invalid channel no=%d!!", channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1096 | return -EINVAL; |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * hdd_is_auth_type_rsn() - RSN authentication type check |
| 1101 | * @authType: authentication type to be checked |
| 1102 | * |
| 1103 | * Return: true if @authType is an RSN authentication type, |
| 1104 | * false if it is not |
| 1105 | */ |
| 1106 | static bool hdd_is_auth_type_rsn(eCsrAuthType authType) |
| 1107 | { |
| 1108 | bool rsnType = false; |
| 1109 | /* is the authType supported? */ |
| 1110 | switch (authType) { |
| 1111 | case eCSR_AUTH_TYPE_NONE: /* never used */ |
| 1112 | rsnType = false; |
| 1113 | break; |
| 1114 | /* MAC layer authentication types */ |
| 1115 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 1116 | rsnType = false; |
| 1117 | break; |
| 1118 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 1119 | rsnType = false; |
| 1120 | break; |
| 1121 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 1122 | rsnType = false; |
| 1123 | break; |
| 1124 | |
| 1125 | /* Upper layer authentication types */ |
| 1126 | case eCSR_AUTH_TYPE_WPA: |
| 1127 | rsnType = true; |
| 1128 | break; |
| 1129 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 1130 | rsnType = true; |
| 1131 | break; |
| 1132 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 1133 | rsnType = true; |
| 1134 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1135 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1136 | case eCSR_AUTH_TYPE_RSN: |
| 1137 | rsnType = true; |
| 1138 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1140 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 1141 | #ifdef WLAN_FEATURE_11W |
| 1142 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 1143 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 1144 | #endif |
| 1145 | rsnType = true; |
| 1146 | break; |
| 1147 | /* case eCSR_AUTH_TYPE_FAILED: */ |
| 1148 | case eCSR_AUTH_TYPE_UNKNOWN: |
| 1149 | rsnType = false; |
| 1150 | break; |
| 1151 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1152 | hdd_err("unknown authType %d, treat as open", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | authType); |
| 1154 | rsnType = false; |
| 1155 | break; |
| 1156 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1157 | hdd_notice("called with authType: %d, returned: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | authType, rsnType); |
| 1159 | return rsnType; |
| 1160 | } |
| 1161 | |
| 1162 | /** |
| 1163 | * hdd_get_rssi_cb() - "Get RSSI" callback function |
| 1164 | * @rssi: Current RSSI of the station |
| 1165 | * @staId: ID of the station |
| 1166 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 1167 | * a &struct statsContext |
| 1168 | * |
| 1169 | * Return: None |
| 1170 | */ |
| 1171 | static void hdd_get_rssi_cb(int8_t rssi, uint32_t staId, void *pContext) |
| 1172 | { |
| 1173 | struct statsContext *pStatsContext; |
| 1174 | hdd_adapter_t *pAdapter; |
| 1175 | |
| 1176 | if (ioctl_debug) { |
| 1177 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
| 1178 | __func__, (int)rssi, (int)staId, pContext); |
| 1179 | } |
| 1180 | |
| 1181 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1182 | hdd_err("Bad param"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1183 | return; |
| 1184 | } |
| 1185 | |
| 1186 | pStatsContext = pContext; |
| 1187 | pAdapter = pStatsContext->pAdapter; |
| 1188 | |
| 1189 | /* there is a race condition that exists between this callback |
| 1190 | * function and the caller since the caller could time out |
| 1191 | * either before or while this code is executing. we use a |
| 1192 | * spinlock to serialize these actions |
| 1193 | */ |
| 1194 | spin_lock(&hdd_context_lock); |
| 1195 | |
| 1196 | if ((NULL == pAdapter) || |
| 1197 | (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 1198 | /* the caller presumably timed out so there is nothing |
| 1199 | * we can do |
| 1200 | */ |
| 1201 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1202 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1203 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | if (ioctl_debug) { |
| 1205 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1206 | __func__, pAdapter, pStatsContext->magic); |
| 1207 | } |
| 1208 | return; |
| 1209 | } |
| 1210 | |
| 1211 | /* context is valid so caller is still waiting */ |
| 1212 | |
| 1213 | /* paranoia: invalidate the magic */ |
| 1214 | pStatsContext->magic = 0; |
| 1215 | |
| 1216 | /* copy over the rssi */ |
| 1217 | pAdapter->rssi = rssi; |
| 1218 | |
Sachin Ahuja | bef8c10 | 2015-11-16 15:15:49 +0530 | [diff] [blame] | 1219 | if (pAdapter->rssi > 0) |
| 1220 | pAdapter->rssi = 0; |
| 1221 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1222 | /* notify the caller */ |
| 1223 | complete(&pStatsContext->completion); |
| 1224 | |
| 1225 | /* serialization is complete */ |
| 1226 | spin_unlock(&hdd_context_lock); |
| 1227 | } |
| 1228 | |
| 1229 | /** |
| 1230 | * hdd_get_snr_cb() - "Get SNR" callback function |
| 1231 | * @snr: Current SNR of the station |
| 1232 | * @staId: ID of the station |
| 1233 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 1234 | * a &struct statsContext |
| 1235 | * |
| 1236 | * Return: None |
| 1237 | */ |
| 1238 | static void hdd_get_snr_cb(int8_t snr, uint32_t staId, void *pContext) |
| 1239 | { |
| 1240 | struct statsContext *pStatsContext; |
| 1241 | hdd_adapter_t *pAdapter; |
| 1242 | |
| 1243 | if (ioctl_debug) { |
| 1244 | pr_info("%s: snr [%d] STA [%d] pContext [%p]\n", |
| 1245 | __func__, (int)snr, (int)staId, pContext); |
| 1246 | } |
| 1247 | |
| 1248 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1249 | hdd_err("Bad param"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | return; |
| 1251 | } |
| 1252 | |
| 1253 | pStatsContext = pContext; |
| 1254 | pAdapter = pStatsContext->pAdapter; |
| 1255 | |
| 1256 | /* there is a race condition that exists between this callback |
| 1257 | * function and the caller since the caller could time out |
| 1258 | * either before or while this code is executing. we use a |
| 1259 | * spinlock to serialize these actions |
| 1260 | */ |
| 1261 | spin_lock(&hdd_context_lock); |
| 1262 | |
| 1263 | if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 1264 | /* the caller presumably timed out so there is nothing |
| 1265 | * we can do |
| 1266 | */ |
| 1267 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1268 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1269 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1270 | if (ioctl_debug) { |
| 1271 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1272 | __func__, pAdapter, pStatsContext->magic); |
| 1273 | } |
| 1274 | return; |
| 1275 | } |
| 1276 | |
| 1277 | /* context is valid so caller is still waiting */ |
| 1278 | |
| 1279 | /* paranoia: invalidate the magic */ |
| 1280 | pStatsContext->magic = 0; |
| 1281 | |
| 1282 | /* copy over the snr */ |
| 1283 | pAdapter->snr = snr; |
| 1284 | |
| 1285 | /* notify the caller */ |
| 1286 | complete(&pStatsContext->completion); |
| 1287 | |
| 1288 | /* serialization is complete */ |
| 1289 | spin_unlock(&hdd_context_lock); |
| 1290 | } |
| 1291 | |
| 1292 | /** |
| 1293 | * wlan_hdd_get_rssi() - Get the current RSSI |
| 1294 | * @pAdapter: adapter upon which the measurement is requested |
| 1295 | * @rssi_value: pointer to where the RSSI should be returned |
| 1296 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1297 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1298 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1299 | QDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1300 | { |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1301 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1302 | hdd_context_t *pHddCtx; |
| 1303 | hdd_station_ctx_t *pHddStaCtx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1304 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1305 | unsigned long rc; |
| 1306 | |
| 1307 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1308 | hdd_warn("Invalid context, pAdapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1309 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1310 | } |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 1311 | if (cds_is_driver_recovering()) { |
| 1312 | hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", |
| 1313 | cds_get_driver_state()); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1314 | /* return a cached value */ |
| 1315 | *rssi_value = pAdapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1316 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1320 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1321 | |
| 1322 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1323 | hdd_err("Not associated!, rssi on disconnect %d", |
| 1324 | pAdapter->rssi_on_disconnect); |
| 1325 | *rssi_value = pAdapter->rssi_on_disconnect; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1326 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1327 | } |
| 1328 | |
| 1329 | if (pHddStaCtx->hdd_ReassocScenario) { |
| 1330 | hdd_info("Roaming in progress, return cached RSSI"); |
| 1331 | *rssi_value = pAdapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1332 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1333 | } |
| 1334 | |
| 1335 | init_completion(&context.completion); |
| 1336 | context.pAdapter = pAdapter; |
| 1337 | context.magic = RSSI_CONTEXT_MAGIC; |
| 1338 | |
| 1339 | hstatus = sme_get_rssi(pHddCtx->hHal, hdd_get_rssi_cb, |
| 1340 | pHddStaCtx->conn_info.staId[0], |
| 1341 | pHddStaCtx->conn_info.bssId, pAdapter->rssi, |
| 1342 | &context, pHddCtx->pcds_context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1343 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1344 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1345 | /* we'll returned a cached value below */ |
| 1346 | } else { |
| 1347 | /* request was sent -- wait for the response */ |
| 1348 | rc = wait_for_completion_timeout(&context.completion, |
| 1349 | msecs_to_jiffies |
| 1350 | (WLAN_WAIT_TIME_STATS)); |
| 1351 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1352 | hdd_err("SME timed out while retrieving RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | /* we'll now returned a cached value below */ |
| 1354 | } |
| 1355 | } |
| 1356 | |
| 1357 | /* either we never sent a request, we sent a request and |
| 1358 | * received a response or we sent a request and timed out. if |
| 1359 | * we never sent a request or if we sent a request and got a |
| 1360 | * response, we want to clear the magic out of paranoia. if |
| 1361 | * we timed out there is a race condition such that the |
| 1362 | * callback function could be executing at the same time we |
| 1363 | * are. of primary concern is if the callback function had |
| 1364 | * already verified the "magic" but had not yet set the |
| 1365 | * completion variable when a timeout occurred. we serialize |
| 1366 | * these activities by invalidating the magic while holding a |
| 1367 | * shared spinlock which will cause us to block if the |
| 1368 | * callback is currently executing |
| 1369 | */ |
| 1370 | spin_lock(&hdd_context_lock); |
| 1371 | context.magic = 0; |
| 1372 | spin_unlock(&hdd_context_lock); |
| 1373 | |
| 1374 | *rssi_value = pAdapter->rssi; |
| 1375 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1376 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1377 | } |
| 1378 | |
| 1379 | /** |
| 1380 | * wlan_hdd_get_snr() - Get the current SNR |
| 1381 | * @pAdapter: adapter upon which the measurement is requested |
| 1382 | * @snr: pointer to where the SNR should be returned |
| 1383 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1384 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1385 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1386 | QDF_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, int8_t *snr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | { |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1388 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | hdd_context_t *pHddCtx; |
| 1390 | hdd_station_ctx_t *pHddStaCtx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1391 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1392 | unsigned long rc; |
| 1393 | int valid; |
| 1394 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1395 | ENTER(); |
| 1396 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1398 | hdd_err("Invalid context, pAdapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1399 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1400 | } |
| 1401 | |
| 1402 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1403 | |
| 1404 | valid = wlan_hdd_validate_context(pHddCtx); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1405 | if (0 != valid) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1406 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | |
| 1408 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1409 | |
| 1410 | init_completion(&context.completion); |
| 1411 | context.pAdapter = pAdapter; |
| 1412 | context.magic = SNR_CONTEXT_MAGIC; |
| 1413 | |
| 1414 | hstatus = sme_get_snr(pHddCtx->hHal, hdd_get_snr_cb, |
| 1415 | pHddStaCtx->conn_info.staId[0], |
| 1416 | pHddStaCtx->conn_info.bssId, &context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1417 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1418 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1419 | /* we'll returned a cached value below */ |
| 1420 | } else { |
| 1421 | /* request was sent -- wait for the response */ |
| 1422 | rc = wait_for_completion_timeout(&context.completion, |
| 1423 | msecs_to_jiffies |
| 1424 | (WLAN_WAIT_TIME_STATS)); |
| 1425 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1426 | hdd_err("SME timed out while retrieving SNR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1427 | /* we'll now returned a cached value below */ |
| 1428 | } |
| 1429 | } |
| 1430 | |
| 1431 | /* either we never sent a request, we sent a request and |
| 1432 | * received a response or we sent a request and timed out. if |
| 1433 | * we never sent a request or if we sent a request and got a |
| 1434 | * response, we want to clear the magic out of paranoia. if |
| 1435 | * we timed out there is a race condition such that the |
| 1436 | * callback function could be executing at the same time we |
| 1437 | * are. of primary concern is if the callback function had |
| 1438 | * already verified the "magic" but had not yet set the |
| 1439 | * completion variable when a timeout occurred. we serialize |
| 1440 | * these activities by invalidating the magic while holding a |
| 1441 | * shared spinlock which will cause us to block if the |
| 1442 | * callback is currently executing |
| 1443 | */ |
| 1444 | spin_lock(&hdd_context_lock); |
| 1445 | context.magic = 0; |
| 1446 | spin_unlock(&hdd_context_lock); |
| 1447 | |
| 1448 | *snr = pAdapter->snr; |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1449 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1450 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | /** |
| 1454 | * hdd_get_link_speed_cb() - Get link speed callback function |
| 1455 | * @pLinkSpeed: pointer to the link speed record |
| 1456 | * @pContext: pointer to the user context passed to SME |
| 1457 | * |
| 1458 | * This function is passed as the callback function to |
| 1459 | * sme_get_link_speed() by wlan_hdd_get_linkspeed_for_peermac(). By |
| 1460 | * agreement a &struct linkspeedContext is passed as @pContext. If |
| 1461 | * the context is valid, then the contents of @pLinkSpeed are copied |
| 1462 | * into the adapter record referenced by @pContext where they can be |
| 1463 | * subsequently retrieved. If the context is invalid, then this |
| 1464 | * function does nothing since it is assumed the caller has already |
| 1465 | * timed-out and destroyed the context. |
| 1466 | * |
| 1467 | * Return: None. |
| 1468 | */ |
| 1469 | static void |
| 1470 | hdd_get_link_speed_cb(tSirLinkSpeedInfo *pLinkSpeed, void *pContext) |
| 1471 | { |
| 1472 | struct linkspeedContext *pLinkSpeedContext; |
| 1473 | hdd_adapter_t *pAdapter; |
| 1474 | |
| 1475 | if ((NULL == pLinkSpeed) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1476 | hdd_err("Bad param, pLinkSpeed [%p] pContext [%p]", |
| 1477 | pLinkSpeed, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | return; |
| 1479 | } |
| 1480 | spin_lock(&hdd_context_lock); |
| 1481 | pLinkSpeedContext = pContext; |
| 1482 | pAdapter = pLinkSpeedContext->pAdapter; |
| 1483 | |
| 1484 | /* there is a race condition that exists between this callback |
| 1485 | * function and the caller since the caller could time out either |
| 1486 | * before or while this code is executing. we use a spinlock to |
| 1487 | * serialize these actions |
| 1488 | */ |
| 1489 | |
| 1490 | if ((NULL == pAdapter) || |
| 1491 | (LINK_CONTEXT_MAGIC != pLinkSpeedContext->magic)) { |
| 1492 | /* the caller presumably timed out so there is nothing |
| 1493 | * we can do |
| 1494 | */ |
| 1495 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1496 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1497 | pAdapter, pLinkSpeedContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | if (ioctl_debug) { |
| 1499 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1500 | __func__, pAdapter, pLinkSpeedContext->magic); |
| 1501 | } |
| 1502 | return; |
| 1503 | } |
| 1504 | |
| 1505 | /* context is valid so caller is still waiting */ |
| 1506 | |
| 1507 | /* paranoia: invalidate the magic */ |
| 1508 | pLinkSpeedContext->magic = 0; |
| 1509 | |
| 1510 | /* copy over the stats. do so as a struct copy */ |
| 1511 | pAdapter->ls_stats = *pLinkSpeed; |
| 1512 | |
| 1513 | /* notify the caller */ |
| 1514 | complete(&pLinkSpeedContext->completion); |
| 1515 | |
| 1516 | /* serialization is complete */ |
| 1517 | spin_unlock(&hdd_context_lock); |
| 1518 | } |
| 1519 | |
| 1520 | /** |
| 1521 | * wlan_hdd_get_linkspeed_for_peermac() - Get link speed for a peer |
| 1522 | * @pAdapter: adapter upon which the peer is active |
| 1523 | * @macAddress: MAC address of the peer |
| 1524 | * |
| 1525 | * This function will send a query to SME for the linkspeed of the |
| 1526 | * given peer, and then wait for the callback to be invoked. |
| 1527 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1528 | * Return: QDF_STATUS_SUCCESS if linkspeed data is available, |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1529 | * otherwise a QDF_STATUS_E_** error. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1530 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1531 | QDF_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1532 | struct qdf_mac_addr macAddress) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1533 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1534 | unsigned long rc; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1535 | static struct linkspeedContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1536 | tSirLinkSpeedInfo *linkspeed_req; |
| 1537 | |
| 1538 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1539 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1540 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1541 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1542 | linkspeed_req = qdf_mem_malloc(sizeof(*linkspeed_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1543 | if (NULL == linkspeed_req) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1544 | hdd_err("Request Buffer Alloc Fail"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1545 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1546 | } |
| 1547 | init_completion(&context.completion); |
| 1548 | context.pAdapter = pAdapter; |
| 1549 | context.magic = LINK_CONTEXT_MAGIC; |
| 1550 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1551 | qdf_copy_macaddr(&linkspeed_req->peer_macaddr, &macAddress); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1552 | status = sme_get_link_speed(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1553 | linkspeed_req, |
| 1554 | &context, hdd_get_link_speed_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1555 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1556 | hdd_err("Unable to retrieve statistics for link speed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1557 | qdf_mem_free(linkspeed_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1558 | } else { |
| 1559 | rc = wait_for_completion_timeout |
| 1560 | (&context.completion, |
| 1561 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 1562 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1563 | hdd_err("SME timed out while retrieving link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | /* either we never sent a request, we sent a request and |
| 1568 | * received a response or we sent a request and timed out. if |
| 1569 | * we never sent a request or if we sent a request and got a |
| 1570 | * response, we want to clear the magic out of paranoia. if |
| 1571 | * we timed out there is a race condition such that the |
| 1572 | * callback function could be executing at the same time we |
| 1573 | * are. of primary concern is if the callback function had |
| 1574 | * already verified the "magic" but had not yet set the |
| 1575 | * completion variable when a timeout occurred. we serialize |
| 1576 | * these activities by invalidating the magic while holding a |
| 1577 | * shared spinlock which will cause us to block if the |
| 1578 | * callback is currently executing |
| 1579 | */ |
| 1580 | spin_lock(&hdd_context_lock); |
| 1581 | context.magic = 0; |
| 1582 | spin_unlock(&hdd_context_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1583 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1584 | } |
| 1585 | |
| 1586 | /** |
| 1587 | * wlan_hdd_get_link_speed() - get link speed |
| 1588 | * @pAdapter: pointer to the adapter |
| 1589 | * @link_speed: pointer to link speed |
| 1590 | * |
| 1591 | * This function fetches per bssid link speed. |
| 1592 | * |
| 1593 | * Return: if associated, link speed shall be returned. |
| 1594 | * if not associated, link speed of 0 is returned. |
| 1595 | * On error, error number will be returned. |
| 1596 | */ |
| 1597 | int wlan_hdd_get_link_speed(hdd_adapter_t *sta_adapter, uint32_t *link_speed) |
| 1598 | { |
| 1599 | hdd_context_t *hddctx = WLAN_HDD_GET_CTX(sta_adapter); |
| 1600 | hdd_station_ctx_t *hdd_stactx = |
| 1601 | WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter); |
| 1602 | int ret; |
| 1603 | |
| 1604 | ret = wlan_hdd_validate_context(hddctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 1605 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1606 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1607 | |
Nitesh Shah | 4e2d5eb | 2016-09-06 19:45:13 +0530 | [diff] [blame] | 1608 | /* Linkspeed is allowed only for P2P mode */ |
| 1609 | if (sta_adapter->device_mode != QDF_P2P_CLIENT_MODE) { |
| 1610 | hdd_err("Link Speed is not allowed in Device mode %s(%d)", |
| 1611 | hdd_device_mode_to_string(sta_adapter->device_mode), |
| 1612 | sta_adapter->device_mode); |
| 1613 | return -ENOTSUPP; |
| 1614 | } |
| 1615 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1616 | if (eConnectionState_Associated != hdd_stactx->conn_info.connState) { |
| 1617 | /* we are not connected so we don't have a classAstats */ |
| 1618 | *link_speed = 0; |
| 1619 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1620 | QDF_STATUS status; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1621 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1623 | qdf_copy_macaddr(&bssid, &hdd_stactx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1624 | |
| 1625 | status = wlan_hdd_get_linkspeed_for_peermac(sta_adapter, bssid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1626 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1627 | hdd_err("Unable to retrieve SME linkspeed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | return -EINVAL; |
| 1629 | } |
| 1630 | *link_speed = sta_adapter->ls_stats.estLinkSpeed; |
| 1631 | /* linkspeed in units of 500 kbps */ |
| 1632 | *link_speed = (*link_speed) / 500; |
| 1633 | } |
| 1634 | return 0; |
| 1635 | } |
| 1636 | |
| 1637 | /** |
| 1638 | * hdd_statistics_cb() - "Get statistics" callback function |
| 1639 | * @pStats: statistics payload |
| 1640 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 1641 | * a pointer to an adapter |
| 1642 | * |
| 1643 | * Return: None |
| 1644 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 1645 | static void hdd_statistics_cb(void *pStats, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1646 | { |
| 1647 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 1648 | hdd_stats_t *pStatsCache = NULL; |
| 1649 | hdd_wext_state_t *pWextState; |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 1650 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1651 | |
| 1652 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 1653 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
| 1654 | tCsrGlobalClassBStatsInfo *pClassBStats = NULL; |
| 1655 | tCsrGlobalClassCStatsInfo *pClassCStats = NULL; |
| 1656 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
| 1657 | tCsrPerStaStatsInfo *pPerStaStats = NULL; |
| 1658 | |
| 1659 | if (pAdapter != NULL) |
| 1660 | pStatsCache = &pAdapter->hdd_stats; |
| 1661 | |
| 1662 | pSummaryStats = (tCsrSummaryStatsInfo *) pStats; |
| 1663 | pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1); |
| 1664 | pClassBStats = (tCsrGlobalClassBStatsInfo *) (pClassAStats + 1); |
| 1665 | pClassCStats = (tCsrGlobalClassCStatsInfo *) (pClassBStats + 1); |
| 1666 | pClassDStats = (tCsrGlobalClassDStatsInfo *) (pClassCStats + 1); |
| 1667 | pPerStaStats = (tCsrPerStaStatsInfo *) (pClassDStats + 1); |
| 1668 | |
| 1669 | if (pStatsCache != NULL) { |
| 1670 | /* copy the stats into the cache we keep in the |
| 1671 | * adapter instance structure |
| 1672 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1673 | qdf_mem_copy(&pStatsCache->summary_stat, pSummaryStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1674 | sizeof(pStatsCache->summary_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1675 | qdf_mem_copy(&pStatsCache->ClassA_stat, pClassAStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1676 | sizeof(pStatsCache->ClassA_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1677 | qdf_mem_copy(&pStatsCache->ClassB_stat, pClassBStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1678 | sizeof(pStatsCache->ClassB_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1679 | qdf_mem_copy(&pStatsCache->ClassC_stat, pClassCStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1680 | sizeof(pStatsCache->ClassC_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1681 | qdf_mem_copy(&pStatsCache->ClassD_stat, pClassDStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1682 | sizeof(pStatsCache->ClassD_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1683 | qdf_mem_copy(&pStatsCache->perStaStats, pPerStaStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | sizeof(pStatsCache->perStaStats)); |
| 1685 | } |
| 1686 | |
| 1687 | if (pAdapter) { |
| 1688 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1689 | qdf_status = qdf_event_set(&pWextState->hdd_qdf_event); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 1690 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1691 | hdd_err("qdf_event_set failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1692 | return; |
| 1693 | } |
| 1694 | } |
| 1695 | } |
| 1696 | |
| 1697 | /** |
| 1698 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
| 1699 | * @pAdapter: adapter who's IEs are to be cleared |
| 1700 | * |
| 1701 | * Return: None |
| 1702 | */ |
| 1703 | void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter) |
| 1704 | { |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 1705 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 1706 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 1707 | ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | |
| 1709 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1710 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 1711 | pWextState->roamProfile.pWPAReqIE = (uint8_t *) NULL; |
| 1712 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 1713 | pWextState->roamProfile.pRSNReqIE = (uint8_t *) NULL; |
| 1714 | |
| 1715 | #ifdef FEATURE_WLAN_WAPI |
| 1716 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 1717 | pWextState->roamProfile.pWAPIReqIE = (uint8_t *) NULL; |
| 1718 | #endif |
| 1719 | |
| 1720 | pWextState->roamProfile.bWPSAssociation = false; |
| 1721 | pWextState->roamProfile.bOSENAssociation = false; |
| 1722 | pWextState->roamProfile.pAddIEScan = (uint8_t *) NULL; |
| 1723 | pWextState->roamProfile.nAddIEScanLength = 0; |
| 1724 | pWextState->roamProfile.pAddIEAssoc = (uint8_t *) NULL; |
| 1725 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 1726 | |
| 1727 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 1728 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 1729 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1730 | |
| 1731 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 1732 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 1733 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1734 | |
| 1735 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 1736 | pWextState->roamProfile.AuthType.authType[0] = |
| 1737 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1738 | |
| 1739 | #ifdef WLAN_FEATURE_11W |
| 1740 | pWextState->roamProfile.MFPEnabled = false; |
| 1741 | pWextState->roamProfile.MFPRequired = 0; |
| 1742 | pWextState->roamProfile.MFPCapable = 0; |
| 1743 | #endif |
| 1744 | |
| 1745 | pWextState->authKeyMgmt = 0; |
| 1746 | |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 1747 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, CSR_MAX_NUM_KEY); |
| 1748 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1749 | #ifdef FEATURE_WLAN_WAPI |
| 1750 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 1751 | pAdapter->wapi_info.nWapiMode = 0; |
| 1752 | #endif |
| 1753 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1754 | qdf_zero_macaddr(&pWextState->req_bssId); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 1755 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | } |
| 1757 | |
| 1758 | /** |
| 1759 | * wlan_hdd_get_vendor_oui_ie_ptr() - Find a vendor OUI |
| 1760 | * @oui: The OUI that is being searched for |
| 1761 | * @oui_size: The length of @oui |
| 1762 | * @ie: The set of IEs within which we're trying to find @oui |
| 1763 | * @ie_len: The length of @ie |
| 1764 | * |
| 1765 | * This function will scan the IEs contained within @ie looking for @oui. |
| 1766 | * |
| 1767 | * Return: Pointer to @oui embedded within @ie if it is present, NULL |
| 1768 | * if @oui is not present within @ie. |
| 1769 | */ |
| 1770 | uint8_t *wlan_hdd_get_vendor_oui_ie_ptr(uint8_t *oui, uint8_t oui_size, |
| 1771 | uint8_t *ie, int ie_len) |
| 1772 | { |
| 1773 | int left = ie_len; |
| 1774 | uint8_t *ptr = ie; |
| 1775 | uint8_t elem_id, elem_len; |
| 1776 | uint8_t eid = 0xDD; |
| 1777 | |
| 1778 | if (NULL == ie || 0 == ie_len) |
| 1779 | return NULL; |
| 1780 | |
| 1781 | while (left >= 2) { |
| 1782 | elem_id = ptr[0]; |
| 1783 | elem_len = ptr[1]; |
| 1784 | left -= 2; |
| 1785 | if (elem_len > left) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1786 | hdd_alert("****Invalid IEs eid = %d elem_len=%d left=%d*****", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1787 | eid, elem_len, left); |
| 1788 | return NULL; |
| 1789 | } |
| 1790 | if (elem_id == eid) { |
| 1791 | if (memcmp(&ptr[2], oui, oui_size) == 0) |
| 1792 | return ptr; |
| 1793 | } |
| 1794 | |
| 1795 | left -= elem_len; |
| 1796 | ptr += (elem_len + 2); |
| 1797 | } |
| 1798 | return NULL; |
| 1799 | } |
| 1800 | |
| 1801 | /** |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 1802 | * hdd_get_ldpc() - Get adapter LDPC |
| 1803 | * @adapter: adapter being queried |
| 1804 | * @value: where to store the value |
| 1805 | * |
| 1806 | * Return: 0 on success, negative errno on failure |
| 1807 | */ |
| 1808 | int hdd_get_ldpc(hdd_adapter_t *adapter, int *value) |
| 1809 | { |
| 1810 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1811 | int ret; |
| 1812 | |
| 1813 | ENTER(); |
| 1814 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 1815 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING); |
| 1816 | if (ret < 0) { |
| 1817 | hdd_alert("Failed to get LDPC value"); |
| 1818 | } else { |
| 1819 | *value = ret; |
| 1820 | ret = 0; |
| 1821 | } |
| 1822 | return ret; |
| 1823 | } |
| 1824 | |
| 1825 | /** |
| 1826 | * hdd_set_ldpc() - Set adapter LDPC |
| 1827 | * @adapter: adapter being modified |
| 1828 | * @value: new LDPC value |
| 1829 | * |
| 1830 | * Return: 0 on success, negative errno on failure |
| 1831 | */ |
| 1832 | int hdd_set_ldpc(hdd_adapter_t *adapter, int value) |
| 1833 | { |
| 1834 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1835 | int ret; |
| 1836 | |
| 1837 | hdd_alert("%d", value); |
| 1838 | if (value) { |
| 1839 | /* make sure HT capabilities allow this */ |
| 1840 | QDF_STATUS status; |
| 1841 | uint32_t cfg_value; |
| 1842 | union { |
| 1843 | uint16_t cfg_value16; |
| 1844 | tSirMacHTCapabilityInfo ht_cap_info; |
| 1845 | } u; |
| 1846 | |
| 1847 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 1848 | if (QDF_STATUS_SUCCESS != status) { |
| 1849 | hdd_alert("Failed to get HT capability info"); |
| 1850 | return -EIO; |
| 1851 | } |
| 1852 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 1853 | if (!u.ht_cap_info.advCodingCap) { |
| 1854 | hdd_alert("LDCP not supported"); |
| 1855 | return -EINVAL; |
| 1856 | } |
| 1857 | } |
| 1858 | |
| 1859 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 1860 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING, |
| 1861 | value); |
| 1862 | if (ret) |
| 1863 | hdd_alert("Failed to set LDPC value"); |
| 1864 | |
| 1865 | return ret; |
| 1866 | } |
| 1867 | |
| 1868 | /** |
| 1869 | * hdd_get_tx_stbc() - Get adapter TX STBC |
| 1870 | * @adapter: adapter being queried |
| 1871 | * @value: where to store the value |
| 1872 | * |
| 1873 | * Return: 0 on success, negative errno on failure |
| 1874 | */ |
| 1875 | int hdd_get_tx_stbc(hdd_adapter_t *adapter, int *value) |
| 1876 | { |
| 1877 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1878 | int ret; |
| 1879 | |
| 1880 | ENTER(); |
| 1881 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 1882 | WNI_CFG_HT_CAP_INFO_TX_STBC); |
| 1883 | if (ret < 0) { |
| 1884 | hdd_alert("Failed to get TX STBC value"); |
| 1885 | } else { |
| 1886 | *value = ret; |
| 1887 | ret = 0; |
| 1888 | } |
| 1889 | |
| 1890 | return ret; |
| 1891 | } |
| 1892 | |
| 1893 | /** |
| 1894 | * hdd_set_tx_stbc() - Set adapter TX STBC |
| 1895 | * @adapter: adapter being modified |
| 1896 | * @value: new TX STBC value |
| 1897 | * |
| 1898 | * Return: 0 on success, negative errno on failure |
| 1899 | */ |
| 1900 | int hdd_set_tx_stbc(hdd_adapter_t *adapter, int value) |
| 1901 | { |
| 1902 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1903 | int ret; |
| 1904 | |
| 1905 | hdd_alert("%d", value); |
| 1906 | if (value) { |
| 1907 | /* make sure HT capabilities allow this */ |
| 1908 | QDF_STATUS status; |
| 1909 | uint32_t cfg_value; |
| 1910 | union { |
| 1911 | uint16_t cfg_value16; |
| 1912 | tSirMacHTCapabilityInfo ht_cap_info; |
| 1913 | } u; |
| 1914 | |
| 1915 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 1916 | if (QDF_STATUS_SUCCESS != status) { |
| 1917 | hdd_alert("Failed to get HT capability info"); |
| 1918 | return -EIO; |
| 1919 | } |
| 1920 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 1921 | if (!u.ht_cap_info.txSTBC) { |
| 1922 | hdd_alert("TX STBC not supported"); |
| 1923 | return -EINVAL; |
| 1924 | } |
| 1925 | } |
| 1926 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 1927 | WNI_CFG_HT_CAP_INFO_TX_STBC, |
| 1928 | value); |
| 1929 | if (ret) |
| 1930 | hdd_alert("Failed to set TX STBC value"); |
| 1931 | |
| 1932 | return ret; |
| 1933 | } |
| 1934 | |
| 1935 | /** |
| 1936 | * hdd_get_rx_stbc() - Get adapter RX STBC |
| 1937 | * @adapter: adapter being queried |
| 1938 | * @value: where to store the value |
| 1939 | * |
| 1940 | * Return: 0 on success, negative errno on failure |
| 1941 | */ |
| 1942 | int hdd_get_rx_stbc(hdd_adapter_t *adapter, int *value) |
| 1943 | { |
| 1944 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1945 | int ret; |
| 1946 | |
| 1947 | ENTER(); |
| 1948 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 1949 | WNI_CFG_HT_CAP_INFO_RX_STBC); |
| 1950 | if (ret < 0) { |
| 1951 | hdd_alert("Failed to get RX STBC value"); |
| 1952 | } else { |
| 1953 | *value = ret; |
| 1954 | ret = 0; |
| 1955 | } |
| 1956 | |
| 1957 | return ret; |
| 1958 | } |
| 1959 | |
| 1960 | /** |
| 1961 | * hdd_set_rx_stbc() - Set adapter RX STBC |
| 1962 | * @adapter: adapter being modified |
| 1963 | * @value: new RX STBC value |
| 1964 | * |
| 1965 | * Return: 0 on success, negative errno on failure |
| 1966 | */ |
| 1967 | int hdd_set_rx_stbc(hdd_adapter_t *adapter, int value) |
| 1968 | { |
| 1969 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 1970 | int ret; |
| 1971 | |
| 1972 | hdd_alert("%d", value); |
| 1973 | if (value) { |
| 1974 | /* make sure HT capabilities allow this */ |
| 1975 | QDF_STATUS status; |
| 1976 | uint32_t cfg_value; |
| 1977 | union { |
| 1978 | uint16_t cfg_value16; |
| 1979 | tSirMacHTCapabilityInfo ht_cap_info; |
| 1980 | } u; |
| 1981 | |
| 1982 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 1983 | if (QDF_STATUS_SUCCESS != status) { |
| 1984 | hdd_alert("Failed to get HT capability info"); |
| 1985 | return -EIO; |
| 1986 | } |
| 1987 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 1988 | if (!u.ht_cap_info.rxSTBC) { |
| 1989 | hdd_alert("RX STBC not supported"); |
| 1990 | return -EINVAL; |
| 1991 | } |
| 1992 | } |
| 1993 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 1994 | WNI_CFG_HT_CAP_INFO_RX_STBC, |
| 1995 | value); |
| 1996 | if (ret) |
| 1997 | hdd_alert("Failed to set RX STBC value"); |
| 1998 | |
| 1999 | return ret; |
| 2000 | } |
| 2001 | |
| 2002 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | * __iw_set_commit() - SIOCSIWCOMMIT ioctl handler |
| 2004 | * @dev: device upon which the ioctl was received |
| 2005 | * @info: ioctl request information |
| 2006 | * @wrqu: ioctl request data |
| 2007 | * @extra: ioctl extra data |
| 2008 | * |
| 2009 | * Return: 0 on success, non-zero on error |
| 2010 | */ |
| 2011 | static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 2012 | union iwreq_data *wrqu, char *extra) |
| 2013 | { |
| 2014 | hdd_adapter_t *adapter; |
| 2015 | hdd_context_t *hdd_ctx; |
| 2016 | int ret; |
| 2017 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2018 | ENTER_DEV(dev); |
| 2019 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2020 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2021 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 2022 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2023 | if (0 != ret) |
| 2024 | return ret; |
| 2025 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2026 | /* Do nothing for now */ |
| 2027 | return 0; |
| 2028 | } |
| 2029 | |
| 2030 | /** |
| 2031 | * iw_set_commit() - SSR wrapper function for __iw_set_commit |
| 2032 | * @dev: pointer to net_device |
| 2033 | * @info: pointer to iw_request_info |
| 2034 | * @wrqu: pointer to iwreq_data |
| 2035 | * @extra: extra |
| 2036 | * |
| 2037 | * Return: 0 on success, error number otherwise |
| 2038 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 2039 | static int iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2040 | union iwreq_data *wrqu, char *extra) |
| 2041 | { |
| 2042 | int ret; |
| 2043 | |
| 2044 | cds_ssr_protect(__func__); |
| 2045 | ret = __iw_set_commit(dev, info, wrqu, extra); |
| 2046 | cds_ssr_unprotect(__func__); |
| 2047 | |
| 2048 | return ret; |
| 2049 | } |
| 2050 | |
| 2051 | /** |
| 2052 | * __iw_get_name() - SIOCGIWNAME ioctl handler |
| 2053 | * @dev: device upon which the ioctl was received |
| 2054 | * @info: ioctl request information |
| 2055 | * @wrqu: ioctl request data |
| 2056 | * @extra: ioctl extra data |
| 2057 | * |
| 2058 | * Return: 0 on success, non-zero on error |
| 2059 | */ |
| 2060 | static int __iw_get_name(struct net_device *dev, |
| 2061 | struct iw_request_info *info, char *wrqu, char *extra) |
| 2062 | { |
| 2063 | hdd_adapter_t *adapter; |
| 2064 | hdd_context_t *hdd_ctx; |
| 2065 | int ret; |
| 2066 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2067 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2068 | |
| 2069 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2070 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 2071 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2072 | if (0 != ret) |
| 2073 | return ret; |
| 2074 | |
| 2075 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 2076 | EXIT(); |
| 2077 | return 0; |
| 2078 | } |
| 2079 | |
| 2080 | /** |
| 2081 | * __iw_get_name() - SSR wrapper for __iw_get_name |
| 2082 | * @dev: pointer to net_device |
| 2083 | * @info: pointer to iw_request_info |
| 2084 | * @wrqu: pointer to iwreq_data |
| 2085 | * @extra: extra |
| 2086 | * |
| 2087 | * Return: 0 on success, error number otherwise |
| 2088 | */ |
| 2089 | static int iw_get_name(struct net_device *dev, |
| 2090 | struct iw_request_info *info, |
| 2091 | char *wrqu, char *extra) |
| 2092 | { |
| 2093 | int ret; |
| 2094 | |
| 2095 | cds_ssr_protect(__func__); |
| 2096 | ret = __iw_get_name(dev, info, wrqu, extra); |
| 2097 | cds_ssr_unprotect(__func__); |
| 2098 | |
| 2099 | return ret; |
| 2100 | } |
| 2101 | |
| 2102 | /** |
| 2103 | * __iw_set_mode() - ioctl handler |
| 2104 | * @dev: device upon which the ioctl was received |
| 2105 | * @info: ioctl request information |
| 2106 | * @wrqu: ioctl request data |
| 2107 | * @extra: ioctl extra data |
| 2108 | * |
| 2109 | * Return: 0 on success, non-zero on error |
| 2110 | */ |
| 2111 | static int __iw_set_mode(struct net_device *dev, |
| 2112 | struct iw_request_info *info, |
| 2113 | union iwreq_data *wrqu, char *extra) |
| 2114 | { |
| 2115 | hdd_wext_state_t *pWextState; |
| 2116 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2117 | hdd_context_t *hdd_ctx; |
| 2118 | tCsrRoamProfile *pRoamProfile; |
| 2119 | eCsrRoamBssType LastBSSType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2120 | struct hdd_config *pConfig; |
| 2121 | struct wireless_dev *wdev; |
| 2122 | int ret; |
| 2123 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2124 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2125 | |
| 2126 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2127 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2128 | if (0 != ret) |
| 2129 | return ret; |
| 2130 | |
| 2131 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2132 | wdev = dev->ieee80211_ptr; |
| 2133 | pRoamProfile = &pWextState->roamProfile; |
| 2134 | LastBSSType = pRoamProfile->BSSType; |
| 2135 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2136 | hdd_notice("Old Bss type = %d", LastBSSType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | |
| 2138 | switch (wrqu->mode) { |
| 2139 | case IW_MODE_ADHOC: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2140 | hdd_notice("Setting AP Mode as IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 2142 | /* Set the phymode correctly for IBSS. */ |
| 2143 | pConfig = (WLAN_HDD_GET_CTX(pAdapter))->config; |
| 2144 | pWextState->roamProfile.phyMode = |
| 2145 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 2146 | pAdapter->device_mode = QDF_IBSS_MODE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2147 | wdev->iftype = NL80211_IFTYPE_ADHOC; |
| 2148 | break; |
| 2149 | case IW_MODE_INFRA: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2150 | hdd_notice("Setting AP Mode as IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2151 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 2152 | wdev->iftype = NL80211_IFTYPE_STATION; |
| 2153 | break; |
| 2154 | case IW_MODE_AUTO: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2155 | hdd_notice("Setting AP Mode as IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2156 | pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY; |
| 2157 | break; |
| 2158 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2159 | hdd_err("Unknown AP Mode value %d", wrqu->mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | return -EOPNOTSUPP; |
| 2161 | } |
| 2162 | |
| 2163 | if (LastBSSType != pRoamProfile->BSSType) { |
| 2164 | /* the BSS mode changed. We need to issue disconnect |
| 2165 | * if connected or in IBSS disconnect state |
| 2166 | */ |
Jeff Johnson | 9eeed0a | 2016-10-03 15:04:57 -0700 | [diff] [blame] | 2167 | if (hdd_conn_is_connected |
| 2168 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2169 | || (eCSR_BSS_TYPE_START_IBSS == LastBSSType)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2170 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2171 | /* need to issue a disconnect to CSR. */ |
| 2172 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2173 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2175 | pAdapter->sessionId, |
| 2176 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2177 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2178 | unsigned long rc; |
| 2179 | rc = wait_for_completion_timeout(&pAdapter-> |
| 2180 | disconnect_comp_var, |
| 2181 | msecs_to_jiffies |
| 2182 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 2183 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2184 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2185 | } |
| 2186 | } |
| 2187 | } |
| 2188 | |
| 2189 | EXIT(); |
| 2190 | return 0; |
| 2191 | } |
| 2192 | |
| 2193 | /** |
| 2194 | * iw_set_mode() - SSR wrapper for __iw_set_mode() |
| 2195 | * @dev: pointer to net_device |
| 2196 | * @info: pointer to iw_request_info |
| 2197 | * @wrqu: pointer to iwreq_data |
| 2198 | * @extra: pointer to extra ioctl payload |
| 2199 | * |
| 2200 | * Return: 0 on success, error number otherwise |
| 2201 | */ |
| 2202 | static int iw_set_mode(struct net_device *dev, struct iw_request_info *info, |
| 2203 | union iwreq_data *wrqu, char *extra) |
| 2204 | { |
| 2205 | int ret; |
| 2206 | |
| 2207 | cds_ssr_protect(__func__); |
| 2208 | ret = __iw_set_mode(dev, info, wrqu, extra); |
| 2209 | cds_ssr_unprotect(__func__); |
| 2210 | |
| 2211 | return ret; |
| 2212 | } |
| 2213 | |
| 2214 | /** |
| 2215 | * __iw_get_mode() - SIOCGIWMODE ioctl handler |
| 2216 | * @dev: device upon which the ioctl was received |
| 2217 | * @info: ioctl request information |
| 2218 | * @wrqu: ioctl request data |
| 2219 | * @extra: ioctl extra data |
| 2220 | * |
| 2221 | * Return: 0 on success, non-zero on error |
| 2222 | */ |
| 2223 | static int |
| 2224 | __iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 2225 | union iwreq_data *wrqu, char *extra) |
| 2226 | { |
| 2227 | hdd_wext_state_t *pWextState; |
| 2228 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2229 | hdd_context_t *hdd_ctx; |
| 2230 | int ret; |
| 2231 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2232 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2233 | |
| 2234 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2235 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2236 | if (0 != ret) |
| 2237 | return ret; |
| 2238 | |
| 2239 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2240 | |
| 2241 | switch (pWextState->roamProfile.BSSType) { |
| 2242 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2243 | hdd_notice("returns IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2244 | wrqu->mode = IW_MODE_INFRA; |
| 2245 | break; |
| 2246 | case eCSR_BSS_TYPE_IBSS: |
| 2247 | case eCSR_BSS_TYPE_START_IBSS: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2248 | hdd_notice("returns IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2249 | wrqu->mode = IW_MODE_ADHOC; |
| 2250 | break; |
| 2251 | case eCSR_BSS_TYPE_ANY: |
| 2252 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2253 | hdd_notice("returns IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2254 | wrqu->mode = IW_MODE_AUTO; |
| 2255 | break; |
| 2256 | } |
| 2257 | |
| 2258 | EXIT(); |
| 2259 | return 0; |
| 2260 | } |
| 2261 | |
| 2262 | /** |
| 2263 | * iw_get_mode() - SSR wrapper for __iw_get_mode() |
| 2264 | * @dev: pointer to net_device |
| 2265 | * @info: pointer to iw_request_info |
| 2266 | * @wrqu: pointer to iwreq_data |
| 2267 | * @extra: pointer to extra ioctl payload |
| 2268 | * |
| 2269 | * Return: 0 on success, error number otherwise |
| 2270 | */ |
| 2271 | static int iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 2272 | union iwreq_data *wrqu, char *extra) |
| 2273 | { |
| 2274 | int ret; |
| 2275 | |
| 2276 | cds_ssr_protect(__func__); |
| 2277 | ret = __iw_get_mode(dev, info, wrqu, extra); |
| 2278 | cds_ssr_unprotect(__func__); |
| 2279 | |
| 2280 | return ret; |
| 2281 | } |
| 2282 | |
| 2283 | /** |
| 2284 | * __iw_set_freq() - SIOCSIWFREQ ioctl handler |
| 2285 | * @dev: device upon which the ioctl was received |
| 2286 | * @info: ioctl request information |
| 2287 | * @wrqu: ioctl request data |
| 2288 | * @extra: ioctl extra data |
| 2289 | * |
| 2290 | * Return: 0 on success, non-zero on error |
| 2291 | */ |
| 2292 | static int __iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 2293 | union iwreq_data *wrqu, char *extra) |
| 2294 | { |
| 2295 | uint32_t numChans = 0; |
| 2296 | uint8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2297 | uint32_t indx = 0; |
| 2298 | int ret; |
| 2299 | hdd_wext_state_t *pWextState; |
| 2300 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2301 | hdd_context_t *hdd_ctx; |
| 2302 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2303 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2304 | tCsrRoamProfile *pRoamProfile; |
| 2305 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2306 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2307 | |
| 2308 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2309 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2310 | if (0 != ret) |
| 2311 | return ret; |
| 2312 | |
| 2313 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2314 | |
| 2315 | pRoamProfile = &pWextState->roamProfile; |
| 2316 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2317 | hdd_notice("setCHANNEL ioctl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2318 | |
| 2319 | /* Link is up then return cant set channel */ |
| 2320 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState || |
| 2321 | eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2322 | hdd_err("IBSS Associated"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2323 | return -EOPNOTSUPP; |
| 2324 | } |
| 2325 | |
| 2326 | /* Settings by Frequency as input */ |
| 2327 | if ((wrqu->freq.e == 1) && (wrqu->freq.m >= (uint32_t) 2.412e8) && |
| 2328 | (wrqu->freq.m <= (uint32_t) 5.825e8)) { |
| 2329 | uint32_t freq = wrqu->freq.m / 100000; |
| 2330 | |
| 2331 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 2332 | && (freq != freq_chan_map[indx].freq)) |
| 2333 | indx++; |
| 2334 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) { |
| 2335 | return -EINVAL; |
| 2336 | } |
| 2337 | wrqu->freq.e = 0; |
| 2338 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 2339 | |
| 2340 | } |
| 2341 | |
| 2342 | if (wrqu->freq.e == 0) { |
| 2343 | if ((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 2344 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2345 | hdd_notice("Channel %d is outside valid range from %d to %d", |
| 2346 | wrqu->freq.m, |
| 2347 | WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 2348 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2349 | return -EINVAL; |
| 2350 | } |
| 2351 | |
| 2352 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2353 | |
| 2354 | if (sme_cfg_get_str(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 2355 | validChan, &numChans) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2356 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2357 | hdd_warn("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2358 | return -EIO; |
| 2359 | } |
| 2360 | |
| 2361 | for (indx = 0; indx < numChans; indx++) { |
| 2362 | if (wrqu->freq.m == validChan[indx]) { |
| 2363 | break; |
| 2364 | } |
| 2365 | } |
| 2366 | } else { |
| 2367 | |
| 2368 | return -EINVAL; |
| 2369 | } |
| 2370 | |
| 2371 | if (indx >= numChans) { |
| 2372 | return -EINVAL; |
| 2373 | } |
| 2374 | |
| 2375 | /* Set the Operational Channel */ |
| 2376 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 2377 | pHddStaCtx->conn_info.operationChannel = wrqu->freq.m; |
| 2378 | pRoamProfile->ChannelInfo.ChannelList = |
| 2379 | &pHddStaCtx->conn_info.operationChannel; |
| 2380 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2381 | hdd_notice("pRoamProfile->operationChannel = %d", wrqu->freq.m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2382 | |
| 2383 | EXIT(); |
| 2384 | |
| 2385 | return ret; |
| 2386 | } |
| 2387 | |
| 2388 | /** |
| 2389 | * iw_set_freq() - SSR wrapper for __iw_set_freq() |
| 2390 | * @dev: pointer to net_device |
| 2391 | * @info: pointer to iw_request_info |
| 2392 | * @wrqu: pointer to iwreq_data |
| 2393 | * @extra: pointer to extra ioctl payload |
| 2394 | * |
| 2395 | * Return: 0 on success, error number otherwise |
| 2396 | */ |
| 2397 | static int iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 2398 | union iwreq_data *wrqu, char *extra) |
| 2399 | { |
| 2400 | int ret; |
| 2401 | |
| 2402 | cds_ssr_protect(__func__); |
| 2403 | ret = __iw_set_freq(dev, info, wrqu, extra); |
| 2404 | cds_ssr_unprotect(__func__); |
| 2405 | |
| 2406 | return ret; |
| 2407 | } |
| 2408 | |
| 2409 | /** |
| 2410 | * __iw_get_freq() - SIOCGIWFREQ ioctl handler |
| 2411 | * @dev: device upon which the ioctl was received |
| 2412 | * @info: ioctl request information |
| 2413 | * @wrqu: ioctl request data |
| 2414 | * @extra: ioctl extra data |
| 2415 | * |
| 2416 | * Return: 0 on success, non-zero on error |
| 2417 | */ |
| 2418 | static int __iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 2419 | struct iw_freq *fwrq, char *extra) |
| 2420 | { |
| 2421 | uint32_t status = false, channel = 0, freq = 0; |
| 2422 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2423 | tHalHandle hHal; |
| 2424 | hdd_wext_state_t *pWextState; |
| 2425 | tCsrRoamProfile *pRoamProfile; |
| 2426 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2427 | hdd_context_t *hdd_ctx; |
| 2428 | int ret; |
| 2429 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2430 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2431 | |
| 2432 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2433 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2434 | if (0 != ret) |
| 2435 | return ret; |
| 2436 | |
| 2437 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2438 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2439 | |
| 2440 | pRoamProfile = &pWextState->roamProfile; |
| 2441 | |
| 2442 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated) { |
| 2443 | if (sme_get_operation_channel(hHal, &channel, pAdapter->sessionId) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2444 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2445 | hdd_err("failed to get operating channel %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2446 | pAdapter->sessionId); |
| 2447 | return -EIO; |
| 2448 | } else { |
| 2449 | status = hdd_wlan_get_freq(channel, &freq); |
| 2450 | if (true == status) { |
| 2451 | /* Set Exponent parameter as 6 (MHZ) |
| 2452 | * in struct iw_freq iwlist & iwconfig |
| 2453 | * command shows frequency into proper |
| 2454 | * format (2.412 GHz instead of 246.2 |
| 2455 | * MHz) |
| 2456 | */ |
| 2457 | fwrq->m = freq; |
| 2458 | fwrq->e = MHZ; |
| 2459 | } |
| 2460 | } |
| 2461 | } else { |
| 2462 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 2463 | * iwlist & iwconfig command shows frequency into proper |
| 2464 | * format (2.412 GHz instead of 246.2 MHz) |
| 2465 | */ |
| 2466 | fwrq->m = 0; |
| 2467 | fwrq->e = MHZ; |
| 2468 | } |
| 2469 | return 0; |
| 2470 | } |
| 2471 | |
| 2472 | /** |
| 2473 | * iw_get_freq() - SSR wrapper for __iw_get_freq() |
| 2474 | * @dev: pointer to net_device |
| 2475 | * @info: pointer to iw_request_info |
| 2476 | * @fwrq: pointer to frequency data |
| 2477 | * @extra: pointer to extra ioctl payload |
| 2478 | * |
| 2479 | * Return: 0 on success, error number otherwise |
| 2480 | */ |
| 2481 | static int iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 2482 | struct iw_freq *fwrq, char *extra) |
| 2483 | { |
| 2484 | int ret; |
| 2485 | |
| 2486 | cds_ssr_protect(__func__); |
| 2487 | ret = __iw_get_freq(dev, info, fwrq, extra); |
| 2488 | cds_ssr_unprotect(__func__); |
| 2489 | |
| 2490 | return ret; |
| 2491 | } |
| 2492 | |
| 2493 | /** |
| 2494 | * __iw_get_tx_power() - SIOCGIWTXPOW ioctl handler |
| 2495 | * @dev: device upon which the ioctl was received |
| 2496 | * @info: ioctl request information |
| 2497 | * @wrqu: ioctl request data |
| 2498 | * @extra: ioctl extra data |
| 2499 | * |
| 2500 | * Return: 0 on success, non-zero on error |
| 2501 | */ |
| 2502 | static int __iw_get_tx_power(struct net_device *dev, |
| 2503 | struct iw_request_info *info, |
| 2504 | union iwreq_data *wrqu, char *extra) |
| 2505 | { |
| 2506 | |
| 2507 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2508 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2509 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2510 | int ret; |
| 2511 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2512 | ENTER_DEV(dev); |
| 2513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2514 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2515 | if (0 != ret) |
| 2516 | return ret; |
| 2517 | |
| 2518 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 2519 | wrqu->txpower.value = 0; |
| 2520 | return 0; |
| 2521 | } |
| 2522 | wlan_hdd_get_class_astats(pAdapter); |
| 2523 | wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 2524 | |
| 2525 | return 0; |
| 2526 | } |
| 2527 | |
| 2528 | /** |
| 2529 | * iw_get_tx_power() - SSR wrapper for __iw_get_tx_power() |
| 2530 | * @dev: pointer to net_device |
| 2531 | * @info: pointer to iw_request_info |
| 2532 | * @wrqu: pointer to iwreq_data |
| 2533 | * @extra: pointer to extra ioctl payload |
| 2534 | * |
| 2535 | * Return: 0 on success, error number otherwise |
| 2536 | */ |
| 2537 | static int iw_get_tx_power(struct net_device *dev, |
| 2538 | struct iw_request_info *info, |
| 2539 | union iwreq_data *wrqu, char *extra) |
| 2540 | { |
| 2541 | int ret; |
| 2542 | |
| 2543 | cds_ssr_protect(__func__); |
| 2544 | ret = __iw_get_tx_power(dev, info, wrqu, extra); |
| 2545 | cds_ssr_unprotect(__func__); |
| 2546 | |
| 2547 | return ret; |
| 2548 | } |
| 2549 | |
| 2550 | /** |
| 2551 | * __iw_set_tx_power() - SIOCSIWTXPOW ioctl handler |
| 2552 | * @dev: device upon which the ioctl was received |
| 2553 | * @info: ioctl request information |
| 2554 | * @wrqu: ioctl request data |
| 2555 | * @extra: ioctl extra data |
| 2556 | * |
| 2557 | * Return: 0 on success, non-zero on error |
| 2558 | */ |
| 2559 | static int __iw_set_tx_power(struct net_device *dev, |
| 2560 | struct iw_request_info *info, |
| 2561 | union iwreq_data *wrqu, char *extra) |
| 2562 | { |
| 2563 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2564 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2565 | hdd_context_t *hdd_ctx; |
| 2566 | int ret; |
| 2567 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2568 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2569 | |
| 2570 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2571 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2572 | if (0 != ret) |
| 2573 | return ret; |
| 2574 | |
| 2575 | if (sme_cfg_set_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2576 | wrqu->txpower.value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2577 | hdd_err("failed to set ini parameter, WNI_CFG_CURRENT_TX_POWER_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | return -EIO; |
| 2579 | } |
| 2580 | |
| 2581 | EXIT(); |
| 2582 | |
| 2583 | return 0; |
| 2584 | } |
| 2585 | |
| 2586 | /** |
| 2587 | * iw_set_tx_power() - SSR wrapper for __iw_set_tx_power() |
| 2588 | * @dev: pointer to net_device |
| 2589 | * @info: pointer to iw_request_info |
| 2590 | * @wrqu: pointer to iwreq_data |
| 2591 | * @extra: pointer to extra ioctl payload |
| 2592 | * |
| 2593 | * Return: 0 on success, error number otherwise |
| 2594 | */ |
| 2595 | static int iw_set_tx_power(struct net_device *dev, |
| 2596 | struct iw_request_info *info, |
| 2597 | union iwreq_data *wrqu, char *extra) |
| 2598 | { |
| 2599 | int ret; |
| 2600 | |
| 2601 | cds_ssr_protect(__func__); |
| 2602 | ret = __iw_set_tx_power(dev, info, wrqu, extra); |
| 2603 | cds_ssr_unprotect(__func__); |
| 2604 | |
| 2605 | return ret; |
| 2606 | } |
| 2607 | |
| 2608 | /** |
| 2609 | * __iw_get_bitrate() - SIOCGIWRATE ioctl handler |
| 2610 | * @dev: device upon which the ioctl was received |
| 2611 | * @info: ioctl request information |
| 2612 | * @wrqu: ioctl request data |
| 2613 | * @extra: ioctl extra data |
| 2614 | * |
| 2615 | * Return: 0 on success, non-zero on error |
| 2616 | */ |
| 2617 | static int __iw_get_bitrate(struct net_device *dev, |
| 2618 | struct iw_request_info *info, |
| 2619 | union iwreq_data *wrqu, char *extra) |
| 2620 | { |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 2621 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2622 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | hdd_wext_state_t *pWextState; |
| 2624 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2625 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2626 | hdd_context_t *hdd_ctx; |
| 2627 | int ret; |
| 2628 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2629 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2630 | |
| 2631 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2632 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2633 | if (0 != ret) |
| 2634 | return ret; |
| 2635 | |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 2636 | if (cds_is_driver_recovering()) { |
| 2637 | hdd_alert("Recovery in Progress. State: 0x%x Ignore!!!", |
| 2638 | cds_get_driver_state()); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2639 | return status; |
| 2640 | } |
| 2641 | |
| 2642 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 2643 | wrqu->bitrate.value = 0; |
| 2644 | } else { |
| 2645 | status = |
| 2646 | sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2647 | eCSR_HDD, |
| 2648 | SME_SUMMARY_STATS | |
| 2649 | SME_GLOBAL_CLASSA_STATS | |
| 2650 | SME_GLOBAL_CLASSB_STATS | |
| 2651 | SME_GLOBAL_CLASSC_STATS | |
| 2652 | SME_GLOBAL_CLASSD_STATS | |
| 2653 | SME_PER_STA_STATS, |
| 2654 | hdd_statistics_cb, 0, |
| 2655 | false, |
| 2656 | pHddStaCtx->conn_info.staId[0], |
| 2657 | pAdapter, pAdapter->sessionId); |
| 2658 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2659 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2660 | hdd_err("Unable to retrieve statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2661 | return status; |
| 2662 | } |
| 2663 | |
| 2664 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2665 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 2666 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2667 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2668 | WLAN_WAIT_TIME_STATS); |
| 2669 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 2670 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2671 | hdd_err("SME timeout while retrieving statistics"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2672 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2673 | } |
| 2674 | |
| 2675 | wrqu->bitrate.value = |
| 2676 | pAdapter->hdd_stats.ClassA_stat.tx_rate * 500 * 1000; |
| 2677 | } |
| 2678 | |
| 2679 | EXIT(); |
| 2680 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2681 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2682 | } |
| 2683 | |
| 2684 | /** |
| 2685 | * iw_get_bitrate() - SSR wrapper for __iw_get_bitrate() |
| 2686 | * @dev: pointer to net_device |
| 2687 | * @info: pointer to iw_request_info |
| 2688 | * @wrqu: pointer to iwreq_data |
| 2689 | * @extra: pointer to extra ioctl payload |
| 2690 | * |
| 2691 | * Return: 0 on success, error number otherwise |
| 2692 | */ |
| 2693 | static int iw_get_bitrate(struct net_device *dev, |
| 2694 | struct iw_request_info *info, |
| 2695 | union iwreq_data *wrqu, char *extra) |
| 2696 | { |
| 2697 | int ret; |
| 2698 | |
| 2699 | cds_ssr_protect(__func__); |
| 2700 | ret = __iw_get_bitrate(dev, info, wrqu, extra); |
| 2701 | cds_ssr_unprotect(__func__); |
| 2702 | |
| 2703 | return ret; |
| 2704 | } |
| 2705 | |
| 2706 | /** |
| 2707 | * __iw_set_bitrate() - SIOCSIWRATE ioctl handler |
| 2708 | * @dev: device upon which the ioctl was received |
| 2709 | * @info: ioctl request information |
| 2710 | * @wrqu: ioctl request data |
| 2711 | * @extra: ioctl extra data |
| 2712 | * |
| 2713 | * Return: 0 on success, non-zero on error |
| 2714 | */ |
| 2715 | static int __iw_set_bitrate(struct net_device *dev, |
| 2716 | struct iw_request_info *info, |
| 2717 | union iwreq_data *wrqu, char *extra) |
| 2718 | { |
| 2719 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2720 | hdd_wext_state_t *pWextState; |
| 2721 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2722 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 2723 | uint32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 2724 | uint32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 2725 | uint32_t i, rate; |
| 2726 | uint32_t valid_rate = false, active_phy_mode = 0; |
| 2727 | hdd_context_t *hdd_ctx; |
| 2728 | int ret; |
| 2729 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2730 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2731 | |
| 2732 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2733 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2734 | if (0 != ret) |
| 2735 | return ret; |
| 2736 | |
| 2737 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2738 | |
| 2739 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 2740 | return -ENXIO; |
| 2741 | } |
| 2742 | |
| 2743 | rate = wrqu->bitrate.value; |
| 2744 | |
| 2745 | if (rate == -1) { |
| 2746 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 2747 | valid_rate = true; |
| 2748 | } else if (sme_cfg_get_int(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2749 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2750 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2751 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 2752 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 2753 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 2754 | if ((sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2755 | WNI_CFG_SUPPORTED_RATES_11A, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2756 | &a_len) == QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2757 | && |
| 2758 | (sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2759 | WNI_CFG_SUPPORTED_RATES_11B, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2760 | &b_len) == QDF_STATUS_SUCCESS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | for (i = 0; i < (b_len + a_len); ++i) { |
| 2762 | /* supported rates returned is double |
| 2763 | * the actual rate so we divide it by 2 |
| 2764 | */ |
| 2765 | if ((supp_rates[i] & 0x7F) / 2 == |
| 2766 | rate) { |
| 2767 | valid_rate = true; |
| 2768 | rate = i + |
| 2769 | WNI_CFG_FIXED_RATE_1MBPS; |
| 2770 | break; |
| 2771 | } |
| 2772 | } |
| 2773 | } |
| 2774 | } |
| 2775 | } |
| 2776 | if (valid_rate != true) { |
| 2777 | return -EINVAL; |
| 2778 | } |
| 2779 | if (sme_cfg_set_int(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2780 | WNI_CFG_FIXED_RATE, rate) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2781 | hdd_err("failed to set ini parameter, WNI_CFG_FIXED_RATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2782 | return -EIO; |
| 2783 | } |
| 2784 | return 0; |
| 2785 | } |
| 2786 | |
| 2787 | /** |
| 2788 | * iw_set_bitrate() - SSR wrapper for __iw_set_bitrate() |
| 2789 | * @dev: pointer to net_device |
| 2790 | * @info: pointer to iw_request_info |
| 2791 | * @wrqu: pointer to iwreq_data |
| 2792 | * @extra: pointer to extra ioctl payload |
| 2793 | * |
| 2794 | * Return: 0 on success, error number otherwise |
| 2795 | */ |
| 2796 | static int iw_set_bitrate(struct net_device *dev, |
| 2797 | struct iw_request_info *info, |
| 2798 | union iwreq_data *wrqu, char *extra) |
| 2799 | { |
| 2800 | int ret; |
| 2801 | |
| 2802 | cds_ssr_protect(__func__); |
| 2803 | ret = __iw_set_bitrate(dev, info, wrqu, extra); |
| 2804 | cds_ssr_unprotect(__func__); |
| 2805 | |
| 2806 | return ret; |
| 2807 | } |
| 2808 | |
| 2809 | /** |
| 2810 | * __iw_set_genie() - SIOCSIWGENIE ioctl handler |
| 2811 | * @dev: device upon which the ioctl was received |
| 2812 | * @info: ioctl request information |
| 2813 | * @wrqu: ioctl request data |
| 2814 | * @extra: ioctl extra data |
| 2815 | * |
| 2816 | * Return: 0 on success, non-zero on error |
| 2817 | */ |
| 2818 | static int __iw_set_genie(struct net_device *dev, |
| 2819 | struct iw_request_info *info, |
| 2820 | union iwreq_data *wrqu, char *extra) |
| 2821 | { |
| 2822 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2823 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2824 | uint8_t *genie = NULL; |
| 2825 | uint8_t *base_genie = NULL; |
| 2826 | uint16_t remLen; |
| 2827 | hdd_context_t *hdd_ctx; |
| 2828 | int ret; |
| 2829 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2830 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2831 | |
| 2832 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2833 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2834 | if (0 != ret) |
| 2835 | return ret; |
| 2836 | |
| 2837 | if (!wrqu->data.length) { |
| 2838 | hdd_clear_roam_profile_ie(pAdapter); |
| 2839 | EXIT(); |
| 2840 | return 0; |
| 2841 | } |
| 2842 | |
| 2843 | base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 2844 | wrqu->data.length); |
| 2845 | if (NULL == base_genie) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2846 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2847 | return -ENOMEM; |
| 2848 | } |
| 2849 | |
| 2850 | genie = base_genie; |
| 2851 | |
| 2852 | remLen = wrqu->data.length; |
| 2853 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2854 | hdd_notice("iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2855 | genie[1]); |
| 2856 | |
| 2857 | /* clear any previous genIE before this call */ |
| 2858 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 2859 | |
| 2860 | while (remLen >= 2) { |
| 2861 | uint16_t eLen = 0; |
| 2862 | uint8_t elementId; |
| 2863 | elementId = *genie++; |
| 2864 | eLen = *genie++; |
| 2865 | remLen -= 2; |
| 2866 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2867 | hdd_notice("IE[0x%X], LEN[%d]", elementId, eLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2868 | |
| 2869 | switch (elementId) { |
| 2870 | case IE_EID_VENDOR: |
| 2871 | if ((IE_LEN_SIZE + IE_EID_SIZE + IE_VENDOR_OUI_SIZE) > eLen) { /* should have at least OUI */ |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2872 | ret = -EINVAL; |
| 2873 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | } |
| 2875 | |
| 2876 | if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) { |
| 2877 | uint16_t curGenIELen = pWextState->genIE.length; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2878 | hdd_notice("Set WPS OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2879 | genie[0], genie[1], genie[2], |
| 2880 | genie[3], eLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | |
| 2882 | if (SIR_MAC_MAX_IE_LENGTH < |
| 2883 | (pWextState->genIE.length + eLen)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2884 | hdd_alert("Cannot accommodate genIE. Need bigger buffer space"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2885 | QDF_ASSERT(0); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2886 | ret = -ENOMEM; |
| 2887 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | } |
| 2889 | /* save to Additional IE ; it should be accumulated to handle WPS IE + other IE */ |
| 2890 | memcpy(pWextState->genIE.addIEdata + |
| 2891 | curGenIELen, genie - 2, eLen + 2); |
| 2892 | pWextState->genIE.length += eLen + 2; |
| 2893 | } else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2894 | hdd_notice("Set WPA IE (len %d)", eLen + 2); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2895 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) { |
| 2896 | hdd_warn("Cannot accommodate genIE, Need bigger buffer space"); |
| 2897 | ret = -EINVAL; |
| 2898 | QDF_ASSERT(0); |
| 2899 | goto exit; |
| 2900 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2901 | memset(pWextState->WPARSNIE, 0, |
| 2902 | MAX_WPA_RSN_IE_LEN); |
| 2903 | memcpy(pWextState->WPARSNIE, genie - 2, |
| 2904 | (eLen + 2)); |
| 2905 | pWextState->roamProfile.pWPAReqIE = |
| 2906 | pWextState->WPARSNIE; |
| 2907 | pWextState->roamProfile.nWPAReqIELength = |
| 2908 | eLen + 2; |
| 2909 | } else { /* any vendorId except WPA IE should be accumulated to genIE */ |
| 2910 | |
| 2911 | uint16_t curGenIELen = pWextState->genIE.length; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2912 | hdd_notice("Set OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2913 | genie[0], genie[1], genie[2], |
| 2914 | genie[3], eLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2915 | |
| 2916 | if (SIR_MAC_MAX_IE_LENGTH < |
| 2917 | (pWextState->genIE.length + eLen)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2918 | hdd_alert("Cannot accommodate genIE. Need bigger buffer space"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2919 | QDF_ASSERT(0); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2920 | ret = -ENOMEM; |
| 2921 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | } |
| 2923 | /* save to Additional IE ; it should be accumulated to handle WPS IE + other IE */ |
| 2924 | memcpy(pWextState->genIE.addIEdata + |
| 2925 | curGenIELen, genie - 2, eLen + 2); |
| 2926 | pWextState->genIE.length += eLen + 2; |
| 2927 | } |
| 2928 | break; |
| 2929 | case DOT11F_EID_RSN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2930 | hdd_notice("Set RSN IE (len %d)", eLen + 2); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2931 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) { |
| 2932 | hdd_warn("Cannot accommodate genIE, Need bigger buffer space"); |
| 2933 | ret = -EINVAL; |
| 2934 | QDF_ASSERT(0); |
| 2935 | goto exit; |
| 2936 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2937 | memset(pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN); |
| 2938 | memcpy(pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 2939 | pWextState->roamProfile.pRSNReqIE = |
| 2940 | pWextState->WPARSNIE; |
| 2941 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; |
| 2942 | break; |
| 2943 | |
| 2944 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2945 | hdd_err("Set UNKNOWN IE %X", elementId); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2946 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2947 | } |
| 2948 | genie += eLen; |
| 2949 | remLen -= eLen; |
| 2950 | } |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2951 | exit: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | EXIT(); |
| 2953 | kfree(base_genie); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 2954 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | } |
| 2956 | |
| 2957 | /** |
| 2958 | * iw_set_genie() - SSR wrapper for __iw_set_genie() |
| 2959 | * @dev: pointer to net_device |
| 2960 | * @info: pointer to iw_request_info |
| 2961 | * @wrqu: pointer to iwreq_data |
| 2962 | * @extra: pointer to extra ioctl payload |
| 2963 | * |
| 2964 | * Return: 0 on success, error number otherwise |
| 2965 | */ |
| 2966 | static int iw_set_genie(struct net_device *dev, |
| 2967 | struct iw_request_info *info, |
| 2968 | union iwreq_data *wrqu, char *extra) |
| 2969 | { |
| 2970 | int ret; |
| 2971 | |
| 2972 | cds_ssr_protect(__func__); |
| 2973 | ret = __iw_set_genie(dev, info, wrqu, extra); |
| 2974 | cds_ssr_unprotect(__func__); |
| 2975 | |
| 2976 | return ret; |
| 2977 | } |
| 2978 | |
| 2979 | /** |
| 2980 | * __iw_get_genie() - SIOCGIWGENIE ioctl handler |
| 2981 | * @dev: device upon which the ioctl was received |
| 2982 | * @info: ioctl request information |
| 2983 | * @wrqu: ioctl request data |
| 2984 | * @extra: ioctl extra data |
| 2985 | * |
| 2986 | * Return: 0 on success, non-zero on error |
| 2987 | */ |
| 2988 | static int __iw_get_genie(struct net_device *dev, |
| 2989 | struct iw_request_info *info, |
| 2990 | union iwreq_data *wrqu, char *extra) |
| 2991 | { |
| 2992 | hdd_wext_state_t *pWextState; |
| 2993 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2994 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2995 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2996 | uint32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 2997 | uint8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 2998 | hdd_context_t *hdd_ctx; |
| 2999 | int ret; |
| 3000 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3001 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3002 | |
| 3003 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3004 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3005 | if (0 != ret) |
| 3006 | return ret; |
| 3007 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3008 | hdd_notice("getGEN_IE ioctl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3009 | |
| 3010 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3011 | |
| 3012 | if (pHddStaCtx->conn_info.connState == eConnectionState_NotConnected) { |
| 3013 | return -ENXIO; |
| 3014 | } |
| 3015 | |
| 3016 | /* Return something ONLY if we are associated with an RSN or |
| 3017 | * WPA network |
| 3018 | */ |
| 3019 | if (!hdd_is_auth_type_rsn(pWextState->roamProfile.negotiatedAuthType)) { |
| 3020 | return -ENXIO; |
| 3021 | } |
| 3022 | |
| 3023 | /* Actually retrieve the RSN IE from CSR. (We previously sent |
| 3024 | * it down in the CSR Roam Profile.) |
| 3025 | */ |
| 3026 | status = csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3027 | pAdapter->sessionId, |
| 3028 | &length, genIeBytes); |
Manjeet Singh | fde0c04 | 2016-09-03 12:08:09 +0530 | [diff] [blame] | 3029 | if (QDF_STATUS_SUCCESS != status) { |
| 3030 | hdd_notice("failed to get WPA-RSN IE data"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3031 | return -EFAULT; |
| 3032 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | wrqu->data.length = length; |
Manjeet Singh | fde0c04 | 2016-09-03 12:08:09 +0530 | [diff] [blame] | 3034 | if (length > DOT11F_IE_RSN_MAX_LEN) { |
| 3035 | hdd_notice("invalid buffer length length:%d", length); |
| 3036 | return -E2BIG; |
| 3037 | } |
| 3038 | qdf_mem_copy(extra, (void *)genIeBytes, length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3039 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3040 | hdd_notice("RSN IE of %d bytes returned", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | wrqu->data.length); |
| 3042 | |
| 3043 | EXIT(); |
| 3044 | |
| 3045 | return 0; |
| 3046 | } |
| 3047 | |
| 3048 | /** |
| 3049 | * iw_get_genie() - SSR wrapper for __iw_get_genie() |
| 3050 | * @dev: pointer to net_device |
| 3051 | * @info: pointer to iw_request_info |
| 3052 | * @wrqu: pointer to iwreq_data |
| 3053 | * @extra: pointer to extra ioctl payload |
| 3054 | * |
| 3055 | * Return: 0 on success, error number otherwise |
| 3056 | */ |
| 3057 | static int iw_get_genie(struct net_device *dev, |
| 3058 | struct iw_request_info *info, |
| 3059 | union iwreq_data *wrqu, char *extra) |
| 3060 | { |
| 3061 | int ret; |
| 3062 | |
| 3063 | cds_ssr_protect(__func__); |
| 3064 | ret = __iw_get_genie(dev, info, wrqu, extra); |
| 3065 | cds_ssr_unprotect(__func__); |
| 3066 | |
| 3067 | return ret; |
| 3068 | } |
| 3069 | |
| 3070 | /** |
| 3071 | * __iw_get_encode() - SIOCGIWENCODE ioctl handler |
| 3072 | * @dev: device upon which the ioctl was received |
| 3073 | * @info: ioctl request information |
| 3074 | * @wrqu: ioctl request data |
| 3075 | * @extra: ioctl extra data |
| 3076 | * |
| 3077 | * Return: 0 on success, non-zero on error |
| 3078 | */ |
| 3079 | static int __iw_get_encode(struct net_device *dev, |
| 3080 | struct iw_request_info *info, |
| 3081 | struct iw_point *dwrq, char *extra) |
| 3082 | { |
| 3083 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3084 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3085 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3086 | int keyId; |
| 3087 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 3088 | int i; |
| 3089 | hdd_context_t *hdd_ctx; |
| 3090 | int ret; |
| 3091 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3092 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3093 | |
| 3094 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3095 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3096 | if (0 != ret) |
| 3097 | return ret; |
| 3098 | |
| 3099 | keyId = pRoamProfile->Keys.defaultIndex; |
| 3100 | |
| 3101 | if (keyId < 0 || keyId >= MAX_WEP_KEYS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3102 | hdd_notice("Invalid keyId : %d", keyId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3103 | return -EINVAL; |
| 3104 | } |
| 3105 | |
| 3106 | if (pRoamProfile->Keys.KeyLength[keyId] > 0) { |
| 3107 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3108 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3109 | qdf_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3110 | pRoamProfile->Keys.KeyLength[keyId]); |
| 3111 | |
| 3112 | dwrq->flags |= (keyId + 1); |
| 3113 | |
| 3114 | } else { |
| 3115 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3116 | } |
| 3117 | |
| 3118 | for (i = 0; i < MAX_WEP_KEYS; i++) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 3119 | if (pRoamProfile->Keys.KeyLength[i] == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3120 | continue; |
| 3121 | } else { |
| 3122 | break; |
| 3123 | } |
| 3124 | } |
| 3125 | |
| 3126 | if (MAX_WEP_KEYS == i) { |
| 3127 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 3128 | } |
| 3129 | |
| 3130 | authType = |
| 3131 | ((hdd_station_ctx_t *) WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))-> |
| 3132 | conn_info.authType; |
| 3133 | |
| 3134 | if (eCSR_AUTH_TYPE_OPEN_SYSTEM == authType) { |
| 3135 | dwrq->flags |= IW_ENCODE_OPEN; |
| 3136 | } else { |
| 3137 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 3138 | } |
| 3139 | EXIT(); |
| 3140 | return 0; |
| 3141 | } |
| 3142 | |
| 3143 | /** |
| 3144 | * iw_get_encode() - SSR wrapper for __iw_get_encode() |
| 3145 | * @dev: pointer to net_device |
| 3146 | * @info: pointer to iw_request_info |
| 3147 | * @dwrq: pointer to encoding information |
| 3148 | * @extra: pointer to extra ioctl payload |
| 3149 | * |
| 3150 | * Return: 0 on success, error number otherwise |
| 3151 | */ |
| 3152 | static int iw_get_encode(struct net_device *dev, struct iw_request_info *info, |
| 3153 | struct iw_point *dwrq, char *extra) |
| 3154 | { |
| 3155 | int ret; |
| 3156 | |
| 3157 | cds_ssr_protect(__func__); |
| 3158 | ret = __iw_get_encode(dev, info, dwrq, extra); |
| 3159 | cds_ssr_unprotect(__func__); |
| 3160 | |
| 3161 | return ret; |
| 3162 | } |
| 3163 | |
| 3164 | /** |
| 3165 | * __iw_get_rts_threshold() - SIOCGIWRTS ioctl handler |
| 3166 | * @dev: device upon which the ioctl was received |
| 3167 | * @info: ioctl request information |
| 3168 | * @wrqu: ioctl request data |
| 3169 | * @extra: ioctl extra data |
| 3170 | * |
| 3171 | * Return: 0 on success, non-zero on error |
| 3172 | */ |
| 3173 | static int __iw_get_rts_threshold(struct net_device *dev, |
| 3174 | struct iw_request_info *info, |
| 3175 | union iwreq_data *wrqu, char *extra) |
| 3176 | { |
| 3177 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3178 | uint32_t status = 0; |
| 3179 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3180 | ENTER_DEV(dev); |
| 3181 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | status = hdd_wlan_get_rts_threshold(pAdapter, wrqu); |
| 3183 | |
| 3184 | return status; |
| 3185 | } |
| 3186 | |
| 3187 | /** |
| 3188 | * __iw_set_rts_threshold() - SIOCSIWRTS ioctl handler |
| 3189 | * @dev: device upon which the ioctl was received |
| 3190 | * @info: ioctl request information |
| 3191 | * @wrqu: ioctl request data |
| 3192 | * @extra: ioctl extra data |
| 3193 | * |
| 3194 | * Return: 0 on success, non-zero on error |
| 3195 | */ |
| 3196 | static int __iw_set_rts_threshold(struct net_device *dev, |
| 3197 | struct iw_request_info *info, |
| 3198 | union iwreq_data *wrqu, char *extra) |
| 3199 | { |
| 3200 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3201 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3202 | hdd_context_t *hdd_ctx; |
| 3203 | int ret; |
| 3204 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3205 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3206 | |
| 3207 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3208 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3209 | if (0 != ret) |
| 3210 | return ret; |
| 3211 | |
| 3212 | if (wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN |
| 3213 | || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX) { |
| 3214 | return -EINVAL; |
| 3215 | } |
| 3216 | |
| 3217 | if (sme_cfg_set_int(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3218 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3219 | hdd_err("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3220 | return -EIO; |
| 3221 | } |
| 3222 | |
| 3223 | EXIT(); |
| 3224 | |
| 3225 | return 0; |
| 3226 | } |
| 3227 | |
| 3228 | /** |
| 3229 | * iw_get_rts_threshold() - SSR wrapper for __iw_get_rts_threshold() |
| 3230 | * @dev: pointer to net_device |
| 3231 | * @info: pointer to iw_request_info |
| 3232 | * @wrqu: pointer to iwreq_data |
| 3233 | * @extra: pointer to extra ioctl payload |
| 3234 | * |
| 3235 | * Return: 0 on success, error number otherwise |
| 3236 | */ |
| 3237 | static int iw_get_rts_threshold(struct net_device *dev, |
| 3238 | struct iw_request_info *info, |
| 3239 | union iwreq_data *wrqu, char *extra) |
| 3240 | { |
| 3241 | int ret; |
| 3242 | |
| 3243 | cds_ssr_protect(__func__); |
| 3244 | ret = __iw_get_rts_threshold(dev, info, wrqu, extra); |
| 3245 | cds_ssr_unprotect(__func__); |
| 3246 | |
| 3247 | return ret; |
| 3248 | } |
| 3249 | |
| 3250 | /** |
| 3251 | * iw_set_rts_threshold() - SSR wrapper for __iw_set_rts_threshold() |
| 3252 | * @dev: pointer to net_device |
| 3253 | * @info: pointer to iw_request_info |
| 3254 | * @wrqu: pointer to iwreq_data |
| 3255 | * @extra: pointer to extra ioctl payload |
| 3256 | * |
| 3257 | * Return: 0 on success, error number otherwise |
| 3258 | */ |
| 3259 | static int iw_set_rts_threshold(struct net_device *dev, |
| 3260 | struct iw_request_info *info, |
| 3261 | union iwreq_data *wrqu, char *extra) |
| 3262 | { |
| 3263 | int ret; |
| 3264 | |
| 3265 | cds_ssr_protect(__func__); |
| 3266 | ret = __iw_set_rts_threshold(dev, info, wrqu, extra); |
| 3267 | cds_ssr_unprotect(__func__); |
| 3268 | |
| 3269 | return ret; |
| 3270 | } |
| 3271 | |
| 3272 | /** |
| 3273 | * __iw_get_frag_threshold() - SIOCGIWFRAG ioctl handler |
| 3274 | * @dev: device upon which the ioctl was received |
| 3275 | * @info: ioctl request information |
| 3276 | * @wrqu: ioctl request data |
| 3277 | * @extra: ioctl extra data |
| 3278 | * |
| 3279 | * Return: 0 on success, non-zero on error |
| 3280 | */ |
| 3281 | static int __iw_get_frag_threshold(struct net_device *dev, |
| 3282 | struct iw_request_info *info, |
| 3283 | union iwreq_data *wrqu, char *extra) |
| 3284 | { |
| 3285 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3286 | uint32_t status = 0; |
| 3287 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3288 | ENTER_DEV(dev); |
| 3289 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3290 | status = hdd_wlan_get_frag_threshold(pAdapter, wrqu); |
| 3291 | |
| 3292 | return status; |
| 3293 | } |
| 3294 | |
| 3295 | /** |
| 3296 | * iw_get_frag_threshold() - SSR wrapper for __iw_get_frag_threshold() |
| 3297 | * @dev: pointer to net_device |
| 3298 | * @info: pointer to iw_request_info |
| 3299 | * @wrqu: pointer to iwreq_data |
| 3300 | * @extra: pointer to extra ioctl payload |
| 3301 | * |
| 3302 | * Return: 0 on success, error number otherwise |
| 3303 | */ |
| 3304 | static int iw_get_frag_threshold(struct net_device *dev, |
| 3305 | struct iw_request_info *info, |
| 3306 | union iwreq_data *wrqu, char *extra) |
| 3307 | { |
| 3308 | int ret; |
| 3309 | |
| 3310 | cds_ssr_protect(__func__); |
| 3311 | ret = __iw_get_frag_threshold(dev, info, wrqu, extra); |
| 3312 | cds_ssr_unprotect(__func__); |
| 3313 | |
| 3314 | return ret; |
| 3315 | } |
| 3316 | |
| 3317 | /** |
| 3318 | * __iw_set_frag_threshold() - SIOCSIWFRAG ioctl handler |
| 3319 | * @dev: device upon which the ioctl was received |
| 3320 | * @info: ioctl request information |
| 3321 | * @wrqu: ioctl request data |
| 3322 | * @extra: ioctl extra data |
| 3323 | * |
| 3324 | * Return: 0 on success, non-zero on error |
| 3325 | */ |
| 3326 | static int __iw_set_frag_threshold(struct net_device *dev, |
| 3327 | struct iw_request_info *info, |
| 3328 | union iwreq_data *wrqu, char *extra) |
| 3329 | { |
| 3330 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3331 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3332 | hdd_context_t *hdd_ctx; |
| 3333 | int ret; |
| 3334 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3335 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3336 | |
| 3337 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3338 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3339 | if (0 != ret) |
| 3340 | return ret; |
| 3341 | |
| 3342 | if (wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN |
| 3343 | || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX) { |
| 3344 | return -EINVAL; |
| 3345 | } |
| 3346 | |
| 3347 | if (sme_cfg_set_int |
| 3348 | (hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3349 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3350 | hdd_err("failed to set ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3351 | return -EIO; |
| 3352 | } |
| 3353 | |
| 3354 | EXIT(); |
| 3355 | |
| 3356 | return 0; |
| 3357 | } |
| 3358 | |
| 3359 | /** |
| 3360 | * iw_set_frag_threshold() - SSR wrapper for __iw_set_frag_threshold() |
| 3361 | * @dev: pointer to net_device |
| 3362 | * @info: pointer to iw_request_info |
| 3363 | * @wrqu: pointer to iwreq_data |
| 3364 | * @extra: pointer to extra ioctl payload |
| 3365 | * |
| 3366 | * Return: 0 on success, error number otherwise |
| 3367 | */ |
| 3368 | static int iw_set_frag_threshold(struct net_device *dev, |
| 3369 | struct iw_request_info *info, |
| 3370 | union iwreq_data *wrqu, char *extra) |
| 3371 | { |
| 3372 | int ret; |
| 3373 | |
| 3374 | cds_ssr_protect(__func__); |
| 3375 | ret = __iw_set_frag_threshold(dev, info, wrqu, extra); |
| 3376 | cds_ssr_unprotect(__func__); |
| 3377 | |
| 3378 | return ret; |
| 3379 | } |
| 3380 | |
| 3381 | /** |
| 3382 | * __iw_get_power_mode() - SIOCGIWPOWER ioctl handler |
| 3383 | * @dev: device upon which the ioctl was received |
| 3384 | * @info: ioctl request information |
| 3385 | * @wrqu: ioctl request data |
| 3386 | * @extra: ioctl extra data |
| 3387 | * |
| 3388 | * Return: 0 on success, non-zero on error |
| 3389 | */ |
| 3390 | static int __iw_get_power_mode(struct net_device *dev, |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3391 | struct iw_request_info *info, |
| 3392 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3393 | { |
| 3394 | hdd_adapter_t *adapter; |
| 3395 | hdd_context_t *hdd_ctx; |
| 3396 | int ret; |
| 3397 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3398 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | |
| 3400 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3401 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3402 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3403 | if (0 != ret) |
| 3404 | return ret; |
| 3405 | |
| 3406 | return -EOPNOTSUPP; |
| 3407 | } |
| 3408 | |
| 3409 | /** |
| 3410 | * iw_get_power_mode() - SSR wrapper function for __iw_get_power_mode |
| 3411 | * @dev: pointer to net_device |
| 3412 | * @info: pointer to iw_request_info |
| 3413 | * @wrqu: pointer to iwreq_data |
| 3414 | * @extra: extra |
| 3415 | * |
| 3416 | * Return: 0 on success, error number otherwise |
| 3417 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3418 | static int iw_get_power_mode(struct net_device *dev, |
| 3419 | struct iw_request_info *info, |
| 3420 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | { |
| 3422 | int ret; |
| 3423 | |
| 3424 | cds_ssr_protect(__func__); |
| 3425 | ret = __iw_get_power_mode(dev, info, wrqu, extra); |
| 3426 | cds_ssr_unprotect(__func__); |
| 3427 | |
| 3428 | return ret; |
| 3429 | } |
| 3430 | |
| 3431 | /** |
| 3432 | * __iw_set_power_mode() - SIOCSIWPOWER ioctl handler |
| 3433 | * @dev: device upon which the ioctl was received |
| 3434 | * @info: ioctl request information |
| 3435 | * @wrqu: ioctl request data |
| 3436 | * @extra: ioctl extra data |
| 3437 | * |
| 3438 | * Return: 0 on success, non-zero on error |
| 3439 | */ |
| 3440 | static int __iw_set_power_mode(struct net_device *dev, |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3441 | struct iw_request_info *info, |
| 3442 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3443 | { |
| 3444 | hdd_adapter_t *adapter; |
| 3445 | hdd_context_t *hdd_ctx; |
| 3446 | int ret; |
| 3447 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3448 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | |
| 3450 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3451 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3452 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3453 | if (0 != ret) |
| 3454 | return ret; |
| 3455 | |
| 3456 | return -EOPNOTSUPP; |
| 3457 | } |
| 3458 | |
| 3459 | /** |
| 3460 | * iw_set_power_mode() - SSR wrapper function for __iw_set_power_mode |
| 3461 | * @dev: pointer to net_device |
| 3462 | * @info: pointer to iw_request_info |
| 3463 | * @wrqu: pointer to iwreq_data |
| 3464 | * @extra: extra |
| 3465 | * |
| 3466 | * Return: 0 on success, error number otherwise |
| 3467 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3468 | static int iw_set_power_mode(struct net_device *dev, |
| 3469 | struct iw_request_info *info, |
| 3470 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3471 | { |
| 3472 | int ret; |
| 3473 | |
| 3474 | cds_ssr_protect(__func__); |
| 3475 | ret = __iw_set_power_mode(dev, info, wrqu, extra); |
| 3476 | cds_ssr_unprotect(__func__); |
| 3477 | |
| 3478 | return ret; |
| 3479 | } |
| 3480 | |
| 3481 | /** |
| 3482 | * __iw_get_range() - SIOCGIWRANGE ioctl handler |
| 3483 | * @dev: device upon which the ioctl was received |
| 3484 | * @info: ioctl request information |
| 3485 | * @wrqu: ioctl request data |
| 3486 | * @extra: ioctl extra data |
| 3487 | * |
| 3488 | * Return: 0 on success, non-zero on error |
| 3489 | */ |
| 3490 | static int __iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 3491 | union iwreq_data *wrqu, char *extra) |
| 3492 | { |
| 3493 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3494 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3495 | struct iw_range *range = (struct iw_range *)extra; |
| 3496 | |
| 3497 | uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 3498 | |
| 3499 | uint32_t num_channels = sizeof(channels); |
| 3500 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 3501 | uint32_t a_len; |
| 3502 | uint32_t b_len; |
| 3503 | uint32_t active_phy_mode = 0; |
| 3504 | uint8_t index = 0, i; |
| 3505 | hdd_context_t *hdd_ctx; |
| 3506 | int ret; |
| 3507 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3508 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3509 | |
| 3510 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3511 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3512 | if (0 != ret) |
| 3513 | return ret; |
| 3514 | |
| 3515 | wrqu->data.length = sizeof(struct iw_range); |
| 3516 | memset(range, 0, sizeof(struct iw_range)); |
| 3517 | |
| 3518 | |
| 3519 | /*Get the phy mode */ |
| 3520 | if (sme_cfg_get_int(hHal, |
| 3521 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3522 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3523 | hdd_notice("active_phy_mode = %d", active_phy_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3524 | |
| 3525 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 3526 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G) { |
| 3527 | /*Get the supported rates for 11G band */ |
| 3528 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 3529 | if (sme_cfg_get_str(hHal, |
| 3530 | WNI_CFG_SUPPORTED_RATES_11A, |
| 3531 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3532 | &a_len) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3533 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) { |
| 3534 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 3535 | } |
| 3536 | for (i = 0; i < a_len; i++) { |
| 3537 | range->bitrate[i] = |
| 3538 | ((supp_rates[i] & 0x7F) / 2) * |
| 3539 | 1000000; |
| 3540 | } |
| 3541 | range->num_bitrates = a_len; |
| 3542 | } else { |
| 3543 | return -EIO; |
| 3544 | } |
| 3545 | } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 3546 | /*Get the supported rates for 11B band */ |
| 3547 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 3548 | if (sme_cfg_get_str(hHal, |
| 3549 | WNI_CFG_SUPPORTED_RATES_11B, |
| 3550 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3551 | &b_len) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3552 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) { |
| 3553 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 3554 | } |
| 3555 | for (i = 0; i < b_len; i++) { |
| 3556 | range->bitrate[i] = |
| 3557 | ((supp_rates[i] & 0x7F) / 2) * |
| 3558 | 1000000; |
| 3559 | } |
| 3560 | range->num_bitrates = b_len; |
| 3561 | } else { |
| 3562 | return -EIO; |
| 3563 | } |
| 3564 | } |
| 3565 | } |
| 3566 | |
| 3567 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 3568 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 3569 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 3570 | |
| 3571 | range->encoding_size[0] = 5; |
| 3572 | range->encoding_size[1] = 13; |
| 3573 | range->num_encoding_sizes = 2; |
| 3574 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 3575 | |
| 3576 | /* we support through Wireless Extensions 22 */ |
| 3577 | range->we_version_compiled = WIRELESS_EXT; |
| 3578 | range->we_version_source = 22; |
| 3579 | |
| 3580 | /*Supported Channels and Frequencies */ |
| 3581 | if (sme_cfg_get_str |
| 3582 | ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3583 | &num_channels) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3584 | hdd_warn("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3585 | return -EIO; |
| 3586 | } |
| 3587 | if (num_channels > IW_MAX_FREQUENCIES) { |
| 3588 | num_channels = IW_MAX_FREQUENCIES; |
| 3589 | } |
| 3590 | |
| 3591 | range->num_channels = num_channels; |
| 3592 | range->num_frequency = num_channels; |
| 3593 | |
| 3594 | for (index = 0; index < num_channels; index++) { |
| 3595 | uint32_t frq_indx = 0; |
| 3596 | |
| 3597 | range->freq[index].i = channels[index]; |
| 3598 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) { |
| 3599 | if (channels[index] == freq_chan_map[frq_indx].chan) { |
| 3600 | range->freq[index].m = |
| 3601 | freq_chan_map[frq_indx].freq * 100000; |
| 3602 | range->freq[index].e = 1; |
| 3603 | break; |
| 3604 | } |
| 3605 | frq_indx++; |
| 3606 | } |
| 3607 | } |
| 3608 | |
| 3609 | /* Event capability (kernel + driver) */ |
| 3610 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 3611 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 3612 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 3613 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 3614 | |
| 3615 | /*Encryption capability */ |
| 3616 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 3617 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 3618 | |
| 3619 | /* Txpower capability */ |
| 3620 | range->txpower_capa = IW_TXPOW_MWATT; |
| 3621 | |
| 3622 | /*Scanning capability */ |
| 3623 | #if WIRELESS_EXT >= 22 |
| 3624 | range->scan_capa = |
| 3625 | IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 3626 | #endif |
| 3627 | |
| 3628 | EXIT(); |
| 3629 | return 0; |
| 3630 | } |
| 3631 | |
| 3632 | /** |
| 3633 | * iw_get_range() - SSR wrapper for __iw_get_range() |
| 3634 | * @dev: pointer to net_device |
| 3635 | * @info: pointer to iw_request_info |
| 3636 | * @wrqu: pointer to iwreq_data |
| 3637 | * @extra: pointer to extra ioctl payload |
| 3638 | * |
| 3639 | * Return: 0 on success, error number otherwise |
| 3640 | */ |
| 3641 | static int iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 3642 | union iwreq_data *wrqu, char *extra) |
| 3643 | { |
| 3644 | int ret; |
| 3645 | |
| 3646 | cds_ssr_protect(__func__); |
| 3647 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 3648 | cds_ssr_unprotect(__func__); |
| 3649 | |
| 3650 | return ret; |
| 3651 | } |
| 3652 | |
| 3653 | /** |
| 3654 | * hdd_get_class_a_statistics_cb() - Get Class A stats callback function |
| 3655 | * @pStats: pointer to Class A stats |
| 3656 | * @pContext: user context originally registered with SME |
| 3657 | * |
| 3658 | * Return: None |
| 3659 | */ |
| 3660 | static void hdd_get_class_a_statistics_cb(void *pStats, void *pContext) |
| 3661 | { |
| 3662 | struct statsContext *pStatsContext; |
| 3663 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 3664 | hdd_adapter_t *pAdapter; |
| 3665 | |
| 3666 | if (ioctl_debug) { |
| 3667 | pr_info("%s: pStats [%p] pContext [%p]\n", |
| 3668 | __func__, pStats, pContext); |
| 3669 | } |
| 3670 | |
| 3671 | if ((NULL == pStats) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3672 | hdd_err("Bad param, pStats [%p] pContext [%p]", |
| 3673 | pStats, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3674 | return; |
| 3675 | } |
| 3676 | |
| 3677 | pClassAStats = pStats; |
| 3678 | pStatsContext = pContext; |
| 3679 | pAdapter = pStatsContext->pAdapter; |
| 3680 | |
| 3681 | /* there is a race condition that exists between this callback |
| 3682 | * function and the caller since the caller could time out |
| 3683 | * either before or while this code is executing. we use a |
| 3684 | * spinlock to serialize these actions |
| 3685 | */ |
| 3686 | spin_lock(&hdd_context_lock); |
| 3687 | |
| 3688 | if ((NULL == pAdapter) || |
| 3689 | (STATS_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 3690 | /* the caller presumably timed out so there is nothing |
| 3691 | * we can do |
| 3692 | */ |
| 3693 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3694 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 3695 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3696 | if (ioctl_debug) { |
| 3697 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 3698 | __func__, pAdapter, pStatsContext->magic); |
| 3699 | } |
| 3700 | return; |
| 3701 | } |
| 3702 | |
| 3703 | /* context is valid so caller is still waiting */ |
| 3704 | |
| 3705 | /* paranoia: invalidate the magic */ |
| 3706 | pStatsContext->magic = 0; |
| 3707 | |
| 3708 | /* copy over the stats. do so as a struct copy */ |
| 3709 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 3710 | |
| 3711 | /* notify the caller */ |
| 3712 | complete(&pStatsContext->completion); |
| 3713 | |
| 3714 | /* serialization is complete */ |
| 3715 | spin_unlock(&hdd_context_lock); |
| 3716 | } |
| 3717 | |
| 3718 | /** |
| 3719 | * wlan_hdd_get_class_astats() - Get Class A statistics |
| 3720 | * @pAdapter: adapter for which statistics are desired |
| 3721 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3722 | * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3723 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3724 | QDF_STATUS wlan_hdd_get_class_astats(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3725 | { |
| 3726 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3727 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3728 | unsigned long rc; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 3729 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | |
| 3731 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3732 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3733 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3734 | } |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 3735 | if (cds_is_driver_recovering()) { |
| 3736 | hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", |
| 3737 | cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3738 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | } |
| 3740 | |
| 3741 | /* we are connected so prepare our callback context */ |
| 3742 | init_completion(&context.completion); |
| 3743 | context.pAdapter = pAdapter; |
| 3744 | context.magic = STATS_CONTEXT_MAGIC; |
| 3745 | /* query only for Class A statistics (which include link speed) */ |
| 3746 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3747 | eCSR_HDD, SME_GLOBAL_CLASSA_STATS, |
| 3748 | hdd_get_class_a_statistics_cb, |
| 3749 | 0, /* not periodic */ |
| 3750 | false, /* non-cached results */ |
| 3751 | pHddStaCtx->conn_info.staId[0], |
| 3752 | &context, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3753 | if (QDF_STATUS_SUCCESS != hstatus) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 3754 | hdd_warn("Unable to retrieve Class A statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | /* we'll returned a cached value below */ |
| 3756 | } else { |
| 3757 | /* request was sent -- wait for the response */ |
| 3758 | rc = wait_for_completion_timeout |
| 3759 | (&context.completion, |
| 3760 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 3761 | if (!rc) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 3762 | hdd_warn("SME timed out while retrieving Class A statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3763 | } |
| 3764 | } |
| 3765 | |
| 3766 | /* either we never sent a request, we sent a request and |
| 3767 | * received a response or we sent a request and timed out. if |
| 3768 | * we never sent a request or if we sent a request and got a |
| 3769 | * response, we want to clear the magic out of paranoia. if |
| 3770 | * we timed out there is a race condition such that the |
| 3771 | * callback function could be executing at the same time we |
| 3772 | * are. of primary concern is if the callback function had |
| 3773 | * already verified the "magic" but had not yet set the |
| 3774 | * completion variable when a timeout occurred. we serialize |
| 3775 | * these activities by invalidating the magic while holding a |
| 3776 | * shared spinlock which will cause us to block if the |
| 3777 | * callback is currently executing |
| 3778 | */ |
| 3779 | spin_lock(&hdd_context_lock); |
| 3780 | context.magic = 0; |
| 3781 | spin_unlock(&hdd_context_lock); |
| 3782 | |
| 3783 | /* either callback updated pAdapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3784 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3785 | } |
| 3786 | |
| 3787 | /** |
| 3788 | * hdd_get_station_statistics_cb() - Get stats callback function |
| 3789 | * @pStats: pointer to Class A stats |
| 3790 | * @pContext: user context originally registered with SME |
| 3791 | * |
| 3792 | * Return: None |
| 3793 | */ |
| 3794 | static void hdd_get_station_statistics_cb(void *pStats, void *pContext) |
| 3795 | { |
| 3796 | struct statsContext *pStatsContext; |
| 3797 | tCsrSummaryStatsInfo *pSummaryStats; |
| 3798 | tCsrGlobalClassAStatsInfo *pClassAStats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 3799 | struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | hdd_adapter_t *pAdapter; |
| 3801 | |
| 3802 | if (ioctl_debug) { |
| 3803 | pr_info("%s: pStats [%p] pContext [%p]\n", |
| 3804 | __func__, pStats, pContext); |
| 3805 | } |
| 3806 | |
| 3807 | if ((NULL == pStats) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3808 | hdd_err("Bad param, pStats [%p] pContext [%p]", |
| 3809 | pStats, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | return; |
| 3811 | } |
| 3812 | |
| 3813 | /* there is a race condition that exists between this callback |
| 3814 | * function and the caller since the caller could time out |
| 3815 | * either before or while this code is executing. we use a |
| 3816 | * spinlock to serialize these actions |
| 3817 | */ |
| 3818 | spin_lock(&hdd_context_lock); |
| 3819 | |
| 3820 | pSummaryStats = (tCsrSummaryStatsInfo *) pStats; |
| 3821 | pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 3822 | per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *) |
| 3823 | (pClassAStats + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | pStatsContext = pContext; |
| 3825 | pAdapter = pStatsContext->pAdapter; |
| 3826 | if ((NULL == pAdapter) || |
| 3827 | (STATS_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 3828 | /* the caller presumably timed out so there is nothing |
| 3829 | * we can do |
| 3830 | */ |
| 3831 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3832 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 3833 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3834 | if (ioctl_debug) { |
| 3835 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 3836 | __func__, pAdapter, pStatsContext->magic); |
| 3837 | } |
| 3838 | return; |
| 3839 | } |
| 3840 | |
| 3841 | /* context is valid so caller is still waiting */ |
| 3842 | |
| 3843 | /* paranoia: invalidate the magic */ |
| 3844 | pStatsContext->magic = 0; |
| 3845 | |
| 3846 | /* copy over the stats. do so as a struct copy */ |
| 3847 | pAdapter->hdd_stats.summary_stat = *pSummaryStats; |
| 3848 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 3849 | pAdapter->hdd_stats.per_chain_rssi_stats = *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3850 | |
| 3851 | /* notify the caller */ |
| 3852 | complete(&pStatsContext->completion); |
| 3853 | |
| 3854 | /* serialization is complete */ |
| 3855 | spin_unlock(&hdd_context_lock); |
| 3856 | } |
| 3857 | |
| 3858 | /** |
| 3859 | * wlan_hdd_get_station_stats() - Get station statistics |
| 3860 | * @pAdapter: adapter for which statistics are desired |
| 3861 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3862 | * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3863 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3864 | QDF_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3865 | { |
| 3866 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3867 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3868 | unsigned long rc; |
Jeff Johnson | 5aacdf9 | 2016-11-04 18:08:11 -0700 | [diff] [blame] | 3869 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3870 | |
| 3871 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3872 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3873 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | } |
| 3875 | |
| 3876 | /* we are connected so prepare our callback context */ |
| 3877 | init_completion(&context.completion); |
| 3878 | context.pAdapter = pAdapter; |
| 3879 | context.magic = STATS_CONTEXT_MAGIC; |
| 3880 | |
| 3881 | /* query only for Summary & Class A statistics */ |
| 3882 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3883 | eCSR_HDD, |
| 3884 | SME_SUMMARY_STATS | |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 3885 | SME_GLOBAL_CLASSA_STATS | |
| 3886 | SME_PER_CHAIN_RSSI_STATS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3887 | hdd_get_station_statistics_cb, |
| 3888 | 0, /* not periodic */ |
| 3889 | false, /* non-cached results */ |
| 3890 | pHddStaCtx->conn_info.staId[0], |
| 3891 | &context, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3892 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3893 | hdd_err("Unable to retrieve statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3894 | /* we'll return with cached values */ |
| 3895 | } else { |
| 3896 | /* request was sent -- wait for the response */ |
| 3897 | rc = wait_for_completion_timeout |
| 3898 | (&context.completion, |
| 3899 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 3900 | |
| 3901 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3902 | hdd_err("SME timed out while retrieving statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3903 | } |
| 3904 | } |
| 3905 | |
| 3906 | /* either we never sent a request, we sent a request and |
| 3907 | * received a response or we sent a request and timed out. if |
| 3908 | * we never sent a request or if we sent a request and got a |
| 3909 | * response, we want to clear the magic out of paranoia. if |
| 3910 | * we timed out there is a race condition such that the |
| 3911 | * callback function could be executing at the same time we |
| 3912 | * are. of primary concern is if the callback function had |
| 3913 | * already verified the "magic" but had not yet set the |
| 3914 | * completion variable when a timeout occurred. we serialize |
| 3915 | * these activities by invalidating the magic while holding a |
| 3916 | * shared spinlock which will cause us to block if the |
| 3917 | * callback is currently executing |
| 3918 | */ |
| 3919 | spin_lock(&hdd_context_lock); |
| 3920 | context.magic = 0; |
| 3921 | spin_unlock(&hdd_context_lock); |
| 3922 | |
| 3923 | /* either callback updated pAdapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3924 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3925 | } |
| 3926 | |
| 3927 | /** |
| 3928 | * iw_get_linkspeed() - Get current link speed ioctl |
| 3929 | * @dev: device upon which the ioctl was received |
| 3930 | * @info: ioctl request information |
| 3931 | * @wrqu: ioctl request data |
| 3932 | * @extra: extra ioctl buffer |
| 3933 | * |
| 3934 | * Return: 0 on success, non-zero on error |
| 3935 | */ |
| 3936 | static int __iw_get_linkspeed(struct net_device *dev, |
| 3937 | struct iw_request_info *info, |
| 3938 | union iwreq_data *wrqu, char *extra) |
| 3939 | { |
| 3940 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3941 | char *pLinkSpeed = (char *)extra; |
| 3942 | int len = sizeof(uint32_t) + 1; |
| 3943 | uint32_t link_speed = 0; |
| 3944 | hdd_context_t *hdd_ctx; |
| 3945 | int rc, valid; |
| 3946 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 3947 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 3948 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3949 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3950 | valid = wlan_hdd_validate_context(hdd_ctx); |
| 3951 | if (0 != valid) |
| 3952 | return valid; |
| 3953 | |
| 3954 | rc = wlan_hdd_get_link_speed(pAdapter, &link_speed); |
| 3955 | if (0 != rc) { |
| 3956 | return rc; |
| 3957 | } |
| 3958 | |
| 3959 | wrqu->data.length = len; |
| 3960 | /* return the linkspeed as a string */ |
| 3961 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
| 3962 | if ((rc < 0) || (rc >= len)) { |
| 3963 | /* encoding or length error? */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3964 | hdd_err("Unable to encode link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3965 | return -EIO; |
| 3966 | } |
| 3967 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 3968 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3969 | /* a value is being successfully returned */ |
| 3970 | return 0; |
| 3971 | } |
| 3972 | |
| 3973 | static int iw_get_linkspeed(struct net_device *dev, |
| 3974 | struct iw_request_info *info, |
| 3975 | union iwreq_data *wrqu, char *extra) |
| 3976 | { |
| 3977 | int ret; |
| 3978 | |
| 3979 | cds_ssr_protect(__func__); |
| 3980 | ret = __iw_get_linkspeed(dev, info, wrqu, extra); |
| 3981 | cds_ssr_unprotect(__func__); |
| 3982 | |
| 3983 | return ret; |
| 3984 | } |
| 3985 | |
| 3986 | /** |
| 3987 | * wlan_hdd_change_country_code_callback() - Change country code callback |
| 3988 | * @context: opaque context originally passed to SME. All functions |
| 3989 | * which use this callback pass the adapter upon which the country |
| 3990 | * code change is active |
| 3991 | * |
| 3992 | * This function is registered as the callback function when |
| 3993 | * sme_change_country_code() is invoked. Callers of |
| 3994 | * sme_change_country_code() subsequently wait for the adapter's |
| 3995 | * @change_country_code completion variable, so all this function |
| 3996 | * needs to do is set that completion variable so that execution can |
| 3997 | * continue. |
| 3998 | * |
| 3999 | * Return: none |
| 4000 | */ |
| 4001 | void wlan_hdd_change_country_code_callback(void *context) |
| 4002 | { |
| 4003 | |
| 4004 | hdd_adapter_t *adapter = context; |
| 4005 | |
| 4006 | if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) |
| 4007 | complete(&adapter->change_country_code); |
| 4008 | |
| 4009 | return; |
| 4010 | } |
| 4011 | |
| 4012 | /** |
| 4013 | * __iw_set_nick() - SIOCSIWNICKN ioctl handler |
| 4014 | * @dev: device upon which the ioctl was received |
| 4015 | * @info: ioctl request information |
| 4016 | * @wrqu: ioctl request data |
| 4017 | * @extra: ioctl extra data |
| 4018 | * |
| 4019 | * Return: 0 on success, non-zero on error |
| 4020 | */ |
| 4021 | static int __iw_set_nick(struct net_device *dev, |
| 4022 | struct iw_request_info *info, |
| 4023 | union iwreq_data *wrqu, char *extra) |
| 4024 | { |
| 4025 | hdd_adapter_t *adapter; |
| 4026 | hdd_context_t *hdd_ctx; |
| 4027 | int ret; |
| 4028 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4029 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4030 | |
| 4031 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4032 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4033 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4034 | if (0 != ret) |
| 4035 | return ret; |
| 4036 | |
| 4037 | return 0; |
| 4038 | } |
| 4039 | |
| 4040 | /** |
| 4041 | * iw_set_nick() - SSR wrapper for __iw_set_nick |
| 4042 | * @dev: pointer to net_device |
| 4043 | * @info: pointer to iw_request_info |
| 4044 | * @wrqu: pointer to iwreq_data |
| 4045 | * @extra: extra |
| 4046 | * |
| 4047 | * Return: 0 on success, error number otherwise |
| 4048 | */ |
| 4049 | static int iw_set_nick(struct net_device *dev, |
| 4050 | struct iw_request_info *info, |
| 4051 | union iwreq_data *wrqu, char *extra) |
| 4052 | { |
| 4053 | int ret; |
| 4054 | |
| 4055 | cds_ssr_protect(__func__); |
| 4056 | ret = __iw_set_nick(dev, info, wrqu, extra); |
| 4057 | cds_ssr_unprotect(__func__); |
| 4058 | |
| 4059 | return ret; |
| 4060 | } |
| 4061 | |
| 4062 | /** |
| 4063 | * __iw_get_nick() - SIOCGIWNICKN ioctl handler |
| 4064 | * @dev: device upon which the ioctl was received |
| 4065 | * @info: ioctl request information |
| 4066 | * @wrqu: ioctl request data |
| 4067 | * @extra: ioctl extra data |
| 4068 | * |
| 4069 | * Return: 0 on success, non-zero on error |
| 4070 | */ |
| 4071 | static int __iw_get_nick(struct net_device *dev, |
| 4072 | struct iw_request_info *info, |
| 4073 | union iwreq_data *wrqu, char *extra) |
| 4074 | { |
| 4075 | hdd_adapter_t *adapter; |
| 4076 | hdd_context_t *hdd_ctx; |
| 4077 | int ret; |
| 4078 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4079 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4080 | |
| 4081 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4082 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4083 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4084 | if (0 != ret) |
| 4085 | return ret; |
| 4086 | |
| 4087 | return 0; |
| 4088 | } |
| 4089 | |
| 4090 | /** |
| 4091 | * iw_get_nick() - SSR wrapper for __iw_get_nick |
| 4092 | * @dev: pointer to net_device |
| 4093 | * @info: pointer to iw_request_info |
| 4094 | * @wrqu: pointer to iwreq_data |
| 4095 | * @extra: extra |
| 4096 | * |
| 4097 | * Return: 0 on success, error number otherwise |
| 4098 | */ |
| 4099 | static int iw_get_nick(struct net_device *dev, |
| 4100 | struct iw_request_info *info, |
| 4101 | union iwreq_data *wrqu, char *extra) |
| 4102 | { |
| 4103 | int ret; |
| 4104 | |
| 4105 | cds_ssr_protect(__func__); |
| 4106 | ret = __iw_get_nick(dev, info, wrqu, extra); |
| 4107 | cds_ssr_unprotect(__func__); |
| 4108 | |
| 4109 | return ret; |
| 4110 | } |
| 4111 | |
| 4112 | /** |
| 4113 | * __iw_set_encode() - SIOCSIWENCODE ioctl handler |
| 4114 | * @dev: device upon which the ioctl was received |
| 4115 | * @info: ioctl request information |
| 4116 | * @wrqu: ioctl request data |
| 4117 | * @extra: ioctl extra data |
| 4118 | * |
| 4119 | * Return: 0 on success, non-zero on error |
| 4120 | */ |
| 4121 | static int __iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 4122 | union iwreq_data *wrqu, char *extra) |
| 4123 | { |
| 4124 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4125 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4126 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4127 | hdd_context_t *hdd_ctx; |
| 4128 | struct iw_point *encoderq = &(wrqu->encoding); |
| 4129 | uint32_t keyId; |
| 4130 | uint8_t key_length; |
| 4131 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4132 | bool fKeyPresent = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4133 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | int ret; |
| 4135 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4136 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4137 | |
| 4138 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4139 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4140 | if (0 != ret) |
| 4141 | return ret; |
| 4142 | |
| 4143 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 4144 | |
| 4145 | if (keyId) { |
| 4146 | if (keyId > MAX_WEP_KEYS) { |
| 4147 | return -EINVAL; |
| 4148 | } |
| 4149 | |
| 4150 | fKeyPresent = 1; |
| 4151 | keyId--; |
| 4152 | } else { |
| 4153 | fKeyPresent = 0; |
| 4154 | } |
| 4155 | |
| 4156 | if (wrqu->data.flags & IW_ENCODE_DISABLED) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4157 | hdd_notice("****iwconfig wlan0 key off*****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | if (!fKeyPresent) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4159 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, |
| 4160 | CSR_MAX_NUM_KEY); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4161 | } |
| 4162 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4163 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 4164 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 4165 | eCSR_ENCRYPT_TYPE_NONE; |
| 4166 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 4167 | eCSR_ENCRYPT_TYPE_NONE; |
| 4168 | |
| 4169 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4170 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4171 | |
| 4172 | if (eConnectionState_Associated == |
| 4173 | pHddStaCtx->conn_info.connState) { |
| 4174 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4175 | status = |
| 4176 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4177 | pAdapter->sessionId, |
| 4178 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4179 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | unsigned long rc; |
| 4181 | rc = wait_for_completion_timeout(&pAdapter-> |
| 4182 | disconnect_comp_var, |
| 4183 | msecs_to_jiffies |
| 4184 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 4185 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4186 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4187 | } |
| 4188 | } |
| 4189 | |
| 4190 | return status; |
| 4191 | |
| 4192 | } |
| 4193 | |
| 4194 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4195 | hdd_notice("iwconfig wlan0 key on"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4196 | |
| 4197 | pHddStaCtx->conn_info.authType = |
| 4198 | (encoderq-> |
| 4199 | flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : |
| 4200 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4201 | |
| 4202 | } |
| 4203 | |
| 4204 | if (wrqu->data.length > 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4205 | hdd_notice("wrqu->data.length : %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4206 | |
| 4207 | key_length = wrqu->data.length; |
| 4208 | |
| 4209 | /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued. */ |
| 4210 | |
| 4211 | if (5 == key_length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4212 | hdd_notice("Call with WEP40,key_len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4213 | key_length); |
| 4214 | |
| 4215 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 4216 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4217 | pHddStaCtx->conn_info.authType)) { |
| 4218 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 4219 | } else { |
| 4220 | encryptionType = |
| 4221 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4222 | } |
| 4223 | } else if (13 == key_length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4224 | hdd_notice("Call with WEP104,key_len:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4225 | key_length); |
| 4226 | |
| 4227 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 4228 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4229 | pHddStaCtx->conn_info.authType)) { |
| 4230 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 4231 | } else { |
| 4232 | encryptionType = |
| 4233 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4234 | } |
| 4235 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4236 | hdd_warn("Invalid WEP key length :%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | key_length); |
| 4238 | return -EINVAL; |
| 4239 | } |
| 4240 | |
| 4241 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 4242 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 4243 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4244 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 4245 | encryptionType; |
| 4246 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 4247 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 4248 | encryptionType; |
| 4249 | |
| 4250 | if ((eConnectionState_NotConnected == |
| 4251 | pHddStaCtx->conn_info.connState) |
| 4252 | && |
| 4253 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4254 | pHddStaCtx->conn_info.authType) |
| 4255 | || (eCSR_AUTH_TYPE_SHARED_KEY == |
| 4256 | pHddStaCtx->conn_info.authType))) { |
| 4257 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4258 | qdf_mem_copy(&pWextState->roamProfile.Keys. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | KeyMaterial[keyId][0], extra, key_length); |
| 4260 | |
| 4261 | pWextState->roamProfile.Keys.KeyLength[keyId] = |
| 4262 | (uint8_t) key_length; |
| 4263 | pWextState->roamProfile.Keys.defaultIndex = |
| 4264 | (uint8_t) keyId; |
| 4265 | |
| 4266 | return status; |
| 4267 | } |
| 4268 | } |
| 4269 | |
| 4270 | return 0; |
| 4271 | } |
| 4272 | |
| 4273 | /** |
| 4274 | * iw_set_encode() - SSR wrapper for __iw_set_encode() |
| 4275 | * @dev: pointer to net_device |
| 4276 | * @info: pointer to iw_request_info |
| 4277 | * @wrqu: pointer to iwreq_data |
| 4278 | * @extra: pointer to extra ioctl payload |
| 4279 | * |
| 4280 | * Return: 0 on success, error number otherwise |
| 4281 | */ |
| 4282 | static int iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 4283 | union iwreq_data *wrqu, char *extra) |
| 4284 | { |
| 4285 | int ret; |
| 4286 | |
| 4287 | cds_ssr_protect(__func__); |
| 4288 | ret = __iw_set_encode(dev, info, wrqu, extra); |
| 4289 | cds_ssr_unprotect(__func__); |
| 4290 | |
| 4291 | return ret; |
| 4292 | } |
| 4293 | |
| 4294 | /** |
| 4295 | * __iw_get_encodeext() - SIOCGIWENCODEEXT ioctl handler |
| 4296 | * @dev: device upon which the ioctl was received |
| 4297 | * @info: ioctl request information |
| 4298 | * @wrqu: ioctl request data |
| 4299 | * @extra: ioctl extra data |
| 4300 | * |
| 4301 | * Return: 0 on success, non-zero on error |
| 4302 | */ |
| 4303 | static int __iw_get_encodeext(struct net_device *dev, |
| 4304 | struct iw_request_info *info, |
| 4305 | struct iw_point *dwrq, char *extra) |
| 4306 | { |
| 4307 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4308 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4309 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 4310 | int keyId; |
| 4311 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4312 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 4313 | int i, ret; |
| 4314 | hdd_context_t *hdd_ctx; |
| 4315 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4316 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4317 | |
| 4318 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4319 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4320 | if (0 != ret) |
| 4321 | return ret; |
| 4322 | |
| 4323 | keyId = pRoamProfile->Keys.defaultIndex; |
| 4324 | |
| 4325 | if (keyId < 0 || keyId >= MAX_WEP_KEYS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4326 | hdd_notice("Invalid keyId : %d", keyId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4327 | return -EINVAL; |
| 4328 | } |
| 4329 | |
| 4330 | if (pRoamProfile->Keys.KeyLength[keyId] > 0) { |
| 4331 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4332 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4333 | qdf_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4334 | pRoamProfile->Keys.KeyLength[keyId]); |
| 4335 | } else { |
| 4336 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4337 | } |
| 4338 | |
| 4339 | for (i = 0; i < MAX_WEP_KEYS; i++) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4340 | if (pRoamProfile->Keys.KeyLength[i] == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4341 | continue; |
| 4342 | } else { |
| 4343 | break; |
| 4344 | } |
| 4345 | } |
| 4346 | |
| 4347 | if (MAX_WEP_KEYS == i) { |
| 4348 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 4349 | } else { |
| 4350 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4351 | } |
| 4352 | |
| 4353 | encryptionType = pRoamProfile->EncryptionType.encryptionType[0]; |
| 4354 | |
| 4355 | if (eCSR_ENCRYPT_TYPE_NONE == encryptionType) { |
| 4356 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4357 | } |
| 4358 | |
| 4359 | authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 4360 | |
| 4361 | if (IW_AUTH_ALG_OPEN_SYSTEM == authType) { |
| 4362 | dwrq->flags |= IW_ENCODE_OPEN; |
| 4363 | } else { |
| 4364 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 4365 | } |
| 4366 | EXIT(); |
| 4367 | return 0; |
| 4368 | |
| 4369 | } |
| 4370 | |
| 4371 | /** |
| 4372 | * iw_get_encodeext() - SSR wrapper for __iw_get_encodeext() |
| 4373 | * @dev: pointer to net_device |
| 4374 | * @info: pointer to iw_request_info |
| 4375 | * @dwrq: pointer to encoding information |
| 4376 | * @extra: pointer to extra ioctl payload |
| 4377 | * |
| 4378 | * Return: 0 on success, error number otherwise |
| 4379 | */ |
| 4380 | static int iw_get_encodeext(struct net_device *dev, |
| 4381 | struct iw_request_info *info, |
| 4382 | struct iw_point *dwrq, char *extra) |
| 4383 | { |
| 4384 | int ret; |
| 4385 | |
| 4386 | cds_ssr_protect(__func__); |
| 4387 | ret = __iw_get_encodeext(dev, info, dwrq, extra); |
| 4388 | cds_ssr_unprotect(__func__); |
| 4389 | |
| 4390 | return ret; |
| 4391 | } |
| 4392 | |
| 4393 | /** |
| 4394 | * __iw_set_encodeext() - SIOCSIWENCODEEXT ioctl handler |
| 4395 | * @dev: device upon which the ioctl was received |
| 4396 | * @info: ioctl request information |
| 4397 | * @wrqu: ioctl request data |
| 4398 | * @extra: ioctl extra data |
| 4399 | * |
| 4400 | * Return: 0 on success, non-zero on error |
| 4401 | */ |
| 4402 | static int __iw_set_encodeext(struct net_device *dev, |
| 4403 | struct iw_request_info *info, |
| 4404 | union iwreq_data *wrqu, char *extra) |
| 4405 | { |
| 4406 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4407 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4408 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4409 | hdd_context_t *hdd_ctx; |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4410 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 4412 | int ret; |
| 4413 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
| 4414 | int key_index; |
| 4415 | struct iw_point *encoding = &wrqu->encoding; |
| 4416 | tCsrRoamSetKey setKey; |
| 4417 | uint32_t roamId = 0xFF; |
| 4418 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4419 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | |
| 4421 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4422 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4423 | if (0 != ret) |
| 4424 | return ret; |
| 4425 | |
| 4426 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 4427 | |
| 4428 | if (key_index > 0) { |
| 4429 | |
| 4430 | /*Convert from 1-based to 0-based keying */ |
| 4431 | key_index--; |
| 4432 | } |
| 4433 | if (!ext->key_len) { |
| 4434 | |
| 4435 | /*Set the encrytion type to NONE */ |
| 4436 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 4437 | eCSR_ENCRYPT_TYPE_NONE; |
| 4438 | return ret; |
| 4439 | } |
| 4440 | |
| 4441 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState && |
| 4442 | (IW_ENCODE_ALG_WEP == ext->alg)) { |
| 4443 | if (IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { |
| 4444 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4445 | hdd_err("Invalid Configuration"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4446 | return -EINVAL; |
| 4447 | } else { |
| 4448 | /*Static wep, update the roam profile with the keys */ |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4449 | if (ext->key_len |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4450 | && (ext->key_len <= |
| 4451 | eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) |
| 4452 | && key_index < CSR_MAX_NUM_KEY) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4453 | qdf_mem_copy(&pRoamProfile->Keys. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4454 | KeyMaterial[key_index][0], |
| 4455 | ext->key, ext->key_len); |
| 4456 | pRoamProfile->Keys.KeyLength[key_index] = |
| 4457 | (uint8_t) ext->key_len; |
| 4458 | |
| 4459 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 4460 | pRoamProfile->Keys.defaultIndex = |
| 4461 | (uint8_t) key_index; |
| 4462 | |
| 4463 | } |
| 4464 | } |
| 4465 | return ret; |
| 4466 | } |
| 4467 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4468 | qdf_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | |
| 4470 | setKey.keyId = key_index; |
| 4471 | setKey.keyLength = ext->key_len; |
| 4472 | |
| 4473 | if (ext->key_len <= CSR_MAX_KEY_LEN) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4474 | qdf_mem_copy(&setKey.Key[0], ext->key, ext->key_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | } |
| 4476 | |
| 4477 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4478 | /*Key direction for group is RX only */ |
| 4479 | setKey.keyDirection = eSIR_RX_ONLY; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4480 | qdf_set_macaddr_broadcast(&setKey.peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | } else { |
| 4482 | |
| 4483 | setKey.keyDirection = eSIR_TX_RX; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4484 | qdf_mem_copy(setKey.peerMac.bytes, ext->addr.sa_data, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4485 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4486 | } |
| 4487 | |
| 4488 | /*For supplicant pae role is zero */ |
| 4489 | setKey.paeRole = 0; |
| 4490 | |
| 4491 | switch (ext->alg) { |
| 4492 | case IW_ENCODE_ALG_NONE: |
| 4493 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4494 | break; |
| 4495 | |
| 4496 | case IW_ENCODE_ALG_WEP: |
| 4497 | setKey.encType = |
| 4498 | (ext->key_len == |
| 4499 | 5) ? eCSR_ENCRYPT_TYPE_WEP40 : eCSR_ENCRYPT_TYPE_WEP104; |
| 4500 | break; |
| 4501 | |
| 4502 | case IW_ENCODE_ALG_TKIP: |
| 4503 | { |
| 4504 | uint8_t *pKey = &setKey.Key[0]; |
| 4505 | |
| 4506 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 4507 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4508 | qdf_mem_zero(pKey, CSR_MAX_KEY_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | |
| 4510 | /* Supplicant sends the 32bytes key in this order |
| 4511 | * |--------------|----------|----------| |
| 4512 | * | Tk1 | TX MIC | RX MIC | |
| 4513 | * |--------------|----------|----------| |
| 4514 | * <---16bytes---><--8bytes--><--8bytes--> |
| 4515 | * |
| 4516 | * |
| 4517 | * Sme expects the 32 bytes key to be in the below order |
| 4518 | * |--------------|----------|----------| |
| 4519 | * | Tk1 | RX MIC | TX MIC | |
| 4520 | * |--------------|----------|----------| |
| 4521 | * <---16bytes---><--8bytes--><--8bytes--> |
| 4522 | */ |
| 4523 | |
| 4524 | /* Copy the Temporal Key 1 (TK1) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4525 | qdf_mem_copy(pKey, ext->key, 16); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4526 | |
| 4527 | /* Copy the rx mic first */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4528 | qdf_mem_copy(&pKey[16], &ext->key[24], 8); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | |
| 4530 | /* Copy the tx mic */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4531 | qdf_mem_copy(&pKey[24], &ext->key[16], 8); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4532 | |
| 4533 | } |
| 4534 | break; |
| 4535 | |
| 4536 | case IW_ENCODE_ALG_CCMP: |
| 4537 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4538 | break; |
| 4539 | |
| 4540 | #ifdef FEATURE_WLAN_ESE |
| 4541 | #define IW_ENCODE_ALG_KRK 6 |
| 4542 | case IW_ENCODE_ALG_KRK: |
| 4543 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 4544 | break; |
| 4545 | #endif /* FEATURE_WLAN_ESE */ |
| 4546 | |
| 4547 | default: |
| 4548 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4549 | break; |
| 4550 | } |
| 4551 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4552 | hdd_notice("cipher_alg:%d key_len:%d EncryptionType:%d", |
| 4553 | (int)ext->alg, (int)ext->key_len, setKey.encType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4554 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4555 | /* The supplicant may attempt to set the PTK once |
| 4556 | * pre-authentication is done. Save the key in the UMAC and |
| 4557 | * include it in the ADD BSS request |
| 4558 | */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4559 | qdf_ret_status = sme_ft_update_key(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | pAdapter->sessionId, &setKey); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4561 | if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4562 | hdd_info("Update PreAuth Key success"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4563 | return 0; |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4564 | } else if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_FAILED) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4565 | hdd_err("Update PreAuth Key failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4566 | return -EINVAL; |
| 4567 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | |
| 4569 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4570 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4571 | qdf_ret_status = sme_roam_set_key(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4572 | pAdapter->sessionId, |
| 4573 | &setKey, &roamId); |
| 4574 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4575 | if (qdf_ret_status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4576 | hdd_err("[%4d] sme_roam_set_key returned ERROR status= %d", |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4577 | __LINE__, qdf_ret_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4578 | |
| 4579 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4580 | } |
| 4581 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4582 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4583 | } |
| 4584 | |
| 4585 | /** |
| 4586 | * iw_set_encodeext() - SSR wrapper for __iw_set_encodeext() |
| 4587 | * @dev: pointer to net_device |
| 4588 | * @info: pointer to iw_request_info |
| 4589 | * @wrqu: pointer to iwreq_data |
| 4590 | * @extra: pointer to extra ioctl payload |
| 4591 | * |
| 4592 | * Return: 0 on success, error number otherwise |
| 4593 | */ |
| 4594 | static int iw_set_encodeext(struct net_device *dev, |
| 4595 | struct iw_request_info *info, |
| 4596 | union iwreq_data *wrqu, char *extra) |
| 4597 | { |
| 4598 | int ret; |
| 4599 | |
| 4600 | cds_ssr_protect(__func__); |
| 4601 | ret = __iw_set_encodeext(dev, info, wrqu, extra); |
| 4602 | cds_ssr_unprotect(__func__); |
| 4603 | |
| 4604 | return ret; |
| 4605 | } |
| 4606 | |
| 4607 | /** |
| 4608 | * __iw_set_retry() - SIOCSIWRETRY ioctl handler |
| 4609 | * @dev: device upon which the ioctl was received |
| 4610 | * @info: ioctl request information |
| 4611 | * @wrqu: ioctl request data |
| 4612 | * @extra: ioctl extra data |
| 4613 | * |
| 4614 | * Return: 0 on success, non-zero on error |
| 4615 | */ |
| 4616 | static int __iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 4617 | union iwreq_data *wrqu, char *extra) |
| 4618 | { |
| 4619 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4620 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4621 | hdd_context_t *hdd_ctx; |
| 4622 | int ret; |
| 4623 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4624 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4625 | |
| 4626 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4627 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4628 | if (0 != ret) |
| 4629 | return ret; |
| 4630 | |
| 4631 | if (wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 4632 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 4633 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4634 | hdd_err("Invalid Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4635 | |
| 4636 | return -EINVAL; |
| 4637 | } |
| 4638 | |
| 4639 | if (wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 4640 | |
| 4641 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 4642 | if (sme_cfg_set_int (hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 4643 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4644 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4645 | hdd_err("failed to set ini parameter, WNI_CFG_LONG_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4646 | return -EIO; |
| 4647 | } |
| 4648 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 4649 | if (sme_cfg_set_int (hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 4650 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4651 | QDF_STATUS_SUCCESS) { |
Anurag Chouhan | d29e760 | 2016-10-17 15:20:22 +0530 | [diff] [blame] | 4652 | hdd_err("failed to set ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4653 | return -EIO; |
| 4654 | } |
| 4655 | } |
| 4656 | } else { |
| 4657 | return -EOPNOTSUPP; |
| 4658 | } |
| 4659 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4660 | hdd_notice("Set Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4661 | |
| 4662 | EXIT(); |
| 4663 | |
| 4664 | return 0; |
| 4665 | |
| 4666 | } |
| 4667 | |
| 4668 | /** |
| 4669 | * iw_set_retry() - SSR wrapper for __iw_set_retry() |
| 4670 | * @dev: pointer to net_device |
| 4671 | * @info: pointer to iw_request_info |
| 4672 | * @wrqu: pointer to iwreq_data |
| 4673 | * @extra: pointer to extra ioctl payload |
| 4674 | * |
| 4675 | * Return: 0 on success, error number otherwise |
| 4676 | */ |
| 4677 | static int iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 4678 | union iwreq_data *wrqu, char *extra) |
| 4679 | { |
| 4680 | int ret; |
| 4681 | |
| 4682 | cds_ssr_protect(__func__); |
| 4683 | ret = __iw_set_retry(dev, info, wrqu, extra); |
| 4684 | cds_ssr_unprotect(__func__); |
| 4685 | |
| 4686 | return ret; |
| 4687 | } |
| 4688 | |
| 4689 | /** |
| 4690 | * __iw_get_retry() - SIOCGIWRETRY ioctl handler |
| 4691 | * @dev: device upon which the ioctl was received |
| 4692 | * @info: ioctl request information |
| 4693 | * @wrqu: ioctl request data |
| 4694 | * @extra: ioctl extra data |
| 4695 | * |
| 4696 | * Return: 0 on success, non-zero on error |
| 4697 | */ |
| 4698 | static int __iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 4699 | union iwreq_data *wrqu, char *extra) |
| 4700 | { |
| 4701 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4702 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4703 | uint32_t retry = 0; |
| 4704 | hdd_context_t *hdd_ctx; |
| 4705 | int ret; |
| 4706 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4707 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | |
| 4709 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4710 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4711 | if (0 != ret) |
| 4712 | return ret; |
| 4713 | |
| 4714 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 4715 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 4716 | |
| 4717 | if (sme_cfg_get_int(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4718 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4719 | hdd_warn("failed to get ini parameter, WNI_CFG_LONG_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4720 | return -EIO; |
| 4721 | } |
| 4722 | |
| 4723 | wrqu->retry.value = retry; |
| 4724 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 4725 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 4726 | |
| 4727 | if (sme_cfg_get_int(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4728 | QDF_STATUS_SUCCESS) { |
Anurag Chouhan | d29e760 | 2016-10-17 15:20:22 +0530 | [diff] [blame] | 4729 | hdd_warn("failed to get ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | return -EIO; |
| 4731 | } |
| 4732 | |
| 4733 | wrqu->retry.value = retry; |
| 4734 | } else { |
| 4735 | return -EOPNOTSUPP; |
| 4736 | } |
| 4737 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4738 | hdd_notice("Retry-Limit=%d!!", retry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | |
| 4740 | EXIT(); |
| 4741 | |
| 4742 | return 0; |
| 4743 | } |
| 4744 | |
| 4745 | /** |
| 4746 | * iw_get_retry() - SSR wrapper for __iw_get_retry() |
| 4747 | * @dev: pointer to net_device |
| 4748 | * @info: pointer to iw_request_info |
| 4749 | * @wrqu: pointer to iwreq_data |
| 4750 | * @extra: pointer to extra ioctl payload |
| 4751 | * |
| 4752 | * Return: 0 on success, error number otherwise |
| 4753 | */ |
| 4754 | static int iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 4755 | union iwreq_data *wrqu, char *extra) |
| 4756 | { |
| 4757 | int ret; |
| 4758 | |
| 4759 | cds_ssr_protect(__func__); |
| 4760 | ret = __iw_get_retry(dev, info, wrqu, extra); |
| 4761 | cds_ssr_unprotect(__func__); |
| 4762 | |
| 4763 | return ret; |
| 4764 | } |
| 4765 | |
| 4766 | /** |
| 4767 | * __iw_set_mlme() - SIOCSIWMLME ioctl handler |
| 4768 | * @dev: device upon which the ioctl was received |
| 4769 | * @info: ioctl request information |
| 4770 | * @wrqu: ioctl request data |
| 4771 | * @extra: ioctl extra data |
| 4772 | * |
| 4773 | * Return: 0 on success, non-zero on error |
| 4774 | */ |
| 4775 | static int __iw_set_mlme(struct net_device *dev, |
| 4776 | struct iw_request_info *info, |
| 4777 | union iwreq_data *wrqu, char *extra) |
| 4778 | { |
| 4779 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4780 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4781 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4782 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4783 | hdd_context_t *hdd_ctx; |
| 4784 | int ret; |
| 4785 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4786 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4787 | |
| 4788 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4789 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4790 | if (0 != ret) |
| 4791 | return ret; |
| 4792 | |
| 4793 | /* reason_code is unused. By default it is set to |
| 4794 | * eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 4795 | */ |
| 4796 | switch (mlme->cmd) { |
| 4797 | case IW_MLME_DISASSOC: |
| 4798 | case IW_MLME_DEAUTH: |
| 4799 | |
| 4800 | if (pHddStaCtx->conn_info.connState == |
| 4801 | eConnectionState_Associated) { |
| 4802 | eCsrRoamDisconnectReason reason = |
| 4803 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 4804 | |
| 4805 | if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE) |
| 4806 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 4807 | |
| 4808 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4809 | status = |
| 4810 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4811 | pAdapter->sessionId, reason); |
| 4812 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4813 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4814 | unsigned long rc; |
| 4815 | rc = wait_for_completion_timeout(&pAdapter-> |
| 4816 | disconnect_comp_var, |
| 4817 | msecs_to_jiffies |
| 4818 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 4819 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4820 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4821 | } else |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4822 | hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d", |
| 4823 | (int)mlme->cmd, (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4824 | |
| 4825 | /* Resetting authKeyMgmt */ |
| 4826 | (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = |
| 4827 | 0; |
| 4828 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4829 | hdd_notice("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4830 | wlan_hdd_netif_queue_control(pAdapter, |
| 4831 | WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 4832 | WLAN_CONTROL_PATH); |
| 4833 | |
| 4834 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4835 | hdd_err("%d Command Disassociate/Deauthenticate called but station is not in associated state", |
| 4836 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | } |
| 4838 | break; |
| 4839 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4840 | hdd_err("%d Command should be Disassociate/Deauthenticate", |
| 4841 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | return -EINVAL; |
| 4843 | } /* end of switch */ |
| 4844 | |
| 4845 | EXIT(); |
| 4846 | |
| 4847 | return status; |
| 4848 | |
| 4849 | } |
| 4850 | |
| 4851 | /** |
| 4852 | * iw_set_mlme() - SSR wrapper for __iw_set_mlme() |
| 4853 | * @dev: pointer to net_device |
| 4854 | * @info: pointer to iw_request_info |
| 4855 | * @wrqu: pointer to iwreq_data |
| 4856 | * @extra: pointer to extra ioctl payload |
| 4857 | * |
| 4858 | * Return: 0 on success, error number otherwise |
| 4859 | */ |
| 4860 | static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info, |
| 4861 | union iwreq_data *wrqu, char *extra) |
| 4862 | { |
| 4863 | int ret; |
| 4864 | |
| 4865 | cds_ssr_protect(__func__); |
| 4866 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 4867 | cds_ssr_unprotect(__func__); |
| 4868 | |
| 4869 | return ret; |
| 4870 | } |
| 4871 | |
| 4872 | /** |
| 4873 | * wlan_hdd_update_phymode() - handle change in PHY mode |
| 4874 | * @net: device upon which PHY mode change was received |
| 4875 | * @hal: umac handle for the driver |
| 4876 | * @new_phymode: new PHY mode for the device |
| 4877 | * @phddctx: pointer to the HDD context |
| 4878 | * |
| 4879 | * This function is called when the device is set to a new PHY mode. |
| 4880 | * It takes a holistic look at the desired PHY mode along with the |
| 4881 | * configured capabilities of the driver and the reported capabilities |
| 4882 | * of the hardware in order to correctly configure all PHY-related |
| 4883 | * parameters. |
| 4884 | * |
| 4885 | * Return: 0 on success, negative errno value on error |
| 4886 | */ |
| 4887 | int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, |
| 4888 | int new_phymode, hdd_context_t *phddctx) |
| 4889 | { |
| 4890 | #ifdef QCA_HT_2040_COEX |
| 4891 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(net); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4892 | QDF_STATUS halStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | #endif |
| 4894 | bool band_24 = false, band_5g = false; |
| 4895 | bool ch_bond24 = false, ch_bond5g = false; |
| 4896 | tSmeConfigParams smeconfig; |
| 4897 | uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4898 | uint32_t vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4899 | eCsrPhyMode phymode = -EIO, old_phymode; |
| 4900 | eHddDot11Mode hdd_dot11mode = phddctx->config->dot11Mode; |
| 4901 | eCsrBand curr_band = eCSR_BAND_ALL; |
| 4902 | |
| 4903 | old_phymode = sme_get_phy_mode(hal); |
| 4904 | |
| 4905 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 4906 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 4907 | nChannelBondingMode24GHz)) |
| 4908 | ch_bond24 = true; |
| 4909 | |
| 4910 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 4911 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 4912 | nChannelBondingMode5GHz)) |
| 4913 | ch_bond5g = true; |
| 4914 | |
| 4915 | if (phddctx->config->nBandCapability == eCSR_BAND_ALL) { |
| 4916 | band_24 = band_5g = true; |
| 4917 | } else if (phddctx->config->nBandCapability == eCSR_BAND_24) { |
| 4918 | band_24 = true; |
| 4919 | } else if (phddctx->config->nBandCapability == eCSR_BAND_5G) { |
| 4920 | band_5g = true; |
| 4921 | } |
| 4922 | |
| 4923 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4924 | hdd_warn("ch_bond24=%d ch_bond5g=%d band_24=%d band_5g=%d VHT_ch_width=%u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4925 | ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth); |
| 4926 | |
| 4927 | switch (new_phymode) { |
| 4928 | case IEEE80211_MODE_AUTO: |
| 4929 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 4930 | if (hdd_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
| 4931 | phymode = eCSR_DOT11_MODE_AUTO; |
| 4932 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 4933 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 4934 | curr_band = eCSR_BAND_ALL; |
| 4935 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 4936 | } else { |
| 4937 | sme_set_phy_mode(hal, old_phymode); |
| 4938 | return -EIO; |
| 4939 | } |
| 4940 | break; |
| 4941 | case IEEE80211_MODE_11A: |
| 4942 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a); |
| 4943 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 4944 | phymode = eCSR_DOT11_MODE_11a; |
| 4945 | hdd_dot11mode = eHDD_DOT11_MODE_11a; |
| 4946 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 4947 | curr_band = eCSR_BAND_5G; |
| 4948 | } else { |
| 4949 | sme_set_phy_mode(hal, old_phymode); |
| 4950 | return -EIO; |
| 4951 | } |
| 4952 | break; |
| 4953 | case IEEE80211_MODE_11B: |
| 4954 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b); |
| 4955 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 4956 | phymode = eCSR_DOT11_MODE_11b; |
| 4957 | hdd_dot11mode = eHDD_DOT11_MODE_11b; |
| 4958 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 4959 | curr_band = eCSR_BAND_24; |
| 4960 | } else { |
| 4961 | sme_set_phy_mode(hal, old_phymode); |
| 4962 | return -EIO; |
| 4963 | } |
| 4964 | break; |
| 4965 | case IEEE80211_MODE_11G: |
| 4966 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g); |
| 4967 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 4968 | phymode = eCSR_DOT11_MODE_11g; |
| 4969 | hdd_dot11mode = eHDD_DOT11_MODE_11g; |
| 4970 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 4971 | curr_band = eCSR_BAND_24; |
| 4972 | } else { |
| 4973 | sme_set_phy_mode(hal, old_phymode); |
| 4974 | return -EIO; |
| 4975 | } |
| 4976 | break; |
| 4977 | /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode |
| 4978 | * so setting phymode as eCSR_DOT11_MODE_11n and updating the band |
| 4979 | * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG |
| 4980 | */ |
| 4981 | case IEEE80211_MODE_11NA_HT20: |
| 4982 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 4983 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 4984 | phymode = eCSR_DOT11_MODE_11n; |
| 4985 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 4986 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 4987 | curr_band = eCSR_BAND_5G; |
| 4988 | } else { |
| 4989 | sme_set_phy_mode(hal, old_phymode); |
| 4990 | return -EIO; |
| 4991 | } |
| 4992 | break; |
| 4993 | case IEEE80211_MODE_11NA_HT40: |
| 4994 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 4995 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 4996 | phymode = eCSR_DOT11_MODE_11n; |
| 4997 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 4998 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 4999 | curr_band = eCSR_BAND_5G; |
| 5000 | } else { |
| 5001 | sme_set_phy_mode(hal, old_phymode); |
| 5002 | return -EIO; |
| 5003 | } |
| 5004 | break; |
| 5005 | case IEEE80211_MODE_11NG_HT20: |
| 5006 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5007 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5008 | phymode = eCSR_DOT11_MODE_11n; |
| 5009 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5010 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5011 | curr_band = eCSR_BAND_24; |
| 5012 | } else { |
| 5013 | sme_set_phy_mode(hal, old_phymode); |
| 5014 | return -EIO; |
| 5015 | } |
| 5016 | break; |
| 5017 | case IEEE80211_MODE_11NG_HT40: |
| 5018 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5019 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5020 | phymode = eCSR_DOT11_MODE_11n; |
| 5021 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5022 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5023 | curr_band = eCSR_BAND_24; |
| 5024 | } else { |
| 5025 | sme_set_phy_mode(hal, old_phymode); |
| 5026 | return -EIO; |
| 5027 | } |
| 5028 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5029 | case IEEE80211_MODE_11AC_VHT20: |
| 5030 | case IEEE80211_MODE_11AC_VHT40: |
| 5031 | case IEEE80211_MODE_11AC_VHT80: |
| 5032 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac); |
| 5033 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5034 | phymode = eCSR_DOT11_MODE_11ac; |
| 5035 | hdd_dot11mode = eHDD_DOT11_MODE_11ac; |
| 5036 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5037 | curr_band = eCSR_BAND_5G; |
| 5038 | } else { |
| 5039 | sme_set_phy_mode(hal, old_phymode); |
| 5040 | return -EIO; |
| 5041 | } |
| 5042 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5043 | case IEEE80211_MODE_2G_AUTO: |
| 5044 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 5045 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5046 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5047 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5048 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5049 | curr_band = eCSR_BAND_24; |
| 5050 | } else { |
| 5051 | sme_set_phy_mode(hal, old_phymode); |
| 5052 | return -EIO; |
| 5053 | } |
| 5054 | break; |
| 5055 | case IEEE80211_MODE_5G_AUTO: |
| 5056 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 5057 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5058 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5059 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5060 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5061 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5062 | curr_band = eCSR_BAND_5G; |
| 5063 | } else { |
| 5064 | sme_set_phy_mode(hal, old_phymode); |
| 5065 | return -EIO; |
| 5066 | } |
| 5067 | break; |
| 5068 | case IEEE80211_MODE_11AGN: |
| 5069 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5070 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0)) { |
| 5071 | phymode = eCSR_DOT11_MODE_11n; |
| 5072 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5073 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5074 | curr_band = eCSR_BAND_ALL; |
| 5075 | } else { |
| 5076 | sme_set_phy_mode(hal, old_phymode); |
| 5077 | return -EIO; |
| 5078 | } |
| 5079 | break; |
| 5080 | default: |
| 5081 | return -EIO; |
| 5082 | } |
| 5083 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | switch (new_phymode) { |
| 5085 | case IEEE80211_MODE_11AC_VHT20: |
| 5086 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5087 | vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ; |
| 5088 | break; |
| 5089 | case IEEE80211_MODE_11AC_VHT40: |
| 5090 | vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ; |
| 5091 | break; |
| 5092 | case IEEE80211_MODE_11AC_VHT80: |
| 5093 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5094 | break; |
| 5095 | default: |
| 5096 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
| 5097 | break; |
| 5098 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5099 | |
| 5100 | if (phymode != -EIO) { |
| 5101 | sme_get_config_param(hal, &smeconfig); |
| 5102 | smeconfig.csrConfig.phyMode = phymode; |
| 5103 | #ifdef QCA_HT_2040_COEX |
| 5104 | if (phymode == eCSR_DOT11_MODE_11n && |
| 5105 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { |
| 5106 | smeconfig.csrConfig.obssEnabled = false; |
| 5107 | halStatus = sme_set_ht2040_mode(hal, |
| 5108 | pAdapter->sessionId, |
| 5109 | eHT_CHAN_HT20, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5110 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5111 | hdd_err("Failed to disable OBSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5112 | return -EIO; |
| 5113 | } |
| 5114 | } else if (phymode == eCSR_DOT11_MODE_11n && |
| 5115 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) { |
| 5116 | smeconfig.csrConfig.obssEnabled = true; |
| 5117 | halStatus = sme_set_ht2040_mode(hal, |
| 5118 | pAdapter->sessionId, |
| 5119 | eHT_CHAN_HT20, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5120 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5121 | hdd_err("Failed to enable OBSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | return -EIO; |
| 5123 | } |
| 5124 | } |
| 5125 | #endif |
| 5126 | smeconfig.csrConfig.eBand = curr_band; |
| 5127 | smeconfig.csrConfig.bandCapability = curr_band; |
| 5128 | if (curr_band == eCSR_BAND_24) |
| 5129 | smeconfig.csrConfig.Is11hSupportEnabled = 0; |
| 5130 | else |
| 5131 | smeconfig.csrConfig.Is11hSupportEnabled = |
| 5132 | phddctx->config->Is11hSupportEnabled; |
| 5133 | if (curr_band == eCSR_BAND_24) |
| 5134 | smeconfig.csrConfig.channelBondingMode24GHz = chwidth; |
| 5135 | else if (curr_band == eCSR_BAND_24) |
| 5136 | smeconfig.csrConfig.channelBondingMode5GHz = chwidth; |
| 5137 | else { |
| 5138 | smeconfig.csrConfig.channelBondingMode24GHz = chwidth; |
| 5139 | smeconfig.csrConfig.channelBondingMode5GHz = chwidth; |
| 5140 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5141 | smeconfig.csrConfig.nVhtChannelWidth = vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5142 | sme_update_config(hal, &smeconfig); |
| 5143 | |
| 5144 | phddctx->config->dot11Mode = hdd_dot11mode; |
| 5145 | phddctx->config->nBandCapability = curr_band; |
| 5146 | phddctx->config->nChannelBondingMode24GHz = |
| 5147 | smeconfig.csrConfig.channelBondingMode24GHz; |
| 5148 | phddctx->config->nChannelBondingMode5GHz = |
| 5149 | smeconfig.csrConfig.channelBondingMode5GHz; |
| 5150 | phddctx->config->vhtChannelWidth = vhtchanwidth; |
Krunal Soni | df0f874 | 2016-09-26 14:56:31 -0700 | [diff] [blame] | 5151 | if (hdd_update_config_cfg(phddctx) == false) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5152 | hdd_err("could not update config_dat"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5153 | return -EIO; |
| 5154 | } |
| 5155 | if (phddctx->config->nChannelBondingMode5GHz) |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 5156 | phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5157 | |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5158 | else |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 5159 | phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5161 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5162 | hdd_warn("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5163 | phymode, chwidth, curr_band, vhtchanwidth); |
| 5164 | } |
| 5165 | |
| 5166 | return 0; |
| 5167 | } |
| 5168 | |
| 5169 | /** |
| 5170 | * hdd_get_temperature_cb() - "Get Temperature" callback function |
| 5171 | * @temperature: measured temperature |
| 5172 | * @pContext: callback context |
| 5173 | * |
| 5174 | * This function is passed to sme_get_temperature() as the callback |
| 5175 | * function to be invoked when the temperature measurement is |
| 5176 | * available. |
| 5177 | * |
| 5178 | * Return: None |
| 5179 | */ |
| 5180 | static void hdd_get_temperature_cb(int temperature, void *pContext) |
| 5181 | { |
| 5182 | struct statsContext *pTempContext; |
| 5183 | hdd_adapter_t *pAdapter; |
| 5184 | ENTER(); |
| 5185 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5186 | hdd_err("pContext is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5187 | return; |
| 5188 | } |
| 5189 | pTempContext = pContext; |
| 5190 | pAdapter = pTempContext->pAdapter; |
| 5191 | spin_lock(&hdd_context_lock); |
| 5192 | if ((NULL == pAdapter) || (TEMP_CONTEXT_MAGIC != pTempContext->magic)) { |
| 5193 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5194 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5195 | pAdapter, pTempContext->magic); |
| 5196 | return; |
| 5197 | } |
| 5198 | if (temperature != 0) { |
| 5199 | pAdapter->temperature = temperature; |
| 5200 | } |
| 5201 | complete(&pTempContext->completion); |
| 5202 | spin_unlock(&hdd_context_lock); |
| 5203 | EXIT(); |
| 5204 | } |
| 5205 | |
| 5206 | /** |
| 5207 | * wlan_hdd_get_temperature() - get current device temperature |
| 5208 | * @pAdapter: device upon which the request was made |
| 5209 | * @temperature: pointer to where the temperature is to be returned |
| 5210 | * |
| 5211 | * Return: 0 if a temperature value (either current or cached) was |
| 5212 | * returned, otherwise a negative errno is returned. |
| 5213 | * |
| 5214 | */ |
| 5215 | int wlan_hdd_get_temperature(hdd_adapter_t *pAdapter, int *temperature) |
| 5216 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5217 | QDF_STATUS status; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 5218 | static struct statsContext tempContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5219 | unsigned long rc; |
| 5220 | |
| 5221 | ENTER(); |
| 5222 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5223 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5224 | return -EPERM; |
| 5225 | } |
| 5226 | init_completion(&tempContext.completion); |
| 5227 | tempContext.pAdapter = pAdapter; |
| 5228 | tempContext.magic = TEMP_CONTEXT_MAGIC; |
| 5229 | status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5230 | &tempContext, hdd_get_temperature_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5231 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5232 | hdd_err("Unable to retrieve temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5233 | } else { |
| 5234 | rc = wait_for_completion_timeout(&tempContext.completion, |
| 5235 | msecs_to_jiffies |
| 5236 | (WLAN_WAIT_TIME_STATS)); |
| 5237 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5238 | hdd_err("SME timed out while retrieving temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5239 | } |
| 5240 | } |
| 5241 | spin_lock(&hdd_context_lock); |
| 5242 | tempContext.magic = 0; |
| 5243 | spin_unlock(&hdd_context_lock); |
| 5244 | *temperature = pAdapter->temperature; |
| 5245 | EXIT(); |
| 5246 | return 0; |
| 5247 | } |
| 5248 | |
| 5249 | /** |
| 5250 | * iw_setint_getnone() - Generic "set integer" private ioctl handler |
| 5251 | * @dev: device upon which the ioctl was received |
| 5252 | * @info: ioctl request information |
| 5253 | * @wrqu: ioctl request data |
| 5254 | * @extra: ioctl extra data |
| 5255 | * |
| 5256 | * Return: 0 on success, non-zero on error |
| 5257 | */ |
| 5258 | static int __iw_setint_getnone(struct net_device *dev, |
| 5259 | struct iw_request_info *info, |
| 5260 | union iwreq_data *wrqu, char *extra) |
| 5261 | { |
| 5262 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5263 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5264 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5265 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5266 | hdd_context_t *hdd_ctx; |
| 5267 | tSmeConfigParams smeConfig; |
| 5268 | int *value = (int *)extra; |
| 5269 | int sub_cmd = value[0]; |
| 5270 | int set_value = value[1]; |
| 5271 | int ret; |
| 5272 | int enable_pbm, enable_mp; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5273 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5274 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 5275 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 5276 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5277 | INIT_COMPLETION(pWextState->completion_var); |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 5278 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5279 | |
| 5280 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5281 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5282 | if (0 != ret) |
| 5283 | return ret; |
| 5284 | |
| 5285 | switch (sub_cmd) { |
| 5286 | case WE_SET_11D_STATE: |
| 5287 | { |
| 5288 | if ((ENABLE_11D == set_value) |
| 5289 | || (DISABLE_11D == set_value)) { |
| 5290 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5291 | sme_get_config_param(hHal, &smeConfig); |
| 5292 | smeConfig.csrConfig.Is11dSupportEnabled = |
| 5293 | (bool) set_value; |
| 5294 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5295 | hdd_notice("11D state=%d!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5296 | smeConfig.csrConfig. |
| 5297 | Is11dSupportEnabled); |
| 5298 | |
| 5299 | sme_update_config(hHal, &smeConfig); |
| 5300 | } else { |
| 5301 | return -EINVAL; |
| 5302 | } |
| 5303 | break; |
| 5304 | } |
| 5305 | |
| 5306 | case WE_WOWL: |
| 5307 | { |
| 5308 | switch (set_value) { |
| 5309 | case 0x00: |
| 5310 | hdd_exit_wowl(pAdapter); |
| 5311 | break; |
| 5312 | case 0x01: |
| 5313 | case 0x02: |
| 5314 | case 0x03: |
| 5315 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 5316 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5317 | hdd_err("magic packet ? = %s pattern byte matching ? = %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5318 | (enable_mp ? "YES" : "NO"), |
| 5319 | (enable_pbm ? "YES" : "NO")); |
| 5320 | hdd_enter_wowl(pAdapter, enable_mp, enable_pbm); |
| 5321 | break; |
| 5322 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5323 | hdd_err("Invalid arg %d in WE_WOWL IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5324 | set_value); |
| 5325 | ret = -EINVAL; |
| 5326 | break; |
| 5327 | } |
| 5328 | |
| 5329 | break; |
| 5330 | } |
| 5331 | case WE_SET_POWER: |
| 5332 | { |
| 5333 | switch (set_value) { |
| 5334 | case 1: |
| 5335 | /* Enable PowerSave */ |
| 5336 | sme_ps_enable_disable(hHal, pAdapter->sessionId, |
| 5337 | SME_PS_ENABLE); |
| 5338 | break; |
| 5339 | case 2: |
| 5340 | /* Disable PowerSave */ |
| 5341 | sme_ps_enable_disable(hHal, pAdapter->sessionId, |
| 5342 | SME_PS_DISABLE); |
| 5343 | break; |
| 5344 | case 3: /* Enable UASPD */ |
| 5345 | sme_ps_uapsd_enable(hHal, pAdapter->sessionId); |
| 5346 | break; |
| 5347 | case 4: /* Disable UASPD */ |
| 5348 | sme_ps_uapsd_disable(hHal, pAdapter->sessionId); |
| 5349 | break; |
| 5350 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5351 | hdd_err("Invalid arg %d in WE_SET_POWER IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | set_value); |
| 5353 | ret = -EINVAL; |
| 5354 | break; |
| 5355 | } |
| 5356 | break; |
| 5357 | } |
| 5358 | |
| 5359 | case WE_SET_MAX_ASSOC: |
| 5360 | { |
| 5361 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 5362 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) { |
| 5363 | ret = -EINVAL; |
| 5364 | } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 5365 | set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5366 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5367 | hdd_err("failed to set ini parameter, WNI_CFG_ASSOC_STA_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5368 | ret = -EIO; |
| 5369 | } |
| 5370 | break; |
| 5371 | } |
| 5372 | |
| 5373 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 5374 | if (set_value == 0 || set_value == 1) |
| 5375 | (WLAN_HDD_GET_CTX(pAdapter))->config->force_sap_acs = |
| 5376 | set_value; |
| 5377 | else |
| 5378 | ret = -EINVAL; |
| 5379 | break; |
| 5380 | |
| 5381 | case WE_SET_DATA_INACTIVITY_TO: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 5383 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
| 5384 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 5385 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5386 | set_value) == QDF_STATUS_E_FAILURE)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5387 | hdd_err("Failure: Could not pass on WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5388 | ret = -EINVAL; |
| 5389 | } |
| 5390 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5391 | case WE_SET_MC_RATE: |
| 5392 | { |
| 5393 | ret = wlan_hdd_set_mc_rate(pAdapter, set_value); |
| 5394 | break; |
| 5395 | } |
| 5396 | case WE_SET_TX_POWER: |
| 5397 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5398 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5399 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5400 | qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5401 | if (sme_set_tx_power |
| 5402 | (hHal, pAdapter->sessionId, bssid, |
| 5403 | pAdapter->device_mode, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5404 | set_value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5405 | hdd_err("Setting tx power failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5406 | return -EIO; |
| 5407 | } |
| 5408 | break; |
| 5409 | } |
| 5410 | case WE_SET_MAX_TX_POWER: |
| 5411 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5412 | struct qdf_mac_addr bssid; |
| 5413 | struct qdf_mac_addr selfMac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5414 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5415 | hdd_notice("Setting maximum tx power %d dBm", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5416 | set_value); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5417 | qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId); |
| 5418 | qdf_copy_macaddr(&selfMac, &pHddStaCtx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5419 | |
| 5420 | if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5421 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5422 | hdd_err("Setting maximum tx power failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | return -EIO; |
| 5424 | } |
| 5425 | |
| 5426 | break; |
| 5427 | } |
| 5428 | case WE_SET_MAX_TX_POWER_2_4: |
| 5429 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5430 | hdd_notice("Setting maximum tx power %d dBm for 2.4 GHz band", |
| 5431 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5432 | if (sme_set_max_tx_power_per_band(eCSR_BAND_24, set_value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5433 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5434 | hdd_err("Setting maximum tx power failed for 2.4 GHz band"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5435 | return -EIO; |
| 5436 | } |
| 5437 | |
| 5438 | break; |
| 5439 | } |
| 5440 | case WE_SET_MAX_TX_POWER_5_0: |
| 5441 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5442 | hdd_notice("Setting maximum tx power %d dBm for 5.0 GHz band", |
| 5443 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5444 | if (sme_set_max_tx_power_per_band(eCSR_BAND_5G, set_value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5445 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5446 | hdd_err("Setting maximum tx power failed for 5.0 GHz band"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5447 | return -EIO; |
| 5448 | } |
| 5449 | |
| 5450 | break; |
| 5451 | } |
| 5452 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 5453 | { |
| 5454 | if (!((set_value == false) || (set_value == true))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5455 | hdd_err("Dynamic DTIM Incorrect data:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5456 | set_value); |
| 5457 | ret = -EINVAL; |
| 5458 | } else { |
| 5459 | if (pAdapter->higherDtimTransition != set_value) { |
| 5460 | pAdapter->higherDtimTransition = |
| 5461 | set_value; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5462 | hdd_notice("higherDtimTransition set to :%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5463 | pAdapter->higherDtimTransition); |
| 5464 | } |
| 5465 | } |
| 5466 | |
| 5467 | break; |
| 5468 | } |
| 5469 | |
| 5470 | case WE_SET_TM_LEVEL: |
| 5471 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5472 | hdd_notice("Set Thermal Mitigation Level %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5473 | (void)sme_set_thermal_level(hHal, set_value); |
| 5474 | break; |
| 5475 | } |
| 5476 | |
| 5477 | case WE_SET_PHYMODE: |
| 5478 | { |
| 5479 | hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5480 | |
| 5481 | ret = |
| 5482 | wlan_hdd_update_phymode(dev, hHal, set_value, |
| 5483 | phddctx); |
| 5484 | break; |
| 5485 | } |
| 5486 | |
| 5487 | case WE_SET_NSS: |
| 5488 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5489 | hdd_notice("Set NSS = %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5490 | if ((set_value > 2) || (set_value <= 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5491 | hdd_err("NSS greater than 2 not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5492 | ret = -EINVAL; |
| 5493 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5494 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5495 | hdd_update_nss(WLAN_HDD_GET_CTX(pAdapter), |
| 5496 | set_value)) |
| 5497 | ret = -EINVAL; |
| 5498 | } |
| 5499 | break; |
| 5500 | } |
| 5501 | |
| 5502 | case WE_SET_GTX_HT_MCS: |
| 5503 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5504 | hdd_notice("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5505 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5506 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 5507 | set_value, GTX_CMD); |
| 5508 | break; |
| 5509 | } |
| 5510 | |
| 5511 | case WE_SET_GTX_VHT_MCS: |
| 5512 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5513 | hdd_notice("WMI_VDEV_PARAM_GTX_VHT_MCS %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5514 | set_value); |
| 5515 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5516 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 5517 | set_value, GTX_CMD); |
| 5518 | break; |
| 5519 | } |
| 5520 | |
| 5521 | case WE_SET_GTX_USRCFG: |
| 5522 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5523 | hdd_notice("WMI_VDEV_PARAM_GTX_USR_CFG %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5524 | set_value); |
| 5525 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5526 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 5527 | set_value, GTX_CMD); |
| 5528 | break; |
| 5529 | } |
| 5530 | |
| 5531 | case WE_SET_GTX_THRE: |
| 5532 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5533 | hdd_notice("WMI_VDEV_PARAM_GTX_THRE %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5534 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5535 | WMI_VDEV_PARAM_GTX_THRE, |
| 5536 | set_value, GTX_CMD); |
| 5537 | break; |
| 5538 | } |
| 5539 | |
| 5540 | case WE_SET_GTX_MARGIN: |
| 5541 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5542 | hdd_notice("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5543 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5544 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 5545 | set_value, GTX_CMD); |
| 5546 | break; |
| 5547 | } |
| 5548 | |
| 5549 | case WE_SET_GTX_STEP: |
| 5550 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5551 | hdd_notice("WMI_VDEV_PARAM_GTX_STEP %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5552 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5553 | WMI_VDEV_PARAM_GTX_STEP, |
| 5554 | set_value, GTX_CMD); |
| 5555 | break; |
| 5556 | } |
| 5557 | |
| 5558 | case WE_SET_GTX_MINTPC: |
| 5559 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5560 | hdd_notice("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5561 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5562 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 5563 | set_value, GTX_CMD); |
| 5564 | break; |
| 5565 | } |
| 5566 | |
| 5567 | case WE_SET_GTX_BWMASK: |
| 5568 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5569 | hdd_notice("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5570 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5571 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 5572 | set_value, GTX_CMD); |
| 5573 | break; |
| 5574 | } |
| 5575 | |
| 5576 | case WE_SET_LDPC: |
| 5577 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 5578 | ret = hdd_set_ldpc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5579 | break; |
| 5580 | } |
| 5581 | |
| 5582 | case WE_SET_TX_STBC: |
| 5583 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 5584 | ret = hdd_set_tx_stbc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5585 | break; |
| 5586 | } |
| 5587 | |
| 5588 | case WE_SET_RX_STBC: |
| 5589 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 5590 | ret = hdd_set_rx_stbc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5591 | break; |
| 5592 | } |
| 5593 | |
| 5594 | case WE_SET_SHORT_GI: |
| 5595 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5596 | hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5597 | ret = sme_update_ht_config(hHal, pAdapter->sessionId, |
| 5598 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ, |
| 5599 | set_value); |
| 5600 | if (ret) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5601 | hdd_err("Failed to set ShortGI value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5602 | break; |
| 5603 | } |
| 5604 | |
| 5605 | case WE_SET_RTSCTS: |
| 5606 | { |
| 5607 | uint32_t value; |
| 5608 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5609 | hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5610 | set_value); |
| 5611 | |
| 5612 | if ((set_value & HDD_RTSCTS_EN_MASK) == |
| 5613 | HDD_RTSCTS_ENABLE) |
| 5614 | value = |
| 5615 | (WLAN_HDD_GET_CTX(pAdapter))->config-> |
| 5616 | RTSThreshold; |
| 5617 | else if (((set_value & HDD_RTSCTS_EN_MASK) == 0) |
| 5618 | || ((set_value & HDD_RTSCTS_EN_MASK) == |
| 5619 | HDD_CTS_ENABLE)) |
| 5620 | value = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 5621 | else |
| 5622 | return -EIO; |
| 5623 | |
| 5624 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5625 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 5626 | set_value, VDEV_CMD); |
| 5627 | if (!ret) { |
| 5628 | if (sme_cfg_set_int |
| 5629 | (hHal, WNI_CFG_RTS_THRESHOLD, value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5630 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5631 | hdd_err("FAILED TO SET RTSCTS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | return -EIO; |
| 5633 | } |
| 5634 | } |
| 5635 | |
| 5636 | break; |
| 5637 | } |
| 5638 | |
| 5639 | case WE_SET_CHWIDTH: |
| 5640 | { |
| 5641 | bool chwidth = false; |
| 5642 | hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5643 | /*updating channel bonding only on 5Ghz */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5644 | hdd_notice("WMI_VDEV_PARAM_CHWIDTH val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5645 | set_value); |
| 5646 | if (set_value > eHT_CHANNEL_WIDTH_80MHZ) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5647 | hdd_err("Invalid channel width 0->20 1->40 2->80"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5648 | return -EINVAL; |
| 5649 | } |
| 5650 | |
| 5651 | if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 5652 | csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config-> |
| 5653 | nChannelBondingMode5GHz))) |
| 5654 | chwidth = true; |
| 5655 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5656 | sme_get_config_param(hHal, &smeConfig); |
| 5657 | switch (set_value) { |
| 5658 | case eHT_CHANNEL_WIDTH_20MHZ: |
| 5659 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 5660 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5661 | break; |
| 5662 | case eHT_CHANNEL_WIDTH_40MHZ: |
| 5663 | if (chwidth) |
| 5664 | smeConfig.csrConfig. |
| 5665 | channelBondingMode5GHz = |
| 5666 | phddctx->config-> |
| 5667 | nChannelBondingMode5GHz; |
| 5668 | else |
| 5669 | return -EINVAL; |
| 5670 | |
| 5671 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5672 | case eHT_CHANNEL_WIDTH_80MHZ: |
| 5673 | if (chwidth) |
| 5674 | smeConfig.csrConfig. |
| 5675 | channelBondingMode5GHz = |
| 5676 | phddctx->config-> |
| 5677 | nChannelBondingMode5GHz; |
| 5678 | else |
| 5679 | return -EINVAL; |
| 5680 | |
| 5681 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5682 | |
| 5683 | default: |
| 5684 | return -EINVAL; |
| 5685 | } |
| 5686 | |
| 5687 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5688 | WMI_VDEV_PARAM_CHWIDTH, |
| 5689 | set_value, VDEV_CMD); |
| 5690 | if (!ret) |
| 5691 | sme_update_config(hHal, &smeConfig); |
| 5692 | |
| 5693 | break; |
| 5694 | } |
| 5695 | |
| 5696 | case WE_SET_ANI_EN_DIS: |
| 5697 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5698 | hdd_notice("WMI_PDEV_PARAM_ANI_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5699 | set_value); |
| 5700 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5701 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 5702 | set_value, PDEV_CMD); |
| 5703 | break; |
| 5704 | } |
| 5705 | |
| 5706 | case WE_SET_ANI_POLL_PERIOD: |
| 5707 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5708 | hdd_notice("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5709 | set_value); |
| 5710 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5711 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 5712 | set_value, PDEV_CMD); |
| 5713 | break; |
| 5714 | } |
| 5715 | |
| 5716 | case WE_SET_ANI_LISTEN_PERIOD: |
| 5717 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5718 | hdd_notice("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5719 | set_value); |
| 5720 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5721 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 5722 | set_value, PDEV_CMD); |
| 5723 | break; |
| 5724 | } |
| 5725 | |
| 5726 | case WE_SET_ANI_OFDM_LEVEL: |
| 5727 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5728 | hdd_notice("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | set_value); |
| 5730 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5731 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 5732 | set_value, PDEV_CMD); |
| 5733 | break; |
| 5734 | } |
| 5735 | |
| 5736 | case WE_SET_ANI_CCK_LEVEL: |
| 5737 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5738 | hdd_notice("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5739 | set_value); |
| 5740 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5741 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 5742 | set_value, PDEV_CMD); |
| 5743 | break; |
| 5744 | } |
| 5745 | |
| 5746 | case WE_SET_DYNAMIC_BW: |
| 5747 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5748 | hdd_notice("WMI_PDEV_PARAM_DYNAMIC_BW val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5749 | set_value); |
| 5750 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5751 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 5752 | set_value, PDEV_CMD); |
| 5753 | break; |
| 5754 | } |
| 5755 | |
| 5756 | case WE_SET_CTS_CBW: |
| 5757 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5758 | hdd_notice("WE_SET_CTS_CBW val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5759 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5760 | WMI_PDEV_PARAM_CTS_CBW, |
| 5761 | set_value, PDEV_CMD); |
| 5762 | break; |
| 5763 | } |
| 5764 | |
| 5765 | case WE_SET_11N_RATE: |
| 5766 | { |
| 5767 | uint8_t preamble = 0, nss = 0, rix = 0; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5768 | hdd_notice("WMI_VDEV_PARAM_FIXED_RATE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | set_value); |
| 5770 | |
| 5771 | if (set_value != 0xff) { |
| 5772 | rix = RC_2_RATE_IDX(set_value); |
| 5773 | if (set_value & 0x80) { |
| 5774 | preamble = WMI_RATE_PREAMBLE_HT; |
| 5775 | nss = HT_RC_2_STREAMS(set_value) - 1; |
| 5776 | } else { |
| 5777 | nss = 0; |
| 5778 | rix = RC_2_RATE_IDX(set_value); |
| 5779 | if (set_value & 0x10) { |
| 5780 | preamble = |
| 5781 | WMI_RATE_PREAMBLE_CCK; |
| 5782 | if (rix != 0x3) |
| 5783 | /* Enable Short |
| 5784 | * preamble always for |
| 5785 | * CCK except 1mbps |
| 5786 | */ |
| 5787 | rix |= 0x4; |
| 5788 | } else { |
| 5789 | preamble = |
| 5790 | WMI_RATE_PREAMBLE_OFDM; |
| 5791 | } |
| 5792 | } |
| 5793 | set_value = (preamble << 6) | (nss << 4) | rix; |
| 5794 | } |
| 5795 | hdd_info("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
| 5796 | set_value, rix, preamble, nss); |
| 5797 | |
| 5798 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5799 | WMI_VDEV_PARAM_FIXED_RATE, |
| 5800 | set_value, VDEV_CMD); |
| 5801 | break; |
| 5802 | } |
| 5803 | |
| 5804 | case WE_SET_VHT_RATE: |
| 5805 | { |
| 5806 | uint8_t preamble = 0, nss = 0, rix = 0; |
| 5807 | |
| 5808 | if (set_value != 0xff) { |
| 5809 | rix = RC_2_RATE_IDX_11AC(set_value); |
| 5810 | preamble = WMI_RATE_PREAMBLE_VHT; |
| 5811 | nss = HT_RC_2_STREAMS_11AC(set_value) - 1; |
| 5812 | |
| 5813 | set_value = (preamble << 6) | (nss << 4) | rix; |
| 5814 | } |
| 5815 | hdd_info("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
| 5816 | set_value, rix, preamble, nss); |
| 5817 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5818 | WMI_VDEV_PARAM_FIXED_RATE, |
| 5819 | set_value, VDEV_CMD); |
| 5820 | break; |
| 5821 | } |
| 5822 | |
| 5823 | case WE_SET_AMPDU: |
| 5824 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5825 | hdd_notice("SET AMPDU val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5826 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5827 | GEN_VDEV_PARAM_AMPDU, |
| 5828 | set_value, GEN_CMD); |
| 5829 | break; |
| 5830 | } |
| 5831 | |
| 5832 | case WE_SET_AMSDU: |
| 5833 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5834 | hdd_notice("SET AMSDU val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5835 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5836 | GEN_VDEV_PARAM_AMSDU, |
| 5837 | set_value, GEN_CMD); |
| 5838 | break; |
| 5839 | } |
| 5840 | |
| 5841 | case WE_SET_BURST_ENABLE: |
| 5842 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5843 | hdd_notice("SET Burst enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5844 | if ((set_value == 0) || (set_value == 1)) { |
| 5845 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5846 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 5847 | set_value, PDEV_CMD); |
| 5848 | } else |
| 5849 | ret = -EINVAL; |
| 5850 | break; |
| 5851 | } |
| 5852 | case WE_SET_BURST_DUR: |
| 5853 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5854 | hdd_notice("SET Burst duration val %d", set_value); |
Jeff Johnson | da5ee77 | 2016-08-04 17:18:47 -0700 | [diff] [blame] | 5855 | if ((set_value > 0) && (set_value <= 102400)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5856 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5857 | WMI_PDEV_PARAM_BURST_DUR, |
| 5858 | set_value, PDEV_CMD); |
| 5859 | else |
| 5860 | ret = -EINVAL; |
| 5861 | break; |
| 5862 | } |
| 5863 | |
| 5864 | case WE_SET_TX_CHAINMASK: |
| 5865 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5866 | hdd_notice("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5867 | set_value); |
| 5868 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5869 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 5870 | set_value, PDEV_CMD); |
| 5871 | break; |
| 5872 | } |
| 5873 | |
| 5874 | case WE_SET_RX_CHAINMASK: |
| 5875 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5876 | hdd_notice("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5877 | set_value); |
| 5878 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5879 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 5880 | set_value, PDEV_CMD); |
| 5881 | break; |
| 5882 | } |
| 5883 | |
| 5884 | case WE_SET_TXPOW_2G: |
| 5885 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5886 | hdd_notice("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5887 | set_value); |
| 5888 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5889 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 5890 | set_value, PDEV_CMD); |
| 5891 | break; |
| 5892 | } |
| 5893 | |
| 5894 | case WE_SET_TXPOW_5G: |
| 5895 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5896 | hdd_notice("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5897 | set_value); |
| 5898 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5899 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 5900 | set_value, PDEV_CMD); |
| 5901 | break; |
| 5902 | } |
| 5903 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5904 | /* Firmware debug log */ |
| 5905 | case WE_DBGLOG_LOG_LEVEL: |
| 5906 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5907 | hdd_notice("WE_DBGLOG_LOG_LEVEL val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5908 | hdd_ctx->fw_log_settings.dl_loglevel = set_value; |
| 5909 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5910 | WMI_DBGLOG_LOG_LEVEL, |
| 5911 | set_value, DBG_CMD); |
| 5912 | break; |
| 5913 | } |
| 5914 | |
| 5915 | case WE_DBGLOG_VAP_ENABLE: |
| 5916 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5917 | hdd_notice("WE_DBGLOG_VAP_ENABLE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5918 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5919 | WMI_DBGLOG_VAP_ENABLE, |
| 5920 | set_value, DBG_CMD); |
| 5921 | break; |
| 5922 | } |
| 5923 | |
| 5924 | case WE_DBGLOG_VAP_DISABLE: |
| 5925 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5926 | hdd_notice("WE_DBGLOG_VAP_DISABLE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5927 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5928 | WMI_DBGLOG_VAP_DISABLE, |
| 5929 | set_value, DBG_CMD); |
| 5930 | break; |
| 5931 | } |
| 5932 | |
| 5933 | case WE_DBGLOG_MODULE_ENABLE: |
| 5934 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5935 | hdd_notice("WE_DBGLOG_MODULE_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5936 | set_value); |
| 5937 | hdd_ctx->fw_log_settings.enable = set_value; |
| 5938 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5939 | WMI_DBGLOG_MODULE_ENABLE, |
| 5940 | set_value, DBG_CMD); |
| 5941 | break; |
| 5942 | } |
| 5943 | |
| 5944 | case WE_DBGLOG_MODULE_DISABLE: |
| 5945 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5946 | hdd_notice("WE_DBGLOG_MODULE_DISABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5947 | set_value); |
| 5948 | hdd_ctx->fw_log_settings.enable = set_value; |
| 5949 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5950 | WMI_DBGLOG_MODULE_DISABLE, |
| 5951 | set_value, DBG_CMD); |
| 5952 | break; |
| 5953 | } |
| 5954 | case WE_DBGLOG_MOD_LOG_LEVEL: |
| 5955 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5956 | hdd_notice("WE_DBGLOG_MOD_LOG_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5957 | set_value); |
| 5958 | |
| 5959 | if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL) |
| 5960 | hdd_ctx->fw_log_settings.index = 0; |
| 5961 | |
| 5962 | hdd_ctx->fw_log_settings. |
| 5963 | dl_mod_loglevel[hdd_ctx->fw_log_settings.index] = |
| 5964 | set_value; |
| 5965 | hdd_ctx->fw_log_settings.index++; |
| 5966 | |
| 5967 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5968 | WMI_DBGLOG_MOD_LOG_LEVEL, |
| 5969 | set_value, DBG_CMD); |
| 5970 | break; |
| 5971 | } |
| 5972 | |
| 5973 | case WE_DBGLOG_TYPE: |
| 5974 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5975 | hdd_notice("WE_DBGLOG_TYPE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5976 | hdd_ctx->fw_log_settings.dl_type = set_value; |
| 5977 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5978 | WMI_DBGLOG_TYPE, |
| 5979 | set_value, DBG_CMD); |
| 5980 | break; |
| 5981 | } |
| 5982 | case WE_DBGLOG_REPORT_ENABLE: |
| 5983 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5984 | hdd_notice("WE_DBGLOG_REPORT_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5985 | set_value); |
| 5986 | hdd_ctx->fw_log_settings.dl_report = set_value; |
| 5987 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5988 | WMI_DBGLOG_REPORT_ENABLE, |
| 5989 | set_value, DBG_CMD); |
| 5990 | break; |
| 5991 | } |
| 5992 | |
| 5993 | case WE_SET_TXRX_FWSTATS: |
| 5994 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5995 | hdd_notice("WE_SET_TXRX_FWSTATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5996 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5997 | WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID, |
| 5998 | set_value, VDEV_CMD); |
| 5999 | break; |
| 6000 | } |
| 6001 | |
| 6002 | case WE_TXRX_FWSTATS_RESET: |
| 6003 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6004 | hdd_notice("WE_TXRX_FWSTATS_RESET val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6005 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6006 | WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, |
| 6007 | set_value, VDEV_CMD); |
| 6008 | break; |
| 6009 | } |
| 6010 | |
| 6011 | case WE_DUMP_STATS: |
| 6012 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6013 | hdd_notice("WE_DUMP_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6014 | hdd_wlan_dump_stats(pAdapter, set_value); |
| 6015 | break; |
| 6016 | } |
| 6017 | |
| 6018 | case WE_CLEAR_STATS: |
| 6019 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6020 | hdd_notice("WE_CLEAR_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6021 | switch (set_value) { |
| 6022 | case WLAN_HDD_STATS: |
| 6023 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 6024 | memset(&pAdapter->hdd_stats, 0, |
| 6025 | sizeof(pAdapter->hdd_stats)); |
| 6026 | break; |
| 6027 | case WLAN_TXRX_HIST_STATS: |
| 6028 | wlan_hdd_clear_tx_rx_histogram(hdd_ctx); |
| 6029 | break; |
| 6030 | case WLAN_HDD_NETIF_OPER_HISTORY: |
| 6031 | wlan_hdd_clear_netif_queue_history(hdd_ctx); |
| 6032 | break; |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 6033 | case WLAN_HIF_STATS: |
| 6034 | hdd_clear_hif_stats(); |
| 6035 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6036 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 6037 | cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 6038 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6039 | } |
| 6040 | break; |
| 6041 | } |
| 6042 | |
| 6043 | case WE_PPS_PAID_MATCH: |
| 6044 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6045 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6046 | return EINVAL; |
| 6047 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6048 | hdd_notice("WMI_VDEV_PPS_PAID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6049 | set_value); |
| 6050 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6051 | WMI_VDEV_PPS_PAID_MATCH, |
| 6052 | set_value, PPS_CMD); |
| 6053 | break; |
| 6054 | } |
| 6055 | |
| 6056 | case WE_PPS_GID_MATCH: |
| 6057 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6058 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6059 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6060 | hdd_notice("WMI_VDEV_PPS_GID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6061 | set_value); |
| 6062 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6063 | WMI_VDEV_PPS_GID_MATCH, |
| 6064 | set_value, PPS_CMD); |
| 6065 | break; |
| 6066 | } |
| 6067 | |
| 6068 | case WE_PPS_EARLY_TIM_CLEAR: |
| 6069 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6070 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6071 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6072 | hdd_notice(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6073 | set_value); |
| 6074 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6075 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 6076 | set_value, PPS_CMD); |
| 6077 | break; |
| 6078 | } |
| 6079 | |
| 6080 | case WE_PPS_EARLY_DTIM_CLEAR: |
| 6081 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6082 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6083 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6084 | hdd_notice("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6085 | set_value); |
| 6086 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6087 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 6088 | set_value, PPS_CMD); |
| 6089 | break; |
| 6090 | } |
| 6091 | |
| 6092 | case WE_PPS_EOF_PAD_DELIM: |
| 6093 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6094 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6095 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6096 | hdd_notice("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6097 | set_value); |
| 6098 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6099 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 6100 | set_value, PPS_CMD); |
| 6101 | break; |
| 6102 | } |
| 6103 | |
| 6104 | case WE_PPS_MACADDR_MISMATCH: |
| 6105 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6106 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6107 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6108 | hdd_notice("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6109 | set_value); |
| 6110 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6111 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 6112 | set_value, PPS_CMD); |
| 6113 | break; |
| 6114 | } |
| 6115 | |
| 6116 | case WE_PPS_DELIM_CRC_FAIL: |
| 6117 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6118 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6119 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6120 | hdd_notice("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6121 | set_value); |
| 6122 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6123 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 6124 | set_value, PPS_CMD); |
| 6125 | break; |
| 6126 | } |
| 6127 | |
| 6128 | case WE_PPS_GID_NSTS_ZERO: |
| 6129 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6130 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6132 | hdd_notice("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6133 | set_value); |
| 6134 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6135 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 6136 | set_value, PPS_CMD); |
| 6137 | break; |
| 6138 | } |
| 6139 | |
| 6140 | case WE_PPS_RSSI_CHECK: |
| 6141 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6142 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6143 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6144 | hdd_notice("WMI_VDEV_PPS_RSSI_CHECK val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6145 | set_value); |
| 6146 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6147 | WMI_VDEV_PPS_RSSI_CHECK, |
| 6148 | set_value, PPS_CMD); |
| 6149 | break; |
| 6150 | } |
| 6151 | |
| 6152 | case WE_PPS_5G_EBT: |
| 6153 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6154 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6155 | return -EINVAL; |
| 6156 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6157 | hdd_notice("WMI_VDEV_PPS_5G_EBT val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6158 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6159 | WMI_VDEV_PPS_5G_EBT, |
| 6160 | set_value, PPS_CMD); |
| 6161 | break; |
| 6162 | } |
| 6163 | |
| 6164 | case WE_SET_HTSMPS: |
| 6165 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6166 | hdd_notice("WE_SET_HTSMPS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6167 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6168 | WMI_STA_SMPS_FORCE_MODE_CMDID, |
| 6169 | set_value, VDEV_CMD); |
| 6170 | break; |
| 6171 | } |
| 6172 | |
| 6173 | case WE_SET_QPOWER_MAX_PSPOLL_COUNT: |
| 6174 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6175 | hdd_notice("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6176 | set_value); |
| 6177 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6178 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 6179 | set_value, QPOWER_CMD); |
| 6180 | break; |
| 6181 | } |
| 6182 | |
| 6183 | case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 6184 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6185 | hdd_notice("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6186 | set_value); |
| 6187 | ret = wma_cli_set_command( |
| 6188 | pAdapter->sessionId, |
| 6189 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 6190 | set_value, QPOWER_CMD); |
| 6191 | break; |
| 6192 | } |
| 6193 | |
| 6194 | case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 6195 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6196 | hdd_notice("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6197 | set_value); |
| 6198 | ret = wma_cli_set_command( |
| 6199 | pAdapter->sessionId, |
| 6200 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 6201 | set_value, QPOWER_CMD); |
| 6202 | break; |
| 6203 | } |
| 6204 | |
| 6205 | case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 6206 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6207 | hdd_notice("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6208 | set_value); |
| 6209 | ret = wma_cli_set_command( |
| 6210 | pAdapter->sessionId, |
| 6211 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 6212 | set_value, QPOWER_CMD); |
| 6213 | break; |
| 6214 | } |
| 6215 | |
| 6216 | case WE_MCC_CONFIG_LATENCY: |
| 6217 | { |
| 6218 | cds_set_mcc_latency(pAdapter, set_value); |
| 6219 | break; |
| 6220 | } |
| 6221 | |
| 6222 | case WE_MCC_CONFIG_QUOTA: |
| 6223 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6224 | hdd_notice("iwpriv cmd to set MCC quota with val %dms", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6225 | set_value); |
| 6226 | ret = cds_set_mcc_p2p_quota(pAdapter, set_value); |
| 6227 | break; |
| 6228 | } |
| 6229 | case WE_SET_DEBUG_LOG: |
| 6230 | { |
| 6231 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 6232 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6233 | hdd_ctx->config->gEnableDebugLog = set_value; |
| 6234 | sme_update_connect_debug(hdd_ctx->hHal, set_value); |
| 6235 | break; |
| 6236 | } |
| 6237 | case WE_SET_EARLY_RX_ADJUST_ENABLE: |
| 6238 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6239 | hdd_notice("SET early_rx enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6240 | if ((set_value == 0) || (set_value == 1)) |
| 6241 | ret = wma_cli_set_command( |
| 6242 | pAdapter->sessionId, |
| 6243 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, |
| 6244 | set_value, VDEV_CMD); |
| 6245 | else |
| 6246 | ret = -EINVAL; |
| 6247 | break; |
| 6248 | } |
| 6249 | case WE_SET_EARLY_RX_TGT_BMISS_NUM: |
| 6250 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6251 | hdd_notice("SET early_rx bmiss val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6252 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6253 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, |
| 6254 | set_value, VDEV_CMD); |
| 6255 | break; |
| 6256 | } |
| 6257 | case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 6258 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6259 | hdd_notice("SET early_rx bmiss sample cycle %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6260 | set_value); |
| 6261 | ret = wma_cli_set_command( |
| 6262 | pAdapter->sessionId, |
| 6263 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 6264 | set_value, VDEV_CMD); |
| 6265 | break; |
| 6266 | } |
| 6267 | case WE_SET_EARLY_RX_SLOP_STEP: |
| 6268 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6269 | hdd_notice("SET early_rx bmiss slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6270 | set_value); |
| 6271 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6272 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP, |
| 6273 | set_value, VDEV_CMD); |
| 6274 | break; |
| 6275 | } |
| 6276 | case WE_SET_EARLY_RX_INIT_SLOP: |
| 6277 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6278 | hdd_notice("SET early_rx init slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6279 | set_value); |
| 6280 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6281 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP, |
| 6282 | set_value, VDEV_CMD); |
| 6283 | break; |
| 6284 | } |
| 6285 | case WE_SET_EARLY_RX_ADJUST_PAUSE: |
| 6286 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6287 | hdd_notice("SET early_rx adjust pause %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6288 | if ((set_value == 0) || (set_value == 1)) |
| 6289 | ret = wma_cli_set_command( |
| 6290 | pAdapter->sessionId, |
| 6291 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, |
| 6292 | set_value, VDEV_CMD); |
| 6293 | else |
| 6294 | ret = -EINVAL; |
| 6295 | break; |
| 6296 | } |
| 6297 | case WE_SET_EARLY_RX_DRIFT_SAMPLE: |
| 6298 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6299 | hdd_notice("SET early_rx drift sample %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6300 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6301 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE, |
| 6302 | set_value, VDEV_CMD); |
| 6303 | break; |
| 6304 | } |
| 6305 | case WE_SET_SCAN_DISABLE: |
| 6306 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6307 | hdd_notice("SET SCAN DISABLE %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6308 | sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(pAdapter), set_value); |
| 6309 | break; |
| 6310 | } |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 6311 | case WE_START_FW_PROFILE: |
| 6312 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6313 | hdd_notice("WE_START_FW_PROFILE %d", set_value); |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 6314 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6315 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 6316 | set_value, DBG_CMD); |
| 6317 | break; |
| 6318 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6319 | case WE_SET_CHANNEL: |
| 6320 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6321 | hdd_notice("Set Channel %d Session ID %d mode %d", set_value, |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6322 | pAdapter->sessionId, pAdapter->device_mode); |
| 6323 | |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6324 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 6325 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6326 | |
| 6327 | status = sme_ext_change_channel(hHal, |
| 6328 | set_value, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6329 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6330 | hdd_err("Error in change channel status %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6331 | status); |
| 6332 | ret = -EINVAL; |
| 6333 | } |
| 6334 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6335 | hdd_err("change channel not supported for device mode %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6336 | pAdapter->device_mode); |
| 6337 | ret = -EINVAL; |
| 6338 | } |
| 6339 | break; |
| 6340 | } |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 6341 | case WE_SET_CONC_SYSTEM_PREF: |
| 6342 | { |
| 6343 | hdd_info("New preference: %d", set_value); |
| 6344 | if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) && |
| 6345 | (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) { |
| 6346 | hdd_err("Invalid system preference %d", set_value); |
| 6347 | return -EINVAL; |
| 6348 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6349 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 6350 | /* hdd_ctx, hdd_ctx->config are already checked for null */ |
| 6351 | hdd_ctx->config->conc_system_pref = set_value; |
| 6352 | break; |
| 6353 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6354 | default: |
| 6355 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6356 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6357 | sub_cmd); |
| 6358 | ret = -EINVAL; |
| 6359 | break; |
| 6360 | } |
| 6361 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6362 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6363 | return ret; |
| 6364 | } |
| 6365 | |
| 6366 | static int iw_setint_getnone(struct net_device *dev, |
| 6367 | struct iw_request_info *info, |
| 6368 | union iwreq_data *wrqu, |
| 6369 | char *extra) |
| 6370 | { |
| 6371 | int ret; |
| 6372 | |
| 6373 | cds_ssr_protect(__func__); |
| 6374 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 6375 | cds_ssr_unprotect(__func__); |
| 6376 | |
| 6377 | return ret; |
| 6378 | } |
| 6379 | |
| 6380 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 6381 | * __iw_setnone_get_threeint() - return three value to up layer. |
| 6382 | * |
| 6383 | * @dev: pointer of net_device of this wireless card |
| 6384 | * @info: meta data about Request sent |
| 6385 | * @wrqu: include request info |
| 6386 | * @extra: buf used for in/Output |
| 6387 | * |
| 6388 | * Return: execute result |
| 6389 | */ |
| 6390 | static int __iw_setnone_get_threeint(struct net_device *dev, |
| 6391 | struct iw_request_info *info, |
| 6392 | union iwreq_data *wrqu, char *extra) |
| 6393 | { |
| 6394 | int ret = 0; /* success */ |
| 6395 | uint32_t *value = (int *)extra; |
| 6396 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6397 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6398 | |
| 6399 | ENTER_DEV(dev); |
| 6400 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6401 | if (0 != ret) |
| 6402 | return ret; |
| 6403 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6404 | hdd_info("param = %d", value[0]); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 6405 | switch (value[0]) { |
| 6406 | case WE_GET_TSF: |
| 6407 | ret = hdd_indicate_tsf(adapter, value, 3); |
| 6408 | break; |
| 6409 | default: |
| 6410 | hdd_err("Invalid IOCTL get_value command %d", value[0]); |
| 6411 | break; |
| 6412 | } |
| 6413 | return ret; |
| 6414 | } |
| 6415 | |
| 6416 | /** |
| 6417 | * iw_setnone_get_threeint() - return three value to up layer. |
| 6418 | * |
| 6419 | * @dev: pointer of net_device of this wireless card |
| 6420 | * @info: meta data about Request sent |
| 6421 | * @wrqu: include request info |
| 6422 | * @extra: buf used for in/Output |
| 6423 | * |
| 6424 | * Return: execute result |
| 6425 | */ |
| 6426 | static int iw_setnone_get_threeint(struct net_device *dev, |
| 6427 | struct iw_request_info *info, |
| 6428 | union iwreq_data *wrqu, char *extra) |
| 6429 | { |
| 6430 | int ret; |
| 6431 | |
| 6432 | cds_ssr_protect(__func__); |
| 6433 | ret = __iw_setnone_get_threeint(dev, info, wrqu, extra); |
| 6434 | cds_ssr_unprotect(__func__); |
| 6435 | |
| 6436 | return ret; |
| 6437 | } |
| 6438 | |
| 6439 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6440 | * iw_setchar_getnone() - Generic "set string" private ioctl handler |
| 6441 | * @dev: device upon which the ioctl was received |
| 6442 | * @info: ioctl request information |
| 6443 | * @wrqu: ioctl request data |
| 6444 | * @extra: ioctl extra data |
| 6445 | * |
| 6446 | * Return: 0 on success, non-zero on error |
| 6447 | */ |
| 6448 | static int __iw_setchar_getnone(struct net_device *dev, |
| 6449 | struct iw_request_info *info, |
| 6450 | union iwreq_data *wrqu, char *extra) |
| 6451 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6452 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6453 | int sub_cmd; |
| 6454 | int ret; |
| 6455 | char *pBuffer = NULL; |
| 6456 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 6457 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6458 | struct hdd_config *pConfig = hdd_ctx->config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6459 | struct iw_point s_priv_data; |
| 6460 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 6461 | ENTER_DEV(dev); |
| 6462 | |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 6463 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6464 | hdd_err("permission check failed"); |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 6465 | return -EPERM; |
| 6466 | } |
| 6467 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6468 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6469 | if (0 != ret) |
| 6470 | return ret; |
| 6471 | |
| 6472 | /* helper function to get iwreq_data with compat handling. */ |
| 6473 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 6474 | return -EINVAL; |
| 6475 | } |
| 6476 | |
| 6477 | /* make sure all params are correctly passed to function */ |
| 6478 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) { |
| 6479 | return -EINVAL; |
| 6480 | } |
| 6481 | |
| 6482 | sub_cmd = s_priv_data.flags; |
| 6483 | |
| 6484 | /* ODD number is used for set, copy data using copy_from_user */ |
| 6485 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 6486 | s_priv_data.length); |
| 6487 | if (NULL == pBuffer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6488 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6489 | return -ENOMEM; |
| 6490 | } |
| 6491 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6492 | hdd_notice("Received length %d", s_priv_data.length); |
| 6493 | hdd_notice("Received data %s", pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6494 | |
| 6495 | switch (sub_cmd) { |
| 6496 | case WE_WOWL_ADD_PTRN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6497 | hdd_notice("ADD_PTRN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6498 | hdd_add_wowl_ptrn(pAdapter, pBuffer); |
| 6499 | break; |
| 6500 | case WE_WOWL_DEL_PTRN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6501 | hdd_notice("DEL_PTRN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6502 | hdd_del_wowl_ptrn(pAdapter, pBuffer); |
| 6503 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6504 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 6505 | { |
| 6506 | tRrmNeighborReq neighborReq; |
| 6507 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 6508 | |
| 6509 | if (pConfig->fRrmEnable) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6510 | hdd_notice("Neighbor Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6511 | neighborReq.no_ssid = |
| 6512 | (s_priv_data.length - 1) ? false : true; |
| 6513 | if (!neighborReq.no_ssid) { |
| 6514 | neighborReq.ssid.length = |
| 6515 | (s_priv_data.length - 1) > |
| 6516 | 32 ? 32 : (s_priv_data.length - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6517 | qdf_mem_copy(neighborReq.ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6518 | pBuffer, |
| 6519 | neighborReq.ssid.length); |
| 6520 | } |
| 6521 | |
| 6522 | callbackInfo.neighborRspCallback = NULL; |
| 6523 | callbackInfo.neighborRspCallbackContext = NULL; |
| 6524 | callbackInfo.timeout = 5000; /* 5 seconds */ |
| 6525 | sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX |
| 6526 | (pAdapter), |
| 6527 | pAdapter->sessionId, |
| 6528 | &neighborReq, |
| 6529 | &callbackInfo); |
| 6530 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6531 | hdd_err("Ignoring neighbor request as RRM is not enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6532 | ret = -EINVAL; |
| 6533 | } |
| 6534 | } |
| 6535 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6536 | case WE_SET_AP_WPS_IE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6537 | hdd_err("Received WE_SET_AP_WPS_IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6538 | sme_update_p2p_ie(WLAN_HDD_GET_HAL_CTX(pAdapter), pBuffer, |
| 6539 | s_priv_data.length); |
| 6540 | break; |
| 6541 | case WE_SET_CONFIG: |
| 6542 | vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6543 | if (QDF_STATUS_SUCCESS != vstatus) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6544 | ret = -EINVAL; |
| 6545 | } |
| 6546 | break; |
| 6547 | default: |
| 6548 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6549 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6550 | sub_cmd); |
| 6551 | ret = -EINVAL; |
| 6552 | break; |
| 6553 | } |
| 6554 | } |
| 6555 | kfree(pBuffer); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6556 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6557 | return ret; |
| 6558 | } |
| 6559 | |
| 6560 | static int iw_setchar_getnone(struct net_device *dev, |
| 6561 | struct iw_request_info *info, |
| 6562 | union iwreq_data *wrqu, char *extra) |
| 6563 | { |
| 6564 | int ret; |
| 6565 | |
| 6566 | cds_ssr_protect(__func__); |
| 6567 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 6568 | cds_ssr_unprotect(__func__); |
| 6569 | |
| 6570 | return ret; |
| 6571 | } |
| 6572 | |
| 6573 | /** |
| 6574 | * iw_setnone_getint() - Generic "get integer" private ioctl handler |
| 6575 | * @dev: device upon which the ioctl was received |
| 6576 | * @info: ioctl request information |
| 6577 | * @wrqu: ioctl request data |
| 6578 | * @extra: ioctl extra data |
| 6579 | * |
| 6580 | * Return: 0 on success, non-zero on error |
| 6581 | */ |
| 6582 | static int __iw_setnone_getint(struct net_device *dev, |
| 6583 | struct iw_request_info *info, |
| 6584 | union iwreq_data *wrqu, char *extra) |
| 6585 | { |
| 6586 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6587 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6588 | int *value = (int *)extra; |
| 6589 | int ret; |
| 6590 | tSmeConfigParams smeConfig; |
| 6591 | hdd_context_t *hdd_ctx; |
| 6592 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 6593 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6594 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6595 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6596 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6597 | if (0 != ret) |
| 6598 | return ret; |
| 6599 | |
| 6600 | switch (value[0]) { |
| 6601 | case WE_GET_11D_STATE: |
| 6602 | { |
| 6603 | sme_get_config_param(hHal, &smeConfig); |
| 6604 | |
| 6605 | *value = smeConfig.csrConfig.Is11dSupportEnabled; |
| 6606 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6607 | hdd_notice("11D state=%d!!", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6608 | |
| 6609 | break; |
| 6610 | } |
| 6611 | |
| 6612 | case WE_IBSS_STATUS: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6613 | hdd_notice("****Return IBSS Status*****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6614 | break; |
| 6615 | |
| 6616 | case WE_GET_WLAN_DBG: |
| 6617 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6618 | qdf_trace_display(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6619 | *value = 0; |
| 6620 | break; |
| 6621 | } |
| 6622 | case WE_GET_MAX_ASSOC: |
| 6623 | { |
| 6624 | if (sme_cfg_get_int |
| 6625 | (hHal, WNI_CFG_ASSOC_STA_LIMIT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6626 | (uint32_t *) value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6627 | hdd_warn("failed to get ini parameter, WNI_CFG_ASSOC_STA_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6628 | ret = -EIO; |
| 6629 | } |
| 6630 | break; |
| 6631 | } |
| 6632 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 6633 | *value = (WLAN_HDD_GET_CTX( |
| 6634 | pAdapter))->config->force_sap_acs; |
| 6635 | break; |
| 6636 | |
| 6637 | case WE_GET_CONCURRENCY_MODE: |
| 6638 | { |
| 6639 | *value = cds_get_concurrency_mode(); |
| 6640 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6641 | hdd_notice("concurrency mode=%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6642 | break; |
| 6643 | } |
| 6644 | |
| 6645 | case WE_GET_NSS: |
| 6646 | { |
| 6647 | sme_get_config_param(hHal, &smeConfig); |
| 6648 | *value = (smeConfig.csrConfig.enable2x2 == 0) ? 1 : 2; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6649 | hdd_notice("GET_NSS: Current NSS:%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6650 | break; |
| 6651 | } |
| 6652 | |
| 6653 | case WE_GET_GTX_HT_MCS: |
| 6654 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6655 | hdd_notice("GET WMI_VDEV_PARAM_GTX_HT_MCS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6656 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6657 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 6658 | GTX_CMD); |
| 6659 | break; |
| 6660 | } |
| 6661 | |
| 6662 | case WE_GET_GTX_VHT_MCS: |
| 6663 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6664 | hdd_notice("GET WMI_VDEV_PARAM_GTX_VHT_MCS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6665 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6666 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 6667 | GTX_CMD); |
| 6668 | break; |
| 6669 | } |
| 6670 | |
| 6671 | case WE_GET_GTX_USRCFG: |
| 6672 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6673 | hdd_notice("GET WMI_VDEV_PARAM_GTX_USR_CFG"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6674 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6675 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 6676 | GTX_CMD); |
| 6677 | break; |
| 6678 | } |
| 6679 | |
| 6680 | case WE_GET_GTX_THRE: |
| 6681 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6682 | hdd_notice("GET WMI_VDEV_PARAM_GTX_THRE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6683 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6684 | WMI_VDEV_PARAM_GTX_THRE, |
| 6685 | GTX_CMD); |
| 6686 | break; |
| 6687 | } |
| 6688 | |
| 6689 | case WE_GET_GTX_MARGIN: |
| 6690 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6691 | hdd_notice("GET WMI_VDEV_PARAM_GTX_MARGIN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6692 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6693 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 6694 | GTX_CMD); |
| 6695 | break; |
| 6696 | } |
| 6697 | |
| 6698 | case WE_GET_GTX_STEP: |
| 6699 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6700 | hdd_notice("GET WMI_VDEV_PARAM_GTX_STEP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6701 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6702 | WMI_VDEV_PARAM_GTX_STEP, |
| 6703 | GTX_CMD); |
| 6704 | break; |
| 6705 | } |
| 6706 | |
| 6707 | case WE_GET_GTX_MINTPC: |
| 6708 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6709 | hdd_notice("GET WMI_VDEV_PARAM_GTX_MINTPC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6710 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6711 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 6712 | GTX_CMD); |
| 6713 | break; |
| 6714 | } |
| 6715 | |
| 6716 | case WE_GET_GTX_BWMASK: |
| 6717 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6718 | hdd_notice("GET WMI_VDEV_PARAM_GTX_BW_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6719 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6720 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 6721 | GTX_CMD); |
| 6722 | break; |
| 6723 | } |
| 6724 | |
| 6725 | case WE_GET_LDPC: |
| 6726 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6727 | ret = hdd_get_ldpc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6728 | break; |
| 6729 | } |
| 6730 | |
| 6731 | case WE_GET_TX_STBC: |
| 6732 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6733 | ret = hdd_get_tx_stbc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6734 | break; |
| 6735 | } |
| 6736 | |
| 6737 | case WE_GET_RX_STBC: |
| 6738 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6739 | ret = hdd_get_rx_stbc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6740 | break; |
| 6741 | } |
| 6742 | |
| 6743 | case WE_GET_SHORT_GI: |
| 6744 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6745 | hdd_notice("GET WMI_VDEV_PARAM_SGI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6746 | *value = sme_get_ht_config(hHal, pAdapter->sessionId, |
| 6747 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ); |
| 6748 | break; |
| 6749 | } |
| 6750 | |
| 6751 | case WE_GET_RTSCTS: |
| 6752 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6753 | hdd_notice("GET WMI_VDEV_PARAM_ENABLE_RTSCTS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6754 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6755 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 6756 | VDEV_CMD); |
| 6757 | break; |
| 6758 | } |
| 6759 | |
| 6760 | case WE_GET_CHWIDTH: |
| 6761 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6762 | hdd_notice("GET WMI_VDEV_PARAM_CHWIDTH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6763 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6764 | WMI_VDEV_PARAM_CHWIDTH, |
| 6765 | VDEV_CMD); |
| 6766 | break; |
| 6767 | } |
| 6768 | |
| 6769 | case WE_GET_ANI_EN_DIS: |
| 6770 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6771 | hdd_notice("GET WMI_PDEV_PARAM_ANI_ENABLE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6772 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6773 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 6774 | PDEV_CMD); |
| 6775 | break; |
| 6776 | } |
| 6777 | |
| 6778 | case WE_GET_ANI_POLL_PERIOD: |
| 6779 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6780 | hdd_notice("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6781 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6782 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 6783 | PDEV_CMD); |
| 6784 | break; |
| 6785 | } |
| 6786 | |
| 6787 | case WE_GET_ANI_LISTEN_PERIOD: |
| 6788 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6789 | hdd_notice("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6790 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6791 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 6792 | PDEV_CMD); |
| 6793 | break; |
| 6794 | } |
| 6795 | |
| 6796 | case WE_GET_ANI_OFDM_LEVEL: |
| 6797 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6798 | hdd_notice("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6799 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6800 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 6801 | PDEV_CMD); |
| 6802 | break; |
| 6803 | } |
| 6804 | |
| 6805 | case WE_GET_ANI_CCK_LEVEL: |
| 6806 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6807 | hdd_notice("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6808 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6809 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 6810 | PDEV_CMD); |
| 6811 | break; |
| 6812 | } |
| 6813 | |
| 6814 | case WE_GET_DYNAMIC_BW: |
| 6815 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6816 | hdd_notice("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6817 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6818 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 6819 | PDEV_CMD); |
| 6820 | break; |
| 6821 | } |
| 6822 | |
| 6823 | case WE_GET_11N_RATE: |
| 6824 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6825 | hdd_notice("GET WMI_VDEV_PARAM_FIXED_RATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6826 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6827 | WMI_VDEV_PARAM_FIXED_RATE, |
| 6828 | VDEV_CMD); |
| 6829 | break; |
| 6830 | } |
| 6831 | |
| 6832 | case WE_GET_AMPDU: |
| 6833 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6834 | hdd_notice("GET AMPDU"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6835 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6836 | GEN_VDEV_PARAM_AMPDU, |
| 6837 | GEN_CMD); |
| 6838 | break; |
| 6839 | } |
| 6840 | |
| 6841 | case WE_GET_AMSDU: |
| 6842 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6843 | hdd_notice("GET AMSDU"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6844 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6845 | GEN_VDEV_PARAM_AMSDU, |
| 6846 | GEN_CMD); |
| 6847 | break; |
| 6848 | } |
| 6849 | |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 6850 | case WE_GET_ROAM_SYNCH_DELAY: |
| 6851 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6852 | hdd_notice("GET ROAM SYNCH DELAY"); |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 6853 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6854 | GEN_VDEV_ROAM_SYNCH_DELAY, |
| 6855 | GEN_CMD); |
| 6856 | break; |
| 6857 | } |
| 6858 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6859 | case WE_GET_BURST_ENABLE: |
| 6860 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6861 | hdd_notice("GET Burst enable value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6862 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6863 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 6864 | PDEV_CMD); |
| 6865 | break; |
| 6866 | } |
| 6867 | case WE_GET_BURST_DUR: |
| 6868 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6869 | hdd_notice("GET Burst Duration value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6870 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6871 | WMI_PDEV_PARAM_BURST_DUR, |
| 6872 | PDEV_CMD); |
| 6873 | break; |
| 6874 | } |
| 6875 | |
| 6876 | case WE_GET_TX_CHAINMASK: |
| 6877 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6878 | hdd_notice("GET WMI_PDEV_PARAM_TX_CHAIN_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6879 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6880 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 6881 | PDEV_CMD); |
| 6882 | break; |
| 6883 | } |
| 6884 | |
| 6885 | case WE_GET_RX_CHAINMASK: |
| 6886 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6887 | hdd_notice("GET WMI_PDEV_PARAM_RX_CHAIN_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6888 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6889 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 6890 | PDEV_CMD); |
| 6891 | break; |
| 6892 | } |
| 6893 | |
| 6894 | case WE_GET_TXPOW_2G: |
| 6895 | { |
| 6896 | uint32_t txpow2g = 0; |
| 6897 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6898 | hdd_notice("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6899 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6900 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 6901 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6902 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6903 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 6904 | &txpow2g)) { |
| 6905 | return -EIO; |
| 6906 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6907 | hdd_notice("2G tx_power %d", txpow2g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6908 | break; |
| 6909 | } |
| 6910 | |
| 6911 | case WE_GET_TXPOW_5G: |
| 6912 | { |
| 6913 | uint32_t txpow5g = 0; |
| 6914 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6915 | hdd_notice("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6916 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6917 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 6918 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6919 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6920 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 6921 | &txpow5g)) { |
| 6922 | return -EIO; |
| 6923 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6924 | hdd_notice("5G tx_power %d", txpow5g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6925 | break; |
| 6926 | } |
| 6927 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6928 | case WE_GET_PPS_PAID_MATCH: |
| 6929 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6930 | hdd_notice("GET WMI_VDEV_PPS_PAID_MATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6931 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6932 | WMI_VDEV_PPS_PAID_MATCH, |
| 6933 | PPS_CMD); |
| 6934 | break; |
| 6935 | } |
| 6936 | |
| 6937 | case WE_GET_PPS_GID_MATCH: |
| 6938 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6939 | hdd_notice("GET WMI_VDEV_PPS_GID_MATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6940 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6941 | WMI_VDEV_PPS_GID_MATCH, |
| 6942 | PPS_CMD); |
| 6943 | break; |
| 6944 | } |
| 6945 | |
| 6946 | case WE_GET_PPS_EARLY_TIM_CLEAR: |
| 6947 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6948 | hdd_notice("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6949 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6950 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 6951 | PPS_CMD); |
| 6952 | break; |
| 6953 | } |
| 6954 | |
| 6955 | case WE_GET_PPS_EARLY_DTIM_CLEAR: |
| 6956 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6957 | hdd_notice("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6958 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6959 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 6960 | PPS_CMD); |
| 6961 | break; |
| 6962 | } |
| 6963 | |
| 6964 | case WE_GET_PPS_EOF_PAD_DELIM: |
| 6965 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6966 | hdd_notice("GET WMI_VDEV_PPS_EOF_PAD_DELIM"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6967 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6968 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 6969 | PPS_CMD); |
| 6970 | break; |
| 6971 | } |
| 6972 | |
| 6973 | case WE_GET_PPS_MACADDR_MISMATCH: |
| 6974 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6975 | hdd_notice("GET WMI_VDEV_PPS_MACADDR_MISMATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6976 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6977 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 6978 | PPS_CMD); |
| 6979 | break; |
| 6980 | } |
| 6981 | |
| 6982 | case WE_GET_PPS_DELIM_CRC_FAIL: |
| 6983 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6984 | hdd_notice("GET WMI_VDEV_PPS_DELIM_CRC_FAIL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6985 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6986 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 6987 | PPS_CMD); |
| 6988 | break; |
| 6989 | } |
| 6990 | |
| 6991 | case WE_GET_PPS_GID_NSTS_ZERO: |
| 6992 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6993 | hdd_notice("GET WMI_VDEV_PPS_GID_NSTS_ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6994 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 6995 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 6996 | PPS_CMD); |
| 6997 | break; |
| 6998 | } |
| 6999 | |
| 7000 | case WE_GET_PPS_RSSI_CHECK: |
| 7001 | { |
| 7002 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7003 | hdd_notice("GET WMI_VDEV_PPS_RSSI_CHECK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7004 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7005 | WMI_VDEV_PPS_RSSI_CHECK, |
| 7006 | PPS_CMD); |
| 7007 | break; |
| 7008 | } |
| 7009 | |
| 7010 | case WE_GET_QPOWER_MAX_PSPOLL_COUNT: |
| 7011 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7012 | hdd_notice("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7013 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7014 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 7015 | QPOWER_CMD); |
| 7016 | break; |
| 7017 | } |
| 7018 | |
| 7019 | case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 7020 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7021 | hdd_notice("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7022 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7023 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 7024 | QPOWER_CMD); |
| 7025 | break; |
| 7026 | } |
| 7027 | |
| 7028 | case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 7029 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7030 | hdd_notice("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7031 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7032 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 7033 | QPOWER_CMD); |
| 7034 | break; |
| 7035 | } |
| 7036 | |
| 7037 | case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 7038 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7039 | hdd_notice("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7040 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7041 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 7042 | QPOWER_CMD); |
| 7043 | break; |
| 7044 | } |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7045 | case WE_CAP_TSF: |
| 7046 | ret = hdd_capture_tsf(pAdapter, (uint32_t *)value, 1); |
| 7047 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7048 | case WE_GET_TEMPERATURE: |
| 7049 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7050 | hdd_notice("WE_GET_TEMPERATURE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7051 | ret = wlan_hdd_get_temperature(pAdapter, value); |
| 7052 | break; |
| 7053 | } |
| 7054 | default: |
| 7055 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7056 | hdd_err("Invalid IOCTL get_value command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7057 | value[0]); |
| 7058 | break; |
| 7059 | } |
| 7060 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7061 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7062 | return ret; |
| 7063 | } |
| 7064 | |
| 7065 | static int iw_setnone_getint(struct net_device *dev, |
| 7066 | struct iw_request_info *info, |
| 7067 | union iwreq_data *wrqu, char *extra) |
| 7068 | { |
| 7069 | int ret; |
| 7070 | |
| 7071 | cds_ssr_protect(__func__); |
| 7072 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 7073 | cds_ssr_unprotect(__func__); |
| 7074 | |
| 7075 | return ret; |
| 7076 | } |
| 7077 | |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 7078 | static int hdd_set_fwtest(int argc, int cmd, int value) |
| 7079 | { |
| 7080 | struct set_fwtest_params *fw_test; |
| 7081 | |
| 7082 | /* check for max number of arguments */ |
| 7083 | if (argc > (WMA_MAX_NUM_ARGS) || |
| 7084 | argc != HDD_FWTEST_PARAMS) { |
| 7085 | hdd_err("Too Many args %d", argc); |
| 7086 | return -EINVAL; |
| 7087 | } |
| 7088 | /* |
| 7089 | * check if number of arguments are 3 then, check |
| 7090 | * then set the default value for sounding interval. |
| 7091 | */ |
| 7092 | if (HDD_FWTEST_PARAMS == argc) { |
| 7093 | if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value) |
| 7094 | value = HDD_FWTEST_SU_DEFAULT_VALUE; |
| 7095 | if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value) |
| 7096 | value = HDD_FWTEST_MU_DEFAULT_VALUE; |
| 7097 | } |
| 7098 | /* check sounding interval value should not exceed to max */ |
| 7099 | if (value > HDD_FWTEST_MAX_VALUE) { |
| 7100 | hdd_err("Invalid arguments value should not exceed max: %d", |
| 7101 | value); |
| 7102 | return -EINVAL; |
| 7103 | } |
| 7104 | fw_test = qdf_mem_malloc(sizeof(*fw_test)); |
| 7105 | if (NULL == fw_test) { |
| 7106 | hdd_err("qdf_mem_malloc failed for fw_test"); |
| 7107 | return -ENOMEM; |
| 7108 | } |
| 7109 | fw_test->arg = cmd; |
| 7110 | fw_test->value = value; |
| 7111 | if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) { |
| 7112 | qdf_mem_free(fw_test); |
| 7113 | hdd_err("Not able to post FW_TEST_CMD message to WMA"); |
| 7114 | return -EINVAL; |
| 7115 | } |
| 7116 | return 0; |
| 7117 | } |
| 7118 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7119 | /** |
| 7120 | * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler |
| 7121 | * @dev: device upon which the ioctl was received |
| 7122 | * @info: ioctl request information |
| 7123 | * @wrqu: ioctl request data |
| 7124 | * @extra: ioctl extra data |
| 7125 | * |
| 7126 | * Return: 0 on success, non-zero on error |
| 7127 | */ |
| 7128 | static int __iw_set_three_ints_getnone(struct net_device *dev, |
| 7129 | struct iw_request_info *info, |
| 7130 | union iwreq_data *wrqu, char *extra) |
| 7131 | { |
| 7132 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7133 | int *value = (int *)extra; |
| 7134 | int sub_cmd = value[0]; |
| 7135 | int ret; |
| 7136 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7137 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7138 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7139 | |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 7140 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7141 | hdd_err("permission check failed"); |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 7142 | return -EPERM; |
| 7143 | } |
| 7144 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7145 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7146 | if (0 != ret) |
| 7147 | return ret; |
| 7148 | |
| 7149 | switch (sub_cmd) { |
| 7150 | |
| 7151 | case WE_SET_WLAN_DBG: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7152 | qdf_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7153 | break; |
| 7154 | case WE_SET_DP_TRACE: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7155 | qdf_dp_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7156 | break; |
| 7157 | |
| 7158 | /* value[3] the acs band is not required as start and end channels are |
| 7159 | * enough but this cmd is maintained under set three ints for historic |
| 7160 | * reasons. |
| 7161 | */ |
| 7162 | case WE_SET_SAP_CHANNELS: |
| 7163 | if (wlan_hdd_validate_operation_channel(pAdapter, value[1]) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7164 | QDF_STATUS_SUCCESS || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7165 | wlan_hdd_validate_operation_channel(pAdapter, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7166 | value[2]) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7167 | ret = -EINVAL; |
| 7168 | } else { |
| 7169 | hdd_ctx->config->force_sap_acs_st_ch = value[1]; |
| 7170 | hdd_ctx->config->force_sap_acs_end_ch = value[2]; |
| 7171 | } |
| 7172 | break; |
| 7173 | case WE_SET_DUAL_MAC_SCAN_CONFIG: |
| 7174 | hdd_debug("Ioctl to set dual mac scan config"); |
| 7175 | if (hdd_ctx->config->dual_mac_feature_disable) { |
| 7176 | hdd_err("Dual mac feature is disabled from INI"); |
| 7177 | return -EPERM; |
| 7178 | } |
| 7179 | hdd_debug("%d %d %d", value[1], value[2], value[3]); |
Tushnim Bhattacharyya | 4adb368 | 2016-01-07 15:07:12 -0800 | [diff] [blame] | 7180 | cds_set_dual_mac_scan_config(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7181 | break; |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 7182 | case WE_SET_FW_TEST: |
| 7183 | { |
| 7184 | ret = hdd_set_fwtest(value[1], value[2], value[3]); |
| 7185 | if (ret) { |
| 7186 | hdd_err("Not able to set fwtest %d", ret); |
| 7187 | return ret; |
| 7188 | } |
| 7189 | } |
| 7190 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7191 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7192 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7193 | break; |
| 7194 | |
| 7195 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7196 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7197 | return ret; |
| 7198 | } |
| 7199 | |
| 7200 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 7201 | struct iw_request_info *info, |
| 7202 | union iwreq_data *wrqu, char *extra) |
| 7203 | { |
| 7204 | int ret; |
| 7205 | |
| 7206 | cds_ssr_protect(__func__); |
| 7207 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 7208 | cds_ssr_unprotect(__func__); |
| 7209 | |
| 7210 | return ret; |
| 7211 | } |
| 7212 | |
| 7213 | /** |
| 7214 | * hdd_connection_state_string() - Get connection state string |
| 7215 | * @connection_state: enum to be converted to a string |
| 7216 | * |
| 7217 | * Return: the string equivalent of @connection_state |
| 7218 | */ |
| 7219 | static const char * |
| 7220 | hdd_connection_state_string(eConnectionState connection_state) |
| 7221 | { |
| 7222 | switch (connection_state) { |
| 7223 | CASE_RETURN_STRING(eConnectionState_NotConnected); |
| 7224 | CASE_RETURN_STRING(eConnectionState_Connecting); |
| 7225 | CASE_RETURN_STRING(eConnectionState_Associated); |
| 7226 | CASE_RETURN_STRING(eConnectionState_IbssDisconnected); |
| 7227 | CASE_RETURN_STRING(eConnectionState_IbssConnected); |
| 7228 | CASE_RETURN_STRING(eConnectionState_Disconnecting); |
| 7229 | default: |
| 7230 | return "UNKNOWN"; |
| 7231 | } |
| 7232 | } |
| 7233 | |
| 7234 | /** |
| 7235 | * iw_get_char_setnone() - Generic "get string" private ioctl handler |
| 7236 | * @dev: device upon which the ioctl was received |
| 7237 | * @info: ioctl request information |
| 7238 | * @wrqu: ioctl request data |
| 7239 | * @extra: ioctl extra data |
| 7240 | * |
| 7241 | * Return: 0 on success, non-zero on error |
| 7242 | */ |
| 7243 | static int __iw_get_char_setnone(struct net_device *dev, |
| 7244 | struct iw_request_info *info, |
| 7245 | union iwreq_data *wrqu, char *extra) |
| 7246 | { |
| 7247 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7248 | int sub_cmd = wrqu->data.flags; |
| 7249 | hdd_context_t *hdd_ctx; |
| 7250 | int ret; |
| 7251 | #ifdef WLAN_FEATURE_11W |
| 7252 | hdd_wext_state_t *pWextState; |
| 7253 | #endif |
| 7254 | |
| 7255 | #ifdef WLAN_FEATURE_11W |
| 7256 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7257 | #endif |
| 7258 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7259 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7260 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7261 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7262 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7263 | if (0 != ret) |
| 7264 | return ret; |
| 7265 | |
| 7266 | switch (sub_cmd) { |
| 7267 | case WE_WLAN_VERSION: |
| 7268 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 7269 | hdd_wlan_get_version(hdd_ctx, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7270 | break; |
| 7271 | } |
| 7272 | |
| 7273 | case WE_GET_STATS: |
| 7274 | { |
| 7275 | hdd_wlan_get_stats(pAdapter, &(wrqu->data.length), |
| 7276 | extra, WE_MAX_STR_LEN); |
| 7277 | break; |
| 7278 | } |
| 7279 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7280 | case WE_LIST_FW_PROFILE: |
| 7281 | hdd_wlan_list_fw_profile(&(wrqu->data.length), |
| 7282 | extra, WE_MAX_STR_LEN); |
| 7283 | break; |
| 7284 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7285 | /* The case prints the current state of the HDD, SME, CSR, PE, |
| 7286 | * TL it can be extended for WDI Global State as well. And |
| 7287 | * currently it only checks P2P_CLIENT adapter. P2P_DEVICE |
| 7288 | * and P2P_GO have not been added as of now. |
| 7289 | */ |
| 7290 | case WE_GET_STATES: |
| 7291 | { |
| 7292 | int buf = 0, len = 0; |
| 7293 | int adapter_num = 0; |
| 7294 | int count = 0, check = 1; |
| 7295 | |
| 7296 | tHalHandle hHal = NULL; |
| 7297 | tpAniSirGlobal pMac = NULL; |
| 7298 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 7299 | |
| 7300 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7301 | hdd_adapter_t *useAdapter = NULL; |
| 7302 | |
| 7303 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 7304 | * by using the correct adapter |
| 7305 | */ |
| 7306 | while (adapter_num < 2) { |
| 7307 | if (WLAN_ADAPTER == adapter_num) { |
| 7308 | useAdapter = pAdapter; |
| 7309 | buf = |
| 7310 | scnprintf(extra + len, |
| 7311 | WE_MAX_STR_LEN - len, |
| 7312 | "\n\n wlan0 States:-"); |
| 7313 | len += buf; |
| 7314 | } else if (P2P_ADAPTER == adapter_num) { |
| 7315 | buf = |
| 7316 | scnprintf(extra + len, |
| 7317 | WE_MAX_STR_LEN - len, |
| 7318 | "\n\n p2p0 States:-"); |
| 7319 | len += buf; |
| 7320 | |
| 7321 | if (!pHddCtx) { |
| 7322 | buf = |
| 7323 | scnprintf(extra + len, |
| 7324 | WE_MAX_STR_LEN - |
| 7325 | len, |
| 7326 | "\n pHddCtx is NULL"); |
| 7327 | len += buf; |
| 7328 | break; |
| 7329 | } |
| 7330 | |
| 7331 | /* Printing p2p0 states only in the |
| 7332 | * case when the device is configured |
| 7333 | * as a p2p_client |
| 7334 | */ |
| 7335 | useAdapter = |
| 7336 | hdd_get_adapter(pHddCtx, |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 7337 | QDF_P2P_CLIENT_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7338 | if (!useAdapter) { |
| 7339 | buf = |
| 7340 | scnprintf(extra + len, |
| 7341 | WE_MAX_STR_LEN - |
| 7342 | len, |
| 7343 | "\n Device not configured as P2P_CLIENT."); |
| 7344 | len += buf; |
| 7345 | break; |
| 7346 | } |
| 7347 | } |
| 7348 | |
| 7349 | hHal = WLAN_HDD_GET_HAL_CTX(useAdapter); |
| 7350 | if (!hHal) { |
| 7351 | buf = |
| 7352 | scnprintf(extra + len, |
| 7353 | WE_MAX_STR_LEN - len, |
| 7354 | "\n pMac is NULL"); |
| 7355 | len += buf; |
| 7356 | break; |
| 7357 | } |
| 7358 | pMac = PMAC_STRUCT(hHal); |
| 7359 | if (!pMac) { |
| 7360 | buf = |
| 7361 | scnprintf(extra + len, |
| 7362 | WE_MAX_STR_LEN - len, |
| 7363 | "\n pMac is NULL"); |
| 7364 | len += buf; |
| 7365 | break; |
| 7366 | } |
| 7367 | pHddStaCtx = |
| 7368 | WLAN_HDD_GET_STATION_CTX_PTR(useAdapter); |
| 7369 | |
| 7370 | |
| 7371 | buf = |
| 7372 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7373 | "\n HDD Conn State - %s " |
| 7374 | "\n \n SME State:" |
| 7375 | "\n Neighbour Roam State - %s" |
| 7376 | "\n CSR State - %s" |
| 7377 | "\n CSR Substate - %s", |
| 7378 | hdd_connection_state_string |
| 7379 | (pHddStaCtx->conn_info.connState), |
| 7380 | mac_trace_get_neighbour_roam_state |
| 7381 | (sme_get_neighbor_roam_state |
| 7382 | (hHal, useAdapter->sessionId)), |
| 7383 | mac_trace_getcsr_roam_state |
| 7384 | (sme_get_current_roam_state |
| 7385 | (hHal, useAdapter->sessionId)), |
| 7386 | mac_trace_getcsr_roam_sub_state |
| 7387 | (sme_get_current_roam_sub_state |
| 7388 | (hHal, useAdapter->sessionId)) |
| 7389 | ); |
| 7390 | len += buf; |
| 7391 | adapter_num++; |
| 7392 | } |
| 7393 | |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 7394 | if (hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7395 | /* Printing Lim State starting with global lim states */ |
| 7396 | buf = |
| 7397 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7398 | "\n \n LIM STATES:-" |
| 7399 | "\n Global Sme State - %s " |
| 7400 | "\n Global mlm State - %s " "\n", |
| 7401 | mac_trace_get_lim_sme_state |
| 7402 | (sme_get_lim_sme_state(hHal)), |
| 7403 | mac_trace_get_lim_mlm_state |
| 7404 | (sme_get_lim_sme_state(hHal)) |
| 7405 | ); |
| 7406 | len += buf; |
| 7407 | |
| 7408 | /* Printing the PE Sme and Mlm states for valid lim sessions */ |
| 7409 | while (check < 3 && count < 255) { |
| 7410 | if (sme_is_lim_session_valid(hHal, count)) { |
| 7411 | buf = |
| 7412 | scnprintf(extra + len, |
| 7413 | WE_MAX_STR_LEN - |
| 7414 | len, |
| 7415 | "\n Lim Valid Session %d:-" |
| 7416 | "\n PE Sme State - %s " |
| 7417 | "\n PE Mlm State - %s " |
| 7418 | "\n", check, |
| 7419 | mac_trace_get_lim_sme_state |
| 7420 | (sme_get_lim_sme_session_state |
| 7421 | (hHal, count)), |
| 7422 | mac_trace_get_lim_mlm_state |
| 7423 | (sme_get_lim_mlm_session_state |
| 7424 | (hHal, count)) |
| 7425 | ); |
| 7426 | |
| 7427 | len += buf; |
| 7428 | check++; |
| 7429 | } |
| 7430 | count++; |
| 7431 | } |
| 7432 | } |
| 7433 | |
| 7434 | wrqu->data.length = strlen(extra) + 1; |
| 7435 | break; |
| 7436 | } |
| 7437 | |
| 7438 | case WE_GET_CFG: |
| 7439 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7440 | hdd_notice("Printing CLD global INI Config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7441 | hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(pAdapter), |
| 7442 | extra, |
| 7443 | QCSAP_IOCTL_MAX_STR_LEN); |
| 7444 | wrqu->data.length = strlen(extra) + 1; |
| 7445 | break; |
| 7446 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7447 | case WE_GET_RSSI: |
| 7448 | { |
| 7449 | int8_t s7Rssi = 0; |
| 7450 | wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 7451 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 7452 | wrqu->data.length = strlen(extra) + 1; |
| 7453 | break; |
| 7454 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7455 | |
| 7456 | case WE_GET_WMM_STATUS: |
| 7457 | { |
| 7458 | snprintf(extra, WE_MAX_STR_LEN, |
| 7459 | "\nDir: 0=up, 1=down, 3=both\n" |
| 7460 | "|------------------------|\n" |
| 7461 | "|AC | ACM |Admitted| Dir |\n" |
| 7462 | "|------------------------|\n" |
| 7463 | "|VO | %d | %3s | %d |\n" |
| 7464 | "|VI | %d | %3s | %d |\n" |
| 7465 | "|BE | %d | %3s | %d |\n" |
| 7466 | "|BK | %d | %3s | %d |\n" |
| 7467 | "|------------------------|\n", |
| 7468 | pAdapter->hddWmmStatus. |
| 7469 | wmmAcStatus[SME_AC_VO].wmmAcAccessRequired, |
| 7470 | pAdapter->hddWmmStatus. |
| 7471 | wmmAcStatus[SME_AC_VO]. |
| 7472 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7473 | pAdapter->hddWmmStatus. |
| 7474 | wmmAcStatus[SME_AC_VO].wmmAcTspecInfo. |
| 7475 | ts_info.direction, |
| 7476 | pAdapter->hddWmmStatus. |
| 7477 | wmmAcStatus[SME_AC_VI].wmmAcAccessRequired, |
| 7478 | pAdapter->hddWmmStatus. |
| 7479 | wmmAcStatus[SME_AC_VI]. |
| 7480 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7481 | pAdapter->hddWmmStatus. |
| 7482 | wmmAcStatus[SME_AC_VI].wmmAcTspecInfo. |
| 7483 | ts_info.direction, |
| 7484 | pAdapter->hddWmmStatus. |
| 7485 | wmmAcStatus[SME_AC_BE].wmmAcAccessRequired, |
| 7486 | pAdapter->hddWmmStatus. |
| 7487 | wmmAcStatus[SME_AC_BE]. |
| 7488 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7489 | pAdapter->hddWmmStatus. |
| 7490 | wmmAcStatus[SME_AC_BE].wmmAcTspecInfo. |
| 7491 | ts_info.direction, |
| 7492 | pAdapter->hddWmmStatus. |
| 7493 | wmmAcStatus[SME_AC_BK].wmmAcAccessRequired, |
| 7494 | pAdapter->hddWmmStatus. |
| 7495 | wmmAcStatus[SME_AC_BK]. |
| 7496 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7497 | pAdapter->hddWmmStatus. |
| 7498 | wmmAcStatus[SME_AC_BK].wmmAcTspecInfo. |
| 7499 | ts_info.direction); |
| 7500 | |
| 7501 | wrqu->data.length = strlen(extra) + 1; |
| 7502 | break; |
| 7503 | } |
| 7504 | case WE_GET_CHANNEL_LIST: |
| 7505 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7506 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7507 | uint8_t i, len; |
| 7508 | char *buf; |
| 7509 | uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN]; |
| 7510 | uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN; |
| 7511 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7512 | |
| 7513 | tChannelListInfo channel_list; |
| 7514 | |
| 7515 | memset(&channel_list, 0, sizeof(channel_list)); |
Agrawal Ashish | 6c9bca7 | 2016-09-04 13:37:59 +0530 | [diff] [blame] | 7516 | status = iw_get_channel_list(dev, info, wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7517 | (char *)&channel_list); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7518 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7519 | hdd_err("GetChannelList Failed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7520 | return -EINVAL; |
| 7521 | } |
| 7522 | buf = extra; |
| 7523 | /* |
| 7524 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. |
| 7525 | * Maximum buffer needed = 5 * number of channels. |
| 7526 | * Check ifsufficient buffer is available and then |
| 7527 | * proceed to fill the buffer. |
| 7528 | */ |
| 7529 | if (WE_MAX_STR_LEN < |
| 7530 | (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7531 | hdd_err("Insufficient Buffer to populate channel list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7532 | return -EINVAL; |
| 7533 | } |
| 7534 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 7535 | channel_list.num_channels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7536 | if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7537 | ubuf, &ubuf_len)) { |
| 7538 | /* Printing Country code in getChannelList */ |
| 7539 | for (i = 0; i < (ubuf_len - 1); i++) |
| 7540 | len += scnprintf(buf + len, |
| 7541 | WE_MAX_STR_LEN - len, |
| 7542 | "%c", ubuf[i]); |
| 7543 | } |
| 7544 | for (i = 0; i < channel_list.num_channels; i++) { |
| 7545 | len += |
| 7546 | scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 7547 | " %u", channel_list.channels[i]); |
| 7548 | } |
| 7549 | wrqu->data.length = strlen(extra) + 1; |
| 7550 | |
| 7551 | break; |
| 7552 | } |
| 7553 | #ifdef FEATURE_WLAN_TDLS |
| 7554 | case WE_GET_TDLS_PEERS: |
| 7555 | { |
| 7556 | wrqu->data.length = |
| 7557 | wlan_hdd_tdls_get_all_peers(pAdapter, extra, |
| 7558 | WE_MAX_STR_LEN) + 1; |
| 7559 | break; |
| 7560 | } |
| 7561 | #endif |
| 7562 | #ifdef WLAN_FEATURE_11W |
| 7563 | case WE_GET_11W_INFO: |
| 7564 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7565 | hdd_err("WE_GET_11W_ENABLED = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7566 | pWextState->roamProfile.MFPEnabled); |
| 7567 | |
| 7568 | snprintf(extra, WE_MAX_STR_LEN, |
| 7569 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 7570 | "\n Number of Unprotected Disassocs %d" |
| 7571 | "\n Number of Unprotected Deauths %d", |
| 7572 | pWextState->roamProfile.BSSIDs.bssid->bytes[0], |
| 7573 | pWextState->roamProfile.BSSIDs.bssid->bytes[1], |
| 7574 | pWextState->roamProfile.BSSIDs.bssid->bytes[2], |
| 7575 | pWextState->roamProfile.BSSIDs.bssid->bytes[3], |
| 7576 | pWextState->roamProfile.BSSIDs.bssid->bytes[4], |
| 7577 | pWextState->roamProfile.BSSIDs.bssid->bytes[5], |
| 7578 | pWextState->roamProfile.MFPEnabled, |
| 7579 | pAdapter->hdd_stats.hddPmfStats. |
| 7580 | numUnprotDisassocRx, |
| 7581 | pAdapter->hdd_stats.hddPmfStats. |
| 7582 | numUnprotDeauthRx); |
| 7583 | |
| 7584 | wrqu->data.length = strlen(extra) + 1; |
| 7585 | break; |
| 7586 | } |
| 7587 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7588 | case WE_GET_IBSS_STA_INFO: |
| 7589 | { |
| 7590 | hdd_station_ctx_t *pHddStaCtx = |
| 7591 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7592 | int idx = 0; |
| 7593 | int length = 0, buf = 0; |
| 7594 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 7595 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7596 | if (0 != pHddStaCtx->conn_info.staId[idx]) { |
| 7597 | buf = snprintf |
| 7598 | ((extra + length), |
| 7599 | WE_MAX_STR_LEN - length, |
| 7600 | "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
| 7601 | pHddStaCtx->conn_info.staId[idx], |
| 7602 | pHddStaCtx->conn_info. |
| 7603 | peerMacAddress[idx].bytes[0], |
| 7604 | pHddStaCtx->conn_info. |
| 7605 | peerMacAddress[idx].bytes[1], |
| 7606 | pHddStaCtx->conn_info. |
| 7607 | peerMacAddress[idx].bytes[2], |
| 7608 | pHddStaCtx->conn_info. |
| 7609 | peerMacAddress[idx].bytes[3], |
| 7610 | pHddStaCtx->conn_info. |
| 7611 | peerMacAddress[idx].bytes[4], |
| 7612 | pHddStaCtx->conn_info. |
| 7613 | peerMacAddress[idx].bytes[5] |
| 7614 | ); |
| 7615 | length += buf; |
| 7616 | } |
| 7617 | } |
| 7618 | wrqu->data.length = strlen(extra) + 1; |
| 7619 | break; |
| 7620 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7621 | case WE_GET_PHYMODE: |
| 7622 | { |
| 7623 | bool ch_bond24 = false, ch_bond5g = false; |
| 7624 | hdd_context_t *hddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7625 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7626 | eCsrPhyMode phymode; |
| 7627 | eCsrBand currBand; |
| 7628 | tSmeConfigParams smeconfig; |
| 7629 | |
| 7630 | sme_get_config_param(hal, &smeconfig); |
| 7631 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 7632 | smeconfig.csrConfig.channelBondingMode24GHz) |
| 7633 | ch_bond24 = true; |
| 7634 | |
| 7635 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 7636 | smeconfig.csrConfig.channelBondingMode5GHz) |
| 7637 | ch_bond5g = true; |
| 7638 | |
| 7639 | phymode = sme_get_phy_mode(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7640 | if ((QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7641 | sme_get_freq_band(hal, &currBand))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7642 | hdd_notice("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7643 | return -EIO; |
| 7644 | } |
| 7645 | |
| 7646 | switch (phymode) { |
| 7647 | case eCSR_DOT11_MODE_AUTO: |
| 7648 | snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE"); |
| 7649 | break; |
| 7650 | case eCSR_DOT11_MODE_11n: |
| 7651 | case eCSR_DOT11_MODE_11n_ONLY: |
| 7652 | if (currBand == eCSR_BAND_24) { |
| 7653 | if (ch_bond24) |
| 7654 | snprintf(extra, WE_MAX_STR_LEN, |
| 7655 | "11NGHT40"); |
| 7656 | else |
| 7657 | snprintf(extra, WE_MAX_STR_LEN, |
| 7658 | "11NGHT20"); |
| 7659 | } else if (currBand == eCSR_BAND_5G) { |
| 7660 | if (ch_bond5g) |
| 7661 | snprintf(extra, WE_MAX_STR_LEN, |
| 7662 | "11NAHT40"); |
| 7663 | else |
| 7664 | snprintf(extra, WE_MAX_STR_LEN, |
| 7665 | "11NAHT20"); |
| 7666 | } else { |
| 7667 | snprintf(extra, WE_MAX_STR_LEN, "11N"); |
| 7668 | } |
| 7669 | break; |
| 7670 | case eCSR_DOT11_MODE_abg: |
| 7671 | snprintf(extra, WE_MAX_STR_LEN, "11ABG"); |
| 7672 | break; |
| 7673 | case eCSR_DOT11_MODE_11a: |
| 7674 | snprintf(extra, WE_MAX_STR_LEN, "11A"); |
| 7675 | break; |
| 7676 | case eCSR_DOT11_MODE_11b: |
| 7677 | case eCSR_DOT11_MODE_11b_ONLY: |
| 7678 | snprintf(extra, WE_MAX_STR_LEN, "11B"); |
| 7679 | break; |
| 7680 | case eCSR_DOT11_MODE_11g: |
| 7681 | case eCSR_DOT11_MODE_11g_ONLY: |
| 7682 | snprintf(extra, WE_MAX_STR_LEN, "11G"); |
| 7683 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7684 | case eCSR_DOT11_MODE_11ac: |
| 7685 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 7686 | if (hddctx->config->vhtChannelWidth == |
| 7687 | eHT_CHANNEL_WIDTH_20MHZ) |
| 7688 | snprintf(extra, WE_MAX_STR_LEN, |
| 7689 | "11ACVHT20"); |
| 7690 | else if (hddctx->config->vhtChannelWidth == |
| 7691 | eHT_CHANNEL_WIDTH_40MHZ) |
| 7692 | snprintf(extra, WE_MAX_STR_LEN, |
| 7693 | "11ACVHT40"); |
| 7694 | else if (hddctx->config->vhtChannelWidth == |
| 7695 | eHT_CHANNEL_WIDTH_80MHZ) |
| 7696 | snprintf(extra, WE_MAX_STR_LEN, |
| 7697 | "11ACVHT80"); |
| 7698 | else if (hddctx->config->vhtChannelWidth == |
| 7699 | eHT_CHANNEL_WIDTH_160MHZ) |
| 7700 | snprintf(extra, WE_MAX_STR_LEN, |
| 7701 | "11ACVHT160"); |
| 7702 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7703 | } |
| 7704 | |
| 7705 | wrqu->data.length = strlen(extra) + 1; |
| 7706 | break; |
| 7707 | } |
| 7708 | |
| 7709 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 7710 | case WE_GET_OEM_DATA_CAP: |
| 7711 | { |
| 7712 | return iw_get_oem_data_cap(dev, info, wrqu, extra); |
| 7713 | } |
| 7714 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 7715 | case WE_GET_SNR: |
| 7716 | { |
| 7717 | int8_t s7snr = 0; |
| 7718 | int status = 0; |
| 7719 | hdd_context_t *pHddCtx; |
| 7720 | hdd_station_ctx_t *pHddStaCtx; |
| 7721 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7722 | status = wlan_hdd_validate_context(pHddCtx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 7723 | if (status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7724 | return status; |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 7725 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7726 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7727 | if (0 == pHddCtx->config->fEnableSNRMonitoring || |
| 7728 | eConnectionState_Associated != |
| 7729 | pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7730 | hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7731 | pHddCtx->config->fEnableSNRMonitoring, |
| 7732 | pHddStaCtx->conn_info.connState); |
| 7733 | return -ENONET; |
| 7734 | } |
| 7735 | wlan_hdd_get_snr(pAdapter, &s7snr); |
| 7736 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr); |
| 7737 | wrqu->data.length = strlen(extra) + 1; |
| 7738 | break; |
| 7739 | } |
| 7740 | default: |
| 7741 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7742 | hdd_err("Invalid IOCTL command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7743 | sub_cmd); |
| 7744 | break; |
| 7745 | } |
| 7746 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7747 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7748 | return 0; |
| 7749 | } |
| 7750 | |
| 7751 | static int iw_get_char_setnone(struct net_device *dev, |
| 7752 | struct iw_request_info *info, |
| 7753 | union iwreq_data *wrqu, char *extra) |
| 7754 | { |
| 7755 | int ret; |
| 7756 | |
| 7757 | cds_ssr_protect(__func__); |
| 7758 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 7759 | cds_ssr_unprotect(__func__); |
| 7760 | |
| 7761 | return ret; |
| 7762 | } |
| 7763 | |
| 7764 | /** |
| 7765 | * iw_setnone_getnone() - Generic "action" private ioctl handler |
| 7766 | * @dev: device upon which the ioctl was received |
| 7767 | * @info: ioctl request information |
| 7768 | * @wrqu: ioctl request data |
| 7769 | * @extra: ioctl extra data |
| 7770 | * |
| 7771 | * Return: 0 on success, non-zero on error |
| 7772 | */ |
| 7773 | static int __iw_setnone_getnone(struct net_device *dev, |
| 7774 | struct iw_request_info *info, |
| 7775 | union iwreq_data *wrqu, char *extra) |
| 7776 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7777 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7778 | hdd_context_t *hdd_ctx; |
| 7779 | int ret; |
| 7780 | int sub_cmd; |
| 7781 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7782 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7783 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7784 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7785 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7786 | if (0 != ret) |
| 7787 | return ret; |
| 7788 | |
| 7789 | #ifdef CONFIG_COMPAT |
| 7790 | /* this ioctl is a special case where a sub-ioctl is used and both |
| 7791 | * the number of get and set args is 0. in this specific case the |
| 7792 | * logic in iwpriv places the sub_cmd in the data.flags portion of |
| 7793 | * the iwreq. unfortunately the location of this field will be |
| 7794 | * different between 32-bit and 64-bit userspace, and the standard |
| 7795 | * compat support in the kernel does not handle this case. so we |
| 7796 | * need to explicitly handle it here. |
| 7797 | */ |
| 7798 | if (is_compat_task()) { |
| 7799 | struct compat_iw_point *compat_iw_point = |
| 7800 | (struct compat_iw_point *)&wrqu->data; |
| 7801 | sub_cmd = compat_iw_point->flags; |
| 7802 | } else { |
| 7803 | sub_cmd = wrqu->data.flags; |
| 7804 | } |
| 7805 | #else |
| 7806 | sub_cmd = wrqu->data.flags; |
| 7807 | #endif |
| 7808 | |
| 7809 | switch (sub_cmd) { |
| 7810 | case WE_GET_RECOVERY_STAT: |
| 7811 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7812 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7813 | sme_get_recovery_stats(hal); |
| 7814 | break; |
| 7815 | } |
| 7816 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7817 | case WE_GET_FW_PROFILE_DATA: |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7818 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7819 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 7820 | 0, DBG_CMD); |
| 7821 | break; |
| 7822 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7823 | case WE_IBSS_GET_PEER_INFO_ALL: |
| 7824 | { |
| 7825 | hdd_wlan_get_ibss_peer_info_all(adapter); |
| 7826 | break; |
| 7827 | } |
| 7828 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7829 | case WE_SET_REASSOC_TRIGGER: |
| 7830 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7831 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7832 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 7833 | tSirMacAddr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7834 | uint32_t roamId = 0; |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 7835 | uint8_t operating_ch = |
| 7836 | adapter->sessionCtx.station.conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7837 | tCsrRoamModifyProfileFields modProfileFields; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7838 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7839 | sme_get_modify_profile_fields(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7840 | &modProfileFields); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 7841 | if (roaming_offload_enabled(hdd_ctx)) { |
| 7842 | qdf_mem_copy(bssid, |
| 7843 | &adapter->sessionCtx.station.conn_info.bssId, |
| 7844 | sizeof(bssid)); |
| 7845 | hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId, |
| 7846 | bssid, operating_ch); |
| 7847 | } else { |
| 7848 | sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, |
| 7849 | NULL, modProfileFields, &roamId, 1); |
| 7850 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7851 | return 0; |
| 7852 | } |
| 7853 | |
| 7854 | case WE_DUMP_AGC_START: |
| 7855 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7856 | hdd_notice("WE_DUMP_AGC_START"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7857 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7858 | GEN_PARAM_DUMP_AGC_START, |
| 7859 | 0, GEN_CMD); |
| 7860 | break; |
| 7861 | } |
| 7862 | case WE_DUMP_AGC: |
| 7863 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7864 | hdd_notice("WE_DUMP_AGC"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7865 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7866 | GEN_PARAM_DUMP_AGC, |
| 7867 | 0, GEN_CMD); |
| 7868 | break; |
| 7869 | } |
| 7870 | |
| 7871 | case WE_DUMP_CHANINFO_START: |
| 7872 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7873 | hdd_notice("WE_DUMP_CHANINFO_START"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7874 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7875 | GEN_PARAM_DUMP_CHANINFO_START, |
| 7876 | 0, GEN_CMD); |
| 7877 | break; |
| 7878 | } |
| 7879 | case WE_DUMP_CHANINFO: |
| 7880 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7881 | hdd_notice("WE_DUMP_CHANINFO_START"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7882 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7883 | GEN_PARAM_DUMP_CHANINFO, |
| 7884 | 0, GEN_CMD); |
| 7885 | break; |
| 7886 | } |
| 7887 | case WE_DUMP_WATCHDOG: |
| 7888 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7889 | hdd_notice("WE_DUMP_WATCHDOG"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7890 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7891 | GEN_PARAM_DUMP_WATCHDOG, |
| 7892 | 0, GEN_CMD); |
| 7893 | break; |
| 7894 | } |
| 7895 | #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG |
| 7896 | case WE_DUMP_PCIE_LOG: |
| 7897 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7898 | hdd_err("WE_DUMP_PCIE_LOG"); |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7899 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7900 | GEN_PARAM_DUMP_PCIE_ACCESS_LOG, |
| 7901 | 0, GEN_CMD); |
| 7902 | break; |
| 7903 | } |
| 7904 | #endif |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 7905 | case WE_STOP_OBSS_SCAN: |
| 7906 | { |
| 7907 | /* |
| 7908 | * 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 7909 | * 2.OBSS scan is stopped by Firmware during the disassociation |
| 7910 | * 3.OBSS stop comamnd is added for debugging purpose |
| 7911 | */ |
| 7912 | tHalHandle hal; |
| 7913 | |
| 7914 | hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 7915 | if (hal == NULL) { |
| 7916 | hdd_err("hal context is NULL"); |
| 7917 | return -EINVAL; |
| 7918 | } |
| 7919 | sme_ht40_stop_obss_scan(hal, adapter->sessionId); |
| 7920 | } |
| 7921 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7922 | default: |
| 7923 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7924 | hdd_err("unknown ioctl %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7925 | break; |
| 7926 | } |
| 7927 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7928 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7929 | return ret; |
| 7930 | } |
| 7931 | |
| 7932 | static int iw_setnone_getnone(struct net_device *dev, |
| 7933 | struct iw_request_info *info, |
| 7934 | union iwreq_data *wrqu, char *extra) |
| 7935 | { |
| 7936 | int ret; |
| 7937 | |
| 7938 | cds_ssr_protect(__func__); |
| 7939 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 7940 | cds_ssr_unprotect(__func__); |
| 7941 | |
| 7942 | return ret; |
| 7943 | } |
| 7944 | |
| 7945 | /** |
| 7946 | * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 7947 | * @dev: device upon which the ioctl was received |
| 7948 | * @info: ioctl request information |
| 7949 | * @wrqu: ioctl request data |
| 7950 | * @extra: ioctl extra data |
| 7951 | * |
| 7952 | * This is an SSR-protected generic handler for private ioctls which |
| 7953 | * take multiple arguments. Note that this implementation is also |
| 7954 | * somewhat unique in that it is shared by both STA-mode and SAP-mode |
| 7955 | * interfaces. |
| 7956 | * |
| 7957 | * Return: 0 on success, non-zero on error |
| 7958 | */ |
| 7959 | static int __iw_set_var_ints_getnone(struct net_device *dev, |
| 7960 | struct iw_request_info *info, |
| 7961 | union iwreq_data *wrqu, char *extra) |
| 7962 | { |
| 7963 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7964 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7965 | int sub_cmd; |
| 7966 | int *apps_args = (int *) extra; |
| 7967 | hdd_context_t *hdd_ctx; |
| 7968 | int ret, num_args; |
| 7969 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7970 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7971 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7972 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7973 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7974 | if (0 != ret) |
| 7975 | return ret; |
| 7976 | |
| 7977 | if (extra == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7978 | hdd_err("NULL extra buffer pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7979 | return -EINVAL; |
| 7980 | } |
| 7981 | |
| 7982 | sub_cmd = wrqu->data.flags; |
| 7983 | num_args = wrqu->data.length; |
| 7984 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7985 | hdd_notice("Received length %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7986 | |
| 7987 | switch (sub_cmd) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7988 | case WE_IBSS_GET_PEER_INFO: |
| 7989 | { |
| 7990 | pr_info("Station ID = %d\n", apps_args[0]); |
| 7991 | hdd_wlan_get_ibss_peer_info(pAdapter, apps_args[0]); |
| 7992 | } |
| 7993 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7994 | |
| 7995 | case WE_P2P_NOA_CMD: |
| 7996 | { |
| 7997 | p2p_app_setP2pPs_t p2pNoA; |
| 7998 | |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 7999 | if (pAdapter->device_mode != QDF_P2P_GO_MODE) { |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 8000 | hdd_err("Setting NoA is not allowed in Device mode %s(%d)", |
| 8001 | hdd_device_mode_to_string( |
| 8002 | pAdapter->device_mode), |
| 8003 | pAdapter->device_mode); |
| 8004 | return -EINVAL; |
| 8005 | } |
| 8006 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8007 | p2pNoA.opp_ps = apps_args[0]; |
| 8008 | p2pNoA.ctWindow = apps_args[1]; |
| 8009 | p2pNoA.duration = apps_args[2]; |
| 8010 | p2pNoA.interval = apps_args[3]; |
| 8011 | p2pNoA.count = apps_args[4]; |
| 8012 | p2pNoA.single_noa_duration = apps_args[5]; |
| 8013 | p2pNoA.psSelection = apps_args[6]; |
| 8014 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8015 | hdd_notice("P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x", |
| 8016 | apps_args[0], apps_args[1], apps_args[2], |
| 8017 | apps_args[3], apps_args[4], |
| 8018 | apps_args[5], apps_args[6]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8019 | |
| 8020 | hdd_set_p2p_ps(dev, &p2pNoA); |
| 8021 | |
| 8022 | } |
| 8023 | break; |
| 8024 | |
| 8025 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 8026 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8027 | hdd_notice("SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
| 8028 | apps_args[0], apps_args[1]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8029 | qdf_trace_enable(apps_args[0], apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8030 | } |
| 8031 | break; |
| 8032 | |
| 8033 | case WE_MTRACE_DUMP_CMD: |
| 8034 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8035 | hdd_notice("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ", |
| 8036 | apps_args[0], apps_args[1], |
| 8037 | apps_args[2], apps_args[3]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8038 | qdf_trace_dump_all((void *)hHal, apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8039 | apps_args[1], apps_args[2], |
| 8040 | apps_args[3]); |
| 8041 | |
| 8042 | } |
| 8043 | break; |
| 8044 | |
| 8045 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 8046 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8047 | hdd_err("<iwpriv wlan0 pm_clist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8048 | cds_incr_connection_count_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8049 | apps_args[1], apps_args[2], apps_args[3], |
| 8050 | apps_args[4], apps_args[5], apps_args[6], |
| 8051 | apps_args[7]); |
| 8052 | } |
| 8053 | break; |
| 8054 | |
| 8055 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 8056 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8057 | hdd_err("<iwpriv wlan0 pm_dlist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8058 | cds_decr_connection_count_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8059 | apps_args[1]); |
| 8060 | } |
| 8061 | break; |
| 8062 | |
| 8063 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 8064 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8065 | hdd_err("<iwpriv wlan0 pm_ulist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8066 | cds_update_connection_info_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8067 | apps_args[1], apps_args[2], apps_args[3], |
| 8068 | apps_args[4], apps_args[5], apps_args[6], |
| 8069 | apps_args[7]); |
| 8070 | } |
| 8071 | break; |
| 8072 | |
| 8073 | case WE_POLICY_MANAGER_DBS_CMD: |
| 8074 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8075 | hdd_err("<iwpriv wlan0 pm_dbs> is called"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8076 | if (apps_args[0] == 0) |
| 8077 | wma_set_dbs_capability_ut(0); |
| 8078 | else |
| 8079 | wma_set_dbs_capability_ut(1); |
| 8080 | |
| 8081 | if (apps_args[1] >= CDS_THROUGHPUT && |
| 8082 | apps_args[1] <= CDS_LATENCY) { |
| 8083 | pr_info("setting system pref to [%d]\n", apps_args[1]); |
| 8084 | hdd_ctx->config->conc_system_pref = apps_args[1]; |
| 8085 | } |
| 8086 | } |
| 8087 | break; |
| 8088 | |
| 8089 | case WE_POLICY_MANAGER_PCL_CMD: |
| 8090 | { |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 8091 | uint8_t pcl[QDF_MAX_NUM_CHAN] = {0}; |
| 8092 | uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8093 | uint32_t pcl_len = 0, i = 0; |
| 8094 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8095 | hdd_err("<iwpriv wlan0 pm_pcl> is called"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8096 | |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8097 | cds_get_pcl(apps_args[0], |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8098 | pcl, &pcl_len, |
| 8099 | weight_list, QDF_ARRAY_SIZE(weight_list)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8100 | pr_info("PCL list for role[%d] is {", apps_args[0]); |
| 8101 | for (i = 0 ; i < pcl_len; i++) |
| 8102 | pr_info(" %d, ", pcl[i]); |
| 8103 | pr_info("}--------->\n"); |
| 8104 | } |
| 8105 | break; |
| 8106 | |
| 8107 | case WE_POLICY_MANAGER_CINFO_CMD: |
| 8108 | { |
| 8109 | struct cds_conc_connection_info *conn_info; |
| 8110 | uint32_t i = 0, len = 0; |
| 8111 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8112 | hdd_err("<iwpriv wlan0 pm_cinfo> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8113 | conn_info = cds_get_conn_info(&len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8114 | pr_info("+-----------------------------+\n"); |
| 8115 | for (i = 0; i < len; i++) { |
| 8116 | pr_info("|table_index[%d]\t\t|\n", i); |
| 8117 | pr_info("|\t|vdev_id - %d\t\t|\n", conn_info->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8118 | pr_info("|\t|chan - %d\t\t|\n", conn_info->chan); |
Tushnim Bhattacharyya | 7624a18 | 2016-03-30 13:30:46 -0700 | [diff] [blame] | 8119 | pr_info("|\t|bw - %d\t\t|\n", conn_info->bw); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8120 | pr_info("|\t|mode - %d\t\t|\n", conn_info->mode); |
| 8121 | pr_info("|\t|mac - %d\t\t|\n", conn_info->mac); |
| 8122 | pr_info("|\t|in_use - %d\t\t|\n", conn_info->in_use); |
| 8123 | pr_info("+-----------------------------+\n"); |
| 8124 | conn_info++; |
| 8125 | } |
| 8126 | } |
| 8127 | break; |
| 8128 | |
| 8129 | case WE_POLICY_SET_HW_MODE_CMD: |
| 8130 | { |
| 8131 | if (apps_args[0] == 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8132 | hdd_err("set hw mode for single mac"); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8133 | cds_pdev_set_hw_mode( |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8134 | pAdapter->sessionId, |
| 8135 | HW_MODE_SS_2x2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8136 | HW_MODE_80_MHZ, |
| 8137 | HW_MODE_SS_0x0, HW_MODE_BW_NONE, |
| 8138 | HW_MODE_DBS_NONE, |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8139 | HW_MODE_AGILE_DFS_NONE, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 8140 | HW_MODE_SBS_NONE, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8141 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8142 | } else if (apps_args[0] == 1) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8143 | hdd_err("set hw mode for dual mac"); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8144 | cds_pdev_set_hw_mode( |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8145 | pAdapter->sessionId, |
| 8146 | HW_MODE_SS_1x1, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8147 | HW_MODE_80_MHZ, |
| 8148 | HW_MODE_SS_1x1, HW_MODE_40_MHZ, |
| 8149 | HW_MODE_DBS, |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8150 | HW_MODE_AGILE_DFS_NONE, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 8151 | HW_MODE_SBS_NONE, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8152 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8153 | } |
| 8154 | } |
| 8155 | break; |
| 8156 | |
| 8157 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 8158 | { |
| 8159 | enum cds_conc_next_action action; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8160 | hdd_err("<iwpriv wlan0 pm_query_action> is called"); |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8161 | action = cds_current_connections_update(pAdapter->sessionId, |
| 8162 | apps_args[0], |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8163 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8164 | pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action); |
| 8165 | } |
| 8166 | break; |
| 8167 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 8168 | { |
| 8169 | bool allow; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8170 | hdd_err("<iwpriv wlan0 pm_query_allow> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8171 | allow = cds_allow_concurrency( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8172 | apps_args[0], apps_args[1], apps_args[2]); |
| 8173 | pr_info("allow %d {0 = don't allow, 1 = allow}", allow); |
| 8174 | } |
| 8175 | break; |
| 8176 | |
| 8177 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 8178 | { |
| 8179 | clean_report(hdd_ctx); |
| 8180 | if (apps_args[0] == 1) { |
| 8181 | wlan_hdd_one_connection_scenario(hdd_ctx); |
| 8182 | } else if (apps_args[0] == 2) { |
| 8183 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8184 | 6, CDS_TWO_TWO); |
| 8185 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8186 | 36, CDS_TWO_TWO); |
| 8187 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8188 | 6, CDS_ONE_ONE); |
| 8189 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8190 | 36, CDS_ONE_ONE); |
| 8191 | } else if (apps_args[0] == 3) { |
| 8192 | /* MCC on same band with 2x2 same mac*/ |
| 8193 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8194 | 6, 11, CDS_TWO_TWO, 0); |
| 8195 | /* MCC on diff band with 2x2 same mac*/ |
| 8196 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8197 | 6, 36, CDS_TWO_TWO, 0); |
| 8198 | /* MCC on diff band with 1x1 diff mac */ |
| 8199 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8200 | 36, 6, CDS_ONE_ONE, 0); |
| 8201 | /* MCC on diff band with 1x1 same mac */ |
| 8202 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8203 | 36, 6, CDS_ONE_ONE, 1); |
| 8204 | /* SCC on same band with 2x2 same mac */ |
| 8205 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8206 | 36, 36, CDS_TWO_TWO, 0); |
| 8207 | /* SCC on same band with 1x1 same mac */ |
| 8208 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8209 | 36, 36, CDS_ONE_ONE, 1); |
| 8210 | /* MCC on same band with 2x2 same mac */ |
| 8211 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8212 | 36, 149, CDS_TWO_TWO, 0); |
| 8213 | /* MCC on same band with 1x1 same mac */ |
| 8214 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8215 | 36, 149, CDS_ONE_ONE, 1); |
| 8216 | } |
| 8217 | print_report(hdd_ctx); |
| 8218 | } |
| 8219 | break; |
| 8220 | |
| 8221 | #ifdef FEATURE_WLAN_TDLS |
| 8222 | case WE_TDLS_CONFIG_PARAMS: |
| 8223 | { |
| 8224 | tdls_config_params_t tdlsParams; |
| 8225 | |
| 8226 | tdlsParams.tdls = apps_args[0]; |
| 8227 | tdlsParams.tx_period_t = apps_args[1]; |
| 8228 | tdlsParams.tx_packet_n = apps_args[2]; |
| 8229 | /* ignore args[3] as discovery_period is not used anymore */ |
| 8230 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 8231 | /* ignore args[5] as idle_timeout is not used anymore */ |
| 8232 | tdlsParams.idle_packet_n = apps_args[6]; |
| 8233 | /* ignore args[7] as rssi_hysteresis is not used anymore */ |
| 8234 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 8235 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
| 8236 | tdlsParams.rssi_delta = apps_args[10]; |
| 8237 | |
| 8238 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
| 8239 | } |
| 8240 | break; |
| 8241 | #endif |
| 8242 | case WE_UNIT_TEST_CMD: |
| 8243 | { |
| 8244 | t_wma_unit_test_cmd *unitTestArgs; |
| 8245 | cds_msg_t msg = { 0 }; |
| 8246 | int i, j; |
| 8247 | if ((apps_args[0] < WLAN_MODULE_ID_MIN) || |
| 8248 | (apps_args[0] >= WLAN_MODULE_ID_MAX)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8249 | hdd_err("Invalid MODULE ID %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8250 | apps_args[0]); |
| 8251 | return -EINVAL; |
| 8252 | } |
Anurag Chouhan | 7756418 | 2016-09-03 16:38:01 +0530 | [diff] [blame] | 8253 | if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) || |
| 8254 | (apps_args[1] < 0)) { |
| 8255 | hdd_err("Too Many/Few args %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8256 | apps_args[1]); |
| 8257 | return -EINVAL; |
| 8258 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8259 | unitTestArgs = qdf_mem_malloc(sizeof(*unitTestArgs)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8260 | if (NULL == unitTestArgs) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8261 | hdd_err("qdf_mem_malloc failed for unitTestArgs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8262 | return -ENOMEM; |
| 8263 | } |
| 8264 | unitTestArgs->vdev_id = (int)pAdapter->sessionId; |
| 8265 | unitTestArgs->module_id = apps_args[0]; |
| 8266 | unitTestArgs->num_args = apps_args[1]; |
| 8267 | for (i = 0, j = 2; i < unitTestArgs->num_args; i++, j++) { |
| 8268 | unitTestArgs->args[i] = apps_args[j]; |
| 8269 | } |
| 8270 | msg.type = SIR_HAL_UNIT_TEST_CMD; |
| 8271 | msg.reserved = 0; |
| 8272 | msg.bodyptr = unitTestArgs; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8273 | if (QDF_STATUS_SUCCESS != |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8274 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8275 | qdf_mem_free(unitTestArgs); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8276 | hdd_err("Not able to post UNIT_TEST_CMD message to WMA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8277 | return -EINVAL; |
| 8278 | } |
| 8279 | } |
| 8280 | break; |
| 8281 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 8282 | case WE_LED_FLASHING_PARAM: |
| 8283 | { |
| 8284 | int i; |
| 8285 | if (num_args != 4) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8286 | hdd_err("gpio_control: 4 parameters are required"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8287 | return -EINVAL; |
| 8288 | } |
| 8289 | for (i = 0; i < num_args; i++) { |
| 8290 | if (apps_args[i] >= 0x7fffffff) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8291 | hdd_err("gpio_control: parameter should be less than 0x7fffffff"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8292 | return -EINVAL; |
| 8293 | } |
| 8294 | } |
| 8295 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8296 | 0, apps_args[0], apps_args[1]); |
| 8297 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8298 | 1, apps_args[2], apps_args[3]); |
| 8299 | } |
| 8300 | break; |
| 8301 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 8302 | case WE_SET_PKTLOG: |
| 8303 | { |
| 8304 | int ret; |
| 8305 | |
| 8306 | if (num_args < 1 || num_args > 2) { |
| 8307 | hdd_err("pktlog: either 1 or 2 parameters are required"); |
| 8308 | return -EINVAL; |
| 8309 | } |
| 8310 | |
| 8311 | ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0], |
| 8312 | apps_args[1]); |
| 8313 | if (ret) |
| 8314 | return ret; |
| 8315 | break; |
| 8316 | } |
| 8317 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 8318 | case WE_MAC_PWR_DEBUG_CMD: |
| 8319 | { |
| 8320 | struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args; |
| 8321 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8322 | int i, j; |
| 8323 | |
| 8324 | if (num_args < 3) { |
| 8325 | hdd_err("number of arguments can't be null %d", |
| 8326 | num_args); |
| 8327 | return -EINVAL; |
| 8328 | } |
| 8329 | if (num_args - 3 != apps_args[2]) { |
| 8330 | hdd_err("arg list of size %d doesn't match num_args %d", |
| 8331 | num_args-3, apps_args[2]); |
| 8332 | return -EINVAL; |
| 8333 | } |
| 8334 | if ((apps_args[1] < WLAN_MODULE_ID_MIN) || |
| 8335 | (apps_args[1] >= WLAN_MODULE_ID_MAX)) { |
| 8336 | hdd_err("Invalid MODULE ID %d", apps_args[1]); |
| 8337 | return -EINVAL; |
| 8338 | } |
| 8339 | if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) { |
| 8340 | hdd_err("Too Many args %d", apps_args[2]); |
| 8341 | return -EINVAL; |
| 8342 | } |
| 8343 | mac_pwr_dbg_args.pdev_id = apps_args[0]; |
| 8344 | mac_pwr_dbg_args.module_id = apps_args[1]; |
| 8345 | mac_pwr_dbg_args.num_args = apps_args[2]; |
| 8346 | |
| 8347 | for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++) |
| 8348 | mac_pwr_dbg_args.args[i] = apps_args[j]; |
| 8349 | |
| 8350 | if (QDF_STATUS_SUCCESS != |
| 8351 | sme_process_mac_pwr_dbg_cmd(hal, pAdapter->sessionId, |
| 8352 | &mac_pwr_dbg_args)) { |
| 8353 | return -EINVAL; |
| 8354 | } |
| 8355 | } |
| 8356 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8357 | default: |
| 8358 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8359 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8360 | } |
| 8361 | break; |
| 8362 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8363 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8364 | return 0; |
| 8365 | } |
| 8366 | |
| 8367 | /** |
| 8368 | * iw_hdd_set_var_ints_getnone() - set var ints getnone callback |
| 8369 | * @dev: pointer to net_device structure |
| 8370 | * @info: pointer to iw_request_info structure |
| 8371 | * @wrqu: pointer to iwreq_data |
| 8372 | * @extra; extra |
| 8373 | * |
| 8374 | * Return: 0 on success, error number otherwise |
| 8375 | * |
| 8376 | */ |
| 8377 | static int iw_hdd_set_var_ints_getnone(struct net_device *dev, |
| 8378 | struct iw_request_info *info, |
| 8379 | union iwreq_data *wrqu, char *extra) |
| 8380 | { |
| 8381 | union iwreq_data u_priv_wrqu; |
| 8382 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 8383 | int ret, num_args; |
| 8384 | |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 8385 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8386 | hdd_err("permission check failed"); |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 8387 | return -EPERM; |
| 8388 | } |
| 8389 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8390 | /* Helper function to get iwreq_data with compat handling. */ |
| 8391 | if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) |
| 8392 | return -EINVAL; |
| 8393 | |
| 8394 | if (NULL == u_priv_wrqu.data.pointer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8395 | hdd_err("NULL data pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8396 | return -EINVAL; |
| 8397 | } |
| 8398 | |
| 8399 | num_args = u_priv_wrqu.data.length; |
| 8400 | if (num_args > MAX_VAR_ARGS) |
| 8401 | num_args = MAX_VAR_ARGS; |
| 8402 | |
| 8403 | if (copy_from_user(apps_args, u_priv_wrqu.data.pointer, |
| 8404 | (sizeof(int)) * num_args)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8405 | hdd_err("failed to copy data from user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8406 | return -EFAULT; |
| 8407 | } |
| 8408 | |
| 8409 | cds_ssr_protect(__func__); |
| 8410 | ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu, |
| 8411 | (char *)&apps_args); |
| 8412 | cds_ssr_unprotect(__func__); |
| 8413 | return ret; |
| 8414 | } |
| 8415 | |
| 8416 | /** |
| 8417 | * iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 8418 | * @dev: device upon which the ioctl was received |
| 8419 | * @info: ioctl request information |
| 8420 | * @wrqu: ioctl request data |
| 8421 | * @extra: ioctl extra data |
| 8422 | * |
| 8423 | * This is a generic handler for private ioctls which take multiple |
| 8424 | * arguments. Note that this implementation is also somewhat unique |
| 8425 | * in that it is shared by both STA-mode and SAP-mode interfaces. |
| 8426 | * |
| 8427 | * Return: 0 on success, non-zero on error |
| 8428 | */ |
| 8429 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 8430 | struct iw_request_info *info, |
| 8431 | union iwreq_data *wrqu, char *extra) |
| 8432 | { |
| 8433 | int ret; |
| 8434 | |
| 8435 | cds_ssr_protect(__func__); |
| 8436 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 8437 | cds_ssr_unprotect(__func__); |
| 8438 | return ret; |
| 8439 | } |
| 8440 | |
| 8441 | /** |
| 8442 | * iw_add_tspec - Add TSpec private ioctl handler |
| 8443 | * @dev: device upon which the ioctl was received |
| 8444 | * @info: ioctl request information |
| 8445 | * @wrqu: ioctl request data |
| 8446 | * @extra: ioctl extra data |
| 8447 | * |
| 8448 | * Return: 0 on success, non-zero on error |
| 8449 | */ |
| 8450 | static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info, |
| 8451 | union iwreq_data *wrqu, char *extra) |
| 8452 | { |
| 8453 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8454 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8455 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 8456 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
| 8457 | sme_QosWmmTspecInfo tSpec; |
| 8458 | uint32_t handle; |
| 8459 | struct iw_point s_priv_data; |
| 8460 | hdd_context_t *hdd_ctx; |
| 8461 | int ret; |
| 8462 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8463 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8464 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8465 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8466 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8467 | if (0 != ret) |
| 8468 | return ret; |
| 8469 | |
| 8470 | /* make sure the application is sufficiently priviledged */ |
| 8471 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 8472 | /* this ioctl wants to return status to user space it must be */ |
| 8473 | /* defined as a "get" ioctl */ |
| 8474 | if (!capable(CAP_NET_ADMIN)) { |
| 8475 | return -EPERM; |
| 8476 | } |
| 8477 | |
| 8478 | /* we must be associated in order to add a tspec */ |
| 8479 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 8480 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8481 | return 0; |
| 8482 | } |
| 8483 | /* since we are defined to be a "get" ioctl, and since the number */ |
| 8484 | /* of params exceeds the number of params that wireless extensions */ |
| 8485 | /* will pass down in the iwreq_data, we must copy the "set" params. */ |
| 8486 | /* We must handle the compat for iwreq_data in 32U/64K environment. */ |
| 8487 | |
| 8488 | /* helper function to get iwreq_data with compat handling. */ |
| 8489 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 8490 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8491 | return 0; |
| 8492 | } |
| 8493 | /* make sure all params are correctly passed to function */ |
| 8494 | if ((NULL == s_priv_data.pointer) || |
| 8495 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) { |
| 8496 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8497 | return 0; |
| 8498 | } |
| 8499 | /* from user space ourselves */ |
| 8500 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) { |
| 8501 | /* hmmm, can't get them */ |
| 8502 | return -EIO; |
| 8503 | } |
| 8504 | /* clear the tspec */ |
| 8505 | memset(&tSpec, 0, sizeof(tSpec)); |
| 8506 | |
| 8507 | /* validate the handle */ |
| 8508 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8509 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 8510 | /* that one is reserved */ |
| 8511 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8512 | return 0; |
| 8513 | } |
| 8514 | /* validate the TID */ |
| 8515 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) { |
| 8516 | /* out of range */ |
| 8517 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8518 | return 0; |
| 8519 | } |
| 8520 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 8521 | |
| 8522 | /* validate the direction */ |
| 8523 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) { |
| 8524 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 8525 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 8526 | break; |
| 8527 | |
| 8528 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 8529 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 8530 | break; |
| 8531 | |
| 8532 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 8533 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 8534 | break; |
| 8535 | |
| 8536 | default: |
| 8537 | /* unknown */ |
| 8538 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8539 | return 0; |
| 8540 | } |
| 8541 | |
| 8542 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 8543 | |
| 8544 | /* validate the user priority */ |
| 8545 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) { |
| 8546 | /* out of range */ |
| 8547 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8548 | return 0; |
| 8549 | } |
| 8550 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
| 8551 | if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8552 | hdd_err("***ts_info.up out of bounds***"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8553 | return 0; |
| 8554 | } |
| 8555 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8556 | hdd_info("TS_INFO PSB %d UP %d !!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8557 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 8558 | |
| 8559 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 8560 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 8561 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 8562 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 8563 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 8564 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 8565 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 8566 | tSpec.surplus_bw_allowance = |
| 8567 | params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 8568 | tSpec.min_service_interval = |
| 8569 | params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 8570 | tSpec.max_service_interval = |
| 8571 | params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 8572 | tSpec.suspension_interval = |
| 8573 | params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 8574 | tSpec.inactivity_interval = |
| 8575 | params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 8576 | |
| 8577 | tSpec.ts_info.burst_size_defn = |
| 8578 | params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 8579 | |
| 8580 | /* validate the ts info ack policy */ |
| 8581 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) { |
| 8582 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 8583 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 8584 | break; |
| 8585 | |
| 8586 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 8587 | tSpec.ts_info.ack_policy = |
| 8588 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 8589 | break; |
| 8590 | |
| 8591 | default: |
| 8592 | /* unknown */ |
| 8593 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8594 | return 0; |
| 8595 | } |
| 8596 | |
| 8597 | *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8598 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8599 | return 0; |
| 8600 | } |
| 8601 | |
| 8602 | static int iw_add_tspec(struct net_device *dev, |
| 8603 | struct iw_request_info *info, |
| 8604 | union iwreq_data *wrqu, char *extra) |
| 8605 | { |
| 8606 | int ret; |
| 8607 | |
| 8608 | cds_ssr_protect(__func__); |
| 8609 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 8610 | cds_ssr_unprotect(__func__); |
| 8611 | |
| 8612 | return ret; |
| 8613 | } |
| 8614 | |
| 8615 | /** |
| 8616 | * iw_del_tspec - Delete TSpec private ioctl handler |
| 8617 | * @dev: device upon which the ioctl was received |
| 8618 | * @info: ioctl request information |
| 8619 | * @wrqu: ioctl request data |
| 8620 | * @extra: ioctl extra data |
| 8621 | * |
| 8622 | * Return: 0 on success, non-zero on error |
| 8623 | */ |
| 8624 | static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info, |
| 8625 | union iwreq_data *wrqu, char *extra) |
| 8626 | { |
| 8627 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8628 | hdd_context_t *hdd_ctx; |
| 8629 | int *params = (int *)extra; |
| 8630 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 8631 | uint32_t handle; |
| 8632 | int ret; |
| 8633 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8634 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8635 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8636 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8637 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8638 | if (0 != ret) |
| 8639 | return ret; |
| 8640 | |
| 8641 | /* make sure the application is sufficiently priviledged */ |
| 8642 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 8643 | /* this ioctl wants to return status to user space it must be */ |
| 8644 | /* defined as a "get" ioctl */ |
| 8645 | if (!capable(CAP_NET_ADMIN)) { |
| 8646 | return -EPERM; |
| 8647 | } |
| 8648 | |
| 8649 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 8650 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 8651 | /* is no need to copy the params from user space */ |
| 8652 | |
| 8653 | /* validate the handle */ |
| 8654 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8655 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 8656 | /* that one is reserved */ |
| 8657 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8658 | return 0; |
| 8659 | } |
| 8660 | |
| 8661 | *pStatus = hdd_wmm_delts(pAdapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8662 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8663 | return 0; |
| 8664 | } |
| 8665 | |
| 8666 | static int iw_del_tspec(struct net_device *dev, |
| 8667 | struct iw_request_info *info, |
| 8668 | union iwreq_data *wrqu, char *extra) |
| 8669 | { |
| 8670 | int ret; |
| 8671 | |
| 8672 | cds_ssr_protect(__func__); |
| 8673 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 8674 | cds_ssr_unprotect(__func__); |
| 8675 | |
| 8676 | return ret; |
| 8677 | } |
| 8678 | |
| 8679 | /** |
| 8680 | * iw_get_tspec - Get TSpec private ioctl handler |
| 8681 | * @dev: device upon which the ioctl was received |
| 8682 | * @info: ioctl request information |
| 8683 | * @wrqu: ioctl request data |
| 8684 | * @extra: ioctl extra data |
| 8685 | * |
| 8686 | * Return: 0 on success, non-zero on error |
| 8687 | */ |
| 8688 | static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info, |
| 8689 | union iwreq_data *wrqu, char *extra) |
| 8690 | { |
| 8691 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8692 | hdd_context_t *hdd_ctx; |
| 8693 | int *params = (int *)extra; |
| 8694 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 8695 | uint32_t handle; |
| 8696 | int ret; |
| 8697 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8698 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8699 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8700 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8701 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8702 | if (0 != ret) |
| 8703 | return ret; |
| 8704 | |
| 8705 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 8706 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 8707 | /* is no need to copy the params from user space */ |
| 8708 | |
| 8709 | /* validate the handle */ |
| 8710 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8711 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 8712 | /* that one is reserved */ |
| 8713 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8714 | return 0; |
| 8715 | } |
| 8716 | |
| 8717 | *pStatus = hdd_wmm_checkts(pAdapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8718 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8719 | return 0; |
| 8720 | } |
| 8721 | |
| 8722 | static int iw_get_tspec(struct net_device *dev, |
| 8723 | struct iw_request_info *info, |
| 8724 | union iwreq_data *wrqu, char *extra) |
| 8725 | { |
| 8726 | int ret; |
| 8727 | |
| 8728 | cds_ssr_protect(__func__); |
| 8729 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 8730 | cds_ssr_unprotect(__func__); |
| 8731 | |
| 8732 | return ret; |
| 8733 | } |
| 8734 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8735 | /** |
| 8736 | * iw_set_fties - Set FT IEs private ioctl handler |
| 8737 | * @dev: device upon which the ioctl was received |
| 8738 | * @info: ioctl request information |
| 8739 | * @wrqu: ioctl request data |
| 8740 | * @extra: ioctl extra data |
| 8741 | * |
| 8742 | * Each time the supplicant has the auth_request or reassoc request |
| 8743 | * IEs ready they are pushed to the driver. The driver will in turn |
| 8744 | * use it to send out the auth req and reassoc req for 11r FT Assoc. |
| 8745 | * |
| 8746 | * Return: 0 on success, non-zero on error |
| 8747 | */ |
| 8748 | static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info, |
| 8749 | union iwreq_data *wrqu, char *extra) |
| 8750 | { |
| 8751 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8752 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8753 | hdd_context_t *hdd_ctx; |
| 8754 | int ret; |
| 8755 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8756 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8757 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8758 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8759 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8760 | if (0 != ret) |
| 8761 | return ret; |
| 8762 | |
| 8763 | if (!wrqu->data.length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8764 | hdd_err("called with 0 length IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8765 | return -EINVAL; |
| 8766 | } |
| 8767 | if (wrqu->data.pointer == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8768 | hdd_err("called with NULL IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8769 | return -EINVAL; |
| 8770 | } |
| 8771 | /* Added for debug on reception of Re-assoc Req. */ |
| 8772 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8773 | hdd_err("Called with Ie of length = %d when not associated", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8774 | wrqu->data.length); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8775 | hdd_err("Should be Re-assoc Req IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8776 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8777 | hdd_notice("called with Ie of length = %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8778 | |
| 8779 | /* Pass the received FT IEs to SME */ |
| 8780 | sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 8781 | extra, wrqu->data.length); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8782 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8783 | return 0; |
| 8784 | } |
| 8785 | |
| 8786 | static int iw_set_fties(struct net_device *dev, |
| 8787 | struct iw_request_info *info, |
| 8788 | union iwreq_data *wrqu, char *extra) |
| 8789 | { |
| 8790 | int ret; |
| 8791 | |
| 8792 | cds_ssr_protect(__func__); |
| 8793 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 8794 | cds_ssr_unprotect(__func__); |
| 8795 | |
| 8796 | return ret; |
| 8797 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8798 | |
| 8799 | /** |
| 8800 | * iw_set_host_offload - Set host offload ioctl handler |
| 8801 | * @dev: device upon which the ioctl was received |
| 8802 | * @info: ioctl request information |
| 8803 | * @wrqu: ioctl request data |
| 8804 | * @extra: ioctl extra data |
| 8805 | * |
| 8806 | * Return: 0 on success, non-zero on error |
| 8807 | */ |
| 8808 | static int __iw_set_host_offload(struct net_device *dev, |
| 8809 | struct iw_request_info *info, |
| 8810 | union iwreq_data *wrqu, char *extra) |
| 8811 | { |
| 8812 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8813 | tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra; |
| 8814 | tSirHostOffloadReq offloadRequest; |
| 8815 | hdd_context_t *hdd_ctx; |
| 8816 | int ret; |
| 8817 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8818 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8819 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8820 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8821 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8822 | if (0 != ret) |
| 8823 | return ret; |
| 8824 | |
| 8825 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8826 | hdd_err("dev is not in CONNECTED state, ignore!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8827 | return -EINVAL; |
| 8828 | } |
| 8829 | |
| 8830 | /* Debug display of request components. */ |
| 8831 | switch (pRequest->offloadType) { |
| 8832 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8833 | hdd_warn("Host offload request: ARP reply"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8834 | switch (pRequest->enableOrDisable) { |
| 8835 | case WLAN_OFFLOAD_DISABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8836 | hdd_warn(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8837 | break; |
| 8838 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8839 | hdd_warn(" BC Filtering enable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8840 | case WLAN_OFFLOAD_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8841 | hdd_warn(" ARP offload enable"); |
| 8842 | hdd_warn(" IP address: %d.%d.%d.%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8843 | pRequest->params.hostIpv4Addr[0], |
| 8844 | pRequest->params.hostIpv4Addr[1], |
| 8845 | pRequest->params.hostIpv4Addr[2], |
| 8846 | pRequest->params.hostIpv4Addr[3]); |
| 8847 | } |
| 8848 | break; |
| 8849 | |
| 8850 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8851 | hdd_info("Host offload request: neighbor discovery"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8852 | switch (pRequest->enableOrDisable) { |
| 8853 | case WLAN_OFFLOAD_DISABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8854 | hdd_info(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8855 | break; |
| 8856 | case WLAN_OFFLOAD_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8857 | hdd_info(" enable"); |
| 8858 | hdd_info(" IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8859 | *(uint16_t *) (pRequest->params.hostIpv6Addr), |
| 8860 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8861 | 2), |
| 8862 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8863 | 4), |
| 8864 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8865 | 6), |
| 8866 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8867 | 8), |
| 8868 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8869 | 10), |
| 8870 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8871 | 12), |
| 8872 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 8873 | 14)); |
| 8874 | } |
| 8875 | } |
| 8876 | |
| 8877 | /* Execute offload request. The reason that we can copy the |
| 8878 | * request information from the ioctl structure to the SME |
| 8879 | * structure is that they are laid out exactly the same. |
| 8880 | * Otherwise, each piece of information would have to be |
| 8881 | * copied individually. |
| 8882 | */ |
| 8883 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8884 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8885 | sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8886 | pAdapter->sessionId, &offloadRequest)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8887 | hdd_err("Failure to execute host offload request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8888 | return -EINVAL; |
| 8889 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8890 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8891 | return 0; |
| 8892 | } |
| 8893 | |
| 8894 | static int iw_set_host_offload(struct net_device *dev, |
| 8895 | struct iw_request_info *info, |
| 8896 | union iwreq_data *wrqu, char *extra) |
| 8897 | { |
| 8898 | int ret; |
| 8899 | |
| 8900 | cds_ssr_protect(__func__); |
| 8901 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 8902 | cds_ssr_unprotect(__func__); |
| 8903 | |
| 8904 | return ret; |
| 8905 | } |
| 8906 | |
| 8907 | /** |
| 8908 | * iw_set_keepalive_params - Set keepalive params ioctl handler |
| 8909 | * @dev: device upon which the ioctl was received |
| 8910 | * @info: ioctl request information |
| 8911 | * @wrqu: ioctl request data |
| 8912 | * @extra: ioctl extra data |
| 8913 | * |
| 8914 | * Return: 0 on success, non-zero on error |
| 8915 | */ |
| 8916 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 8917 | struct iw_request_info *info, |
| 8918 | union iwreq_data *wrqu, char *extra) |
| 8919 | { |
| 8920 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8921 | tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8922 | hdd_context_t *hdd_ctx; |
| 8923 | int ret; |
| 8924 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8925 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8926 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8927 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8928 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8929 | if (0 != ret) |
| 8930 | return ret; |
| 8931 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8932 | if (wrqu->data.length != sizeof(*request)) { |
| 8933 | hdd_err("Invalid length %d", wrqu->data.length); |
| 8934 | return -EINVAL; |
| 8935 | } |
| 8936 | |
| 8937 | if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) { |
| 8938 | hdd_err("Value of timePeriod %d exceed Max limit %d", |
| 8939 | request->timePeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8940 | WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX); |
| 8941 | return -EINVAL; |
| 8942 | } |
| 8943 | |
| 8944 | /* Debug display of request components. */ |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8945 | hdd_info("Set Keep Alive Request : TimePeriod %d size %zu", |
| 8946 | request->timePeriod, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8947 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8948 | switch (request->packetType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8949 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8950 | hdd_info("Keep Alive Request: Tx NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8951 | break; |
| 8952 | |
| 8953 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8954 | hdd_info("Keep Alive Request: Tx UnSolicited ARP RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8955 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8956 | hdd_info("Host IP address: %d.%d.%d.%d", |
| 8957 | request->hostIpv4Addr[0], request->hostIpv4Addr[1], |
| 8958 | request->hostIpv4Addr[2], request->hostIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8959 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8960 | hdd_info("Dest IP address: %d.%d.%d.%d", |
| 8961 | request->destIpv4Addr[0], request->destIpv4Addr[1], |
| 8962 | request->destIpv4Addr[2], request->destIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8963 | |
Srinivas Girigowda | 9c330a9 | 2015-11-24 12:28:25 -0800 | [diff] [blame] | 8964 | hdd_info("Dest MAC address: "MAC_ADDRESS_STR, |
| 8965 | MAC_ADDR_ARRAY(request->dest_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8966 | break; |
| 8967 | } |
| 8968 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8969 | hdd_info("Keep alive period %d", request->timePeriod); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8970 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8971 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8972 | sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 8973 | pAdapter->sessionId, request)) { |
| 8974 | hdd_err("Failure to execute Keep Alive"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8975 | return -EINVAL; |
| 8976 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8977 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8978 | return 0; |
| 8979 | } |
| 8980 | |
| 8981 | static int iw_set_keepalive_params(struct net_device *dev, |
| 8982 | struct iw_request_info *info, |
| 8983 | union iwreq_data *wrqu, |
| 8984 | char *extra) |
| 8985 | { |
| 8986 | int ret; |
| 8987 | |
| 8988 | cds_ssr_protect(__func__); |
| 8989 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 8990 | cds_ssr_unprotect(__func__); |
| 8991 | |
| 8992 | return ret; |
| 8993 | } |
| 8994 | |
| 8995 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 8996 | /** |
| 8997 | * wlan_hdd_set_filter() - Set packet filter |
| 8998 | * @hdd_ctx: Global HDD context |
| 8999 | * @request: Packet filter request struct |
| 9000 | * @sessionId: Target session for the request |
| 9001 | * |
| 9002 | * Return: 0 on success, non-zero on error |
| 9003 | */ |
| 9004 | static int wlan_hdd_set_filter(hdd_context_t *hdd_ctx, |
| 9005 | struct pkt_filter_cfg *request, |
| 9006 | uint8_t sessionId) |
| 9007 | { |
| 9008 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 9009 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
| 9010 | int i = 0; |
| 9011 | |
| 9012 | if (hdd_ctx->config->disablePacketFilter) { |
| 9013 | hdd_err("packet filtering disabled in ini returning"); |
| 9014 | return 0; |
| 9015 | } |
| 9016 | |
| 9017 | /* Debug display of request components. */ |
| 9018 | hdd_info("Packet Filter Request : FA %d params %d", |
| 9019 | request->filter_action, request->num_params); |
| 9020 | |
| 9021 | switch (request->filter_action) { |
| 9022 | case HDD_RCV_FILTER_SET: |
| 9023 | hdd_info("Set Packet Filter Request for Id: %d", |
| 9024 | request->filter_id); |
| 9025 | |
| 9026 | packetFilterSetReq.filterId = request->filter_id; |
| 9027 | if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) { |
| 9028 | hdd_err("Number of Params exceed Max limit %d", |
| 9029 | request->num_params); |
| 9030 | return -EINVAL; |
| 9031 | } |
| 9032 | packetFilterSetReq.numFieldParams = request->num_params; |
| 9033 | packetFilterSetReq.coalesceTime = 0; |
| 9034 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 9035 | for (i = 0; i < request->num_params; i++) { |
| 9036 | packetFilterSetReq.paramsData[i].protocolLayer = |
| 9037 | request->params_data[i].protocol_layer; |
| 9038 | packetFilterSetReq.paramsData[i].cmpFlag = |
| 9039 | request->params_data[i].compare_flag; |
| 9040 | packetFilterSetReq.paramsData[i].dataOffset = |
| 9041 | request->params_data[i].data_offset; |
| 9042 | packetFilterSetReq.paramsData[i].dataLength = |
| 9043 | request->params_data[i].data_length; |
| 9044 | packetFilterSetReq.paramsData[i].reserved = 0; |
| 9045 | |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 9046 | if (request->params_data[i].data_offset > |
| 9047 | SIR_MAX_FILTER_TEST_DATA_OFFSET) { |
| 9048 | hdd_err("Invalid data offset %u for param %d (max = %d)", |
| 9049 | request->params_data[i].data_offset, |
| 9050 | i, |
| 9051 | SIR_MAX_FILTER_TEST_DATA_OFFSET); |
| 9052 | return -EINVAL; |
| 9053 | } |
| 9054 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9055 | if (request->params_data[i].data_length > |
| 9056 | SIR_MAX_FILTER_TEST_DATA_LEN) { |
| 9057 | hdd_err("Error invalid data length %d", |
| 9058 | request->params_data[i].data_length); |
| 9059 | return -EINVAL; |
| 9060 | } |
| 9061 | |
| 9062 | hdd_info("Proto %d Comp Flag %d Filter Type %d", |
| 9063 | request->params_data[i].protocol_layer, |
| 9064 | request->params_data[i].compare_flag, |
| 9065 | packetFilterSetReq.filterType); |
| 9066 | |
| 9067 | hdd_info("Data Offset %d Data Len %d", |
| 9068 | request->params_data[i].data_offset, |
| 9069 | request->params_data[i].data_length); |
| 9070 | |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 9071 | if (sizeof(packetFilterSetReq.paramsData[i].compareData) |
| 9072 | < (request->params_data[i].data_length)) { |
| 9073 | hdd_err("Error invalid data length %d", |
| 9074 | request->params_data[i].data_length); |
| 9075 | return -EINVAL; |
| 9076 | } |
| 9077 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9078 | memcpy(&packetFilterSetReq.paramsData[i].compareData, |
| 9079 | request->params_data[i].compare_data, |
| 9080 | request->params_data[i].data_length); |
| 9081 | memcpy(&packetFilterSetReq.paramsData[i].dataMask, |
| 9082 | request->params_data[i].data_mask, |
| 9083 | request->params_data[i].data_length); |
| 9084 | |
| 9085 | hdd_info("CData %d CData %d CData %d CData %d CData %d CData %d", |
| 9086 | request->params_data[i].compare_data[0], |
| 9087 | request->params_data[i].compare_data[1], |
| 9088 | request->params_data[i].compare_data[2], |
| 9089 | request->params_data[i].compare_data[3], |
| 9090 | request->params_data[i].compare_data[4], |
| 9091 | request->params_data[i].compare_data[5]); |
| 9092 | |
| 9093 | hdd_info("MData %d MData %d MData %d MData %d MData %d MData %d", |
| 9094 | request->params_data[i].data_mask[0], |
| 9095 | request->params_data[i].data_mask[1], |
| 9096 | request->params_data[i].data_mask[2], |
| 9097 | request->params_data[i].data_mask[3], |
| 9098 | request->params_data[i].data_mask[4], |
| 9099 | request->params_data[i].data_mask[5]); |
| 9100 | } |
| 9101 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9102 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9103 | sme_receive_filter_set_filter(hdd_ctx->hHal, |
| 9104 | &packetFilterSetReq, |
| 9105 | sessionId)) { |
| 9106 | hdd_err("Failure to execute Set Filter"); |
| 9107 | return -EINVAL; |
| 9108 | } |
| 9109 | |
| 9110 | break; |
| 9111 | |
| 9112 | case HDD_RCV_FILTER_CLEAR: |
| 9113 | |
| 9114 | hdd_info("Clear Packet Filter Request for Id: %d", |
| 9115 | request->filter_id); |
| 9116 | packetFilterClrReq.filterId = request->filter_id; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9117 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9118 | sme_receive_filter_clear_filter(hdd_ctx->hHal, |
| 9119 | &packetFilterClrReq, |
| 9120 | sessionId)) { |
| 9121 | hdd_err("Failure to execute Clear Filter"); |
| 9122 | return -EINVAL; |
| 9123 | } |
| 9124 | break; |
| 9125 | |
| 9126 | default: |
| 9127 | hdd_err("Packet Filter Request: Invalid %d", |
| 9128 | request->filter_action); |
| 9129 | return -EINVAL; |
| 9130 | } |
| 9131 | return 0; |
| 9132 | } |
| 9133 | |
| 9134 | /** |
| 9135 | * __iw_set_packet_filter_params() - set packet filter parameters in target |
| 9136 | * @dev: Pointer to netdev |
| 9137 | * @info: Pointer to iw request info |
| 9138 | * @wrqu: Pointer to data |
| 9139 | * @extra: Pointer to extra data |
| 9140 | * |
| 9141 | * Return: 0 on success, non-zero on error |
| 9142 | */ |
| 9143 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 9144 | struct iw_request_info *info, |
| 9145 | union iwreq_data *wrqu, char *extra) |
| 9146 | { |
| 9147 | int ret; |
| 9148 | hdd_context_t *hdd_ctx; |
| 9149 | struct iw_point priv_data; |
| 9150 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9151 | struct pkt_filter_cfg *request = NULL; |
| 9152 | |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 9153 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9154 | hdd_err("permission check failed"); |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 9155 | return -EPERM; |
| 9156 | } |
| 9157 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9158 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9159 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9160 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 9161 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9162 | if (0 != ret) |
| 9163 | return ret; |
| 9164 | |
| 9165 | if (hdd_priv_get_data(&priv_data, wrqu)) { |
| 9166 | hdd_err("failed to get priv data"); |
| 9167 | return -EINVAL; |
| 9168 | } |
| 9169 | |
| 9170 | if ((NULL == priv_data.pointer) || (0 == priv_data.length)) { |
| 9171 | hdd_err("invalid priv data %p or invalid priv data length %d", |
| 9172 | priv_data.pointer, priv_data.length); |
| 9173 | return -EINVAL; |
| 9174 | } |
| 9175 | |
| 9176 | /* copy data using copy_from_user */ |
| 9177 | request = mem_alloc_copy_from_user_helper(priv_data.pointer, |
| 9178 | priv_data.length); |
| 9179 | if (NULL == request) { |
| 9180 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
| 9181 | return -ENOMEM; |
| 9182 | } |
| 9183 | |
| 9184 | ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId); |
| 9185 | |
| 9186 | kfree(request); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9187 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9188 | return ret; |
| 9189 | } |
| 9190 | |
| 9191 | /** |
| 9192 | * iw_set_packet_filter_params() - set packet filter parameters in target |
| 9193 | * @dev: Pointer to netdev |
| 9194 | * @info: Pointer to iw request info |
| 9195 | * @wrqu: Pointer to data |
| 9196 | * @extra: Pointer to extra data |
| 9197 | * |
| 9198 | * Return: 0 on success, non-zero on error |
| 9199 | */ |
| 9200 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 9201 | struct iw_request_info *info, |
| 9202 | union iwreq_data *wrqu, char *extra) |
| 9203 | { |
| 9204 | int ret; |
| 9205 | |
| 9206 | cds_ssr_protect(__func__); |
| 9207 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 9208 | cds_ssr_unprotect(__func__); |
| 9209 | |
| 9210 | return ret; |
| 9211 | } |
| 9212 | #endif |
| 9213 | |
| 9214 | |
| 9215 | static int __iw_get_statistics(struct net_device *dev, |
| 9216 | struct iw_request_info *info, |
| 9217 | union iwreq_data *wrqu, char *extra) |
| 9218 | { |
| 9219 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9220 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9221 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9222 | hdd_wext_state_t *pWextState; |
| 9223 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9224 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9225 | char *p = extra; |
| 9226 | int tlen = 0; |
| 9227 | tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat); |
| 9228 | tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat); |
| 9229 | tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat); |
| 9230 | int ret; |
| 9231 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9232 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9233 | |
| 9234 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9235 | if (0 != ret) |
| 9236 | return ret; |
| 9237 | |
| 9238 | if (eConnectionState_Associated != |
| 9239 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { |
| 9240 | |
| 9241 | wrqu->txpower.value = 0; |
| 9242 | } else { |
| 9243 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 9244 | SME_SUMMARY_STATS | |
| 9245 | SME_GLOBAL_CLASSA_STATS | |
| 9246 | SME_GLOBAL_CLASSB_STATS | |
| 9247 | SME_GLOBAL_CLASSC_STATS | |
| 9248 | SME_GLOBAL_CLASSD_STATS | |
| 9249 | SME_PER_STA_STATS, |
| 9250 | hdd_statistics_cb, 0, false, |
| 9251 | (WLAN_HDD_GET_STATION_CTX_PTR |
| 9252 | (pAdapter))->conn_info.staId[0], |
| 9253 | pAdapter, pAdapter->sessionId); |
| 9254 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9255 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9256 | hdd_err("Unable to retrieve SME statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9257 | return -EINVAL; |
| 9258 | } |
| 9259 | |
| 9260 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9261 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9262 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 9263 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9264 | WLAN_WAIT_TIME_STATS); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9265 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9266 | hdd_err("SME timeout while retrieving statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9267 | /*Remove the SME statistics list by passing NULL in callback argument */ |
| 9268 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 9269 | SME_SUMMARY_STATS | |
| 9270 | SME_GLOBAL_CLASSA_STATS | |
| 9271 | SME_GLOBAL_CLASSB_STATS | |
| 9272 | SME_GLOBAL_CLASSC_STATS | |
| 9273 | SME_GLOBAL_CLASSD_STATS | |
| 9274 | SME_PER_STA_STATS, |
| 9275 | NULL, 0, false, |
| 9276 | (WLAN_HDD_GET_STATION_CTX_PTR |
| 9277 | (pAdapter))->conn_info. |
| 9278 | staId[0], pAdapter, |
| 9279 | pAdapter->sessionId); |
| 9280 | |
| 9281 | return -EINVAL; |
| 9282 | } |
| 9283 | FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT, |
| 9284 | (uint8_t) sizeof(pStats->retry_cnt), |
| 9285 | (char *)&(pStats->retry_cnt[0]), tlen); |
| 9286 | |
| 9287 | FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT, |
| 9288 | (uint8_t) sizeof(pStats->multiple_retry_cnt), |
| 9289 | (char *)&(pStats->multiple_retry_cnt[0]), tlen); |
| 9290 | |
| 9291 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT, |
| 9292 | (uint8_t) sizeof(pStats->tx_frm_cnt), |
| 9293 | (char *)&(pStats->tx_frm_cnt[0]), tlen); |
| 9294 | |
| 9295 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT, |
| 9296 | (uint8_t) sizeof(pStats->rx_frm_cnt), |
| 9297 | (char *)&(pStats->rx_frm_cnt), tlen); |
| 9298 | |
| 9299 | FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT, |
| 9300 | (uint8_t) sizeof(pStats->frm_dup_cnt), |
| 9301 | (char *)&(pStats->frm_dup_cnt), tlen); |
| 9302 | |
| 9303 | FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT, |
| 9304 | (uint8_t) sizeof(pStats->fail_cnt), |
| 9305 | (char *)&(pStats->fail_cnt[0]), tlen); |
| 9306 | |
| 9307 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT, |
| 9308 | (uint8_t) sizeof(pStats->rts_fail_cnt), |
| 9309 | (char *)&(pStats->rts_fail_cnt), tlen); |
| 9310 | |
| 9311 | FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT, |
| 9312 | (uint8_t) sizeof(pStats->ack_fail_cnt), |
| 9313 | (char *)&(pStats->ack_fail_cnt), tlen); |
| 9314 | |
| 9315 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT, |
| 9316 | (uint8_t) sizeof(pStats->rts_succ_cnt), |
| 9317 | (char *)&(pStats->rts_succ_cnt), tlen); |
| 9318 | |
| 9319 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT, |
| 9320 | (uint8_t) sizeof(pStats->rx_discard_cnt), |
| 9321 | (char *)&(pStats->rx_discard_cnt), tlen); |
| 9322 | |
| 9323 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT, |
| 9324 | (uint8_t) sizeof(pStats->rx_error_cnt), |
| 9325 | (char *)&(pStats->rx_error_cnt), tlen); |
| 9326 | |
| 9327 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT, |
| 9328 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 9329 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 9330 | |
| 9331 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT, |
| 9332 | (uint8_t) sizeof(dStats->rx_byte_cnt), |
| 9333 | (char *)&(dStats->rx_byte_cnt), tlen); |
| 9334 | |
| 9335 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE, |
| 9336 | (uint8_t) sizeof(dStats->rx_rate), |
| 9337 | (char *)&(dStats->rx_rate), tlen); |
| 9338 | |
| 9339 | /* Transmit rate, in units of 500 kbit/sec */ |
| 9340 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE, |
| 9341 | (uint8_t) sizeof(aStats->tx_rate), |
| 9342 | (char *)&(aStats->tx_rate), tlen); |
| 9343 | |
| 9344 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT, |
| 9345 | (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]), |
| 9346 | (char *)&(dStats->rx_uc_byte_cnt[0]), tlen); |
| 9347 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT, |
| 9348 | (uint8_t) sizeof(dStats->rx_mc_byte_cnt), |
| 9349 | (char *)&(dStats->rx_mc_byte_cnt), tlen); |
| 9350 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT, |
| 9351 | (uint8_t) sizeof(dStats->rx_bc_byte_cnt), |
| 9352 | (char *)&(dStats->rx_bc_byte_cnt), tlen); |
| 9353 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT, |
| 9354 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 9355 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 9356 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT, |
| 9357 | (uint8_t) sizeof(dStats->tx_mc_byte_cnt), |
| 9358 | (char *)&(dStats->tx_mc_byte_cnt), tlen); |
| 9359 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT, |
| 9360 | (uint8_t) sizeof(dStats->tx_bc_byte_cnt), |
| 9361 | (char *)&(dStats->tx_bc_byte_cnt), tlen); |
| 9362 | |
| 9363 | wrqu->data.length = tlen; |
| 9364 | |
| 9365 | } |
| 9366 | |
| 9367 | EXIT(); |
| 9368 | |
| 9369 | return 0; |
| 9370 | } |
| 9371 | |
| 9372 | static int iw_get_statistics(struct net_device *dev, |
| 9373 | struct iw_request_info *info, |
| 9374 | union iwreq_data *wrqu, char *extra) |
| 9375 | { |
| 9376 | int ret; |
| 9377 | |
| 9378 | cds_ssr_protect(__func__); |
| 9379 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 9380 | cds_ssr_unprotect(__func__); |
| 9381 | |
| 9382 | return ret; |
| 9383 | } |
| 9384 | |
| 9385 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 9386 | |
| 9387 | /*Max Len for PNO notification*/ |
| 9388 | #define MAX_PNO_NOTIFY_LEN 100 |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 9389 | static void found_pref_network_cb(void *callbackContext, |
| 9390 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9391 | { |
| 9392 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) callbackContext; |
| 9393 | union iwreq_data wrqu; |
| 9394 | char buf[MAX_PNO_NOTIFY_LEN + 1]; |
| 9395 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9396 | hdd_warn("A preferred network was found: %s with rssi: -%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9397 | pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi); |
| 9398 | |
| 9399 | /* create the event */ |
| 9400 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9401 | memset(buf, 0, sizeof(buf)); |
| 9402 | |
| 9403 | snprintf(buf, MAX_PNO_NOTIFY_LEN, |
| 9404 | "QCOM: Found preferred network: %s with RSSI of -%u", |
| 9405 | pPrefNetworkFoundInd->ssId.ssId, |
| 9406 | (unsigned int)pPrefNetworkFoundInd->rssi); |
| 9407 | |
| 9408 | wrqu.data.pointer = buf; |
| 9409 | wrqu.data.length = strlen(buf); |
| 9410 | |
| 9411 | /* send the event */ |
| 9412 | |
| 9413 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 9414 | |
| 9415 | } |
| 9416 | |
| 9417 | /** |
| 9418 | * __iw_set_pno() - Preferred Network Offload ioctl handler |
| 9419 | * @dev: device upon which the ioctl was received |
| 9420 | * @info: ioctl request information |
| 9421 | * @wrqu: ioctl request data |
| 9422 | * @extra: ioctl extra data |
| 9423 | * |
| 9424 | * This function parses a Preferred Network Offload command |
| 9425 | * Input is string based and expected to be of the form: |
| 9426 | * |
| 9427 | * <enable(1) | disable(0)> |
| 9428 | * when enabling: |
| 9429 | * <number of networks> |
| 9430 | * for each network: |
| 9431 | * <ssid_len> <ssid> <authentication> <encryption> |
| 9432 | * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9433 | * <scan_time (seconds)> |
| 9434 | * <scan_repeat_count (0 means indefinite)> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9435 | * <suspend mode> |
| 9436 | * |
| 9437 | * e.g: |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9438 | * 1 2 4 test 0 0 3 1 6 11 2 40 5 test2 4 4 6 1 2 3 4 5 6 1 0 5 2 1 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9439 | * |
| 9440 | * this translates into: |
| 9441 | * ----------------------------- |
| 9442 | * enable PNO |
| 9443 | * 2 networks |
| 9444 | * Network 1: |
| 9445 | * test - with authentication type 0 and encryption type 0, |
| 9446 | * search on 3 channels: 1 6 and 11, |
| 9447 | * SSID bcast type is unknown (directed probe will be sent if |
| 9448 | * AP not found) and must meet -40dBm RSSI |
| 9449 | * Network 2: |
| 9450 | * test2 - with authentication type 4 and encryption type 4, |
| 9451 | * search on 6 channels 1, 2, 3, 4, 5 and 6 |
| 9452 | * bcast type is non-bcast (directed probe will be sent) |
| 9453 | * and must not meet any RSSI threshold |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9454 | * scan every 5 seconds 2 times |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9455 | * enable on suspend |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9456 | */ |
| 9457 | static int __iw_set_pno(struct net_device *dev, |
| 9458 | struct iw_request_info *info, |
| 9459 | union iwreq_data *wrqu, char *extra) |
| 9460 | { |
| 9461 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9462 | hdd_context_t *hdd_ctx; |
| 9463 | int ret; |
| 9464 | int offset; |
| 9465 | char *ptr; |
| 9466 | uint8_t i, j, params, mode; |
| 9467 | |
| 9468 | /* request is a large struct, so we make it static to avoid |
| 9469 | * stack overflow. This API is only invoked via ioctl, so it |
| 9470 | * is serialized by the kernel rtnl_lock and hence does not |
| 9471 | * need to be reentrant |
| 9472 | */ |
| 9473 | static tSirPNOScanReq request; |
| 9474 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9475 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9476 | |
| 9477 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 9478 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9479 | if (ret) |
| 9480 | return ret; |
| 9481 | |
| 9482 | hdd_notice("PNO data len %d data %s", wrqu->data.length, extra); |
| 9483 | |
| 9484 | request.enable = 0; |
| 9485 | request.ucNetworksCount = 0; |
| 9486 | |
| 9487 | ptr = extra; |
| 9488 | |
| 9489 | if (1 != sscanf(ptr, "%hhu%n", &(request.enable), &offset)) { |
| 9490 | hdd_err("PNO enable input is not valid %s", ptr); |
| 9491 | return -EINVAL; |
| 9492 | } |
| 9493 | |
| 9494 | if (0 == request.enable) { |
| 9495 | /* Disable PNO, ignore any other params */ |
| 9496 | memset(&request, 0, sizeof(request)); |
| 9497 | sme_set_preferred_network_list(WLAN_HDD_GET_HAL_CTX(adapter), |
| 9498 | &request, adapter->sessionId, |
| 9499 | found_pref_network_cb, adapter); |
| 9500 | return 0; |
| 9501 | } |
| 9502 | |
| 9503 | ptr += offset; |
| 9504 | |
| 9505 | if (1 != |
| 9506 | sscanf(ptr, "%hhu %n", &(request.ucNetworksCount), &offset)) { |
| 9507 | hdd_err("PNO count input not valid %s", ptr); |
| 9508 | return -EINVAL; |
| 9509 | |
| 9510 | } |
| 9511 | |
| 9512 | hdd_info("PNO enable %d networks count %d offset %d", |
| 9513 | request.enable, request.ucNetworksCount, offset); |
| 9514 | |
| 9515 | if ((0 == request.ucNetworksCount) || |
| 9516 | (request.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS)) { |
| 9517 | hdd_err("Network count %d invalid", |
| 9518 | request.ucNetworksCount); |
| 9519 | return -EINVAL; |
| 9520 | } |
| 9521 | |
| 9522 | ptr += offset; |
| 9523 | |
| 9524 | for (i = 0; i < request.ucNetworksCount; i++) { |
| 9525 | |
| 9526 | request.aNetworks[i].ssId.length = 0; |
| 9527 | |
| 9528 | params = sscanf(ptr, "%hhu %n", |
| 9529 | &(request.aNetworks[i].ssId.length), |
| 9530 | &offset); |
| 9531 | |
| 9532 | if (1 != params) { |
| 9533 | hdd_err("PNO ssid length input is not valid %s", ptr); |
| 9534 | return -EINVAL; |
| 9535 | } |
| 9536 | |
| 9537 | if ((0 == request.aNetworks[i].ssId.length) || |
| 9538 | (request.aNetworks[i].ssId.length > 32)) { |
| 9539 | hdd_err("SSID Len %d is not correct for network %d", |
| 9540 | request.aNetworks[i].ssId.length, i); |
| 9541 | return -EINVAL; |
| 9542 | } |
| 9543 | |
| 9544 | /* Advance to SSID */ |
| 9545 | ptr += offset; |
| 9546 | |
| 9547 | memcpy(request.aNetworks[i].ssId.ssId, ptr, |
| 9548 | request.aNetworks[i].ssId.length); |
| 9549 | ptr += request.aNetworks[i].ssId.length; |
| 9550 | |
| 9551 | params = sscanf(ptr, "%u %u %hhu %n", |
| 9552 | &(request.aNetworks[i].authentication), |
| 9553 | &(request.aNetworks[i].encryption), |
| 9554 | &(request.aNetworks[i].ucChannelCount), |
| 9555 | &offset); |
| 9556 | |
| 9557 | if (3 != params) { |
| 9558 | hdd_warn("Incorrect cmd %s", ptr); |
| 9559 | return -EINVAL; |
| 9560 | } |
| 9561 | |
| 9562 | hdd_notice("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d", |
| 9563 | request.aNetworks[i].ssId.length, |
| 9564 | request.aNetworks[i].ssId.length, |
| 9565 | request.aNetworks[i].ssId.ssId, |
| 9566 | request.aNetworks[i].authentication, |
| 9567 | request.aNetworks[i].encryption, |
| 9568 | request.aNetworks[i].ucChannelCount, offset); |
| 9569 | |
| 9570 | /* Advance to channel list */ |
| 9571 | ptr += offset; |
| 9572 | |
| 9573 | if (SIR_PNO_MAX_NETW_CHANNELS < |
| 9574 | request.aNetworks[i].ucChannelCount) { |
| 9575 | hdd_warn("Incorrect number of channels"); |
| 9576 | return -EINVAL; |
| 9577 | } |
| 9578 | |
| 9579 | if (0 != request.aNetworks[i].ucChannelCount) { |
| 9580 | for (j = 0; j < request.aNetworks[i].ucChannelCount; |
| 9581 | j++) { |
| 9582 | if (1 != |
| 9583 | sscanf(ptr, "%hhu %n", |
| 9584 | &(request.aNetworks[i]. |
| 9585 | aChannels[j]), &offset)) { |
| 9586 | hdd_err("PNO network channel input is not valid %s", |
| 9587 | ptr); |
| 9588 | return -EINVAL; |
| 9589 | } |
| 9590 | /* Advance to next channel number */ |
| 9591 | ptr += offset; |
| 9592 | } |
| 9593 | } |
| 9594 | |
| 9595 | if (1 != sscanf(ptr, "%u %n", |
| 9596 | &(request.aNetworks[i].bcastNetwType), |
| 9597 | &offset)) { |
| 9598 | hdd_err("PNO broadcast network type input is not valid %s", |
| 9599 | ptr); |
| 9600 | return -EINVAL; |
| 9601 | } |
| 9602 | |
| 9603 | hdd_notice("PNO bcastNetwType %d offset %d", |
| 9604 | request.aNetworks[i].bcastNetwType, offset); |
| 9605 | |
| 9606 | /* Advance to rssi Threshold */ |
| 9607 | ptr += offset; |
| 9608 | if (1 != sscanf(ptr, "%d %n", |
| 9609 | &(request.aNetworks[i].rssiThreshold), |
| 9610 | &offset)) { |
| 9611 | hdd_err("PNO rssi threshold input is not valid %s", |
| 9612 | ptr); |
| 9613 | return -EINVAL; |
| 9614 | } |
| 9615 | hdd_notice("PNO rssi %d offset %d", |
| 9616 | request.aNetworks[i].rssiThreshold, offset); |
| 9617 | /* Advance to next network */ |
| 9618 | ptr += offset; |
| 9619 | } /* For ucNetworkCount */ |
| 9620 | |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9621 | request.fast_scan_period = 0; |
| 9622 | if (sscanf(ptr, "%u %n", &(request.fast_scan_period), &offset) > 0) { |
| 9623 | request.fast_scan_period *= MSEC_PER_SEC; |
| 9624 | ptr += offset; |
| 9625 | } |
| 9626 | |
| 9627 | request.fast_scan_max_cycles = 0; |
| 9628 | if (sscanf(ptr, "%hhu %n", &(request.fast_scan_max_cycles), |
| 9629 | &offset) > 0) |
| 9630 | ptr += offset; |
| 9631 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9632 | params = sscanf(ptr, "%hhu %n", &(mode), &offset); |
| 9633 | |
| 9634 | request.modePNO = mode; |
| 9635 | /* for LA we just expose suspend option */ |
| 9636 | if ((1 != params) || (mode >= SIR_PNO_MODE_MAX)) { |
| 9637 | request.modePNO = SIR_PNO_MODE_ON_SUSPEND; |
| 9638 | } |
| 9639 | |
| 9640 | sme_set_preferred_network_list(WLAN_HDD_GET_HAL_CTX(adapter), |
| 9641 | &request, |
| 9642 | adapter->sessionId, |
| 9643 | found_pref_network_cb, adapter); |
| 9644 | |
| 9645 | return 0; |
| 9646 | } |
| 9647 | |
| 9648 | static int iw_set_pno(struct net_device *dev, |
| 9649 | struct iw_request_info *info, |
| 9650 | union iwreq_data *wrqu, char *extra) |
| 9651 | { |
| 9652 | int ret; |
| 9653 | |
| 9654 | cds_ssr_protect(__func__); |
| 9655 | ret = __iw_set_pno(dev, info, wrqu, extra); |
| 9656 | cds_ssr_unprotect(__func__); |
| 9657 | |
| 9658 | return ret; |
| 9659 | } |
| 9660 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 9661 | |
| 9662 | /* Common function to SetBand */ |
| 9663 | int hdd_set_band(struct net_device *dev, u8 ui_band) |
| 9664 | { |
| 9665 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9666 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9667 | eCsrBand band; |
| 9668 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9669 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9670 | hdd_context_t *pHddCtx; |
| 9671 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 9672 | eCsrBand currBand = eCSR_BAND_MAX; |
| 9673 | eCsrBand connectedBand; |
| 9674 | |
| 9675 | pAdapterNode = NULL; |
| 9676 | pNext = NULL; |
| 9677 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9678 | |
| 9679 | switch (ui_band) { |
| 9680 | case WLAN_HDD_UI_BAND_AUTO: |
| 9681 | band = eCSR_BAND_ALL; |
| 9682 | break; |
| 9683 | case WLAN_HDD_UI_BAND_5_GHZ: |
| 9684 | band = eCSR_BAND_5G; |
| 9685 | break; |
| 9686 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
| 9687 | band = eCSR_BAND_24; |
| 9688 | break; |
| 9689 | default: |
| 9690 | band = eCSR_BAND_MAX; |
| 9691 | } |
| 9692 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9693 | hdd_notice("change band to %u", band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9694 | |
| 9695 | if (band == eCSR_BAND_MAX) { |
| 9696 | /* Received change band request with invalid band value */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9697 | hdd_err("Invalid band value %u", ui_band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9698 | return -EINVAL; |
| 9699 | } |
| 9700 | |
| 9701 | if ((band == eCSR_BAND_24 && pHddCtx->config->nBandCapability == 2) || |
| 9702 | (band == eCSR_BAND_5G && pHddCtx->config->nBandCapability == 1)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9703 | hdd_err("band value %u violate INI settings %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9704 | band, pHddCtx->config->nBandCapability); |
| 9705 | return -EIO; |
| 9706 | } |
| 9707 | |
| 9708 | if (band == eCSR_BAND_ALL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9709 | hdd_notice("Auto band received. Setting band same as ini value %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9710 | pHddCtx->config->nBandCapability); |
| 9711 | band = pHddCtx->config->nBandCapability; |
| 9712 | } |
| 9713 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9714 | if (QDF_STATUS_SUCCESS != sme_get_freq_band(hHal, &currBand)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9715 | hdd_notice("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9716 | return -EIO; |
| 9717 | } |
| 9718 | |
| 9719 | if (currBand != band) { |
| 9720 | /* Change band request received. |
| 9721 | * Abort pending scan requests, flush the existing scan results, |
| 9722 | * and change the band capability |
| 9723 | */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9724 | hdd_notice("Current band value = %u, new setting %u ", |
| 9725 | currBand, band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9726 | |
| 9727 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9728 | while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9729 | pAdapter = pAdapterNode->pAdapter; |
| 9730 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9731 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 9732 | eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE); |
| 9733 | connectedBand = |
| 9734 | hdd_conn_get_connected_band |
| 9735 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 9736 | |
| 9737 | /* Handling is done only for STA and P2P */ |
| 9738 | if (band != eCSR_BAND_ALL && |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 9739 | ((pAdapter->device_mode == QDF_STA_MODE) |
| 9740 | || (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9741 | && |
| 9742 | (hdd_conn_is_connected |
| 9743 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) |
| 9744 | && (connectedBand != band)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9745 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9746 | long lrc; |
| 9747 | |
| 9748 | /* STA already connected on current band, So issue disconnect |
| 9749 | * first, then change the band*/ |
| 9750 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9751 | hdd_notice("STA (Device mode %s(%d)) connected in band %u, Changing band to %u, Issuing Disconnect", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9752 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 9753 | pAdapter->device_mode, currBand, band); |
| 9754 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 9755 | |
| 9756 | status = |
| 9757 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX |
| 9758 | (pAdapter), |
| 9759 | pAdapter->sessionId, |
| 9760 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 9761 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9762 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9763 | hdd_err("csr_roam_disconnect failure, returned %d", |
| 9764 | (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9765 | return -EINVAL; |
| 9766 | } |
| 9767 | |
| 9768 | lrc = |
| 9769 | wait_for_completion_timeout(&pAdapter-> |
| 9770 | disconnect_comp_var, |
| 9771 | msecs_to_jiffies |
| 9772 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 9773 | |
| 9774 | if (lrc == 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9775 | hdd_err("Timeout while waiting for csr_roam_disconnect"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9776 | return -ETIMEDOUT; |
| 9777 | } |
| 9778 | } |
| 9779 | |
| 9780 | sme_scan_flush_result(hHal); |
| 9781 | |
| 9782 | status = |
| 9783 | hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext); |
| 9784 | pAdapterNode = pNext; |
| 9785 | } |
| 9786 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9787 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9788 | sme_set_freq_band(hHal, pAdapter->sessionId, band)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9789 | hdd_alert("Failed to set the band value to %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9790 | band); |
| 9791 | return -EINVAL; |
| 9792 | } |
| 9793 | wlan_hdd_cfg80211_update_band(pHddCtx->wiphy, (eCsrBand) band); |
| 9794 | } |
| 9795 | return 0; |
| 9796 | } |
| 9797 | |
| 9798 | int hdd_set_band_helper(struct net_device *dev, const char *command) |
| 9799 | { |
| 9800 | uint8_t band; |
| 9801 | int ret; |
| 9802 | |
| 9803 | /* Convert the band value from ascii to integer */ |
| 9804 | command += WLAN_HDD_UI_SET_BAND_VALUE_OFFSET; |
| 9805 | ret = kstrtou8(command, 10, &band); |
| 9806 | if (ret < 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9807 | hdd_err("kstrtou8 failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9808 | return -EINVAL; |
| 9809 | } |
| 9810 | |
| 9811 | return hdd_set_band(dev, band); |
| 9812 | } |
| 9813 | |
| 9814 | static int __iw_set_band_config(struct net_device *dev, |
| 9815 | struct iw_request_info *info, |
| 9816 | union iwreq_data *wrqu, char *extra) |
| 9817 | { |
| 9818 | int *value = (int *)extra; |
| 9819 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9820 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9821 | |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 9822 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9823 | hdd_err("permission check failed"); |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 9824 | return -EPERM; |
| 9825 | } |
| 9826 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9827 | return hdd_set_band(dev, value[0]); |
| 9828 | } |
| 9829 | |
| 9830 | static int iw_set_band_config(struct net_device *dev, |
| 9831 | struct iw_request_info *info, |
| 9832 | union iwreq_data *wrqu, char *extra) |
| 9833 | { |
| 9834 | int ret; |
| 9835 | |
| 9836 | cds_ssr_protect(__func__); |
| 9837 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 9838 | cds_ssr_unprotect(__func__); |
| 9839 | |
| 9840 | return ret; |
| 9841 | } |
| 9842 | |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 9843 | /** |
| 9844 | * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface. |
| 9845 | * @adapter: Handle to adapter |
| 9846 | * @chan: Monitor mode channel |
| 9847 | * @bandwidth: Capture channel bandwidth |
| 9848 | * |
| 9849 | * Return: 0 on success else error code. |
| 9850 | */ |
| 9851 | static int wlan_hdd_set_mon_chan(hdd_adapter_t *adapter, uint32_t chan, |
| 9852 | uint32_t bandwidth) |
| 9853 | { |
| 9854 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 9855 | hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 9856 | struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info; |
| 9857 | QDF_STATUS status; |
| 9858 | tHalHandle hal_hdl = hdd_ctx->hHal; |
| 9859 | struct qdf_mac_addr bssid; |
| 9860 | tCsrRoamProfile roam_profile; |
| 9861 | struct ch_params_s ch_params; |
| 9862 | |
| 9863 | if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { |
| 9864 | hdd_err("Not supported, device is not in monitor mode"); |
| 9865 | return -EINVAL; |
| 9866 | } |
| 9867 | |
| 9868 | hdd_info("Set monitor mode Channel %d", chan); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 9869 | roam_profile.ChannelInfo.ChannelList = &ch_info->channel; |
| 9870 | roam_profile.ChannelInfo.numOfChannels = 1; |
| 9871 | roam_profile.phyMode = ch_info->phy_mode; |
| 9872 | roam_profile.ch_params.ch_width = bandwidth; |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 9873 | hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 9874 | |
| 9875 | qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes, |
| 9876 | QDF_MAC_ADDR_SIZE); |
| 9877 | |
| 9878 | ch_params.ch_width = bandwidth; |
Sandeep Puligilla | 1cc23f6 | 2016-04-27 16:52:49 -0700 | [diff] [blame] | 9879 | cds_set_channel_params(chan, 0, &ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 9880 | status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, |
| 9881 | &roam_profile); |
| 9882 | if (status) { |
| 9883 | hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", |
| 9884 | status); |
| 9885 | } |
| 9886 | |
| 9887 | return qdf_status_to_os_return(status); |
| 9888 | } |
| 9889 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9890 | static int __iw_set_two_ints_getnone(struct net_device *dev, |
| 9891 | struct iw_request_info *info, |
| 9892 | union iwreq_data *wrqu, char *extra) |
| 9893 | { |
| 9894 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9895 | int *value = (int *)extra; |
| 9896 | int sub_cmd = value[0]; |
| 9897 | int ret; |
| 9898 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9899 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9900 | ENTER_DEV(dev); |
| 9901 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9902 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9903 | if (0 != ret) |
| 9904 | return ret; |
| 9905 | |
| 9906 | switch (sub_cmd) { |
| 9907 | case WE_SET_SMPS_PARAM: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9908 | hdd_notice("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9909 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 9910 | WMI_STA_SMPS_PARAM_CMDID, |
| 9911 | value[1] << WMA_SMPS_PARAM_VALUE_S |
| 9912 | | value[2], |
| 9913 | VDEV_CMD); |
| 9914 | break; |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 9915 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9916 | case WE_SET_FW_CRASH_INJECT: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9917 | hdd_err("WE_SET_FW_CRASH_INJECT: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9918 | value[1], value[2]); |
DARAM SUDHA | 7e7e91b | 2015-05-29 11:38:47 +0530 | [diff] [blame] | 9919 | pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n", |
| 9920 | value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9921 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 9922 | GEN_PARAM_CRASH_INJECT, |
| 9923 | value[1], value[2], GEN_CMD); |
| 9924 | break; |
| 9925 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9926 | case WE_ENABLE_FW_PROFILE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9927 | hdd_err("WE_ENABLE_FW_PROFILE: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9928 | value[1], value[2]); |
| 9929 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 9930 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 9931 | value[1], value[2], DBG_CMD); |
| 9932 | break; |
| 9933 | case WE_SET_FW_PROFILE_HIST_INTVL: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9934 | hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9935 | value[1], value[2]); |
| 9936 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 9937 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 9938 | value[1], value[2], DBG_CMD); |
| 9939 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9940 | case WE_SET_DUAL_MAC_FW_MODE_CONFIG: |
| 9941 | hdd_debug("Ioctl to set dual fw mode config"); |
| 9942 | if (hdd_ctx->config->dual_mac_feature_disable) { |
| 9943 | hdd_err("Dual mac feature is disabled from INI"); |
| 9944 | return -EPERM; |
| 9945 | } |
| 9946 | hdd_debug("%d %d", value[1], value[2]); |
Tushnim Bhattacharyya | 4adb368 | 2016-01-07 15:07:12 -0800 | [diff] [blame] | 9947 | cds_set_dual_mac_fw_mode_config(value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9948 | break; |
| 9949 | case WE_DUMP_DP_TRACE_LEVEL: |
| 9950 | hdd_info("WE_DUMP_DP_TRACE_LEVEL: %d %d", |
| 9951 | value[1], value[2]); |
| 9952 | if (value[1] == DUMP_DP_TRACE) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9953 | qdf_dp_trace_dump_all(value[2]); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 9954 | else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE) |
| 9955 | qdf_dp_trace_enable_live_mode(); |
Nirav Shah | da00834 | 2016-05-17 18:50:40 +0530 | [diff] [blame] | 9956 | else if (value[1] == CLEAR_DP_TRACE_BUFFER) |
| 9957 | qdf_dp_trace_clear_buffer(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9958 | break; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 9959 | case WE_SET_MON_MODE_CHAN: |
| 9960 | ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]); |
| 9961 | break; |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 9962 | case WE_SET_WLAN_SUSPEND: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 9963 | ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 9964 | break; |
| 9965 | case WE_SET_WLAN_RESUME: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 9966 | ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 9967 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9968 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9969 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9970 | break; |
| 9971 | } |
| 9972 | |
| 9973 | return ret; |
| 9974 | } |
| 9975 | |
| 9976 | static int iw_set_two_ints_getnone(struct net_device *dev, |
| 9977 | struct iw_request_info *info, |
| 9978 | union iwreq_data *wrqu, char *extra) |
| 9979 | { |
| 9980 | int ret; |
| 9981 | |
| 9982 | cds_ssr_protect(__func__); |
| 9983 | ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra); |
| 9984 | cds_ssr_unprotect(__func__); |
| 9985 | |
| 9986 | return ret; |
| 9987 | } |
| 9988 | |
| 9989 | /* Define the Wireless Extensions to the Linux Network Device structure */ |
| 9990 | /* A number of these routines are NULL (meaning they are not implemented.) */ |
| 9991 | |
| 9992 | static const iw_handler we_handler[] = { |
| 9993 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 9994 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 9995 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 9996 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 9997 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 9998 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 9999 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 10000 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 10001 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 10002 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 10003 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 10004 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 10005 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 10006 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 10007 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 10008 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 10009 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 10010 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 10011 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 10012 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 10013 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 10014 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 10015 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 10016 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 10017 | (iw_handler) iw_set_scan, /* SIOCSIWSCAN */ |
| 10018 | (iw_handler) iw_get_scan, /* SIOCGIWSCAN */ |
| 10019 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 10020 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 10021 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 10022 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 10023 | (iw_handler) NULL, /* -- hole -- */ |
| 10024 | (iw_handler) NULL, /* -- hole -- */ |
| 10025 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 10026 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 10027 | (iw_handler) iw_set_rts_threshold, /* SIOCSIWRTS */ |
| 10028 | (iw_handler) iw_get_rts_threshold, /* SIOCGIWRTS */ |
| 10029 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 10030 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 10031 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 10032 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 10033 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 10034 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 10035 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
| 10036 | (iw_handler) iw_get_encode, /* SIOCGIWENCODE */ |
| 10037 | (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */ |
| 10038 | (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */ |
| 10039 | (iw_handler) NULL, /* -- hole -- */ |
| 10040 | (iw_handler) NULL, /* -- hole -- */ |
| 10041 | (iw_handler) iw_set_genie, /* SIOCSIWGENIE */ |
| 10042 | (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ |
| 10043 | (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ |
| 10044 | (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ |
| 10045 | (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ |
| 10046 | (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */ |
| 10047 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 10048 | }; |
| 10049 | |
| 10050 | static const iw_handler we_private[] = { |
| 10051 | |
| 10052 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, /* set priv ioctl */ |
| 10053 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, /* get priv ioctl */ |
| 10054 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, /* get priv ioctl */ |
| 10055 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10056 | iw_set_three_ints_getnone, |
| 10057 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
| 10058 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, /* action priv ioctl */ |
| 10059 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10060 | iw_hdd_set_var_ints_getnone, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 10061 | [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = |
| 10062 | iw_setnone_get_threeint, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10063 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 10064 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 10065 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10066 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10067 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 10068 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 10069 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = |
| 10070 | iw_set_keepalive_params, |
| 10071 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 10072 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = |
| 10073 | iw_set_packet_filter_params, |
| 10074 | #endif |
| 10075 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 10076 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno, |
| 10077 | #endif |
| 10078 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
| 10079 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed, |
| 10080 | [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10081 | iw_set_two_ints_getnone, |
| 10082 | [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] = |
| 10083 | iw_set_dot11p_channel_sched, |
| 10084 | }; |
| 10085 | |
| 10086 | /*Maximum command length can be only 15 */ |
| 10087 | static const struct iw_priv_args we_private_args[] = { |
| 10088 | |
| 10089 | /* handlers for main ioctl */ |
| 10090 | {WLAN_PRIV_SET_INT_GET_NONE, |
| 10091 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10092 | 0, |
| 10093 | ""}, |
| 10094 | |
| 10095 | /* handlers for sub-ioctl */ |
| 10096 | {WE_SET_11D_STATE, |
| 10097 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10098 | 0, |
| 10099 | "set11Dstate"}, |
| 10100 | |
| 10101 | {WE_WOWL, |
| 10102 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10103 | 0, |
| 10104 | "wowl"}, |
| 10105 | |
| 10106 | {WE_SET_POWER, |
| 10107 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10108 | 0, |
| 10109 | "setPower"}, |
| 10110 | |
| 10111 | {WE_SET_MAX_ASSOC, |
| 10112 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10113 | 0, |
| 10114 | "setMaxAssoc"}, |
| 10115 | |
| 10116 | {WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 10117 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, |
| 10118 | "setAutoChannel" }, |
| 10119 | |
| 10120 | {WE_SET_SCAN_DISABLE, |
| 10121 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10122 | 0, |
| 10123 | "scan_disable"}, |
| 10124 | |
| 10125 | {WE_SET_DATA_INACTIVITY_TO, |
| 10126 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10127 | 0, |
| 10128 | "inactivityTO"}, |
| 10129 | |
| 10130 | {WE_SET_MAX_TX_POWER, |
| 10131 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10132 | 0, |
| 10133 | "setMaxTxPower"}, |
| 10134 | |
| 10135 | {WE_SET_TX_POWER, |
| 10136 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10137 | 0, |
| 10138 | "setTxPower"}, |
| 10139 | |
| 10140 | {WE_SET_MC_RATE, |
| 10141 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10142 | 0, |
| 10143 | "setMcRate"}, |
| 10144 | |
| 10145 | {WE_SET_MAX_TX_POWER_2_4, |
| 10146 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10147 | 0, |
| 10148 | "setTxMaxPower2G"}, |
| 10149 | |
| 10150 | {WE_SET_MAX_TX_POWER_5_0, |
| 10151 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10152 | 0, |
| 10153 | "setTxMaxPower5G"}, |
| 10154 | |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 10155 | {WE_SET_PKTLOG, |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 10156 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 10157 | 0, |
| 10158 | "pktlog"}, |
| 10159 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10160 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 10161 | * as well to keep same syntax as in SAP. Now onwards, STA |
| 10162 | * will support both */ |
| 10163 | {WE_SET_MAX_TX_POWER, |
| 10164 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10165 | 0, |
| 10166 | "setTxMaxPower"}, |
| 10167 | |
| 10168 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
| 10169 | * 1 = enable and 0 = disable */ |
| 10170 | { |
| 10171 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 10172 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10173 | 0, |
| 10174 | "setHDtimTransn" |
| 10175 | }, |
| 10176 | |
| 10177 | {WE_SET_TM_LEVEL, |
| 10178 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10179 | 0, |
| 10180 | "setTmLevel"}, |
| 10181 | |
| 10182 | {WE_SET_PHYMODE, |
| 10183 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10184 | 0, |
| 10185 | "setphymode"}, |
| 10186 | |
| 10187 | {WE_SET_NSS, |
| 10188 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10189 | 0, |
| 10190 | "nss"}, |
| 10191 | |
| 10192 | {WE_SET_LDPC, |
| 10193 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10194 | 0, |
| 10195 | "ldpc"}, |
| 10196 | |
| 10197 | {WE_SET_TX_STBC, |
| 10198 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10199 | 0, |
| 10200 | "tx_stbc"}, |
| 10201 | |
| 10202 | {WE_SET_RX_STBC, |
| 10203 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10204 | 0, |
| 10205 | "rx_stbc"}, |
| 10206 | |
| 10207 | {WE_SET_SHORT_GI, |
| 10208 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10209 | 0, |
| 10210 | "shortgi"}, |
| 10211 | |
| 10212 | {WE_SET_RTSCTS, |
| 10213 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10214 | 0, |
| 10215 | "enablertscts"}, |
| 10216 | |
| 10217 | {WE_SET_CHWIDTH, |
| 10218 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10219 | 0, |
| 10220 | "chwidth"}, |
| 10221 | |
| 10222 | {WE_SET_ANI_EN_DIS, |
| 10223 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10224 | 0, |
| 10225 | "anienable"}, |
| 10226 | |
| 10227 | {WE_SET_ANI_POLL_PERIOD, |
| 10228 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10229 | 0, |
| 10230 | "aniplen"}, |
| 10231 | |
| 10232 | {WE_SET_ANI_LISTEN_PERIOD, |
| 10233 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10234 | 0, |
| 10235 | "anilislen"}, |
| 10236 | |
| 10237 | {WE_SET_ANI_OFDM_LEVEL, |
| 10238 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10239 | 0, |
| 10240 | "aniofdmlvl"}, |
| 10241 | |
| 10242 | {WE_SET_ANI_CCK_LEVEL, |
| 10243 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10244 | 0, |
| 10245 | "aniccklvl"}, |
| 10246 | |
| 10247 | {WE_SET_DYNAMIC_BW, |
| 10248 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10249 | 0, |
| 10250 | "cwmenable"}, |
| 10251 | |
| 10252 | {WE_SET_CTS_CBW, |
| 10253 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10254 | 0, |
| 10255 | "cts_cbw" }, |
| 10256 | |
| 10257 | {WE_SET_GTX_HT_MCS, |
| 10258 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10259 | 0, |
| 10260 | "gtxHTMcs"}, |
| 10261 | |
| 10262 | {WE_SET_GTX_VHT_MCS, |
| 10263 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10264 | 0, |
| 10265 | "gtxVHTMcs"}, |
| 10266 | |
| 10267 | {WE_SET_GTX_USRCFG, |
| 10268 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10269 | 0, |
| 10270 | "gtxUsrCfg"}, |
| 10271 | |
| 10272 | {WE_SET_GTX_THRE, |
| 10273 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10274 | 0, |
| 10275 | "gtxThre"}, |
| 10276 | |
| 10277 | {WE_SET_GTX_MARGIN, |
| 10278 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10279 | 0, |
| 10280 | "gtxMargin"}, |
| 10281 | |
| 10282 | {WE_SET_GTX_STEP, |
| 10283 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10284 | 0, |
| 10285 | "gtxStep"}, |
| 10286 | |
| 10287 | {WE_SET_GTX_MINTPC, |
| 10288 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10289 | 0, |
| 10290 | "gtxMinTpc"}, |
| 10291 | |
| 10292 | {WE_SET_GTX_BWMASK, |
| 10293 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10294 | 0, |
| 10295 | "gtxBWMask"}, |
| 10296 | |
| 10297 | {WE_SET_TX_CHAINMASK, |
| 10298 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10299 | 0, |
| 10300 | "txchainmask"}, |
| 10301 | |
| 10302 | {WE_SET_RX_CHAINMASK, |
| 10303 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10304 | 0, |
| 10305 | "rxchainmask"}, |
| 10306 | |
| 10307 | {WE_SET_11N_RATE, |
| 10308 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10309 | 0, |
| 10310 | "set11NRates"}, |
| 10311 | |
| 10312 | {WE_SET_VHT_RATE, |
| 10313 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10314 | 0, |
| 10315 | "set11ACRates"}, |
| 10316 | |
| 10317 | {WE_SET_AMPDU, |
| 10318 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10319 | 0, |
| 10320 | "ampdu"}, |
| 10321 | |
| 10322 | {WE_SET_AMSDU, |
| 10323 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10324 | 0, |
| 10325 | "amsdu"}, |
| 10326 | |
| 10327 | {WE_SET_BURST_ENABLE, |
| 10328 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10329 | 0, |
| 10330 | "burst_enable"}, |
| 10331 | |
| 10332 | {WE_SET_BURST_DUR, |
| 10333 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10334 | 0, |
| 10335 | "burst_dur"}, |
| 10336 | |
| 10337 | {WE_SET_TXPOW_2G, |
| 10338 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10339 | 0, |
| 10340 | "txpow2g"}, |
| 10341 | |
| 10342 | {WE_SET_TXPOW_5G, |
| 10343 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10344 | 0, |
| 10345 | "txpow5g"}, |
| 10346 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10347 | /* Sub-cmds DBGLOG specific commands */ |
| 10348 | {WE_DBGLOG_LOG_LEVEL, |
| 10349 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10350 | 0, |
| 10351 | "dl_loglevel"}, |
| 10352 | |
| 10353 | {WE_DBGLOG_VAP_ENABLE, |
| 10354 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10355 | 0, |
| 10356 | "dl_vapon"}, |
| 10357 | |
| 10358 | {WE_DBGLOG_VAP_DISABLE, |
| 10359 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10360 | 0, |
| 10361 | "dl_vapoff"}, |
| 10362 | |
| 10363 | {WE_DBGLOG_MODULE_ENABLE, |
| 10364 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10365 | 0, |
| 10366 | "dl_modon"}, |
| 10367 | |
| 10368 | {WE_DBGLOG_MODULE_DISABLE, |
| 10369 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10370 | 0, |
| 10371 | "dl_modoff"}, |
| 10372 | |
| 10373 | {WE_DBGLOG_MOD_LOG_LEVEL, |
| 10374 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10375 | 0, |
| 10376 | "dl_mod_loglevel"}, |
| 10377 | |
| 10378 | {WE_DBGLOG_TYPE, |
| 10379 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10380 | 0, |
| 10381 | "dl_type"}, |
| 10382 | {WE_DBGLOG_REPORT_ENABLE, |
| 10383 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10384 | 0, |
| 10385 | "dl_report"}, |
| 10386 | |
| 10387 | {WE_SET_TXRX_FWSTATS, |
| 10388 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10389 | 0, |
| 10390 | "txrx_fw_stats"}, |
| 10391 | |
| 10392 | {WE_TXRX_FWSTATS_RESET, |
| 10393 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10394 | 0, |
| 10395 | "txrx_fw_st_rst"}, |
| 10396 | |
| 10397 | {WE_PPS_PAID_MATCH, |
| 10398 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10399 | 0, "paid_match"}, |
| 10400 | |
| 10401 | {WE_PPS_GID_MATCH, |
| 10402 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10403 | 0, "gid_match"}, |
| 10404 | |
| 10405 | {WE_PPS_EARLY_TIM_CLEAR, |
| 10406 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10407 | 0, "tim_clear"}, |
| 10408 | |
| 10409 | {WE_PPS_EARLY_DTIM_CLEAR, |
| 10410 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10411 | 0, "dtim_clear"}, |
| 10412 | |
| 10413 | {WE_PPS_EOF_PAD_DELIM, |
| 10414 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10415 | 0, "eof_delim"}, |
| 10416 | |
| 10417 | {WE_PPS_MACADDR_MISMATCH, |
| 10418 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10419 | 0, "mac_match"}, |
| 10420 | |
| 10421 | {WE_PPS_DELIM_CRC_FAIL, |
| 10422 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10423 | 0, "delim_fail"}, |
| 10424 | |
| 10425 | {WE_PPS_GID_NSTS_ZERO, |
| 10426 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10427 | 0, "nsts_zero"}, |
| 10428 | |
| 10429 | {WE_PPS_RSSI_CHECK, |
| 10430 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10431 | 0, "rssi_chk"}, |
| 10432 | |
| 10433 | {WE_PPS_5G_EBT, |
| 10434 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10435 | 0, "5g_ebt"}, |
| 10436 | |
| 10437 | {WE_SET_HTSMPS, |
| 10438 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10439 | 0, "htsmps"}, |
| 10440 | |
| 10441 | {WE_SET_QPOWER_MAX_PSPOLL_COUNT, |
| 10442 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10443 | 0, "set_qpspollcnt"}, |
| 10444 | |
| 10445 | {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 10446 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10447 | 0, "set_qtxwake"}, |
| 10448 | |
| 10449 | {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 10450 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10451 | 0, "set_qwakeintv"}, |
| 10452 | |
| 10453 | {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 10454 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10455 | 0, "set_qnodatapoll"}, |
| 10456 | |
| 10457 | /* handlers for MCC time quota and latency sub ioctls */ |
| 10458 | {WE_MCC_CONFIG_LATENCY, |
| 10459 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10460 | 0, "setMccLatency"}, |
| 10461 | |
| 10462 | {WE_MCC_CONFIG_QUOTA, |
| 10463 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10464 | 0, "setMccQuota"}, |
| 10465 | |
| 10466 | {WE_SET_DEBUG_LOG, |
| 10467 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10468 | 0, "setDbgLvl"}, |
| 10469 | |
| 10470 | /* handlers for early_rx power save */ |
| 10471 | {WE_SET_EARLY_RX_ADJUST_ENABLE, |
| 10472 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10473 | 0, "erx_enable"}, |
| 10474 | |
| 10475 | {WE_SET_EARLY_RX_TGT_BMISS_NUM, |
| 10476 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10477 | 0, "erx_bmiss_val"}, |
| 10478 | |
| 10479 | {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 10480 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10481 | 0, "erx_bmiss_smpl"}, |
| 10482 | |
| 10483 | {WE_SET_EARLY_RX_SLOP_STEP, |
| 10484 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10485 | 0, "erx_slop_step"}, |
| 10486 | |
| 10487 | {WE_SET_EARLY_RX_INIT_SLOP, |
| 10488 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10489 | 0, "erx_init_slop"}, |
| 10490 | |
| 10491 | {WE_SET_EARLY_RX_ADJUST_PAUSE, |
| 10492 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10493 | 0, "erx_adj_pause"}, |
| 10494 | |
| 10495 | {WE_SET_EARLY_RX_DRIFT_SAMPLE, |
| 10496 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10497 | 0, "erx_dri_sample"}, |
| 10498 | |
| 10499 | {WE_DUMP_STATS, |
| 10500 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10501 | 0, "dumpStats"}, |
| 10502 | |
| 10503 | {WE_CLEAR_STATS, |
| 10504 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10505 | 0, "clearStats"}, |
| 10506 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10507 | {WE_START_FW_PROFILE, |
| 10508 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10509 | 0, "startProfile"}, |
| 10510 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 10511 | {WE_SET_CHANNEL, |
| 10512 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10513 | 0, "setChanChange" }, |
| 10514 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 10515 | {WE_SET_CONC_SYSTEM_PREF, |
| 10516 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10517 | 0, "setConcSysPref" }, |
| 10518 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10519 | {WLAN_PRIV_SET_NONE_GET_INT, |
| 10520 | 0, |
| 10521 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10522 | ""}, |
| 10523 | |
| 10524 | /* handlers for sub-ioctl */ |
| 10525 | {WE_GET_11D_STATE, |
| 10526 | 0, |
| 10527 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10528 | "get11Dstate"}, |
| 10529 | |
| 10530 | {WE_IBSS_STATUS, |
| 10531 | 0, |
| 10532 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10533 | "getAdhocStatus"}, |
| 10534 | |
| 10535 | {WE_GET_WLAN_DBG, |
| 10536 | 0, |
| 10537 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10538 | "getwlandbg"}, |
| 10539 | |
| 10540 | {WE_GET_MAX_ASSOC, |
| 10541 | 0, |
| 10542 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10543 | "getMaxAssoc"}, |
| 10544 | |
| 10545 | {WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 10546 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10547 | "getAutoChannel" }, |
| 10548 | |
| 10549 | {WE_GET_CONCURRENCY_MODE, |
| 10550 | 0, |
| 10551 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10552 | "getconcurrency"}, |
| 10553 | |
| 10554 | {WE_GET_NSS, |
| 10555 | 0, |
| 10556 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10557 | "get_nss"}, |
| 10558 | |
| 10559 | {WE_GET_LDPC, |
| 10560 | 0, |
| 10561 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10562 | "get_ldpc"}, |
| 10563 | |
| 10564 | {WE_GET_TX_STBC, |
| 10565 | 0, |
| 10566 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10567 | "get_tx_stbc"}, |
| 10568 | |
| 10569 | {WE_GET_RX_STBC, |
| 10570 | 0, |
| 10571 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10572 | "get_rx_stbc"}, |
| 10573 | |
| 10574 | {WE_GET_SHORT_GI, |
| 10575 | 0, |
| 10576 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10577 | "get_shortgi"}, |
| 10578 | |
| 10579 | {WE_GET_RTSCTS, |
| 10580 | 0, |
| 10581 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10582 | "get_rtscts"}, |
| 10583 | |
| 10584 | {WE_GET_CHWIDTH, |
| 10585 | 0, |
| 10586 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10587 | "get_chwidth"}, |
| 10588 | |
| 10589 | {WE_GET_ANI_EN_DIS, |
| 10590 | 0, |
| 10591 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10592 | "get_anienable"}, |
| 10593 | |
| 10594 | {WE_GET_ANI_POLL_PERIOD, |
| 10595 | 0, |
| 10596 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10597 | "get_aniplen"}, |
| 10598 | |
| 10599 | {WE_GET_ANI_LISTEN_PERIOD, |
| 10600 | 0, |
| 10601 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10602 | "get_anilislen"}, |
| 10603 | |
| 10604 | {WE_GET_ANI_OFDM_LEVEL, |
| 10605 | 0, |
| 10606 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10607 | "get_aniofdmlvl"}, |
| 10608 | |
| 10609 | {WE_GET_ANI_CCK_LEVEL, |
| 10610 | 0, |
| 10611 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10612 | "get_aniccklvl"}, |
| 10613 | |
| 10614 | {WE_GET_DYNAMIC_BW, |
| 10615 | 0, |
| 10616 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10617 | "get_cwmenable"}, |
| 10618 | |
| 10619 | {WE_GET_GTX_HT_MCS, |
| 10620 | 0, |
| 10621 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10622 | "get_gtxHTMcs"}, |
| 10623 | |
| 10624 | {WE_GET_GTX_VHT_MCS, |
| 10625 | 0, |
| 10626 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10627 | "get_gtxVHTMcs"}, |
| 10628 | |
| 10629 | {WE_GET_GTX_USRCFG, |
| 10630 | 0, |
| 10631 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10632 | "get_gtxUsrCfg"}, |
| 10633 | |
| 10634 | {WE_GET_GTX_THRE, |
| 10635 | 0, |
| 10636 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10637 | "get_gtxThre"}, |
| 10638 | |
| 10639 | {WE_GET_GTX_MARGIN, |
| 10640 | 0, |
| 10641 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10642 | "get_gtxMargin"}, |
| 10643 | |
| 10644 | {WE_GET_GTX_STEP, |
| 10645 | 0, |
| 10646 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10647 | "get_gtxStep"}, |
| 10648 | |
| 10649 | {WE_GET_GTX_MINTPC, |
| 10650 | 0, |
| 10651 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10652 | "get_gtxMinTpc"}, |
| 10653 | |
| 10654 | {WE_GET_GTX_BWMASK, |
| 10655 | 0, |
| 10656 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10657 | "get_gtxBWMask"}, |
| 10658 | |
| 10659 | {WE_GET_TX_CHAINMASK, |
| 10660 | 0, |
| 10661 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10662 | "get_txchainmask"}, |
| 10663 | |
| 10664 | {WE_GET_RX_CHAINMASK, |
| 10665 | 0, |
| 10666 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10667 | "get_rxchainmask"}, |
| 10668 | |
| 10669 | {WE_GET_11N_RATE, |
| 10670 | 0, |
| 10671 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10672 | "get_11nrate"}, |
| 10673 | |
| 10674 | {WE_GET_AMPDU, |
| 10675 | 0, |
| 10676 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10677 | "get_ampdu"}, |
| 10678 | |
| 10679 | {WE_GET_AMSDU, |
| 10680 | 0, |
| 10681 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10682 | "get_amsdu"}, |
| 10683 | |
| 10684 | {WE_GET_BURST_ENABLE, |
| 10685 | 0, |
| 10686 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10687 | "get_burst_en"}, |
| 10688 | |
| 10689 | {WE_GET_BURST_DUR, |
| 10690 | 0, |
| 10691 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10692 | "get_burst_dur"}, |
| 10693 | |
| 10694 | {WE_GET_TXPOW_2G, |
| 10695 | 0, |
| 10696 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10697 | "get_txpow2g"}, |
| 10698 | |
| 10699 | {WE_GET_TXPOW_5G, |
| 10700 | 0, |
| 10701 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10702 | "get_txpow5g"}, |
| 10703 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10704 | {WE_GET_PPS_PAID_MATCH, |
| 10705 | 0, |
| 10706 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10707 | "get_paid_match"}, |
| 10708 | |
| 10709 | {WE_GET_PPS_GID_MATCH, |
| 10710 | 0, |
| 10711 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10712 | "get_gid_match"}, |
| 10713 | |
| 10714 | {WE_GET_PPS_EARLY_TIM_CLEAR, |
| 10715 | 0, |
| 10716 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10717 | "get_tim_clear"}, |
| 10718 | |
| 10719 | {WE_GET_PPS_EARLY_DTIM_CLEAR, |
| 10720 | 0, |
| 10721 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10722 | "get_dtim_clear"}, |
| 10723 | |
| 10724 | {WE_GET_PPS_EOF_PAD_DELIM, |
| 10725 | 0, |
| 10726 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10727 | "get_eof_delim"}, |
| 10728 | |
| 10729 | {WE_GET_PPS_MACADDR_MISMATCH, |
| 10730 | 0, |
| 10731 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10732 | "get_mac_match"}, |
| 10733 | |
| 10734 | {WE_GET_PPS_DELIM_CRC_FAIL, |
| 10735 | 0, |
| 10736 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10737 | "get_delim_fail"}, |
| 10738 | |
| 10739 | {WE_GET_PPS_GID_NSTS_ZERO, |
| 10740 | 0, |
| 10741 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10742 | "get_nsts_zero"}, |
| 10743 | |
| 10744 | {WE_GET_PPS_RSSI_CHECK, |
| 10745 | 0, |
| 10746 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10747 | "get_rssi_chk"}, |
| 10748 | |
| 10749 | {WE_GET_QPOWER_MAX_PSPOLL_COUNT, |
| 10750 | 0, |
| 10751 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10752 | "get_qpspollcnt"}, |
| 10753 | |
| 10754 | {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 10755 | 0, |
| 10756 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10757 | "get_qtxwake"}, |
| 10758 | |
| 10759 | {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 10760 | 0, |
| 10761 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10762 | "get_qwakeintv"}, |
| 10763 | |
| 10764 | {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 10765 | 0, |
| 10766 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10767 | "get_qnodatapoll"}, |
| 10768 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 10769 | {WE_CAP_TSF, |
| 10770 | 0, |
| 10771 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10772 | "cap_tsf"}, |
| 10773 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10774 | {WE_GET_TEMPERATURE, |
| 10775 | 0, |
| 10776 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10777 | "get_temp"}, |
| 10778 | /* handlers for main ioctl */ |
| 10779 | {WLAN_PRIV_SET_CHAR_GET_NONE, |
| 10780 | IW_PRIV_TYPE_CHAR | 512, |
| 10781 | 0, |
| 10782 | ""}, |
| 10783 | |
| 10784 | /* handlers for sub-ioctl */ |
| 10785 | {WE_WOWL_ADD_PTRN, |
| 10786 | IW_PRIV_TYPE_CHAR | 512, |
| 10787 | 0, |
| 10788 | "wowlAddPtrn"}, |
| 10789 | |
| 10790 | {WE_WOWL_DEL_PTRN, |
| 10791 | IW_PRIV_TYPE_CHAR | 512, |
| 10792 | 0, |
| 10793 | "wowlDelPtrn"}, |
| 10794 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10795 | /* handlers for sub-ioctl */ |
| 10796 | {WE_NEIGHBOR_REPORT_REQUEST, |
| 10797 | IW_PRIV_TYPE_CHAR | 512, |
| 10798 | 0, |
| 10799 | "neighbor"}, |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 10800 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10801 | {WE_SET_AP_WPS_IE, |
| 10802 | IW_PRIV_TYPE_CHAR | 512, |
| 10803 | 0, |
| 10804 | "set_ap_wps_ie"}, |
| 10805 | |
| 10806 | {WE_SET_CONFIG, |
| 10807 | IW_PRIV_TYPE_CHAR | 512, |
| 10808 | 0, |
| 10809 | "setConfig"}, |
| 10810 | |
| 10811 | /* handlers for main ioctl */ |
| 10812 | {WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 10813 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10814 | 0, |
| 10815 | ""}, |
| 10816 | |
| 10817 | /* handlers for sub-ioctl */ |
| 10818 | {WE_SET_WLAN_DBG, |
| 10819 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10820 | 0, |
| 10821 | "setwlandbg"}, |
| 10822 | |
| 10823 | /* handlers for sub-ioctl */ |
| 10824 | {WE_SET_DP_TRACE, |
| 10825 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10826 | 0, |
| 10827 | "set_dp_trace"}, |
| 10828 | |
| 10829 | {WE_SET_SAP_CHANNELS, |
| 10830 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10831 | 0, |
| 10832 | "setsapchannels"}, |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 10833 | |
| 10834 | {WE_SET_FW_TEST, |
| 10835 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10836 | 0, "fw_test"}, |
| 10837 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 10838 | /* handlers for main ioctl */ |
| 10839 | {WLAN_PRIV_SET_NONE_GET_THREE_INT, |
| 10840 | 0, |
| 10841 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10842 | "" }, |
| 10843 | {WE_GET_TSF, |
| 10844 | 0, |
| 10845 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10846 | "get_tsf" }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10847 | |
| 10848 | {WE_SET_DUAL_MAC_SCAN_CONFIG, |
| 10849 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10850 | 0, |
| 10851 | "set_scan_cfg"}, |
| 10852 | |
| 10853 | /* handlers for main ioctl */ |
| 10854 | {WLAN_PRIV_GET_CHAR_SET_NONE, |
| 10855 | 0, |
| 10856 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10857 | ""}, |
| 10858 | |
| 10859 | /* handlers for sub-ioctl */ |
| 10860 | {WE_WLAN_VERSION, |
| 10861 | 0, |
| 10862 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10863 | "version"}, |
| 10864 | {WE_GET_STATS, |
| 10865 | 0, |
| 10866 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10867 | "getStats"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10868 | {WE_LIST_FW_PROFILE, |
| 10869 | 0, |
| 10870 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10871 | "listProfile"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10872 | {WE_GET_STATES, |
| 10873 | 0, |
| 10874 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10875 | "getHostStates"}, |
| 10876 | {WE_GET_CFG, |
| 10877 | 0, |
| 10878 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10879 | "getConfig"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10880 | {WE_GET_RSSI, |
| 10881 | 0, |
| 10882 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10883 | "getRSSI"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10884 | {WE_GET_WMM_STATUS, |
| 10885 | 0, |
| 10886 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10887 | "getWmmStatus"}, |
| 10888 | { |
| 10889 | WE_GET_CHANNEL_LIST, |
| 10890 | 0, |
| 10891 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10892 | "getChannelList" |
| 10893 | }, |
| 10894 | #ifdef FEATURE_WLAN_TDLS |
| 10895 | { |
| 10896 | WE_GET_TDLS_PEERS, |
| 10897 | 0, |
| 10898 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10899 | "getTdlsPeers" |
| 10900 | }, |
| 10901 | #endif |
| 10902 | #ifdef WLAN_FEATURE_11W |
| 10903 | { |
| 10904 | WE_GET_11W_INFO, |
| 10905 | 0, |
| 10906 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10907 | "getPMFInfo" |
| 10908 | }, |
| 10909 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 10910 | { |
| 10911 | WE_GET_IBSS_STA_INFO, |
| 10912 | 0, |
| 10913 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10914 | "getIbssSTAs" |
| 10915 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10916 | {WE_GET_PHYMODE, |
| 10917 | 0, |
| 10918 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10919 | "getphymode"}, |
| 10920 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 10921 | {WE_GET_OEM_DATA_CAP, |
| 10922 | 0, |
| 10923 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10924 | "getOemDataCap"}, |
| 10925 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 10926 | {WE_GET_SNR, |
| 10927 | 0, |
| 10928 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 10929 | "getSNR"}, |
| 10930 | |
| 10931 | /* handlers for main ioctl */ |
| 10932 | {WLAN_PRIV_SET_NONE_GET_NONE, |
| 10933 | 0, |
| 10934 | 0, |
| 10935 | ""}, |
| 10936 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 10937 | /* handlers for sub-ioctl */ |
| 10938 | { |
| 10939 | WE_IBSS_GET_PEER_INFO_ALL, |
| 10940 | 0, |
| 10941 | 0, |
| 10942 | "ibssPeerInfoAll" |
| 10943 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10944 | {WE_GET_RECOVERY_STAT, |
| 10945 | 0, |
| 10946 | 0, |
| 10947 | "getRecoverStat"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10948 | |
| 10949 | {WE_GET_FW_PROFILE_DATA, |
| 10950 | 0, |
| 10951 | 0, |
| 10952 | "getProfileData"}, |
| 10953 | |
| 10954 | {WE_SET_REASSOC_TRIGGER, |
| 10955 | 0, |
| 10956 | 0, |
| 10957 | "reassoc"}, |
| 10958 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10959 | {WE_DUMP_AGC_START, |
| 10960 | 0, |
| 10961 | 0, |
| 10962 | "dump_agc_start"}, |
| 10963 | |
| 10964 | {WE_DUMP_AGC, |
| 10965 | 0, |
| 10966 | 0, |
| 10967 | "dump_agc"}, |
| 10968 | |
| 10969 | {WE_DUMP_CHANINFO_START, |
| 10970 | 0, |
| 10971 | 0, |
| 10972 | "dump_chninfo_en"}, |
| 10973 | |
| 10974 | {WE_DUMP_CHANINFO, |
| 10975 | 0, |
| 10976 | 0, |
| 10977 | "dump_chninfo"}, |
| 10978 | |
| 10979 | {WE_DUMP_WATCHDOG, |
| 10980 | 0, |
| 10981 | 0, |
| 10982 | "dump_watchdog"}, |
| 10983 | #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG |
| 10984 | {WE_DUMP_PCIE_LOG, |
| 10985 | 0, |
| 10986 | 0, |
| 10987 | "dump_pcie_log"}, |
| 10988 | #endif |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 10989 | {WE_STOP_OBSS_SCAN, |
| 10990 | 0, |
| 10991 | 0, |
| 10992 | "stop_obss_scan"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10993 | /* handlers for main ioctl */ |
| 10994 | {WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 10995 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 10996 | 0, |
| 10997 | ""}, |
| 10998 | |
| 10999 | /* handlers for sub-ioctl */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 11000 | {WE_IBSS_GET_PEER_INFO, |
| 11001 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11002 | 0, |
| 11003 | "ibssPeerInfo"}, |
| 11004 | |
| 11005 | /* handlers for sub-ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11006 | {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 11007 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11008 | 0, |
| 11009 | "setdumplog"}, |
| 11010 | |
| 11011 | {WE_MTRACE_DUMP_CMD, |
| 11012 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11013 | 0, |
| 11014 | "dumplog"}, |
| 11015 | #ifdef MPC_UT_FRAMEWORK |
| 11016 | {WE_POLICY_MANAGER_CLIST_CMD, |
| 11017 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11018 | 0, |
| 11019 | "pm_clist"}, |
| 11020 | |
| 11021 | {WE_POLICY_MANAGER_DLIST_CMD, |
| 11022 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11023 | 0, |
| 11024 | "pm_dlist"}, |
| 11025 | |
| 11026 | {WE_POLICY_MANAGER_DBS_CMD, |
| 11027 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11028 | 0, |
| 11029 | "pm_dbs"}, |
| 11030 | |
| 11031 | {WE_POLICY_MANAGER_PCL_CMD, |
| 11032 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11033 | 0, |
| 11034 | "pm_pcl"}, |
| 11035 | |
| 11036 | {WE_POLICY_MANAGER_CINFO_CMD, |
| 11037 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11038 | 0, |
| 11039 | "pm_cinfo"}, |
| 11040 | |
| 11041 | {WE_POLICY_MANAGER_ULIST_CMD, |
| 11042 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11043 | 0, |
| 11044 | "pm_ulist"}, |
| 11045 | |
| 11046 | {WE_POLICY_MANAGER_QUERY_ACTION_CMD, |
| 11047 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11048 | 0, |
| 11049 | "pm_query_action"}, |
| 11050 | |
| 11051 | {WE_POLICY_MANAGER_QUERY_ALLOW_CMD, |
| 11052 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11053 | 0, |
| 11054 | "pm_query_allow"}, |
| 11055 | |
| 11056 | {WE_POLICY_MANAGER_SCENARIO_CMD, |
| 11057 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11058 | 0, |
| 11059 | "pm_run_scenario"}, |
| 11060 | |
| 11061 | {WE_POLICY_SET_HW_MODE_CMD, |
| 11062 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11063 | 0, |
| 11064 | "pm_set_hw_mode"}, |
| 11065 | #endif |
| 11066 | #ifdef FEATURE_WLAN_TDLS |
| 11067 | /* handlers for sub ioctl */ |
| 11068 | { |
| 11069 | WE_TDLS_CONFIG_PARAMS, |
| 11070 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11071 | 0, |
| 11072 | "setTdlsConfig" |
| 11073 | }, |
| 11074 | #endif |
| 11075 | { |
| 11076 | WE_UNIT_TEST_CMD, |
| 11077 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11078 | 0, |
| 11079 | "setUnitTestCmd" |
| 11080 | }, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 11081 | { |
| 11082 | WE_MAC_PWR_DEBUG_CMD, |
| 11083 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11084 | 0, |
| 11085 | "halPwrDebug" |
| 11086 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11087 | |
| 11088 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 11089 | {WE_LED_FLASHING_PARAM, |
| 11090 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11091 | 0, |
| 11092 | "gpio_control"}, |
| 11093 | #endif |
| 11094 | /* handlers for main ioctl */ |
| 11095 | {WLAN_PRIV_ADD_TSPEC, |
| 11096 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 11097 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11098 | "addTspec"}, |
| 11099 | |
| 11100 | /* handlers for main ioctl */ |
| 11101 | {WLAN_PRIV_DEL_TSPEC, |
| 11102 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11103 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11104 | "delTspec"}, |
| 11105 | |
| 11106 | /* handlers for main ioctl */ |
| 11107 | {WLAN_PRIV_GET_TSPEC, |
| 11108 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11109 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11110 | "getTspec"}, |
| 11111 | |
| 11112 | /* handlers for main ioctl - host offload */ |
| 11113 | { |
| 11114 | WLAN_PRIV_SET_HOST_OFFLOAD, |
| 11115 | IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest), |
| 11116 | 0, |
| 11117 | "setHostOffload" |
| 11118 | } |
| 11119 | , |
| 11120 | |
| 11121 | { |
| 11122 | WLAN_GET_WLAN_STATISTICS, |
| 11123 | 0, |
| 11124 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 11125 | "getWlanStats" |
| 11126 | } |
| 11127 | , |
| 11128 | |
| 11129 | { |
| 11130 | WLAN_SET_KEEPALIVE_PARAMS, |
Mahesh A Saptasagar | 72d2e4b | 2016-04-20 12:44:17 +0530 | [diff] [blame] | 11131 | IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | |
| 11132 | IW_PRIV_SIZE_FIXED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11133 | 0, |
| 11134 | "setKeepAlive" |
| 11135 | } |
| 11136 | , |
| 11137 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 11138 | { |
| 11139 | WLAN_SET_PACKET_FILTER_PARAMS, |
Hanumanth Reddy Pothula | b3ef416 | 2016-10-25 15:13:26 +0530 | [diff] [blame] | 11140 | IW_PRIV_TYPE_BYTE | |
| 11141 | sizeof(struct pkt_filter_cfg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11142 | 0, |
| 11143 | "setPktFilter" |
| 11144 | } |
| 11145 | , |
| 11146 | #endif |
| 11147 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 11148 | { |
| 11149 | WLAN_SET_PNO, |
| 11150 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11151 | 0, |
| 11152 | "setpno" |
| 11153 | } |
| 11154 | , |
| 11155 | #endif |
| 11156 | { |
| 11157 | WLAN_SET_BAND_CONFIG, |
| 11158 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11159 | 0, |
| 11160 | "SETBAND" |
| 11161 | } |
| 11162 | , |
| 11163 | { |
| 11164 | WLAN_GET_LINK_SPEED, |
| 11165 | IW_PRIV_TYPE_CHAR | 18, |
| 11166 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" |
| 11167 | } |
| 11168 | , |
| 11169 | |
| 11170 | /* handlers for main ioctl */ |
| 11171 | {WLAN_PRIV_SET_TWO_INT_GET_NONE, |
| 11172 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11173 | 0, |
| 11174 | ""} |
| 11175 | , |
| 11176 | {WE_SET_SMPS_PARAM, |
| 11177 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11178 | 0, "set_smps_param"} |
| 11179 | , |
| 11180 | {WLAN_SET_DOT11P_CHANNEL_SCHED, |
| 11181 | IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched), |
| 11182 | 0, "set_dot11p" } |
| 11183 | , |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 11184 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11185 | {WE_SET_FW_CRASH_INJECT, |
| 11186 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11187 | 0, "crash_inject"} |
| 11188 | , |
| 11189 | #endif |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 11190 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 11191 | {WE_SET_WLAN_SUSPEND, |
| 11192 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11193 | 0, "wlan_suspend"} |
| 11194 | , |
| 11195 | {WE_SET_WLAN_RESUME, |
| 11196 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11197 | 0, "wlan_resume"} |
| 11198 | , |
| 11199 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11200 | {WE_ENABLE_FW_PROFILE, |
| 11201 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11202 | 0, "enableProfile"} |
| 11203 | , |
| 11204 | {WE_SET_FW_PROFILE_HIST_INTVL, |
| 11205 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11206 | 0, "set_hist_intvl"} |
| 11207 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11208 | {WE_SET_DUAL_MAC_FW_MODE_CONFIG, |
| 11209 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11210 | 0, "set_fw_mode_cfg"} |
| 11211 | , |
| 11212 | {WE_DUMP_DP_TRACE_LEVEL, |
| 11213 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11214 | 0, "dump_dp_trace"} |
| 11215 | , |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11216 | {WE_SET_MON_MODE_CHAN, |
| 11217 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11218 | 0, "setMonChan"} |
| 11219 | , |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 11220 | |
| 11221 | {WE_GET_ROAM_SYNCH_DELAY, |
| 11222 | 0, |
| 11223 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11224 | "hostroamdelay"} |
| 11225 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11226 | }; |
| 11227 | |
| 11228 | const struct iw_handler_def we_handler_def = { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11229 | .num_standard = QDF_ARRAY_SIZE(we_handler), |
| 11230 | .num_private = QDF_ARRAY_SIZE(we_private), |
| 11231 | .num_private_args = QDF_ARRAY_SIZE(we_private_args), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11232 | |
| 11233 | .standard = (iw_handler *) we_handler, |
| 11234 | .private = (iw_handler *) we_private, |
| 11235 | .private_args = we_private_args, |
| 11236 | .get_wireless_stats = NULL, |
| 11237 | }; |
| 11238 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11239 | /* hdd_set_wext() - configures bss parameters |
| 11240 | * @pAdapter: handle to adapter context |
| 11241 | * |
| 11242 | * Returns: none |
| 11243 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 11244 | static int hdd_set_wext(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11245 | { |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11246 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11247 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11248 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11249 | ENTER(); |
| 11250 | |
| 11251 | if (!pwextBuf) { |
| 11252 | hdd_err("ERROR: pwextBuf is NULL"); |
| 11253 | return QDF_STATUS_E_FAILURE; |
| 11254 | } |
| 11255 | |
| 11256 | if (!pHddStaCtx) { |
| 11257 | hdd_err("ERROR: pHddStaCtx is NULL"); |
| 11258 | return QDF_STATUS_E_FAILURE; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11259 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11260 | |
| 11261 | /* Now configure the roaming profile links. To SSID and bssid. */ |
| 11262 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11263 | pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11264 | |
| 11265 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11266 | pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11267 | |
| 11268 | /*Set the numOfChannels to zero to scan all the channels */ |
| 11269 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 11270 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 11271 | |
| 11272 | /* Default is no encryption */ |
| 11273 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 11274 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = |
| 11275 | eCSR_ENCRYPT_TYPE_NONE; |
| 11276 | |
| 11277 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 11278 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = |
| 11279 | eCSR_ENCRYPT_TYPE_NONE; |
| 11280 | |
| 11281 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 11282 | |
| 11283 | /* Default is no authentication */ |
| 11284 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 11285 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11286 | |
| 11287 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO; |
| 11288 | pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11289 | |
| 11290 | /*Set the default scan mode */ |
| 11291 | pAdapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 11292 | |
| 11293 | hdd_clear_roam_profile_ie(pAdapter); |
| 11294 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11295 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11296 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11297 | |
| 11298 | } |
| 11299 | |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11300 | /** |
| 11301 | * hdd_register_wext() - register wext context |
| 11302 | * @dev: net device handle |
| 11303 | * |
| 11304 | * Registers wext interface context for a given net device |
| 11305 | * |
| 11306 | * Returns: 0 on success, errno on failure |
| 11307 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11308 | int hdd_register_wext(struct net_device *dev) |
| 11309 | { |
| 11310 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11311 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11312 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11313 | |
| 11314 | ENTER(); |
| 11315 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11316 | if (!pwextBuf) { |
| 11317 | hdd_err(FL("ERROR: pwextBuf is NULL")); |
| 11318 | return QDF_STATUS_E_FAILURE; |
| 11319 | } |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11320 | |
| 11321 | /* Zero the memory. This zeros the profile structure */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11322 | memset(pwextBuf, 0, sizeof(hdd_wext_state_t)); |
| 11323 | |
| 11324 | init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))-> |
| 11325 | completion_var); |
| 11326 | |
| 11327 | status = hdd_set_wext(pAdapter); |
| 11328 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11329 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11330 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11331 | hdd_err("ERROR: hdd_set_wext failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11332 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11333 | } |
| 11334 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 11335 | if (!QDF_IS_STATUS_SUCCESS(qdf_event_create(&pwextBuf->hdd_qdf_event))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11336 | hdd_err("ERROR: HDD qdf event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11337 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11338 | } |
| 11339 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11340 | if (!QDF_IS_STATUS_SUCCESS(qdf_event_create(&pwextBuf->scanevent))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11341 | hdd_err("ERROR: HDD scan event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11342 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11343 | } |
| 11344 | /* Register as a wireless device */ |
| 11345 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 11346 | |
| 11347 | EXIT(); |
| 11348 | return 0; |
| 11349 | } |
| 11350 | |
| 11351 | int hdd_unregister_wext(struct net_device *dev) |
| 11352 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11353 | hdd_notice("dev(%p)", dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11354 | |
| 11355 | if (dev != NULL) { |
| 11356 | rtnl_lock(); |
| 11357 | dev->wireless_handlers = NULL; |
| 11358 | rtnl_unlock(); |
| 11359 | } |
| 11360 | |
| 11361 | return 0; |
| 11362 | } |