Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2017 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 | |
| 34 | #include <linux/version.h> |
| 35 | #include <linux/module.h> |
| 36 | #include <linux/kernel.h> |
| 37 | #include <linux/init.h> |
| 38 | #include <linux/wireless.h> |
| 39 | #include <mac_trace.h> |
| 40 | #include <wlan_hdd_includes.h> |
| 41 | #include <cds_api.h> |
| 42 | #include <net/arp.h> |
Manjunathappa Prakash | 3454fd6 | 2016-04-01 08:52:06 -0700 | [diff] [blame] | 43 | #include <cdp_txrx_stats.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | #include "sir_params.h" |
| 45 | #include "csr_api.h" |
| 46 | #include "csr_inside_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "sme_rrm_internal.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include <ani_global.h> |
| 49 | #include "dot11f.h" |
| 50 | #include <wlan_hdd_wowl.h> |
| 51 | #include <wlan_hdd_cfg.h> |
| 52 | #include <wlan_hdd_wmm.h> |
| 53 | #include "utils_api.h" |
| 54 | #include "wlan_hdd_p2p.h" |
| 55 | #ifdef FEATURE_WLAN_TDLS |
| 56 | #include "wlan_hdd_tdls.h" |
| 57 | #endif |
| 58 | |
| 59 | #include "cds_ieee80211_common.h" |
| 60 | #include "ol_if_athvar.h" |
| 61 | #include "dbglog_host.h" |
| 62 | #include "wma.h" |
| 63 | |
| 64 | #include "wlan_hdd_power.h" |
| 65 | #include "qwlan_version.h" |
| 66 | #include "wlan_hdd_host_offload.h" |
| 67 | |
| 68 | #include <linux/wireless.h> |
| 69 | #include <net/cfg80211.h> |
| 70 | |
| 71 | #include "wlan_hdd_misc.h" |
| 72 | |
| 73 | #include "qc_sap_ioctl.h" |
| 74 | #include "sme_api.h" |
| 75 | #include "wma_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 76 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | #include "wlan_hdd_assoc.h" |
| 78 | #include "wlan_hdd_ioctl.h" |
| 79 | #include "wlan_hdd_scan.h" |
| 80 | #include "sme_power_save_api.h" |
| 81 | #include "cds_concurrency.h" |
| 82 | #include "wlan_hdd_conc_ut.h" |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 83 | #include "wlan_hdd_tsf.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | #include "wlan_hdd_ocb.h" |
| 85 | #include "wlan_hdd_napi.h" |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 86 | #include "cdp_txrx_flow_ctrl_legacy.h" |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 87 | #include "wlan_hdd_nan_datapath.h" |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 88 | #include "wlan_hdd_stats.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 89 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 90 | #include "wlan_hdd_driver_ops.h" |
| 91 | #include "hif.h" |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 92 | #include "pld_common.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 93 | #endif |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 94 | #include "wlan_hdd_lro.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 95 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | #define HDD_FINISH_ULA_TIME_OUT 800 |
| 97 | #define HDD_SET_MCBC_FILTERS_TO_FW 1 |
| 98 | #define HDD_DELETE_MCBC_FILTERS_FROM_FW 0 |
| 99 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 100 | static int ioctl_debug; |
| 101 | module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |
| 102 | |
| 103 | /* To Validate Channel against the Frequency and Vice-Versa */ |
| 104 | static const hdd_freq_chan_map_t freq_chan_map[] = { |
| 105 | {2412, 1}, {2417, 2}, {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, |
| 106 | {2442, 7}, {2447, 8}, {2452, 9}, {2457, 10}, {2462, 11}, {2467, 12}, |
| 107 | {2472, 13}, {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, |
| 108 | {4980, 252}, {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, |
| 109 | {5200, 40}, {5220, 44}, {5240, 48}, {5260, 52}, {5280, 56}, |
| 110 | {5300, 60}, {5320, 64}, {5500, 100}, {5520, 104}, {5540, 108}, |
| 111 | {5560, 112}, {5580, 116}, {5600, 120}, {5620, 124}, {5640, 128}, |
| 112 | {5660, 132}, {5680, 136}, {5700, 140}, {5720, 144}, {5745, 149}, |
| 113 | {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165}, {5852, 170}, |
| 114 | {5855, 171}, {5860, 172}, {5865, 173}, {5870, 174}, {5875, 175}, |
| 115 | {5880, 176}, {5885, 177}, {5890, 178}, {5895, 179}, {5900, 180}, |
| 116 | {5905, 181}, {5910, 182}, {5915, 183}, {5920, 184} }; |
| 117 | |
| 118 | #define FREQ_CHAN_MAP_TABLE_SIZE \ |
| 119 | (sizeof(freq_chan_map) / sizeof(freq_chan_map[0])) |
| 120 | |
| 121 | /* Private ioctls and their sub-ioctls */ |
| 122 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 123 | #define WE_SET_11D_STATE 1 |
| 124 | #define WE_WOWL 2 |
| 125 | #define WE_SET_POWER 3 |
| 126 | #define WE_SET_MAX_ASSOC 4 |
| 127 | #define WE_SET_SCAN_DISABLE 5 |
| 128 | #define WE_SET_DATA_INACTIVITY_TO 6 |
| 129 | #define WE_SET_MAX_TX_POWER 7 |
| 130 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 131 | #define WE_SET_TM_LEVEL 9 |
| 132 | #define WE_SET_PHYMODE 10 |
| 133 | #define WE_SET_NSS 11 |
| 134 | #define WE_SET_LDPC 12 |
| 135 | #define WE_SET_TX_STBC 13 |
| 136 | #define WE_SET_RX_STBC 14 |
| 137 | #define WE_SET_SHORT_GI 15 |
| 138 | #define WE_SET_RTSCTS 16 |
| 139 | #define WE_SET_CHWIDTH 17 |
| 140 | #define WE_SET_ANI_EN_DIS 18 |
| 141 | #define WE_SET_ANI_POLL_PERIOD 19 |
| 142 | #define WE_SET_ANI_LISTEN_PERIOD 20 |
| 143 | #define WE_SET_ANI_OFDM_LEVEL 21 |
| 144 | #define WE_SET_ANI_CCK_LEVEL 22 |
| 145 | #define WE_SET_DYNAMIC_BW 23 |
| 146 | #define WE_SET_TX_CHAINMASK 24 |
| 147 | #define WE_SET_RX_CHAINMASK 25 |
| 148 | #define WE_SET_11N_RATE 26 |
| 149 | #define WE_SET_AMPDU 27 |
| 150 | #define WE_SET_AMSDU 28 |
| 151 | #define WE_SET_TXPOW_2G 29 |
| 152 | #define WE_SET_TXPOW_5G 30 |
| 153 | /* Private ioctl for firmware debug log */ |
| 154 | #define WE_DBGLOG_LOG_LEVEL 31 |
| 155 | #define WE_DBGLOG_VAP_ENABLE 32 |
| 156 | #define WE_DBGLOG_VAP_DISABLE 33 |
| 157 | #define WE_DBGLOG_MODULE_ENABLE 34 |
| 158 | #define WE_DBGLOG_MODULE_DISABLE 35 |
| 159 | #define WE_DBGLOG_MOD_LOG_LEVEL 36 |
| 160 | #define WE_DBGLOG_TYPE 37 |
| 161 | #define WE_SET_TXRX_FWSTATS 38 |
| 162 | #define WE_SET_VHT_RATE 39 |
| 163 | #define WE_DBGLOG_REPORT_ENABLE 40 |
| 164 | #define WE_TXRX_FWSTATS_RESET 41 |
| 165 | #define WE_SET_MAX_TX_POWER_2_4 42 |
| 166 | #define WE_SET_MAX_TX_POWER_5_0 43 |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 167 | #define WE_SET_PKTLOG 44 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 168 | /* Private ioctl for packet powe save */ |
| 169 | #define WE_PPS_PAID_MATCH 45 |
| 170 | #define WE_PPS_GID_MATCH 46 |
| 171 | #define WE_PPS_EARLY_TIM_CLEAR 47 |
| 172 | #define WE_PPS_EARLY_DTIM_CLEAR 48 |
| 173 | #define WE_PPS_EOF_PAD_DELIM 49 |
| 174 | #define WE_PPS_MACADDR_MISMATCH 50 |
| 175 | #define WE_PPS_DELIM_CRC_FAIL 51 |
| 176 | #define WE_PPS_GID_NSTS_ZERO 52 |
| 177 | #define WE_PPS_RSSI_CHECK 53 |
| 178 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 54 |
| 179 | #define WE_SET_HTSMPS 55 |
| 180 | /* Private ioctl for QPower */ |
| 181 | #define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56 |
| 182 | #define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57 |
| 183 | #define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58 |
| 184 | #define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59 |
| 185 | |
| 186 | #define WE_SET_BURST_ENABLE 60 |
| 187 | #define WE_SET_BURST_DUR 61 |
| 188 | /* GTX Commands */ |
| 189 | #define WE_SET_GTX_HT_MCS 62 |
| 190 | #define WE_SET_GTX_VHT_MCS 63 |
| 191 | #define WE_SET_GTX_USRCFG 64 |
| 192 | #define WE_SET_GTX_THRE 65 |
| 193 | #define WE_SET_GTX_MARGIN 66 |
| 194 | #define WE_SET_GTX_STEP 67 |
| 195 | #define WE_SET_GTX_MINTPC 68 |
| 196 | #define WE_SET_GTX_BWMASK 69 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 197 | |
| 198 | /* |
| 199 | * <ioctl> |
| 200 | * setMccLatency - Sets the MCC latency value during STA-P2P concurrency |
| 201 | * |
| 202 | * @INPUT: set_value |
| 203 | * |
| 204 | * @OUTPUT: None |
| 205 | * |
| 206 | * This IOCTL is used to set the MCC latency value in milliseconds |
| 207 | * during STA-P2P concurrency. |
| 208 | * |
| 209 | * If 0ms latency is provided, then FW will set to a default. |
| 210 | * Otherwise, latency must be at least 30ms. |
| 211 | * |
| 212 | * @E.g: iwpriv wlan0 setMccLatency 40 |
| 213 | * |
| 214 | * |
| 215 | * Supported Feature: Concurrency |
| 216 | * |
| 217 | * Usage: Internal/External |
| 218 | * |
| 219 | * </ioctl> |
| 220 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 221 | #define WE_MCC_CONFIG_LATENCY 70 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 222 | |
| 223 | /* |
| 224 | * <ioctl> |
| 225 | * setMccQuota- Set the quota for P2P cases |
| 226 | * |
| 227 | * @INPUT: set_value [0,100] |
| 228 | * |
| 229 | * @OUTPUT: None |
| 230 | * |
| 231 | * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA. |
| 232 | * |
| 233 | * Currently used to set time quota for 2 MCC vdevs/adapters using |
| 234 | * (operating channel, quota) for each mode. |
| 235 | * The info is provided run time using iwpriv command: |
| 236 | * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>. |
| 237 | * Note: the quota provided in command is for the same mode in cmd. |
| 238 | * HDD checks if MCC mode is active, gets the second mode and its |
| 239 | * operating chan. |
| 240 | * Quota for the 2nd role is calculated as 100 - quota of first mode. |
| 241 | * |
| 242 | * @E.g: iwpriv wlan0 setMccQuota 50 |
| 243 | * iwpriv p2p0 setMccQuota 50 |
| 244 | * |
| 245 | * Supported Feature: Concurrency |
| 246 | * |
| 247 | * Usage: Internal/External |
| 248 | * |
| 249 | * </ioctl> |
| 250 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 251 | #define WE_MCC_CONFIG_QUOTA 71 |
| 252 | /* Private IOCTL for debug connection issues */ |
| 253 | #define WE_SET_DEBUG_LOG 72 |
| 254 | #ifdef WE_SET_TX_POWER |
| 255 | #undef WE_SET_TX_POWER |
| 256 | #endif |
| 257 | #define WE_SET_TX_POWER 74 |
| 258 | /* Private ioctl for earlyrx power save feature */ |
| 259 | #define WE_SET_EARLY_RX_ADJUST_ENABLE 75 |
| 260 | #define WE_SET_EARLY_RX_TGT_BMISS_NUM 76 |
| 261 | #define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77 |
| 262 | #define WE_SET_EARLY_RX_SLOP_STEP 78 |
| 263 | #define WE_SET_EARLY_RX_INIT_SLOP 79 |
| 264 | #define WE_SET_EARLY_RX_ADJUST_PAUSE 80 |
| 265 | #define WE_SET_MC_RATE 81 |
| 266 | #define WE_SET_EARLY_RX_DRIFT_SAMPLE 82 |
| 267 | /* Private ioctl for packet power save */ |
| 268 | #define WE_PPS_5G_EBT 83 |
| 269 | #define WE_SET_CTS_CBW 84 |
| 270 | #define WE_DUMP_STATS 85 |
| 271 | #define WE_CLEAR_STATS 86 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 272 | /* Private sub ioctl for starting/stopping the profiling */ |
| 273 | #define WE_START_FW_PROFILE 87 |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 274 | #define WE_SET_CHANNEL 88 |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 275 | #define WE_SET_CONC_SYSTEM_PREF 89 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 276 | |
| 277 | /* Private ioctls and their sub-ioctls */ |
| 278 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 279 | #define WE_GET_11D_STATE 1 |
| 280 | #define WE_IBSS_STATUS 2 |
| 281 | #define WE_SET_SAP_CHANNELS 3 |
| 282 | #define WE_GET_WLAN_DBG 4 |
| 283 | #define WE_GET_MAX_ASSOC 6 |
| 284 | /* 7 is unused */ |
| 285 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 286 | |
| 287 | /* |
| 288 | * <ioctl> |
| 289 | * getconcurrency - Get concurrency mode |
| 290 | * |
| 291 | * @INPUT: None |
| 292 | * |
| 293 | * @OUTPUT: It shows concurrency value |
| 294 | * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO |
| 295 | * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device |
| 296 | * 8:OCB 9:EPPING 10:QVIT 11:NDI |
| 297 | * |
| 298 | * This IOCTL is used to retrieve concurrency mode. |
| 299 | * |
| 300 | * @E.g: iwpriv wlan0 getconcurrency |
| 301 | * wlan0 getconcurrency:5 |
| 302 | * Above value shows STA+P2P_Client |
| 303 | * |
| 304 | * Supported Feature: Concurrency |
| 305 | * |
| 306 | * Usage: Internal/External |
| 307 | * |
| 308 | * </ioctl> |
| 309 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | #define WE_GET_CONCURRENCY_MODE 9 |
| 311 | #define WE_GET_NSS 11 |
| 312 | #define WE_GET_LDPC 12 |
| 313 | #define WE_GET_TX_STBC 13 |
| 314 | #define WE_GET_RX_STBC 14 |
| 315 | #define WE_GET_SHORT_GI 15 |
| 316 | #define WE_GET_RTSCTS 16 |
| 317 | #define WE_GET_CHWIDTH 17 |
| 318 | #define WE_GET_ANI_EN_DIS 18 |
| 319 | #define WE_GET_ANI_POLL_PERIOD 19 |
| 320 | #define WE_GET_ANI_LISTEN_PERIOD 20 |
| 321 | #define WE_GET_ANI_OFDM_LEVEL 21 |
| 322 | #define WE_GET_ANI_CCK_LEVEL 22 |
| 323 | #define WE_GET_DYNAMIC_BW 23 |
| 324 | #define WE_GET_TX_CHAINMASK 24 |
| 325 | #define WE_GET_RX_CHAINMASK 25 |
| 326 | #define WE_GET_11N_RATE 26 |
| 327 | #define WE_GET_AMPDU 27 |
| 328 | #define WE_GET_AMSDU 28 |
| 329 | #define WE_GET_TXPOW_2G 29 |
| 330 | #define WE_GET_TXPOW_5G 30 |
Rajeev Kumar | 1bcfd63 | 2015-12-07 11:38:51 -0800 | [diff] [blame] | 331 | /* 31 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 332 | #define WE_GET_PPS_PAID_MATCH 32 |
| 333 | #define WE_GET_PPS_GID_MATCH 33 |
| 334 | #define WE_GET_PPS_EARLY_TIM_CLEAR 34 |
| 335 | #define WE_GET_PPS_EARLY_DTIM_CLEAR 35 |
| 336 | #define WE_GET_PPS_EOF_PAD_DELIM 36 |
| 337 | #define WE_GET_PPS_MACADDR_MISMATCH 37 |
| 338 | #define WE_GET_PPS_DELIM_CRC_FAIL 38 |
| 339 | #define WE_GET_PPS_GID_NSTS_ZERO 39 |
| 340 | #define WE_GET_PPS_RSSI_CHECK 40 |
| 341 | /* Private ioctl for QPower */ |
| 342 | #define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41 |
| 343 | #define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42 |
| 344 | #define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43 |
| 345 | #define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44 |
| 346 | #define WE_GET_BURST_ENABLE 45 |
| 347 | #define WE_GET_BURST_DUR 46 |
| 348 | /* GTX Commands */ |
| 349 | #define WE_GET_GTX_HT_MCS 47 |
| 350 | #define WE_GET_GTX_VHT_MCS 48 |
| 351 | #define WE_GET_GTX_USRCFG 49 |
| 352 | #define WE_GET_GTX_THRE 50 |
| 353 | #define WE_GET_GTX_MARGIN 51 |
| 354 | #define WE_GET_GTX_STEP 52 |
| 355 | #define WE_GET_GTX_MINTPC 53 |
| 356 | #define WE_GET_GTX_BWMASK 54 |
| 357 | #define WE_GET_TEMPERATURE 56 |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 358 | #define WE_CAP_TSF 58 |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 359 | #define WE_GET_ROAM_SYNCH_DELAY 59 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 360 | |
| 361 | /* Private ioctls and their sub-ioctls */ |
| 362 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 363 | |
| 364 | /* Private ioctls and their sub-ioctls */ |
| 365 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 366 | #define WE_WOWL_ADD_PTRN 1 |
| 367 | #define WE_WOWL_DEL_PTRN 2 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 368 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | #define WE_SET_AP_WPS_IE 4 /* This is called in station mode to set probe rsp ie. */ |
| 370 | #define WE_SET_CONFIG 5 |
| 371 | |
| 372 | /* Private ioctls and their sub-ioctls */ |
| 373 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 374 | #define WE_SET_WLAN_DBG 1 |
| 375 | #define WE_SET_DP_TRACE 2 |
| 376 | #define WE_SET_SAP_CHANNELS 3 |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 377 | #define WE_SET_FW_TEST 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 378 | |
| 379 | /* Private ioctls and their sub-ioctls */ |
| 380 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 381 | #define WE_WLAN_VERSION 1 |
| 382 | #define WE_GET_STATS 2 |
| 383 | #define WE_GET_CFG 3 |
| 384 | #define WE_GET_WMM_STATUS 4 |
| 385 | #define WE_GET_CHANNEL_LIST 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 386 | #define WE_GET_RSSI 6 |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 387 | |
| 388 | /* |
| 389 | * <ioctl> |
| 390 | * getSuspendStats - Get suspend/resume stats |
| 391 | * |
| 392 | * @INPUT: None |
| 393 | * |
| 394 | * @OUTPUT: character string containing formatted suspend/resume stats |
| 395 | * |
| 396 | * This ioctl is used to get suspend/resume stats formatted for display. |
| 397 | * Currently it includes suspend/resume counts, wow wake up reasons, and |
| 398 | * suspend fail reasons. |
| 399 | * |
| 400 | * @E.g: iwpriv wlan0 getSuspendStats |
| 401 | * iwpriv wlan0 getSuspendStats |
| 402 | * |
| 403 | * Supported Feature: suspend/resume |
| 404 | * |
| 405 | * Usage: Internal |
| 406 | * |
| 407 | * </ioctl> |
| 408 | */ |
| 409 | #define WE_GET_SUSPEND_RESUME_STATS 7 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 410 | #ifdef FEATURE_WLAN_TDLS |
Nitesh Shah | 5dfb99e | 2016-12-10 14:19:46 +0530 | [diff] [blame] | 411 | /* |
| 412 | * <ioctl> |
| 413 | * getTdlsPeers - Get all TDLS peers. |
| 414 | * |
| 415 | * @INPUT: None |
| 416 | * |
| 417 | * @OUTPUT: Returns the MAC address of all the TDLS peers |
| 418 | * wlan0 getTdlsPeers: |
| 419 | * MAC Id cap up RSSI |
| 420 | * --------------------------------- |
| 421 | * 00:0a:f5:0e:bd:18 2 Y Y -44 |
| 422 | * 00:0a:f5:bf:0e:12 0 N N 0 |
| 423 | * |
| 424 | * This IOCTL is used to get all TDLS peers. |
| 425 | * |
| 426 | * @E.g: iwpriv wlan0 getTdlsPeers |
| 427 | * |
| 428 | * Supported Feature: TDLS |
| 429 | * |
| 430 | * Usage: Internal/External |
| 431 | * |
| 432 | * </ioctl> |
| 433 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | #define WE_GET_TDLS_PEERS 8 |
| 435 | #endif |
| 436 | #ifdef WLAN_FEATURE_11W |
| 437 | #define WE_GET_11W_INFO 9 |
| 438 | #endif |
| 439 | #define WE_GET_STATES 10 |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 440 | #define WE_GET_IBSS_STA_INFO 11 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 441 | #define WE_GET_PHYMODE 12 |
| 442 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 443 | #define WE_GET_OEM_DATA_CAP 13 |
| 444 | #endif |
| 445 | #define WE_GET_SNR 14 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 446 | #define WE_LIST_FW_PROFILE 15 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 447 | |
| 448 | /* Private ioctls and their sub-ioctls */ |
| 449 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
| 450 | #define WE_SET_REASSOC_TRIGGER 8 |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 451 | #define WE_IBSS_GET_PEER_INFO_ALL 10 |
Rajeev Kumar | f4390fa | 2016-12-22 13:17:33 -0800 | [diff] [blame] | 452 | /* Sub ioctls 11 to 16 are not used */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | #define WE_GET_RECOVERY_STAT 17 |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 454 | #define WE_GET_FW_PROFILE_DATA 18 |
| 455 | #define WE_STOP_OBSS_SCAN 19 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 456 | |
| 457 | /* Private ioctls and their sub-ioctls */ |
| 458 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 459 | |
| 460 | #define WE_P2P_NOA_CMD 2 |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 461 | /* subcommands 3 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 463 | #define WE_MAC_PWR_DEBUG_CMD 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 464 | |
| 465 | #ifdef FEATURE_WLAN_TDLS |
Nitesh Shah | 5dfb99e | 2016-12-10 14:19:46 +0530 | [diff] [blame] | 466 | /* |
| 467 | * <ioctl> |
| 468 | * setTdlsConfig - Set TDLS configuration parameters. |
| 469 | * |
| 470 | * @INPUT: 11 TDLS configuration parameters |
| 471 | * @args[0]: tdls: [0..2] |
| 472 | * @args[1]: tx_period_t: [1000..4294967295UL] |
| 473 | * @args[2]: tx_packet_n: [0..4294967295UL] |
| 474 | * @args[3]: [discovery_period is not used anymore] |
| 475 | * @args[4]: discovery_tries_n: [1..100] |
| 476 | * @args[5]: [idle_timeout is not used anymore] |
| 477 | * @args[6]: idle_packet_n: [0..40000] |
| 478 | * @args[7]: [rssi_hysteresis is not used anymore] |
| 479 | * @args[8]: rssi_trigger_threshold: [-120..0] |
| 480 | * @args[9]: rssi_teardown_threshold: [-120..0] |
| 481 | * @args[10]: rssi_delta: [-30..0] |
| 482 | * |
| 483 | * @OUTPUT: None |
| 484 | * |
| 485 | * This IOCTL is used to set the TDLS configuration parameters. |
| 486 | * |
| 487 | * @E.g: iwpriv wlan0 setTdlsConfig tdls tx_period_t tx_packet_n |
| 488 | * discovery_period discovery_tries_n idle_timeout |
| 489 | * idle_packet_n rssi_hysteresis rssi_trigger_threshold |
| 490 | * rssi_teardown_threshold rssi_delta |
| 491 | * iwpriv wlan0 setTdlsConfig 1 1500 40 1 5 1 5 0 -70 -70 -10 |
| 492 | * |
| 493 | * Supported Feature: TDLS |
| 494 | * |
| 495 | * Usage: Internal/External |
| 496 | * |
| 497 | * </ioctl> |
| 498 | */ |
| 499 | |
| 500 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 501 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 502 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 503 | #define WE_IBSS_GET_PEER_INFO 6 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 504 | #define WE_UNIT_TEST_CMD 7 |
| 505 | |
| 506 | #define WE_MTRACE_DUMP_CMD 8 |
| 507 | #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 |
| 508 | |
| 509 | |
| 510 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 511 | #define WE_LED_FLASHING_PARAM 10 |
| 512 | #endif |
| 513 | |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 514 | /* |
| 515 | * <ioctl> |
| 516 | * pm_clist - Increments the index value of the concurrent connection list |
| 517 | * and update with the input parameters provided. |
| 518 | * |
| 519 | * @INPUT: Following 8 arguments: |
| 520 | * @vdev_id: vdev id |
| 521 | * @tx_streams: TX streams |
| 522 | * @rx_streams: RX streams |
| 523 | * @chain_mask: Chain mask |
| 524 | * @type: vdev_type |
| 525 | * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7 |
| 526 | * @sub_type: vdev_subtype |
| 527 | * P2P_Device:1 P2P_Client:2 P2P_GO:3 |
| 528 | * Proxy_STA:4 Mesh:5 Mesh_11s:6 |
| 529 | * @channel: Channel |
| 530 | * @mac: Mac id |
| 531 | * |
| 532 | * @OUTPUT: None |
| 533 | * |
| 534 | * This IOCTL is used to increments the index value of the concurrent connection |
| 535 | * list and update with the input parameters provided. |
| 536 | * |
| 537 | * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type |
| 538 | * sub_type channel mac |
| 539 | * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1 |
| 540 | * |
| 541 | * Supported Feature: DBS |
| 542 | * |
| 543 | * Usage: Internal/External |
| 544 | * |
| 545 | * </ioctl> |
| 546 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 547 | #define WE_POLICY_MANAGER_CLIST_CMD 11 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 548 | |
| 549 | /* |
| 550 | * <ioctl> |
| 551 | * pm_dlist - Delete the index from the concurrent connection list that is |
| 552 | * present in the given vdev_id. |
| 553 | * |
| 554 | * @INPUT: delete_all, vdev_id |
| 555 | * @delete_all: delete all indices |
| 556 | * @vdev_id: vdev id |
| 557 | * |
| 558 | * @OUTPUT: None |
| 559 | * |
| 560 | * This IOCTL is used to delete the index from the concurrent connection list |
| 561 | * that is present in the given vdev_id. |
| 562 | * |
| 563 | * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id |
| 564 | * iwpriv wlan0 pm_dlist 0 1 |
| 565 | * |
| 566 | * Supported Feature: DBS |
| 567 | * |
| 568 | * Usage: Internal/External |
| 569 | * |
| 570 | * </ioctl> |
| 571 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 572 | #define WE_POLICY_MANAGER_DLIST_CMD 12 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 573 | |
| 574 | /* |
| 575 | * <ioctl> |
| 576 | * pm_dbs - Set dbs capability and system preference |
| 577 | * |
| 578 | * @INPUT: dbs, system_pref |
| 579 | * @dbs: Value of DBS capability to be set |
| 580 | * @system_pref: System preference |
| 581 | * 0:CDS_THROUGHPUT 1: CDS_POWERSAVE 2: CDS_LATENCY |
| 582 | * |
| 583 | * @OUTPUT: None |
| 584 | * |
| 585 | * This IOCTL is used to set dbs capability and system preference. |
| 586 | * |
| 587 | * @E.g: iwpriv wlan0 pm_dbs dbs system_pref |
| 588 | * iwpriv wlan0 pm_dbs 1 0 |
| 589 | * |
| 590 | * Supported Feature: DBS |
| 591 | * |
| 592 | * Usage: Internal/External |
| 593 | * |
| 594 | * </ioctl> |
| 595 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | #define WE_POLICY_MANAGER_DBS_CMD 13 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 597 | |
| 598 | /* |
| 599 | * <ioctl> |
| 600 | * pm_pcl - Set pcl for concurrency mode. |
| 601 | * |
| 602 | * @INPUT: cds_con_mode |
| 603 | * @cds_con_mode: concurrency mode for PCL table |
| 604 | * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS |
| 605 | * |
| 606 | * @OUTPUT: None |
| 607 | * |
| 608 | * This IOCTL is used to set pcl for concurrency mode. |
| 609 | * |
| 610 | * @E.g: iwpriv wlan0 pm_pcl cds_con_mode |
| 611 | * iwpriv wlan0 pm_pcl 0 |
| 612 | * |
| 613 | * Supported Feature: DBS |
| 614 | * |
| 615 | * Usage: Internal/External |
| 616 | * |
| 617 | * </ioctl> |
| 618 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 619 | #define WE_POLICY_MANAGER_PCL_CMD 14 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 620 | |
| 621 | /* |
| 622 | * <ioctl> |
| 623 | * pm_cinfo - Shows the concurrent connection list. |
| 624 | * |
| 625 | * @INPUT: None |
| 626 | * |
| 627 | * @OUTPUT: None |
| 628 | * |
| 629 | * This IOCTL is used to show the concurrent connection list. |
| 630 | * |
| 631 | * @E.g: iwpriv wlan0 pm_cinfo |
| 632 | * |
| 633 | * Supported Feature: DBS |
| 634 | * |
| 635 | * Usage: Internal/External |
| 636 | * |
| 637 | * </ioctl> |
| 638 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 639 | #define WE_POLICY_MANAGER_CINFO_CMD 15 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 640 | |
| 641 | /* |
| 642 | * <ioctl> |
| 643 | * pm_ulist - Updates the index value of the concurrent connection list |
| 644 | * with the input parameters provided. |
| 645 | * |
| 646 | * @INPUT: Following 8 arguments: |
| 647 | * @vdev_id: vdev id |
| 648 | * @tx_streams: TX streams |
| 649 | * @rx_streams: RX streams |
| 650 | * @chain_mask: Chain mask |
| 651 | * @type: vdev_type |
| 652 | * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7 |
| 653 | * @sub_type: vdev_subtype |
| 654 | * P2P_Device:1 P2P_Client:2 P2P_GO:3 |
| 655 | * Proxy_STA:4 Mesh:5 Mesh_11s:6 |
| 656 | * @channel: Channel |
| 657 | * @mac: Mac id |
| 658 | * |
| 659 | * @OUTPUT: None |
| 660 | * |
| 661 | * This IOCTL is used to updates the index value of the concurrent |
| 662 | * connection list with the input parameters provided. |
| 663 | * |
| 664 | * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type |
| 665 | * sub_type channel mac |
| 666 | * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1 |
| 667 | * |
| 668 | * Supported Feature: DBS |
| 669 | * |
| 670 | * Usage: Internal/External |
| 671 | * |
| 672 | * </ioctl> |
| 673 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 674 | #define WE_POLICY_MANAGER_ULIST_CMD 16 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 675 | |
| 676 | /* |
| 677 | * <ioctl> |
| 678 | * pm_query_action - Initiate actions needed on current connections as |
| 679 | * per the channel provided. |
| 680 | * |
| 681 | * @INPUT: channel |
| 682 | * @channel: Channel on which new connection will be. |
| 683 | * |
| 684 | * @OUTPUT: None |
| 685 | * |
| 686 | * This IOCTL is used to initiate actions needed on current connections |
| 687 | * as per the channel provided. |
| 688 | * |
| 689 | * @E.g: iwpriv wlan0 pm_query_action channel |
| 690 | * iwpriv wlan0 pm_query_action 6 |
| 691 | * |
| 692 | * Supported Feature: DBS |
| 693 | * |
| 694 | * Usage: Internal/External |
| 695 | * |
| 696 | * </ioctl> |
| 697 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 698 | #define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 699 | |
| 700 | /* |
| 701 | * <ioctl> |
| 702 | * pm_query_allow - Checks for allowed concurrency combination |
| 703 | * |
| 704 | * @INPUT: mode, channel, bandwidth |
| 705 | * @mode: new connection mode |
| 706 | * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS |
| 707 | * @channel: channel on which new connection is coming up |
| 708 | * @bandwidth: Bandwidth requested by the connection |
| 709 | * 0:None 1:5MHz 2:10MHz 3:20MHz |
| 710 | * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz |
| 711 | * |
| 712 | * @OUTPUT: None |
| 713 | * |
| 714 | * This IOCTL is used to checks for allowed concurrency combination. |
| 715 | * |
| 716 | * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth |
| 717 | * iwpriv wlan0 pm_query_allow 0 6 4 |
| 718 | * |
| 719 | * Supported Feature: DBS |
| 720 | * |
| 721 | * Usage: Internal/External |
| 722 | * |
| 723 | * </ioctl> |
| 724 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 725 | #define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 726 | |
| 727 | /* |
| 728 | * <ioctl> |
| 729 | * pm_run_scenario - Create scenario with number of connections provided. |
| 730 | * |
| 731 | * @INPUT: num_of_conn |
| 732 | * @num_of_conn: the number of connections (values: 1~3) |
| 733 | * |
| 734 | * @OUTPUT: None |
| 735 | * |
| 736 | * This IOCTL is used to create scenario with the number of connections |
| 737 | * provided. |
| 738 | * |
| 739 | * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn |
| 740 | * iwpriv wlan0 pm_run_scenario 1 |
| 741 | * |
| 742 | * Supported Feature: DBS |
| 743 | * |
| 744 | * Usage: Internal/External |
| 745 | * |
| 746 | * </ioctl> |
| 747 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 748 | #define WE_POLICY_MANAGER_SCENARIO_CMD 19 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 749 | |
| 750 | /* |
| 751 | * <ioctl> |
| 752 | * pm_set_hw_mode - Set hardware for single/dual mac. |
| 753 | * |
| 754 | * @INPUT: hw_mode |
| 755 | * 0:single mac 1:dual mac |
| 756 | * |
| 757 | * @OUTPUT: None |
| 758 | * |
| 759 | * This IOCTL is used to set hardware for single/dual mac. |
| 760 | * |
| 761 | * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode |
| 762 | * iwpriv wlan0 pm_set_hw_mode 1 |
| 763 | * |
| 764 | * Supported Feature: DBS |
| 765 | * |
| 766 | * Usage: Internal/External |
| 767 | * |
| 768 | * </ioctl> |
| 769 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 770 | #define WE_POLICY_SET_HW_MODE_CMD 20 |
| 771 | |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 772 | /* |
| 773 | * <ioctl> |
| 774 | * set_scan_cfg - Set dual MAC scan config parameters. |
| 775 | * |
| 776 | * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs |
| 777 | * @dbs: Value of DBS bit |
| 778 | * @dbs_plus_agile_scan: Value of DBS plus agile scan bit |
| 779 | * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS |
| 780 | * |
| 781 | * @OUTPUT: None |
| 782 | * |
| 783 | * This IOCTL is used to set the dual MAC scan config. |
| 784 | * |
| 785 | * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan |
| 786 | * single_mac_scan_with_dbs |
| 787 | * iwpriv wlan0 set_scan_cfg 1 0 1 |
| 788 | * |
| 789 | * Supported Feature: DBS |
| 790 | * |
| 791 | * Usage: Internal/External |
| 792 | * |
| 793 | * </ioctl> |
| 794 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | #define WE_SET_DUAL_MAC_SCAN_CONFIG 21 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 796 | |
| 797 | /* |
| 798 | * <ioctl> |
| 799 | * set_fw_mode_cfg - Sets the dual mac FW mode config |
| 800 | * |
| 801 | * @INPUT: dbs, dfs |
| 802 | * @dbs: DBS bit |
| 803 | * @dfs: Agile DFS bit |
| 804 | * |
| 805 | * @OUTPUT: None |
| 806 | * |
| 807 | * This IOCTL is used to set the dual mac FW mode config. |
| 808 | * |
| 809 | * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs |
| 810 | * iwpriv wlan0 set_fw_mode_cfg 1 1 |
| 811 | * |
| 812 | * Supported Feature: DBS |
| 813 | * |
| 814 | * Usage: Internal/External |
| 815 | * |
| 816 | * </ioctl> |
| 817 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 818 | #define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22 |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 819 | #define WE_SET_MON_MODE_CHAN 23 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 820 | |
| 821 | #ifdef FEATURE_WLAN_TDLS |
| 822 | #undef MAX_VAR_ARGS |
| 823 | #define MAX_VAR_ARGS 11 |
| 824 | #else |
| 825 | #undef MAX_VAR_ARGS |
| 826 | #define MAX_VAR_ARGS 9 |
| 827 | #endif |
| 828 | |
| 829 | /* Private ioctls (with no sub-ioctls) */ |
| 830 | /* note that they must be odd so that they have "get" semantics */ |
| 831 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
| 832 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
| 833 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 834 | |
| 835 | /* (SIOCIWFIRSTPRIV + 8) is currently unused */ |
| 836 | /* (SIOCIWFIRSTPRIV + 10) is currently unused */ |
| 837 | /* (SIOCIWFIRSTPRIV + 12) is currently unused */ |
| 838 | /* (SIOCIWFIRSTPRIV + 14) is currently unused */ |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 839 | #define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15) |
| 840 | #define WE_GET_TSF 1 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | /* (SIOCIWFIRSTPRIV + 16) is currently unused */ |
| 842 | /* (SIOCIWFIRSTPRIV + 17) is currently unused */ |
| 843 | /* (SIOCIWFIRSTPRIV + 19) is currently unused */ |
| 844 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 846 | |
| 847 | /* Private ioctl for setting the host offload feature */ |
| 848 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 849 | |
| 850 | /* Private ioctl to get the statistics */ |
| 851 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 852 | |
| 853 | /* Private ioctl to set the Keep Alive Params */ |
| 854 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 855 | |
| 856 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 857 | /* Private ioctl to set the packet filtering params */ |
| 858 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 859 | #endif |
| 860 | |
| 861 | |
| 862 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 863 | /* Private ioctl to get the statistics */ |
| 864 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 865 | #endif |
| 866 | |
| 867 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) |
| 868 | |
| 869 | /* (SIOCIWFIRSTPRIV + 26) is currently unused */ |
| 870 | /* (SIOCIWFIRSTPRIV + 27) is currently unused */ |
| 871 | |
| 872 | /* Private ioctls and their sub-ioctls */ |
| 873 | #define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28) |
| 874 | #define WE_SET_SMPS_PARAM 1 |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 875 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 876 | #define WE_SET_FW_CRASH_INJECT 2 |
| 877 | #endif |
| 878 | #define WE_DUMP_DP_TRACE_LEVEL 3 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 879 | /* Private sub ioctl for enabling and setting histogram interval of profiling */ |
| 880 | #define WE_ENABLE_FW_PROFILE 4 |
| 881 | #define WE_SET_FW_PROFILE_HIST_INTVL 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 883 | /* Private sub-ioctl for initiating WoW suspend without Apps suspend */ |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 884 | #define WE_SET_WLAN_SUSPEND 6 |
| 885 | #define WE_SET_WLAN_RESUME 7 |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 886 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 887 | /* (SIOCIWFIRSTPRIV + 29) is currently unused */ |
| 888 | |
| 889 | /* 802.11p IOCTL */ |
| 890 | #define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30) |
| 891 | |
| 892 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 893 | |
| 894 | #define WLAN_STATS_INVALID 0 |
| 895 | #define WLAN_STATS_RETRY_CNT 1 |
| 896 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 897 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 898 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 899 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 900 | #define WLAN_STATS_FAIL_CNT 6 |
| 901 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 902 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 903 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 904 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 905 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 906 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 907 | |
| 908 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 909 | #define WLAN_STATS_RX_RATE 14 |
| 910 | #define WLAN_STATS_TX_RATE 15 |
| 911 | |
| 912 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 913 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 914 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 915 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 916 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 917 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 918 | |
| 919 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 920 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \ |
| 921 | *__p++ = __type; \ |
| 922 | *__p++ = __size; \ |
| 923 | memcpy(__p, __val, __size); \ |
| 924 | __p += __size; \ |
| 925 | __tlen += __size + 2; \ |
| 926 | } else { \ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 927 | hdd_err("FILL_TLV Failed!!!"); \ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 928 | } \ |
| 929 | } while (0) |
| 930 | |
| 931 | #define VERSION_VALUE_MAX_LEN 32 |
| 932 | |
| 933 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 934 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 935 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 936 | |
| 937 | #define WLAN_ADAPTER 0 |
| 938 | #define P2P_ADAPTER 1 |
| 939 | |
| 940 | /** |
| 941 | * mem_alloc_copy_from_user_helper - copy from user helper |
| 942 | * @wrqu_data: wireless extensions request data |
| 943 | * @len: length of @wrqu_data |
| 944 | * |
| 945 | * Helper function to allocate buffer and copy user data. |
| 946 | * |
| 947 | * Return: On success return a pointer to a kernel buffer containing a |
| 948 | * copy of the userspace data (with an additional NUL character |
| 949 | * appended for safety). On failure return %NULL. |
| 950 | */ |
| 951 | void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len) |
| 952 | { |
| 953 | u8 *ptr = NULL; |
| 954 | |
| 955 | /* in order to protect the code, an extra byte is post |
| 956 | * appended to the buffer and the null termination is added. |
| 957 | * However, when allocating (len+1) byte of memory, we need to |
| 958 | * make sure that there is no uint overflow when doing |
| 959 | * addition. In theory check len < UINT_MAX protects the uint |
| 960 | * overflow. For wlan private ioctl, the buffer size is much |
| 961 | * less than UINT_MAX, as a good guess, now, it is assumed |
| 962 | * that the private command buffer size is no greater than 4K |
| 963 | * (4096 bytes). So we use 4096 as the upper boundary for now. |
| 964 | */ |
| 965 | if (len > MAX_USER_COMMAND_SIZE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 966 | hdd_err("Invalid length"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | return NULL; |
| 968 | } |
| 969 | |
| 970 | ptr = kmalloc(len + 1, GFP_KERNEL); |
| 971 | if (NULL == ptr) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 972 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | return NULL; |
| 974 | } |
| 975 | |
| 976 | if (copy_from_user(ptr, wrqu_data, len)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 977 | hdd_err("failed to copy data to user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | kfree(ptr); |
| 979 | return NULL; |
| 980 | } |
| 981 | ptr[len] = '\0'; |
| 982 | return ptr; |
| 983 | } |
| 984 | |
| 985 | /** |
| 986 | * hdd_priv_get_data() - Get pointer to ioctl private data |
| 987 | * @p_priv_data: pointer to iw_point struct to be filled |
| 988 | * @wrqu: Pointer to IOCTL Data received from userspace |
| 989 | * |
| 990 | * Helper function to get compatible struct iw_point passed to ioctl |
| 991 | * |
| 992 | * Return - 0 if p_priv_data successfully filled, error otherwise |
| 993 | */ |
| 994 | int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu) |
| 995 | { |
| 996 | if ((NULL == p_priv_data) || (NULL == wrqu)) { |
| 997 | return -EINVAL; |
| 998 | } |
| 999 | #ifdef CONFIG_COMPAT |
| 1000 | if (is_compat_task()) { |
| 1001 | struct compat_iw_point *p_compat_priv_data; |
| 1002 | |
| 1003 | /* Compat task: |
| 1004 | * typecast to compat structure and copy the members. |
| 1005 | */ |
| 1006 | p_compat_priv_data = (struct compat_iw_point *)&wrqu->data; |
| 1007 | |
| 1008 | p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer); |
| 1009 | p_priv_data->length = p_compat_priv_data->length; |
| 1010 | p_priv_data->flags = p_compat_priv_data->flags; |
| 1011 | } else { |
| 1012 | #endif /* #ifdef CONFIG_COMPAT */ |
| 1013 | |
| 1014 | /* Non compat task: directly copy the structure. */ |
| 1015 | memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point)); |
| 1016 | |
| 1017 | #ifdef CONFIG_COMPAT |
| 1018 | } |
| 1019 | #endif /* #ifdef CONFIG_COMPAT */ |
| 1020 | |
| 1021 | return 0; |
| 1022 | } |
| 1023 | |
| 1024 | |
| 1025 | /** |
| 1026 | * hdd_wlan_get_stats() - Get txrx stats in SAP mode |
| 1027 | * @pAdapter: Pointer to the hdd adapter. |
| 1028 | * @length: Size of the data copied |
| 1029 | * @buffer: Pointer to char buffer. |
| 1030 | * @buf_len: Length of the char buffer. |
| 1031 | * |
| 1032 | * This function called when the "iwpriv wlan0 get_stats" command is given. |
| 1033 | * It used to collect the txrx stats when the device is configured in SAP mode. |
| 1034 | * |
| 1035 | * Return - none |
| 1036 | */ |
| 1037 | void hdd_wlan_get_stats(hdd_adapter_t *pAdapter, uint16_t *length, |
| 1038 | char *buffer, uint16_t buf_len) |
| 1039 | { |
| 1040 | hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 1041 | uint32_t len = 0; |
| 1042 | uint32_t total_rx_pkt = 0, total_rx_dropped = 0; |
| 1043 | uint32_t total_rx_delv = 0, total_rx_refused = 0; |
| 1044 | int i = 0; |
| 1045 | |
| 1046 | for (; i < NUM_CPUS; i++) { |
| 1047 | total_rx_pkt += pStats->rxPackets[i]; |
| 1048 | total_rx_dropped += pStats->rxDropped[i]; |
| 1049 | total_rx_delv += pStats->rxDelivered[i]; |
| 1050 | total_rx_refused += pStats->rxRefused[i]; |
| 1051 | } |
| 1052 | |
| 1053 | len = scnprintf(buffer, buf_len, |
| 1054 | "\nTransmit" |
| 1055 | "\ncalled %u, dropped %u," |
| 1056 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 1057 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 1058 | "\ncompleted %u," |
| 1059 | "\n\nReceive Total" |
| 1060 | "\n packets %u, dropped %u, delivered %u, refused %u" |
| 1061 | "\n", |
| 1062 | pStats->txXmitCalled, |
| 1063 | pStats->txXmitDropped, |
| 1064 | |
| 1065 | pStats->txXmitDroppedAC[SME_AC_BK], |
| 1066 | pStats->txXmitDroppedAC[SME_AC_BE], |
| 1067 | pStats->txXmitDroppedAC[SME_AC_VI], |
| 1068 | pStats->txXmitDroppedAC[SME_AC_VO], |
| 1069 | |
| 1070 | pStats->txXmitClassifiedAC[SME_AC_BK], |
| 1071 | pStats->txXmitClassifiedAC[SME_AC_BE], |
| 1072 | pStats->txXmitClassifiedAC[SME_AC_VI], |
| 1073 | pStats->txXmitClassifiedAC[SME_AC_VO], |
| 1074 | |
| 1075 | pStats->txCompleted, |
| 1076 | total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused |
| 1077 | ); |
| 1078 | |
| 1079 | for (i = 0; i < NUM_CPUS; i++) { |
| 1080 | len += scnprintf(buffer + len, buf_len - len, |
| 1081 | "\nReceive CPU: %d" |
| 1082 | "\n packets %u, dropped %u, delivered %u, refused %u", |
| 1083 | i, pStats->rxPackets[i], pStats->rxDropped[i], |
| 1084 | pStats->rxDelivered[i], pStats->rxRefused[i]); |
| 1085 | } |
| 1086 | |
| 1087 | len += scnprintf(buffer + len, buf_len - len, |
| 1088 | "\n\nTX_FLOW" |
| 1089 | "\nCurrent status: %s" |
| 1090 | "\ntx-flow timer start count %u" |
| 1091 | "\npause count %u, unpause count %u", |
| 1092 | (pStats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"), |
| 1093 | pStats->txflow_timer_cnt, |
| 1094 | pStats->txflow_pause_cnt, |
| 1095 | pStats->txflow_unpause_cnt); |
| 1096 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1097 | len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 1098 | pAdapter->sessionId, &buffer[len], (buf_len - len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | |
| 1100 | len += hdd_napi_stats(buffer + len, buf_len - len, |
| 1101 | NULL, hdd_napi_get_all()); |
| 1102 | |
| 1103 | *length = len + 1; |
| 1104 | } |
| 1105 | |
| 1106 | /** |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 1107 | * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer |
| 1108 | * @hdd_ctx: The Hdd context owning the stats to be written |
| 1109 | * @buffer: The char buffer to write to |
| 1110 | * @max_len: The maximum number of chars to write |
| 1111 | * |
| 1112 | * This assumes hdd_ctx has already been validated, and buffer is not NULL. |
| 1113 | * |
| 1114 | * Return - length of written content, negative number on error |
| 1115 | */ |
| 1116 | static int wlan_hdd_write_suspend_resume_stats(hdd_context_t *hdd_ctx, |
| 1117 | char *buffer, uint16_t max_len) |
| 1118 | { |
| 1119 | QDF_STATUS status; |
| 1120 | struct suspend_resume_stats *sr_stats; |
| 1121 | struct sir_wake_lock_stats wow_stats; |
| 1122 | |
| 1123 | sr_stats = &hdd_ctx->suspend_resume_stats; |
| 1124 | |
| 1125 | status = wma_get_wakelock_stats(&wow_stats); |
| 1126 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1127 | hdd_err("Failed to get WoW stats"); |
| 1128 | return qdf_status_to_os_return(status); |
| 1129 | } |
| 1130 | |
| 1131 | return scnprintf(buffer, max_len, |
| 1132 | "\n" |
| 1133 | "Suspends: %u\n" |
| 1134 | "Resumes: %u\n" |
| 1135 | "\n" |
| 1136 | "Suspend Fail Reasons\n" |
| 1137 | "\tIPA: %u\n" |
| 1138 | "\tRadar: %u\n" |
| 1139 | "\tRoam: %u\n" |
| 1140 | "\tScan: %u\n" |
| 1141 | "\tInitial Wakeup: %u\n" |
| 1142 | "\n" |
| 1143 | "WoW Wake Reasons\n" |
| 1144 | "\tunicast: %u\n" |
| 1145 | "\tbroadcast: %u\n" |
| 1146 | "\tIPv4 multicast: %u\n" |
| 1147 | "\tIPv6 multicast: %u\n" |
| 1148 | "\tIPv6 multicast RA: %u\n" |
| 1149 | "\tIPv6 multicast NS: %u\n" |
| 1150 | "\tIPv6 multicast NA: %u\n" |
| 1151 | "\tICMPv4: %u\n" |
| 1152 | "\tICMPv6: %u\n" |
| 1153 | "\tRSSI Breach: %u\n" |
| 1154 | "\tLow RSSI: %u\n" |
| 1155 | "\tG-Scan: %u\n" |
| 1156 | "\tPNO Complete: %u\n" |
| 1157 | "\tPNO Match: %u\n", |
| 1158 | sr_stats->suspends, |
| 1159 | sr_stats->resumes, |
| 1160 | sr_stats->suspend_fail[SUSPEND_FAIL_IPA], |
| 1161 | sr_stats->suspend_fail[SUSPEND_FAIL_RADAR], |
| 1162 | sr_stats->suspend_fail[SUSPEND_FAIL_ROAM], |
| 1163 | sr_stats->suspend_fail[SUSPEND_FAIL_SCAN], |
| 1164 | sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP], |
| 1165 | wow_stats.wow_ucast_wake_up_count, |
| 1166 | wow_stats.wow_bcast_wake_up_count, |
| 1167 | wow_stats.wow_ipv4_mcast_wake_up_count, |
| 1168 | wow_stats.wow_ipv6_mcast_wake_up_count, |
| 1169 | wow_stats.wow_ipv6_mcast_ra_stats, |
| 1170 | wow_stats.wow_ipv6_mcast_ns_stats, |
| 1171 | wow_stats.wow_ipv6_mcast_na_stats, |
| 1172 | wow_stats.wow_icmpv4_count, |
| 1173 | wow_stats.wow_icmpv6_count, |
| 1174 | wow_stats.wow_rssi_breach_wake_up_count, |
| 1175 | wow_stats.wow_low_rssi_wake_up_count, |
| 1176 | wow_stats.wow_gscan_wake_up_count, |
| 1177 | wow_stats.wow_pno_complete_wake_up_count, |
| 1178 | wow_stats.wow_pno_match_wake_up_count); |
| 1179 | } |
| 1180 | |
| 1181 | /** |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1182 | * hdd_wlan_list_fw_profile() - Get fw profiling points |
| 1183 | * @length: Size of the data copied |
| 1184 | * @buffer: Pointer to char buffer. |
| 1185 | * @buf_len: Length of the char buffer. |
| 1186 | * |
| 1187 | * This function called when the "iwpriv wlan0 listProfile" command is given. |
| 1188 | * It is used to get the supported profiling points in FW. |
| 1189 | * |
| 1190 | * Return - none |
| 1191 | */ |
| 1192 | void hdd_wlan_list_fw_profile(uint16_t *length, |
| 1193 | char *buffer, uint16_t buf_len) |
| 1194 | { |
| 1195 | uint32_t len = 0; |
| 1196 | |
| 1197 | len = scnprintf(buffer, buf_len, |
| 1198 | "PROF_CPU_IDLE: %u\n" |
| 1199 | "PROF_PPDU_PROC: %u\n" |
| 1200 | "PROF_PPDU_POST: %u\n" |
| 1201 | "PROF_HTT_TX_INPUT: %u\n" |
| 1202 | "PROF_MSDU_ENQ: %u\n" |
| 1203 | "PROF_PPDU_POST_HAL: %u\n" |
| 1204 | "PROF_COMPUTE_TX_TIME: %u\n", |
| 1205 | PROF_CPU_IDLE, |
| 1206 | PROF_PPDU_PROC, |
| 1207 | PROF_PPDU_POST, |
| 1208 | PROF_HTT_TX_INPUT, |
| 1209 | PROF_MSDU_ENQ, |
| 1210 | PROF_PPDU_POST_HAL, |
| 1211 | PROF_COMPUTE_TX_TIME); |
| 1212 | |
| 1213 | *length = len + 1; |
| 1214 | } |
| 1215 | |
| 1216 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | * hdd_wlan_dump_stats() - display dump Stats |
| 1218 | * @adapter: adapter handle |
| 1219 | * @value: value from user |
| 1220 | * |
| 1221 | * Return: none |
| 1222 | */ |
| 1223 | void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value) |
| 1224 | { |
| 1225 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 1226 | |
| 1227 | switch (value) { |
| 1228 | |
| 1229 | case WLAN_TXRX_HIST_STATS: |
| 1230 | wlan_hdd_display_tx_rx_histogram(hdd_ctx); |
| 1231 | break; |
| 1232 | case WLAN_HDD_NETIF_OPER_HISTORY: |
| 1233 | wlan_hdd_display_netif_queue_history(hdd_ctx); |
| 1234 | break; |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 1235 | case WLAN_HIF_STATS: |
| 1236 | hdd_display_hif_stats(); |
| 1237 | break; |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 1238 | case WLAN_LRO_STATS: |
| 1239 | hdd_lro_display_stats(hdd_ctx); |
| 1240 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1242 | cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC), value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | break; |
| 1244 | } |
| 1245 | } |
| 1246 | |
| 1247 | /** |
| 1248 | * hdd_wlan_get_version() - Get driver version information |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1249 | * @hdd_ctx: Global HDD context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | * @wrqu: Pointer to IOCTL REQUEST Data. |
| 1251 | * @extra: Pointer to destination buffer |
| 1252 | * |
| 1253 | * This function is used to get Wlan Driver, Firmware, & Hardware |
| 1254 | * Version information. If @wrqu and @extra are specified, then the |
| 1255 | * version string is returned. Otherwise it is simply printed to the |
| 1256 | * kernel log. |
| 1257 | * |
| 1258 | * Return: none |
| 1259 | */ |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1260 | 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] | 1261 | char *extra) |
| 1262 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1263 | tSirVersionString wcnss_sw_version; |
| 1264 | const char *swversion; |
| 1265 | const char *hwversion; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1266 | 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] | 1267 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1268 | if (!hdd_ctx) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1269 | hdd_err("Invalid context, HDD context is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1270 | goto error; |
| 1271 | } |
| 1272 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1273 | snprintf(wcnss_sw_version, sizeof(wcnss_sw_version), "%08x", |
| 1274 | hdd_ctx->target_fw_version); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1275 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1276 | swversion = wcnss_sw_version; |
| 1277 | msp_id = (hdd_ctx->target_fw_version & 0xf0000000) >> 28; |
| 1278 | mspid = (hdd_ctx->target_fw_version & 0xf000000) >> 24; |
| 1279 | siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20; |
| 1280 | crmid = hdd_ctx->target_fw_version & 0x7fff; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1281 | sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 1283 | hwversion = hdd_ctx->target_hw_name; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1284 | |
| 1285 | if (wrqu && extra) { |
| 1286 | wrqu->data.length = |
| 1287 | scnprintf(extra, WE_MAX_STR_LEN, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1288 | "Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1289 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1290 | msp_id, mspid, siid, crmid, |
| 1291 | sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1292 | } else { |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1293 | 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] | 1294 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 1295 | msp_id, mspid, siid, crmid, sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | } |
| 1297 | error: |
| 1298 | return; |
| 1299 | } |
| 1300 | |
| 1301 | /** |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1302 | * hdd_wlan_get_ibss_mac_addr_from_staid() - Get IBSS MAC address |
| 1303 | * @pAdapter: Adapter upon which the IBSS client is active |
| 1304 | * @staIdx: Station index of the IBSS peer |
| 1305 | * |
| 1306 | * Return: a pointer to the MAC address of the IBSS peer if the peer is |
| 1307 | * found, otherwise %NULL. |
| 1308 | */ |
| 1309 | struct qdf_mac_addr * |
| 1310 | hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter, |
| 1311 | uint8_t staIdx) |
| 1312 | { |
| 1313 | uint8_t idx; |
| 1314 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1315 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1316 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1317 | if (0 != pHddStaCtx->conn_info.staId[idx] && |
| 1318 | staIdx == pHddStaCtx->conn_info.staId[idx]) { |
| 1319 | return &pHddStaCtx->conn_info.peerMacAddress[idx]; |
| 1320 | } |
| 1321 | } |
| 1322 | return NULL; |
| 1323 | } |
| 1324 | |
| 1325 | /** |
| 1326 | * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information |
| 1327 | * @pAdapter: Adapter upon which the IBSS client is active |
| 1328 | * @staIdx: Station index of the IBSS peer |
| 1329 | * |
| 1330 | * Return: QDF_STATUS_STATUS if the peer was found and displayed, |
| 1331 | * otherwise an appropriate QDF_STATUS_E_* failure code. |
| 1332 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 1333 | static QDF_STATUS hdd_wlan_get_ibss_peer_info(hdd_adapter_t *pAdapter, |
| 1334 | uint8_t staIdx) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1335 | { |
| 1336 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 1337 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1338 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1339 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1340 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1341 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
Prakash Dhavali | 4c2a9fe | 2016-12-02 16:01:08 -0800 | [diff] [blame] | 1342 | status = sme_request_ibss_peer_info(hHal, pAdapter, |
| 1343 | hdd_get_ibss_peer_info_cb, |
| 1344 | false, staIdx); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1345 | |
| 1346 | if (QDF_STATUS_SUCCESS == status) { |
| 1347 | unsigned long rc; |
| 1348 | rc = wait_for_completion_timeout |
| 1349 | (&pAdapter->ibss_peer_info_comp, |
| 1350 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 1351 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1352 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1353 | return QDF_STATUS_E_FAILURE; |
| 1354 | } |
| 1355 | |
| 1356 | /** Print the peer info */ |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1357 | hdd_info("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1358 | { |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1359 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 1360 | uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1361 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1362 | qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0]. |
| 1363 | mac_addr, sizeof(mac_addr)); |
| 1364 | hdd_info("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
| 1365 | mac_addr, (int)tx_rate, |
| 1366 | (int)pPeerInfo->peerInfoParams[0].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1367 | } |
| 1368 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1369 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1370 | } |
| 1371 | |
| 1372 | return status; |
| 1373 | } |
| 1374 | |
| 1375 | /** |
| 1376 | * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers |
| 1377 | * @pAdapter: Adapter upon which the IBSS clients are active |
| 1378 | * |
| 1379 | * Return: QDF_STATUS_STATUS if the peer information was retrieved and |
| 1380 | * displayed, otherwise an appropriate QDF_STATUS_E_* failure code. |
| 1381 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 1382 | 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] | 1383 | { |
| 1384 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 1385 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1386 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1387 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1388 | int i; |
| 1389 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1390 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
Prakash Dhavali | 4c2a9fe | 2016-12-02 16:01:08 -0800 | [diff] [blame] | 1391 | status = sme_request_ibss_peer_info(hHal, pAdapter, |
| 1392 | hdd_get_ibss_peer_info_cb, |
| 1393 | true, 0xFF); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1394 | |
| 1395 | if (QDF_STATUS_SUCCESS == status) { |
| 1396 | unsigned long rc; |
| 1397 | rc = wait_for_completion_timeout |
| 1398 | (&pAdapter->ibss_peer_info_comp, |
| 1399 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 1400 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1401 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1402 | return QDF_STATUS_E_FAILURE; |
| 1403 | } |
| 1404 | |
| 1405 | /** Print the peer info */ |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1406 | hdd_info("pPeerInfo->numIBSSPeers = %d ", |
| 1407 | (int)pPeerInfo->numPeers); |
| 1408 | for (i = 0; i < pPeerInfo->numPeers; i++) { |
| 1409 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 1410 | uint32_t tx_rate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1411 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 1412 | tx_rate = pPeerInfo->peerInfoParams[i].txRate; |
| 1413 | qdf_mem_copy(mac_addr, |
| 1414 | pPeerInfo->peerInfoParams[i].mac_addr, |
| 1415 | sizeof(mac_addr)); |
| 1416 | |
| 1417 | hdd_info(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
| 1418 | mac_addr, (int)tx_rate, |
| 1419 | (int)pPeerInfo->peerInfoParams[i].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1420 | } |
| 1421 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1422 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1423 | } |
| 1424 | |
| 1425 | return status; |
| 1426 | } |
| 1427 | |
| 1428 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1429 | * hdd_wlan_get_rts_threshold() - Get RTS threshold |
| 1430 | * @pAdapter: adapter upon which the request was received |
| 1431 | * @wrqu: pointer to the ioctl request |
| 1432 | * |
| 1433 | * This function retrieves the current RTS threshold value and stores |
| 1434 | * it in the ioctl request structure |
| 1435 | * |
| 1436 | * Return: 0 if valid data was returned, non-zero on error |
| 1437 | */ |
| 1438 | int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 1439 | { |
| 1440 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1441 | uint32_t threshold = 0; |
| 1442 | hdd_context_t *hdd_ctx; |
| 1443 | int ret = 0; |
| 1444 | |
| 1445 | ENTER(); |
| 1446 | |
| 1447 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1448 | hdd_err("Adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1449 | return -EINVAL; |
| 1450 | } |
| 1451 | |
| 1452 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 1453 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 1454 | if (0 != ret) |
| 1455 | return ret; |
| 1456 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1457 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | sme_cfg_get_int(hHal, WNI_CFG_RTS_THRESHOLD, &threshold)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1459 | hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | return -EIO; |
| 1461 | } |
| 1462 | wrqu->rts.value = threshold; |
| 1463 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1464 | hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | |
| 1466 | EXIT(); |
| 1467 | |
| 1468 | return 0; |
| 1469 | } |
| 1470 | |
| 1471 | /** |
| 1472 | * hdd_wlan_get_frag_threshold() - Get fragmentation threshold |
| 1473 | * @pAdapter: adapter upon which the request was received |
| 1474 | * @wrqu: pointer to the ioctl request |
| 1475 | * |
| 1476 | * This function retrieves the current fragmentation threshold value |
| 1477 | * and stores it in the ioctl request structure |
| 1478 | * |
| 1479 | * Return: 0 if valid data was returned, non-zero on error |
| 1480 | */ |
| 1481 | int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, |
| 1482 | union iwreq_data *wrqu) |
| 1483 | { |
| 1484 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1485 | uint32_t threshold = 0, status = 0; |
| 1486 | hdd_context_t *hdd_ctx; |
| 1487 | |
| 1488 | ENTER(); |
| 1489 | |
| 1490 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1491 | hdd_err("Adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1492 | return -EINVAL; |
| 1493 | } |
| 1494 | |
| 1495 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 1496 | status = wlan_hdd_validate_context(hdd_ctx); |
| 1497 | if (0 != status) |
| 1498 | return status; |
| 1499 | |
| 1500 | if (sme_cfg_get_int(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1501 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1502 | hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | return -EIO; |
| 1504 | } |
| 1505 | wrqu->frag.value = threshold; |
| 1506 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1507 | hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1508 | |
| 1509 | EXIT(); |
| 1510 | |
| 1511 | return 0; |
| 1512 | } |
| 1513 | |
| 1514 | /** |
| 1515 | * hdd_wlan_get_freq() - Convert channel to frequency |
| 1516 | * @channel: channel to be converted |
| 1517 | * @pfreq: where to store the frequency |
| 1518 | * |
| 1519 | * Return: 1 on success, otherwise a negative errno |
| 1520 | */ |
| 1521 | int hdd_wlan_get_freq(uint32_t channel, uint32_t *pfreq) |
| 1522 | { |
| 1523 | int i; |
| 1524 | if (channel > 0) { |
| 1525 | for (i = 0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) { |
| 1526 | if (channel == freq_chan_map[i].chan) { |
| 1527 | *pfreq = freq_chan_map[i].freq; |
| 1528 | return 1; |
| 1529 | } |
| 1530 | } |
| 1531 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1532 | hdd_notice("Invalid channel no=%d!!", channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1533 | return -EINVAL; |
| 1534 | } |
| 1535 | |
| 1536 | /** |
| 1537 | * hdd_is_auth_type_rsn() - RSN authentication type check |
| 1538 | * @authType: authentication type to be checked |
| 1539 | * |
| 1540 | * Return: true if @authType is an RSN authentication type, |
| 1541 | * false if it is not |
| 1542 | */ |
| 1543 | static bool hdd_is_auth_type_rsn(eCsrAuthType authType) |
| 1544 | { |
| 1545 | bool rsnType = false; |
| 1546 | /* is the authType supported? */ |
| 1547 | switch (authType) { |
| 1548 | case eCSR_AUTH_TYPE_NONE: /* never used */ |
| 1549 | rsnType = false; |
| 1550 | break; |
| 1551 | /* MAC layer authentication types */ |
| 1552 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 1553 | rsnType = false; |
| 1554 | break; |
| 1555 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 1556 | rsnType = false; |
| 1557 | break; |
| 1558 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 1559 | rsnType = false; |
| 1560 | break; |
| 1561 | |
| 1562 | /* Upper layer authentication types */ |
| 1563 | case eCSR_AUTH_TYPE_WPA: |
| 1564 | rsnType = true; |
| 1565 | break; |
| 1566 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 1567 | rsnType = true; |
| 1568 | break; |
| 1569 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 1570 | rsnType = true; |
| 1571 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1572 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1573 | case eCSR_AUTH_TYPE_RSN: |
| 1574 | rsnType = true; |
| 1575 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1577 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 1578 | #ifdef WLAN_FEATURE_11W |
| 1579 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 1580 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 1581 | #endif |
| 1582 | rsnType = true; |
| 1583 | break; |
| 1584 | /* case eCSR_AUTH_TYPE_FAILED: */ |
| 1585 | case eCSR_AUTH_TYPE_UNKNOWN: |
| 1586 | rsnType = false; |
| 1587 | break; |
| 1588 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1589 | hdd_err("unknown authType %d, treat as open", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | authType); |
| 1591 | rsnType = false; |
| 1592 | break; |
| 1593 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1594 | hdd_notice("called with authType: %d, returned: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1595 | authType, rsnType); |
| 1596 | return rsnType; |
| 1597 | } |
| 1598 | |
| 1599 | /** |
| 1600 | * hdd_get_rssi_cb() - "Get RSSI" callback function |
| 1601 | * @rssi: Current RSSI of the station |
| 1602 | * @staId: ID of the station |
| 1603 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 1604 | * a &struct statsContext |
| 1605 | * |
| 1606 | * Return: None |
| 1607 | */ |
| 1608 | static void hdd_get_rssi_cb(int8_t rssi, uint32_t staId, void *pContext) |
| 1609 | { |
| 1610 | struct statsContext *pStatsContext; |
| 1611 | hdd_adapter_t *pAdapter; |
| 1612 | |
| 1613 | if (ioctl_debug) { |
| 1614 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
| 1615 | __func__, (int)rssi, (int)staId, pContext); |
| 1616 | } |
| 1617 | |
| 1618 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1619 | hdd_err("Bad param"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | return; |
| 1621 | } |
| 1622 | |
| 1623 | pStatsContext = pContext; |
| 1624 | pAdapter = pStatsContext->pAdapter; |
| 1625 | |
| 1626 | /* there is a race condition that exists between this callback |
| 1627 | * function and the caller since the caller could time out |
| 1628 | * either before or while this code is executing. we use a |
| 1629 | * spinlock to serialize these actions |
| 1630 | */ |
| 1631 | spin_lock(&hdd_context_lock); |
| 1632 | |
| 1633 | if ((NULL == pAdapter) || |
| 1634 | (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 1635 | /* the caller presumably timed out so there is nothing |
| 1636 | * we can do |
| 1637 | */ |
| 1638 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1639 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1640 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1641 | if (ioctl_debug) { |
| 1642 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1643 | __func__, pAdapter, pStatsContext->magic); |
| 1644 | } |
| 1645 | return; |
| 1646 | } |
| 1647 | |
| 1648 | /* context is valid so caller is still waiting */ |
| 1649 | |
| 1650 | /* paranoia: invalidate the magic */ |
| 1651 | pStatsContext->magic = 0; |
| 1652 | |
| 1653 | /* copy over the rssi */ |
| 1654 | pAdapter->rssi = rssi; |
| 1655 | |
Sachin Ahuja | bef8c10 | 2015-11-16 15:15:49 +0530 | [diff] [blame] | 1656 | if (pAdapter->rssi > 0) |
| 1657 | pAdapter->rssi = 0; |
| 1658 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | /* notify the caller */ |
| 1660 | complete(&pStatsContext->completion); |
| 1661 | |
| 1662 | /* serialization is complete */ |
| 1663 | spin_unlock(&hdd_context_lock); |
| 1664 | } |
| 1665 | |
| 1666 | /** |
| 1667 | * hdd_get_snr_cb() - "Get SNR" callback function |
| 1668 | * @snr: Current SNR of the station |
| 1669 | * @staId: ID of the station |
| 1670 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 1671 | * a &struct statsContext |
| 1672 | * |
| 1673 | * Return: None |
| 1674 | */ |
| 1675 | static void hdd_get_snr_cb(int8_t snr, uint32_t staId, void *pContext) |
| 1676 | { |
| 1677 | struct statsContext *pStatsContext; |
| 1678 | hdd_adapter_t *pAdapter; |
| 1679 | |
| 1680 | if (ioctl_debug) { |
| 1681 | pr_info("%s: snr [%d] STA [%d] pContext [%p]\n", |
| 1682 | __func__, (int)snr, (int)staId, pContext); |
| 1683 | } |
| 1684 | |
| 1685 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1686 | hdd_err("Bad param"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | return; |
| 1688 | } |
| 1689 | |
| 1690 | pStatsContext = pContext; |
| 1691 | pAdapter = pStatsContext->pAdapter; |
| 1692 | |
| 1693 | /* there is a race condition that exists between this callback |
| 1694 | * function and the caller since the caller could time out |
| 1695 | * either before or while this code is executing. we use a |
| 1696 | * spinlock to serialize these actions |
| 1697 | */ |
| 1698 | spin_lock(&hdd_context_lock); |
| 1699 | |
| 1700 | if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 1701 | /* the caller presumably timed out so there is nothing |
| 1702 | * we can do |
| 1703 | */ |
| 1704 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1705 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1706 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1707 | if (ioctl_debug) { |
| 1708 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1709 | __func__, pAdapter, pStatsContext->magic); |
| 1710 | } |
| 1711 | return; |
| 1712 | } |
| 1713 | |
| 1714 | /* context is valid so caller is still waiting */ |
| 1715 | |
| 1716 | /* paranoia: invalidate the magic */ |
| 1717 | pStatsContext->magic = 0; |
| 1718 | |
| 1719 | /* copy over the snr */ |
| 1720 | pAdapter->snr = snr; |
| 1721 | |
| 1722 | /* notify the caller */ |
| 1723 | complete(&pStatsContext->completion); |
| 1724 | |
| 1725 | /* serialization is complete */ |
| 1726 | spin_unlock(&hdd_context_lock); |
| 1727 | } |
| 1728 | |
| 1729 | /** |
| 1730 | * wlan_hdd_get_rssi() - Get the current RSSI |
| 1731 | * @pAdapter: adapter upon which the measurement is requested |
| 1732 | * @rssi_value: pointer to where the RSSI should be returned |
| 1733 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1734 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1735 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1736 | 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] | 1737 | { |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1738 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1739 | hdd_context_t *pHddCtx; |
| 1740 | hdd_station_ctx_t *pHddStaCtx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1741 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1742 | unsigned long rc; |
| 1743 | |
| 1744 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1745 | hdd_warn("Invalid context, pAdapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1746 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1747 | } |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 1748 | if (cds_is_driver_recovering()) { |
| 1749 | hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", |
| 1750 | cds_get_driver_state()); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1751 | /* return a cached value */ |
| 1752 | *rssi_value = pAdapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1753 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1754 | } |
| 1755 | |
| 1756 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1757 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1758 | |
| 1759 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1760 | hdd_err("Not associated!, rssi on disconnect %d", |
| 1761 | pAdapter->rssi_on_disconnect); |
| 1762 | *rssi_value = pAdapter->rssi_on_disconnect; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1763 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1764 | } |
| 1765 | |
| 1766 | if (pHddStaCtx->hdd_ReassocScenario) { |
| 1767 | hdd_info("Roaming in progress, return cached RSSI"); |
| 1768 | *rssi_value = pAdapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1769 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1770 | } |
| 1771 | |
| 1772 | init_completion(&context.completion); |
| 1773 | context.pAdapter = pAdapter; |
| 1774 | context.magic = RSSI_CONTEXT_MAGIC; |
| 1775 | |
| 1776 | hstatus = sme_get_rssi(pHddCtx->hHal, hdd_get_rssi_cb, |
| 1777 | pHddStaCtx->conn_info.staId[0], |
| 1778 | pHddStaCtx->conn_info.bssId, pAdapter->rssi, |
| 1779 | &context, pHddCtx->pcds_context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1780 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1781 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1782 | /* we'll returned a cached value below */ |
| 1783 | } else { |
| 1784 | /* request was sent -- wait for the response */ |
| 1785 | rc = wait_for_completion_timeout(&context.completion, |
| 1786 | msecs_to_jiffies |
| 1787 | (WLAN_WAIT_TIME_STATS)); |
| 1788 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1789 | hdd_err("SME timed out while retrieving RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1790 | /* we'll now returned a cached value below */ |
| 1791 | } |
| 1792 | } |
| 1793 | |
| 1794 | /* either we never sent a request, we sent a request and |
| 1795 | * received a response or we sent a request and timed out. if |
| 1796 | * we never sent a request or if we sent a request and got a |
| 1797 | * response, we want to clear the magic out of paranoia. if |
| 1798 | * we timed out there is a race condition such that the |
| 1799 | * callback function could be executing at the same time we |
| 1800 | * are. of primary concern is if the callback function had |
| 1801 | * already verified the "magic" but had not yet set the |
| 1802 | * completion variable when a timeout occurred. we serialize |
| 1803 | * these activities by invalidating the magic while holding a |
| 1804 | * shared spinlock which will cause us to block if the |
| 1805 | * callback is currently executing |
| 1806 | */ |
| 1807 | spin_lock(&hdd_context_lock); |
| 1808 | context.magic = 0; |
| 1809 | spin_unlock(&hdd_context_lock); |
| 1810 | |
| 1811 | *rssi_value = pAdapter->rssi; |
| 1812 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1813 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1814 | } |
| 1815 | |
| 1816 | /** |
| 1817 | * wlan_hdd_get_snr() - Get the current SNR |
| 1818 | * @pAdapter: adapter upon which the measurement is requested |
| 1819 | * @snr: pointer to where the SNR should be returned |
| 1820 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1821 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1822 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1823 | 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] | 1824 | { |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1825 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | hdd_context_t *pHddCtx; |
| 1827 | hdd_station_ctx_t *pHddStaCtx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1828 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | unsigned long rc; |
| 1830 | int valid; |
| 1831 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1832 | ENTER(); |
| 1833 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1834 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1835 | hdd_err("Invalid context, pAdapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1836 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1837 | } |
| 1838 | |
| 1839 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1840 | |
| 1841 | valid = wlan_hdd_validate_context(pHddCtx); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1842 | if (0 != valid) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1843 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1844 | |
| 1845 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1846 | |
| 1847 | init_completion(&context.completion); |
| 1848 | context.pAdapter = pAdapter; |
| 1849 | context.magic = SNR_CONTEXT_MAGIC; |
| 1850 | |
| 1851 | hstatus = sme_get_snr(pHddCtx->hHal, hdd_get_snr_cb, |
| 1852 | pHddStaCtx->conn_info.staId[0], |
| 1853 | pHddStaCtx->conn_info.bssId, &context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1854 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1855 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | /* we'll returned a cached value below */ |
| 1857 | } else { |
| 1858 | /* request was sent -- wait for the response */ |
| 1859 | rc = wait_for_completion_timeout(&context.completion, |
| 1860 | msecs_to_jiffies |
| 1861 | (WLAN_WAIT_TIME_STATS)); |
| 1862 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1863 | hdd_err("SME timed out while retrieving SNR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | /* we'll now returned a cached value below */ |
| 1865 | } |
| 1866 | } |
| 1867 | |
| 1868 | /* either we never sent a request, we sent a request and |
| 1869 | * received a response or we sent a request and timed out. if |
| 1870 | * we never sent a request or if we sent a request and got a |
| 1871 | * response, we want to clear the magic out of paranoia. if |
| 1872 | * we timed out there is a race condition such that the |
| 1873 | * callback function could be executing at the same time we |
| 1874 | * are. of primary concern is if the callback function had |
| 1875 | * already verified the "magic" but had not yet set the |
| 1876 | * completion variable when a timeout occurred. we serialize |
| 1877 | * these activities by invalidating the magic while holding a |
| 1878 | * shared spinlock which will cause us to block if the |
| 1879 | * callback is currently executing |
| 1880 | */ |
| 1881 | spin_lock(&hdd_context_lock); |
| 1882 | context.magic = 0; |
| 1883 | spin_unlock(&hdd_context_lock); |
| 1884 | |
| 1885 | *snr = pAdapter->snr; |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 1886 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1887 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | } |
| 1889 | |
| 1890 | /** |
| 1891 | * hdd_get_link_speed_cb() - Get link speed callback function |
| 1892 | * @pLinkSpeed: pointer to the link speed record |
| 1893 | * @pContext: pointer to the user context passed to SME |
| 1894 | * |
| 1895 | * This function is passed as the callback function to |
| 1896 | * sme_get_link_speed() by wlan_hdd_get_linkspeed_for_peermac(). By |
| 1897 | * agreement a &struct linkspeedContext is passed as @pContext. If |
| 1898 | * the context is valid, then the contents of @pLinkSpeed are copied |
| 1899 | * into the adapter record referenced by @pContext where they can be |
| 1900 | * subsequently retrieved. If the context is invalid, then this |
| 1901 | * function does nothing since it is assumed the caller has already |
| 1902 | * timed-out and destroyed the context. |
| 1903 | * |
| 1904 | * Return: None. |
| 1905 | */ |
| 1906 | static void |
| 1907 | hdd_get_link_speed_cb(tSirLinkSpeedInfo *pLinkSpeed, void *pContext) |
| 1908 | { |
| 1909 | struct linkspeedContext *pLinkSpeedContext; |
| 1910 | hdd_adapter_t *pAdapter; |
| 1911 | |
| 1912 | if ((NULL == pLinkSpeed) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1913 | hdd_err("Bad param, pLinkSpeed [%p] pContext [%p]", |
| 1914 | pLinkSpeed, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1915 | return; |
| 1916 | } |
| 1917 | spin_lock(&hdd_context_lock); |
| 1918 | pLinkSpeedContext = pContext; |
| 1919 | pAdapter = pLinkSpeedContext->pAdapter; |
| 1920 | |
| 1921 | /* there is a race condition that exists between this callback |
| 1922 | * function and the caller since the caller could time out either |
| 1923 | * before or while this code is executing. we use a spinlock to |
| 1924 | * serialize these actions |
| 1925 | */ |
| 1926 | |
| 1927 | if ((NULL == pAdapter) || |
| 1928 | (LINK_CONTEXT_MAGIC != pLinkSpeedContext->magic)) { |
| 1929 | /* the caller presumably timed out so there is nothing |
| 1930 | * we can do |
| 1931 | */ |
| 1932 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1933 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 1934 | pAdapter, pLinkSpeedContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | if (ioctl_debug) { |
| 1936 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 1937 | __func__, pAdapter, pLinkSpeedContext->magic); |
| 1938 | } |
| 1939 | return; |
| 1940 | } |
| 1941 | |
| 1942 | /* context is valid so caller is still waiting */ |
| 1943 | |
| 1944 | /* paranoia: invalidate the magic */ |
| 1945 | pLinkSpeedContext->magic = 0; |
| 1946 | |
| 1947 | /* copy over the stats. do so as a struct copy */ |
| 1948 | pAdapter->ls_stats = *pLinkSpeed; |
| 1949 | |
| 1950 | /* notify the caller */ |
| 1951 | complete(&pLinkSpeedContext->completion); |
| 1952 | |
| 1953 | /* serialization is complete */ |
| 1954 | spin_unlock(&hdd_context_lock); |
| 1955 | } |
| 1956 | |
| 1957 | /** |
| 1958 | * wlan_hdd_get_linkspeed_for_peermac() - Get link speed for a peer |
| 1959 | * @pAdapter: adapter upon which the peer is active |
| 1960 | * @macAddress: MAC address of the peer |
| 1961 | * |
| 1962 | * This function will send a query to SME for the linkspeed of the |
| 1963 | * given peer, and then wait for the callback to be invoked. |
| 1964 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1965 | * Return: QDF_STATUS_SUCCESS if linkspeed data is available, |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1966 | * otherwise a QDF_STATUS_E_** error. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1967 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1968 | QDF_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1969 | struct qdf_mac_addr macAddress) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1970 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1971 | unsigned long rc; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 1972 | static struct linkspeedContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1973 | tSirLinkSpeedInfo *linkspeed_req; |
| 1974 | |
| 1975 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1976 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1977 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1978 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1979 | linkspeed_req = qdf_mem_malloc(sizeof(*linkspeed_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1980 | if (NULL == linkspeed_req) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1981 | hdd_err("Request Buffer Alloc Fail"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1982 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | } |
| 1984 | init_completion(&context.completion); |
| 1985 | context.pAdapter = pAdapter; |
| 1986 | context.magic = LINK_CONTEXT_MAGIC; |
| 1987 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1988 | qdf_copy_macaddr(&linkspeed_req->peer_macaddr, &macAddress); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1989 | status = sme_get_link_speed(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1990 | linkspeed_req, |
| 1991 | &context, hdd_get_link_speed_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1992 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 1993 | hdd_err("Unable to retrieve statistics for link speed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1994 | qdf_mem_free(linkspeed_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | } else { |
| 1996 | rc = wait_for_completion_timeout |
| 1997 | (&context.completion, |
| 1998 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 1999 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2000 | hdd_err("SME timed out while retrieving link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2001 | } |
| 2002 | } |
| 2003 | |
| 2004 | /* either we never sent a request, we sent a request and |
| 2005 | * received a response or we sent a request and timed out. if |
| 2006 | * we never sent a request or if we sent a request and got a |
| 2007 | * response, we want to clear the magic out of paranoia. if |
| 2008 | * we timed out there is a race condition such that the |
| 2009 | * callback function could be executing at the same time we |
| 2010 | * are. of primary concern is if the callback function had |
| 2011 | * already verified the "magic" but had not yet set the |
| 2012 | * completion variable when a timeout occurred. we serialize |
| 2013 | * these activities by invalidating the magic while holding a |
| 2014 | * shared spinlock which will cause us to block if the |
| 2015 | * callback is currently executing |
| 2016 | */ |
| 2017 | spin_lock(&hdd_context_lock); |
| 2018 | context.magic = 0; |
| 2019 | spin_unlock(&hdd_context_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2020 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2021 | } |
| 2022 | |
| 2023 | /** |
| 2024 | * wlan_hdd_get_link_speed() - get link speed |
| 2025 | * @pAdapter: pointer to the adapter |
| 2026 | * @link_speed: pointer to link speed |
| 2027 | * |
| 2028 | * This function fetches per bssid link speed. |
| 2029 | * |
| 2030 | * Return: if associated, link speed shall be returned. |
| 2031 | * if not associated, link speed of 0 is returned. |
| 2032 | * On error, error number will be returned. |
| 2033 | */ |
| 2034 | int wlan_hdd_get_link_speed(hdd_adapter_t *sta_adapter, uint32_t *link_speed) |
| 2035 | { |
| 2036 | hdd_context_t *hddctx = WLAN_HDD_GET_CTX(sta_adapter); |
| 2037 | hdd_station_ctx_t *hdd_stactx = |
| 2038 | WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter); |
| 2039 | int ret; |
| 2040 | |
| 2041 | ret = wlan_hdd_validate_context(hddctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 2042 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2044 | |
Nitesh Shah | 4e2d5eb | 2016-09-06 19:45:13 +0530 | [diff] [blame] | 2045 | /* Linkspeed is allowed only for P2P mode */ |
| 2046 | if (sta_adapter->device_mode != QDF_P2P_CLIENT_MODE) { |
| 2047 | hdd_err("Link Speed is not allowed in Device mode %s(%d)", |
| 2048 | hdd_device_mode_to_string(sta_adapter->device_mode), |
| 2049 | sta_adapter->device_mode); |
| 2050 | return -ENOTSUPP; |
| 2051 | } |
| 2052 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | if (eConnectionState_Associated != hdd_stactx->conn_info.connState) { |
| 2054 | /* we are not connected so we don't have a classAstats */ |
| 2055 | *link_speed = 0; |
| 2056 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2057 | QDF_STATUS status; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2058 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2059 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2060 | qdf_copy_macaddr(&bssid, &hdd_stactx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2061 | |
| 2062 | status = wlan_hdd_get_linkspeed_for_peermac(sta_adapter, bssid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2063 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2064 | hdd_err("Unable to retrieve SME linkspeed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2065 | return -EINVAL; |
| 2066 | } |
| 2067 | *link_speed = sta_adapter->ls_stats.estLinkSpeed; |
| 2068 | /* linkspeed in units of 500 kbps */ |
| 2069 | *link_speed = (*link_speed) / 500; |
| 2070 | } |
| 2071 | return 0; |
| 2072 | } |
| 2073 | |
| 2074 | /** |
| 2075 | * hdd_statistics_cb() - "Get statistics" callback function |
| 2076 | * @pStats: statistics payload |
| 2077 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 2078 | * a pointer to an adapter |
| 2079 | * |
| 2080 | * Return: None |
| 2081 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 2082 | static void hdd_statistics_cb(void *pStats, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | { |
| 2084 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 2085 | hdd_stats_t *pStatsCache = NULL; |
| 2086 | hdd_wext_state_t *pWextState; |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 2087 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2088 | |
| 2089 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 2090 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
| 2091 | tCsrGlobalClassBStatsInfo *pClassBStats = NULL; |
| 2092 | tCsrGlobalClassCStatsInfo *pClassCStats = NULL; |
| 2093 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
| 2094 | tCsrPerStaStatsInfo *pPerStaStats = NULL; |
| 2095 | |
| 2096 | if (pAdapter != NULL) |
| 2097 | pStatsCache = &pAdapter->hdd_stats; |
| 2098 | |
| 2099 | pSummaryStats = (tCsrSummaryStatsInfo *) pStats; |
| 2100 | pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1); |
| 2101 | pClassBStats = (tCsrGlobalClassBStatsInfo *) (pClassAStats + 1); |
| 2102 | pClassCStats = (tCsrGlobalClassCStatsInfo *) (pClassBStats + 1); |
| 2103 | pClassDStats = (tCsrGlobalClassDStatsInfo *) (pClassCStats + 1); |
| 2104 | pPerStaStats = (tCsrPerStaStatsInfo *) (pClassDStats + 1); |
| 2105 | |
| 2106 | if (pStatsCache != NULL) { |
| 2107 | /* copy the stats into the cache we keep in the |
| 2108 | * adapter instance structure |
| 2109 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2110 | qdf_mem_copy(&pStatsCache->summary_stat, pSummaryStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2111 | sizeof(pStatsCache->summary_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2112 | qdf_mem_copy(&pStatsCache->ClassA_stat, pClassAStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | sizeof(pStatsCache->ClassA_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2114 | qdf_mem_copy(&pStatsCache->ClassB_stat, pClassBStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | sizeof(pStatsCache->ClassB_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2116 | qdf_mem_copy(&pStatsCache->ClassC_stat, pClassCStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2117 | sizeof(pStatsCache->ClassC_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2118 | qdf_mem_copy(&pStatsCache->ClassD_stat, pClassDStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | sizeof(pStatsCache->ClassD_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2120 | qdf_mem_copy(&pStatsCache->perStaStats, pPerStaStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | sizeof(pStatsCache->perStaStats)); |
| 2122 | } |
| 2123 | |
| 2124 | if (pAdapter) { |
| 2125 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2126 | qdf_status = qdf_event_set(&pWextState->hdd_qdf_event); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 2127 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2128 | hdd_err("qdf_event_set failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2129 | return; |
| 2130 | } |
| 2131 | } |
| 2132 | } |
| 2133 | |
| 2134 | /** |
| 2135 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
| 2136 | * @pAdapter: adapter who's IEs are to be cleared |
| 2137 | * |
| 2138 | * Return: None |
| 2139 | */ |
| 2140 | void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter) |
| 2141 | { |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 2142 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 2143 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 2144 | ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2145 | |
| 2146 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 2147 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 2148 | pWextState->roamProfile.pWPAReqIE = (uint8_t *) NULL; |
| 2149 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 2150 | pWextState->roamProfile.pRSNReqIE = (uint8_t *) NULL; |
| 2151 | |
| 2152 | #ifdef FEATURE_WLAN_WAPI |
| 2153 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 2154 | pWextState->roamProfile.pWAPIReqIE = (uint8_t *) NULL; |
| 2155 | #endif |
| 2156 | |
| 2157 | pWextState->roamProfile.bWPSAssociation = false; |
| 2158 | pWextState->roamProfile.bOSENAssociation = false; |
| 2159 | pWextState->roamProfile.pAddIEScan = (uint8_t *) NULL; |
| 2160 | pWextState->roamProfile.nAddIEScanLength = 0; |
| 2161 | pWextState->roamProfile.pAddIEAssoc = (uint8_t *) NULL; |
| 2162 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 2163 | |
| 2164 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 2165 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 2166 | = eCSR_ENCRYPT_TYPE_NONE; |
| 2167 | |
| 2168 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 2169 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 2170 | = eCSR_ENCRYPT_TYPE_NONE; |
| 2171 | |
| 2172 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 2173 | pWextState->roamProfile.AuthType.authType[0] = |
| 2174 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 2175 | |
| 2176 | #ifdef WLAN_FEATURE_11W |
| 2177 | pWextState->roamProfile.MFPEnabled = false; |
| 2178 | pWextState->roamProfile.MFPRequired = 0; |
| 2179 | pWextState->roamProfile.MFPCapable = 0; |
| 2180 | #endif |
| 2181 | |
| 2182 | pWextState->authKeyMgmt = 0; |
| 2183 | |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 2184 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, CSR_MAX_NUM_KEY); |
| 2185 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2186 | #ifdef FEATURE_WLAN_WAPI |
| 2187 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 2188 | pAdapter->wapi_info.nWapiMode = 0; |
| 2189 | #endif |
| 2190 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2191 | qdf_zero_macaddr(&pWextState->req_bssId); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 2192 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2193 | } |
| 2194 | |
| 2195 | /** |
| 2196 | * wlan_hdd_get_vendor_oui_ie_ptr() - Find a vendor OUI |
| 2197 | * @oui: The OUI that is being searched for |
| 2198 | * @oui_size: The length of @oui |
| 2199 | * @ie: The set of IEs within which we're trying to find @oui |
| 2200 | * @ie_len: The length of @ie |
| 2201 | * |
| 2202 | * This function will scan the IEs contained within @ie looking for @oui. |
| 2203 | * |
| 2204 | * Return: Pointer to @oui embedded within @ie if it is present, NULL |
| 2205 | * if @oui is not present within @ie. |
| 2206 | */ |
| 2207 | uint8_t *wlan_hdd_get_vendor_oui_ie_ptr(uint8_t *oui, uint8_t oui_size, |
| 2208 | uint8_t *ie, int ie_len) |
| 2209 | { |
| 2210 | int left = ie_len; |
| 2211 | uint8_t *ptr = ie; |
| 2212 | uint8_t elem_id, elem_len; |
| 2213 | uint8_t eid = 0xDD; |
| 2214 | |
| 2215 | if (NULL == ie || 0 == ie_len) |
| 2216 | return NULL; |
| 2217 | |
| 2218 | while (left >= 2) { |
| 2219 | elem_id = ptr[0]; |
| 2220 | elem_len = ptr[1]; |
| 2221 | left -= 2; |
| 2222 | if (elem_len > left) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2223 | hdd_alert("****Invalid IEs eid = %d elem_len=%d left=%d*****", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2224 | eid, elem_len, left); |
| 2225 | return NULL; |
| 2226 | } |
| 2227 | if (elem_id == eid) { |
| 2228 | if (memcmp(&ptr[2], oui, oui_size) == 0) |
| 2229 | return ptr; |
| 2230 | } |
| 2231 | |
| 2232 | left -= elem_len; |
| 2233 | ptr += (elem_len + 2); |
| 2234 | } |
| 2235 | return NULL; |
| 2236 | } |
| 2237 | |
| 2238 | /** |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 2239 | * hdd_get_ldpc() - Get adapter LDPC |
| 2240 | * @adapter: adapter being queried |
| 2241 | * @value: where to store the value |
| 2242 | * |
| 2243 | * Return: 0 on success, negative errno on failure |
| 2244 | */ |
| 2245 | int hdd_get_ldpc(hdd_adapter_t *adapter, int *value) |
| 2246 | { |
| 2247 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2248 | int ret; |
| 2249 | |
| 2250 | ENTER(); |
| 2251 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 2252 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING); |
| 2253 | if (ret < 0) { |
| 2254 | hdd_alert("Failed to get LDPC value"); |
| 2255 | } else { |
| 2256 | *value = ret; |
| 2257 | ret = 0; |
| 2258 | } |
| 2259 | return ret; |
| 2260 | } |
| 2261 | |
| 2262 | /** |
| 2263 | * hdd_set_ldpc() - Set adapter LDPC |
| 2264 | * @adapter: adapter being modified |
| 2265 | * @value: new LDPC value |
| 2266 | * |
| 2267 | * Return: 0 on success, negative errno on failure |
| 2268 | */ |
| 2269 | int hdd_set_ldpc(hdd_adapter_t *adapter, int value) |
| 2270 | { |
| 2271 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2272 | int ret; |
| 2273 | |
| 2274 | hdd_alert("%d", value); |
| 2275 | if (value) { |
| 2276 | /* make sure HT capabilities allow this */ |
| 2277 | QDF_STATUS status; |
| 2278 | uint32_t cfg_value; |
| 2279 | union { |
| 2280 | uint16_t cfg_value16; |
| 2281 | tSirMacHTCapabilityInfo ht_cap_info; |
| 2282 | } u; |
| 2283 | |
| 2284 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 2285 | if (QDF_STATUS_SUCCESS != status) { |
| 2286 | hdd_alert("Failed to get HT capability info"); |
| 2287 | return -EIO; |
| 2288 | } |
| 2289 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 2290 | if (!u.ht_cap_info.advCodingCap) { |
| 2291 | hdd_alert("LDCP not supported"); |
| 2292 | return -EINVAL; |
| 2293 | } |
| 2294 | } |
| 2295 | |
| 2296 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 2297 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING, |
| 2298 | value); |
| 2299 | if (ret) |
| 2300 | hdd_alert("Failed to set LDPC value"); |
| 2301 | |
| 2302 | return ret; |
| 2303 | } |
| 2304 | |
| 2305 | /** |
| 2306 | * hdd_get_tx_stbc() - Get adapter TX STBC |
| 2307 | * @adapter: adapter being queried |
| 2308 | * @value: where to store the value |
| 2309 | * |
| 2310 | * Return: 0 on success, negative errno on failure |
| 2311 | */ |
| 2312 | int hdd_get_tx_stbc(hdd_adapter_t *adapter, int *value) |
| 2313 | { |
| 2314 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2315 | int ret; |
| 2316 | |
| 2317 | ENTER(); |
| 2318 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 2319 | WNI_CFG_HT_CAP_INFO_TX_STBC); |
| 2320 | if (ret < 0) { |
| 2321 | hdd_alert("Failed to get TX STBC value"); |
| 2322 | } else { |
| 2323 | *value = ret; |
| 2324 | ret = 0; |
| 2325 | } |
| 2326 | |
| 2327 | return ret; |
| 2328 | } |
| 2329 | |
| 2330 | /** |
| 2331 | * hdd_set_tx_stbc() - Set adapter TX STBC |
| 2332 | * @adapter: adapter being modified |
| 2333 | * @value: new TX STBC value |
| 2334 | * |
| 2335 | * Return: 0 on success, negative errno on failure |
| 2336 | */ |
| 2337 | int hdd_set_tx_stbc(hdd_adapter_t *adapter, int value) |
| 2338 | { |
| 2339 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2340 | int ret; |
| 2341 | |
| 2342 | hdd_alert("%d", value); |
| 2343 | if (value) { |
| 2344 | /* make sure HT capabilities allow this */ |
| 2345 | QDF_STATUS status; |
| 2346 | uint32_t cfg_value; |
| 2347 | union { |
| 2348 | uint16_t cfg_value16; |
| 2349 | tSirMacHTCapabilityInfo ht_cap_info; |
| 2350 | } u; |
| 2351 | |
| 2352 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 2353 | if (QDF_STATUS_SUCCESS != status) { |
| 2354 | hdd_alert("Failed to get HT capability info"); |
| 2355 | return -EIO; |
| 2356 | } |
| 2357 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 2358 | if (!u.ht_cap_info.txSTBC) { |
| 2359 | hdd_alert("TX STBC not supported"); |
| 2360 | return -EINVAL; |
| 2361 | } |
| 2362 | } |
| 2363 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 2364 | WNI_CFG_HT_CAP_INFO_TX_STBC, |
| 2365 | value); |
| 2366 | if (ret) |
| 2367 | hdd_alert("Failed to set TX STBC value"); |
| 2368 | |
| 2369 | return ret; |
| 2370 | } |
| 2371 | |
| 2372 | /** |
| 2373 | * hdd_get_rx_stbc() - Get adapter RX STBC |
| 2374 | * @adapter: adapter being queried |
| 2375 | * @value: where to store the value |
| 2376 | * |
| 2377 | * Return: 0 on success, negative errno on failure |
| 2378 | */ |
| 2379 | int hdd_get_rx_stbc(hdd_adapter_t *adapter, int *value) |
| 2380 | { |
| 2381 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2382 | int ret; |
| 2383 | |
| 2384 | ENTER(); |
| 2385 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 2386 | WNI_CFG_HT_CAP_INFO_RX_STBC); |
| 2387 | if (ret < 0) { |
| 2388 | hdd_alert("Failed to get RX STBC value"); |
| 2389 | } else { |
| 2390 | *value = ret; |
| 2391 | ret = 0; |
| 2392 | } |
| 2393 | |
| 2394 | return ret; |
| 2395 | } |
| 2396 | |
| 2397 | /** |
| 2398 | * hdd_set_rx_stbc() - Set adapter RX STBC |
| 2399 | * @adapter: adapter being modified |
| 2400 | * @value: new RX STBC value |
| 2401 | * |
| 2402 | * Return: 0 on success, negative errno on failure |
| 2403 | */ |
| 2404 | int hdd_set_rx_stbc(hdd_adapter_t *adapter, int value) |
| 2405 | { |
| 2406 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2407 | int ret; |
| 2408 | |
| 2409 | hdd_alert("%d", value); |
| 2410 | if (value) { |
| 2411 | /* make sure HT capabilities allow this */ |
| 2412 | QDF_STATUS status; |
| 2413 | uint32_t cfg_value; |
| 2414 | union { |
| 2415 | uint16_t cfg_value16; |
| 2416 | tSirMacHTCapabilityInfo ht_cap_info; |
| 2417 | } u; |
| 2418 | |
| 2419 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 2420 | if (QDF_STATUS_SUCCESS != status) { |
| 2421 | hdd_alert("Failed to get HT capability info"); |
| 2422 | return -EIO; |
| 2423 | } |
| 2424 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 2425 | if (!u.ht_cap_info.rxSTBC) { |
| 2426 | hdd_alert("RX STBC not supported"); |
| 2427 | return -EINVAL; |
| 2428 | } |
| 2429 | } |
| 2430 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 2431 | WNI_CFG_HT_CAP_INFO_RX_STBC, |
| 2432 | value); |
| 2433 | if (ret) |
| 2434 | hdd_alert("Failed to set RX STBC value"); |
| 2435 | |
| 2436 | return ret; |
| 2437 | } |
| 2438 | |
| 2439 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | * __iw_set_commit() - SIOCSIWCOMMIT ioctl handler |
| 2441 | * @dev: device upon which the ioctl was received |
| 2442 | * @info: ioctl request information |
| 2443 | * @wrqu: ioctl request data |
| 2444 | * @extra: ioctl extra data |
| 2445 | * |
| 2446 | * Return: 0 on success, non-zero on error |
| 2447 | */ |
| 2448 | static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 2449 | union iwreq_data *wrqu, char *extra) |
| 2450 | { |
| 2451 | hdd_adapter_t *adapter; |
| 2452 | hdd_context_t *hdd_ctx; |
| 2453 | int ret; |
| 2454 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2455 | ENTER_DEV(dev); |
| 2456 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2457 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2458 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 2459 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2460 | if (0 != ret) |
| 2461 | return ret; |
| 2462 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2463 | /* Do nothing for now */ |
| 2464 | return 0; |
| 2465 | } |
| 2466 | |
| 2467 | /** |
| 2468 | * iw_set_commit() - SSR wrapper function for __iw_set_commit |
| 2469 | * @dev: pointer to net_device |
| 2470 | * @info: pointer to iw_request_info |
| 2471 | * @wrqu: pointer to iwreq_data |
| 2472 | * @extra: extra |
| 2473 | * |
| 2474 | * Return: 0 on success, error number otherwise |
| 2475 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 2476 | 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] | 2477 | union iwreq_data *wrqu, char *extra) |
| 2478 | { |
| 2479 | int ret; |
| 2480 | |
| 2481 | cds_ssr_protect(__func__); |
| 2482 | ret = __iw_set_commit(dev, info, wrqu, extra); |
| 2483 | cds_ssr_unprotect(__func__); |
| 2484 | |
| 2485 | return ret; |
| 2486 | } |
| 2487 | |
| 2488 | /** |
| 2489 | * __iw_get_name() - SIOCGIWNAME ioctl handler |
| 2490 | * @dev: device upon which the ioctl was received |
| 2491 | * @info: ioctl request information |
| 2492 | * @wrqu: ioctl request data |
| 2493 | * @extra: ioctl extra data |
| 2494 | * |
| 2495 | * Return: 0 on success, non-zero on error |
| 2496 | */ |
| 2497 | static int __iw_get_name(struct net_device *dev, |
| 2498 | struct iw_request_info *info, char *wrqu, char *extra) |
| 2499 | { |
| 2500 | hdd_adapter_t *adapter; |
| 2501 | hdd_context_t *hdd_ctx; |
| 2502 | int ret; |
| 2503 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2504 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | |
| 2506 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2507 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 2508 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2509 | if (0 != ret) |
| 2510 | return ret; |
| 2511 | |
| 2512 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 2513 | EXIT(); |
| 2514 | return 0; |
| 2515 | } |
| 2516 | |
| 2517 | /** |
| 2518 | * __iw_get_name() - SSR wrapper for __iw_get_name |
| 2519 | * @dev: pointer to net_device |
| 2520 | * @info: pointer to iw_request_info |
| 2521 | * @wrqu: pointer to iwreq_data |
| 2522 | * @extra: extra |
| 2523 | * |
| 2524 | * Return: 0 on success, error number otherwise |
| 2525 | */ |
| 2526 | static int iw_get_name(struct net_device *dev, |
| 2527 | struct iw_request_info *info, |
| 2528 | char *wrqu, char *extra) |
| 2529 | { |
| 2530 | int ret; |
| 2531 | |
| 2532 | cds_ssr_protect(__func__); |
| 2533 | ret = __iw_get_name(dev, info, wrqu, extra); |
| 2534 | cds_ssr_unprotect(__func__); |
| 2535 | |
| 2536 | return ret; |
| 2537 | } |
| 2538 | |
| 2539 | /** |
| 2540 | * __iw_set_mode() - ioctl handler |
| 2541 | * @dev: device upon which the ioctl was received |
| 2542 | * @info: ioctl request information |
| 2543 | * @wrqu: ioctl request data |
| 2544 | * @extra: ioctl extra data |
| 2545 | * |
| 2546 | * Return: 0 on success, non-zero on error |
| 2547 | */ |
| 2548 | static int __iw_set_mode(struct net_device *dev, |
| 2549 | struct iw_request_info *info, |
| 2550 | union iwreq_data *wrqu, char *extra) |
| 2551 | { |
| 2552 | hdd_wext_state_t *pWextState; |
| 2553 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2554 | hdd_context_t *hdd_ctx; |
| 2555 | tCsrRoamProfile *pRoamProfile; |
| 2556 | eCsrRoamBssType LastBSSType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2557 | struct hdd_config *pConfig; |
| 2558 | struct wireless_dev *wdev; |
| 2559 | int ret; |
| 2560 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2561 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2562 | |
| 2563 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2564 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2565 | if (0 != ret) |
| 2566 | return ret; |
| 2567 | |
| 2568 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2569 | wdev = dev->ieee80211_ptr; |
| 2570 | pRoamProfile = &pWextState->roamProfile; |
| 2571 | LastBSSType = pRoamProfile->BSSType; |
| 2572 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2573 | hdd_notice("Old Bss type = %d", LastBSSType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | |
| 2575 | switch (wrqu->mode) { |
| 2576 | case IW_MODE_ADHOC: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2577 | hdd_notice("Setting AP Mode as IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 2579 | /* Set the phymode correctly for IBSS. */ |
| 2580 | pConfig = (WLAN_HDD_GET_CTX(pAdapter))->config; |
| 2581 | pWextState->roamProfile.phyMode = |
| 2582 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 2583 | pAdapter->device_mode = QDF_IBSS_MODE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2584 | wdev->iftype = NL80211_IFTYPE_ADHOC; |
| 2585 | break; |
| 2586 | case IW_MODE_INFRA: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2587 | hdd_notice("Setting AP Mode as IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 2589 | wdev->iftype = NL80211_IFTYPE_STATION; |
| 2590 | break; |
| 2591 | case IW_MODE_AUTO: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2592 | hdd_notice("Setting AP Mode as IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY; |
| 2594 | break; |
| 2595 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2596 | hdd_err("Unknown AP Mode value %d", wrqu->mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2597 | return -EOPNOTSUPP; |
| 2598 | } |
| 2599 | |
| 2600 | if (LastBSSType != pRoamProfile->BSSType) { |
| 2601 | /* the BSS mode changed. We need to issue disconnect |
| 2602 | * if connected or in IBSS disconnect state |
| 2603 | */ |
Jeff Johnson | 9eeed0a | 2016-10-03 15:04:57 -0700 | [diff] [blame] | 2604 | if (hdd_conn_is_connected |
| 2605 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | || (eCSR_BSS_TYPE_START_IBSS == LastBSSType)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2607 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2608 | /* need to issue a disconnect to CSR. */ |
| 2609 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2610 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2611 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2612 | pAdapter->sessionId, |
| 2613 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2614 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2615 | unsigned long rc; |
| 2616 | rc = wait_for_completion_timeout(&pAdapter-> |
| 2617 | disconnect_comp_var, |
| 2618 | msecs_to_jiffies |
| 2619 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 2620 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2621 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | } |
| 2623 | } |
| 2624 | } |
| 2625 | |
| 2626 | EXIT(); |
| 2627 | return 0; |
| 2628 | } |
| 2629 | |
| 2630 | /** |
| 2631 | * iw_set_mode() - SSR wrapper for __iw_set_mode() |
| 2632 | * @dev: pointer to net_device |
| 2633 | * @info: pointer to iw_request_info |
| 2634 | * @wrqu: pointer to iwreq_data |
| 2635 | * @extra: pointer to extra ioctl payload |
| 2636 | * |
| 2637 | * Return: 0 on success, error number otherwise |
| 2638 | */ |
| 2639 | static int iw_set_mode(struct net_device *dev, struct iw_request_info *info, |
| 2640 | union iwreq_data *wrqu, char *extra) |
| 2641 | { |
| 2642 | int ret; |
| 2643 | |
| 2644 | cds_ssr_protect(__func__); |
| 2645 | ret = __iw_set_mode(dev, info, wrqu, extra); |
| 2646 | cds_ssr_unprotect(__func__); |
| 2647 | |
| 2648 | return ret; |
| 2649 | } |
| 2650 | |
| 2651 | /** |
| 2652 | * __iw_get_mode() - SIOCGIWMODE ioctl handler |
| 2653 | * @dev: device upon which the ioctl was received |
| 2654 | * @info: ioctl request information |
| 2655 | * @wrqu: ioctl request data |
| 2656 | * @extra: ioctl extra data |
| 2657 | * |
| 2658 | * Return: 0 on success, non-zero on error |
| 2659 | */ |
| 2660 | static int |
| 2661 | __iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 2662 | union iwreq_data *wrqu, char *extra) |
| 2663 | { |
| 2664 | hdd_wext_state_t *pWextState; |
| 2665 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2666 | hdd_context_t *hdd_ctx; |
| 2667 | int ret; |
| 2668 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2669 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2670 | |
| 2671 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2672 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2673 | if (0 != ret) |
| 2674 | return ret; |
| 2675 | |
| 2676 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2677 | |
| 2678 | switch (pWextState->roamProfile.BSSType) { |
| 2679 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2680 | hdd_notice("returns IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2681 | wrqu->mode = IW_MODE_INFRA; |
| 2682 | break; |
| 2683 | case eCSR_BSS_TYPE_IBSS: |
| 2684 | case eCSR_BSS_TYPE_START_IBSS: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2685 | hdd_notice("returns IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | wrqu->mode = IW_MODE_ADHOC; |
| 2687 | break; |
| 2688 | case eCSR_BSS_TYPE_ANY: |
| 2689 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2690 | hdd_notice("returns IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2691 | wrqu->mode = IW_MODE_AUTO; |
| 2692 | break; |
| 2693 | } |
| 2694 | |
| 2695 | EXIT(); |
| 2696 | return 0; |
| 2697 | } |
| 2698 | |
| 2699 | /** |
| 2700 | * iw_get_mode() - SSR wrapper for __iw_get_mode() |
| 2701 | * @dev: pointer to net_device |
| 2702 | * @info: pointer to iw_request_info |
| 2703 | * @wrqu: pointer to iwreq_data |
| 2704 | * @extra: pointer to extra ioctl payload |
| 2705 | * |
| 2706 | * Return: 0 on success, error number otherwise |
| 2707 | */ |
| 2708 | static int iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 2709 | union iwreq_data *wrqu, char *extra) |
| 2710 | { |
| 2711 | int ret; |
| 2712 | |
| 2713 | cds_ssr_protect(__func__); |
| 2714 | ret = __iw_get_mode(dev, info, wrqu, extra); |
| 2715 | cds_ssr_unprotect(__func__); |
| 2716 | |
| 2717 | return ret; |
| 2718 | } |
| 2719 | |
| 2720 | /** |
| 2721 | * __iw_set_freq() - SIOCSIWFREQ ioctl handler |
| 2722 | * @dev: device upon which the ioctl was received |
| 2723 | * @info: ioctl request information |
| 2724 | * @wrqu: ioctl request data |
| 2725 | * @extra: ioctl extra data |
| 2726 | * |
| 2727 | * Return: 0 on success, non-zero on error |
| 2728 | */ |
| 2729 | static int __iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 2730 | union iwreq_data *wrqu, char *extra) |
| 2731 | { |
| 2732 | uint32_t numChans = 0; |
| 2733 | uint8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2734 | uint32_t indx = 0; |
| 2735 | int ret; |
| 2736 | hdd_wext_state_t *pWextState; |
| 2737 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2738 | hdd_context_t *hdd_ctx; |
| 2739 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2740 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2741 | tCsrRoamProfile *pRoamProfile; |
| 2742 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2743 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | |
| 2745 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2746 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2747 | if (0 != ret) |
| 2748 | return ret; |
| 2749 | |
| 2750 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2751 | |
| 2752 | pRoamProfile = &pWextState->roamProfile; |
| 2753 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2754 | hdd_notice("setCHANNEL ioctl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2755 | |
| 2756 | /* Link is up then return cant set channel */ |
| 2757 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState || |
| 2758 | eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2759 | hdd_err("IBSS Associated"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | return -EOPNOTSUPP; |
| 2761 | } |
| 2762 | |
| 2763 | /* Settings by Frequency as input */ |
| 2764 | if ((wrqu->freq.e == 1) && (wrqu->freq.m >= (uint32_t) 2.412e8) && |
| 2765 | (wrqu->freq.m <= (uint32_t) 5.825e8)) { |
| 2766 | uint32_t freq = wrqu->freq.m / 100000; |
| 2767 | |
| 2768 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 2769 | && (freq != freq_chan_map[indx].freq)) |
| 2770 | indx++; |
| 2771 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) { |
| 2772 | return -EINVAL; |
| 2773 | } |
| 2774 | wrqu->freq.e = 0; |
| 2775 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 2776 | |
| 2777 | } |
| 2778 | |
| 2779 | if (wrqu->freq.e == 0) { |
| 2780 | if ((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 2781 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2782 | hdd_notice("Channel %d is outside valid range from %d to %d", |
| 2783 | wrqu->freq.m, |
| 2784 | WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 2785 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2786 | return -EINVAL; |
| 2787 | } |
| 2788 | |
| 2789 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2790 | |
| 2791 | if (sme_cfg_get_str(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 2792 | validChan, &numChans) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2793 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2794 | hdd_warn("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2795 | return -EIO; |
| 2796 | } |
| 2797 | |
| 2798 | for (indx = 0; indx < numChans; indx++) { |
| 2799 | if (wrqu->freq.m == validChan[indx]) { |
| 2800 | break; |
| 2801 | } |
| 2802 | } |
| 2803 | } else { |
| 2804 | |
| 2805 | return -EINVAL; |
| 2806 | } |
| 2807 | |
| 2808 | if (indx >= numChans) { |
| 2809 | return -EINVAL; |
| 2810 | } |
| 2811 | |
| 2812 | /* Set the Operational Channel */ |
| 2813 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 2814 | pHddStaCtx->conn_info.operationChannel = wrqu->freq.m; |
| 2815 | pRoamProfile->ChannelInfo.ChannelList = |
| 2816 | &pHddStaCtx->conn_info.operationChannel; |
| 2817 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2818 | hdd_notice("pRoamProfile->operationChannel = %d", wrqu->freq.m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2819 | |
| 2820 | EXIT(); |
| 2821 | |
| 2822 | return ret; |
| 2823 | } |
| 2824 | |
| 2825 | /** |
| 2826 | * iw_set_freq() - SSR wrapper for __iw_set_freq() |
| 2827 | * @dev: pointer to net_device |
| 2828 | * @info: pointer to iw_request_info |
| 2829 | * @wrqu: pointer to iwreq_data |
| 2830 | * @extra: pointer to extra ioctl payload |
| 2831 | * |
| 2832 | * Return: 0 on success, error number otherwise |
| 2833 | */ |
| 2834 | static int iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 2835 | union iwreq_data *wrqu, char *extra) |
| 2836 | { |
| 2837 | int ret; |
| 2838 | |
| 2839 | cds_ssr_protect(__func__); |
| 2840 | ret = __iw_set_freq(dev, info, wrqu, extra); |
| 2841 | cds_ssr_unprotect(__func__); |
| 2842 | |
| 2843 | return ret; |
| 2844 | } |
| 2845 | |
| 2846 | /** |
| 2847 | * __iw_get_freq() - SIOCGIWFREQ ioctl handler |
| 2848 | * @dev: device upon which the ioctl was received |
| 2849 | * @info: ioctl request information |
| 2850 | * @wrqu: ioctl request data |
| 2851 | * @extra: ioctl extra data |
| 2852 | * |
| 2853 | * Return: 0 on success, non-zero on error |
| 2854 | */ |
| 2855 | static int __iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 2856 | struct iw_freq *fwrq, char *extra) |
| 2857 | { |
| 2858 | uint32_t status = false, channel = 0, freq = 0; |
| 2859 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2860 | tHalHandle hHal; |
| 2861 | hdd_wext_state_t *pWextState; |
| 2862 | tCsrRoamProfile *pRoamProfile; |
| 2863 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2864 | hdd_context_t *hdd_ctx; |
| 2865 | int ret; |
| 2866 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2867 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2868 | |
| 2869 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2870 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2871 | if (0 != ret) |
| 2872 | return ret; |
| 2873 | |
| 2874 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2875 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2876 | |
| 2877 | pRoamProfile = &pWextState->roamProfile; |
| 2878 | |
| 2879 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated) { |
| 2880 | if (sme_get_operation_channel(hHal, &channel, pAdapter->sessionId) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2881 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2882 | hdd_err("failed to get operating channel %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2883 | pAdapter->sessionId); |
| 2884 | return -EIO; |
| 2885 | } else { |
| 2886 | status = hdd_wlan_get_freq(channel, &freq); |
| 2887 | if (true == status) { |
| 2888 | /* Set Exponent parameter as 6 (MHZ) |
| 2889 | * in struct iw_freq iwlist & iwconfig |
| 2890 | * command shows frequency into proper |
| 2891 | * format (2.412 GHz instead of 246.2 |
| 2892 | * MHz) |
| 2893 | */ |
| 2894 | fwrq->m = freq; |
| 2895 | fwrq->e = MHZ; |
| 2896 | } |
| 2897 | } |
| 2898 | } else { |
| 2899 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 2900 | * iwlist & iwconfig command shows frequency into proper |
| 2901 | * format (2.412 GHz instead of 246.2 MHz) |
| 2902 | */ |
| 2903 | fwrq->m = 0; |
| 2904 | fwrq->e = MHZ; |
| 2905 | } |
| 2906 | return 0; |
| 2907 | } |
| 2908 | |
| 2909 | /** |
| 2910 | * iw_get_freq() - SSR wrapper for __iw_get_freq() |
| 2911 | * @dev: pointer to net_device |
| 2912 | * @info: pointer to iw_request_info |
| 2913 | * @fwrq: pointer to frequency data |
| 2914 | * @extra: pointer to extra ioctl payload |
| 2915 | * |
| 2916 | * Return: 0 on success, error number otherwise |
| 2917 | */ |
| 2918 | static int iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 2919 | struct iw_freq *fwrq, char *extra) |
| 2920 | { |
| 2921 | int ret; |
| 2922 | |
| 2923 | cds_ssr_protect(__func__); |
| 2924 | ret = __iw_get_freq(dev, info, fwrq, extra); |
| 2925 | cds_ssr_unprotect(__func__); |
| 2926 | |
| 2927 | return ret; |
| 2928 | } |
| 2929 | |
| 2930 | /** |
| 2931 | * __iw_get_tx_power() - SIOCGIWTXPOW ioctl handler |
| 2932 | * @dev: device upon which the ioctl was received |
| 2933 | * @info: ioctl request information |
| 2934 | * @wrqu: ioctl request data |
| 2935 | * @extra: ioctl extra data |
| 2936 | * |
| 2937 | * Return: 0 on success, non-zero on error |
| 2938 | */ |
| 2939 | static int __iw_get_tx_power(struct net_device *dev, |
| 2940 | struct iw_request_info *info, |
| 2941 | union iwreq_data *wrqu, char *extra) |
| 2942 | { |
| 2943 | |
| 2944 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2945 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 2946 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2947 | int ret; |
| 2948 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 2949 | ENTER_DEV(dev); |
| 2950 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2951 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 2952 | if (0 != ret) |
| 2953 | return ret; |
| 2954 | |
| 2955 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 2956 | wrqu->txpower.value = 0; |
| 2957 | return 0; |
| 2958 | } |
| 2959 | wlan_hdd_get_class_astats(pAdapter); |
| 2960 | wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 2961 | |
| 2962 | return 0; |
| 2963 | } |
| 2964 | |
| 2965 | /** |
| 2966 | * iw_get_tx_power() - SSR wrapper for __iw_get_tx_power() |
| 2967 | * @dev: pointer to net_device |
| 2968 | * @info: pointer to iw_request_info |
| 2969 | * @wrqu: pointer to iwreq_data |
| 2970 | * @extra: pointer to extra ioctl payload |
| 2971 | * |
| 2972 | * Return: 0 on success, error number otherwise |
| 2973 | */ |
| 2974 | static int iw_get_tx_power(struct net_device *dev, |
| 2975 | struct iw_request_info *info, |
| 2976 | union iwreq_data *wrqu, char *extra) |
| 2977 | { |
| 2978 | int ret; |
| 2979 | |
| 2980 | cds_ssr_protect(__func__); |
| 2981 | ret = __iw_get_tx_power(dev, info, wrqu, extra); |
| 2982 | cds_ssr_unprotect(__func__); |
| 2983 | |
| 2984 | return ret; |
| 2985 | } |
| 2986 | |
| 2987 | /** |
| 2988 | * __iw_set_tx_power() - SIOCSIWTXPOW ioctl handler |
| 2989 | * @dev: device upon which the ioctl was received |
| 2990 | * @info: ioctl request information |
| 2991 | * @wrqu: ioctl request data |
| 2992 | * @extra: ioctl extra data |
| 2993 | * |
| 2994 | * Return: 0 on success, non-zero on error |
| 2995 | */ |
| 2996 | static int __iw_set_tx_power(struct net_device *dev, |
| 2997 | struct iw_request_info *info, |
| 2998 | union iwreq_data *wrqu, char *extra) |
| 2999 | { |
| 3000 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3001 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3002 | hdd_context_t *hdd_ctx; |
| 3003 | int ret; |
| 3004 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3005 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3006 | |
| 3007 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3008 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3009 | if (0 != ret) |
| 3010 | return ret; |
| 3011 | |
| 3012 | if (sme_cfg_set_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3013 | wrqu->txpower.value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3014 | 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] | 3015 | return -EIO; |
| 3016 | } |
| 3017 | |
| 3018 | EXIT(); |
| 3019 | |
| 3020 | return 0; |
| 3021 | } |
| 3022 | |
| 3023 | /** |
| 3024 | * iw_set_tx_power() - SSR wrapper for __iw_set_tx_power() |
| 3025 | * @dev: pointer to net_device |
| 3026 | * @info: pointer to iw_request_info |
| 3027 | * @wrqu: pointer to iwreq_data |
| 3028 | * @extra: pointer to extra ioctl payload |
| 3029 | * |
| 3030 | * Return: 0 on success, error number otherwise |
| 3031 | */ |
| 3032 | static int iw_set_tx_power(struct net_device *dev, |
| 3033 | struct iw_request_info *info, |
| 3034 | union iwreq_data *wrqu, char *extra) |
| 3035 | { |
| 3036 | int ret; |
| 3037 | |
| 3038 | cds_ssr_protect(__func__); |
| 3039 | ret = __iw_set_tx_power(dev, info, wrqu, extra); |
| 3040 | cds_ssr_unprotect(__func__); |
| 3041 | |
| 3042 | return ret; |
| 3043 | } |
| 3044 | |
| 3045 | /** |
| 3046 | * __iw_get_bitrate() - SIOCGIWRATE ioctl handler |
| 3047 | * @dev: device upon which the ioctl was received |
| 3048 | * @info: ioctl request information |
| 3049 | * @wrqu: ioctl request data |
| 3050 | * @extra: ioctl extra data |
| 3051 | * |
| 3052 | * Return: 0 on success, non-zero on error |
| 3053 | */ |
| 3054 | static int __iw_get_bitrate(struct net_device *dev, |
| 3055 | struct iw_request_info *info, |
| 3056 | union iwreq_data *wrqu, char *extra) |
| 3057 | { |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 3058 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3059 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | hdd_wext_state_t *pWextState; |
| 3061 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3062 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3063 | hdd_context_t *hdd_ctx; |
| 3064 | int ret; |
| 3065 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3066 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3067 | |
| 3068 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3069 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3070 | if (0 != ret) |
| 3071 | return ret; |
| 3072 | |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 3073 | if (cds_is_driver_recovering()) { |
| 3074 | hdd_alert("Recovery in Progress. State: 0x%x Ignore!!!", |
| 3075 | cds_get_driver_state()); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3076 | return status; |
| 3077 | } |
| 3078 | |
| 3079 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 3080 | wrqu->bitrate.value = 0; |
| 3081 | } else { |
| 3082 | status = |
| 3083 | sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3084 | eCSR_HDD, |
| 3085 | SME_SUMMARY_STATS | |
| 3086 | SME_GLOBAL_CLASSA_STATS | |
| 3087 | SME_GLOBAL_CLASSB_STATS | |
| 3088 | SME_GLOBAL_CLASSC_STATS | |
| 3089 | SME_GLOBAL_CLASSD_STATS | |
| 3090 | SME_PER_STA_STATS, |
| 3091 | hdd_statistics_cb, 0, |
| 3092 | false, |
| 3093 | pHddStaCtx->conn_info.staId[0], |
| 3094 | pAdapter, pAdapter->sessionId); |
| 3095 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3096 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3097 | hdd_err("Unable to retrieve statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3098 | return status; |
| 3099 | } |
| 3100 | |
| 3101 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3102 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 3103 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3104 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3105 | WLAN_WAIT_TIME_STATS); |
| 3106 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 3107 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3108 | hdd_err("SME timeout while retrieving statistics"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3109 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3110 | } |
| 3111 | |
| 3112 | wrqu->bitrate.value = |
| 3113 | pAdapter->hdd_stats.ClassA_stat.tx_rate * 500 * 1000; |
| 3114 | } |
| 3115 | |
| 3116 | EXIT(); |
| 3117 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3118 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3119 | } |
| 3120 | |
| 3121 | /** |
| 3122 | * iw_get_bitrate() - SSR wrapper for __iw_get_bitrate() |
| 3123 | * @dev: pointer to net_device |
| 3124 | * @info: pointer to iw_request_info |
| 3125 | * @wrqu: pointer to iwreq_data |
| 3126 | * @extra: pointer to extra ioctl payload |
| 3127 | * |
| 3128 | * Return: 0 on success, error number otherwise |
| 3129 | */ |
| 3130 | static int iw_get_bitrate(struct net_device *dev, |
| 3131 | struct iw_request_info *info, |
| 3132 | union iwreq_data *wrqu, char *extra) |
| 3133 | { |
| 3134 | int ret; |
| 3135 | |
| 3136 | cds_ssr_protect(__func__); |
| 3137 | ret = __iw_get_bitrate(dev, info, wrqu, extra); |
| 3138 | cds_ssr_unprotect(__func__); |
| 3139 | |
| 3140 | return ret; |
| 3141 | } |
| 3142 | |
| 3143 | /** |
| 3144 | * __iw_set_bitrate() - SIOCSIWRATE ioctl handler |
| 3145 | * @dev: device upon which the ioctl was received |
| 3146 | * @info: ioctl request information |
| 3147 | * @wrqu: ioctl request data |
| 3148 | * @extra: ioctl extra data |
| 3149 | * |
| 3150 | * Return: 0 on success, non-zero on error |
| 3151 | */ |
| 3152 | static int __iw_set_bitrate(struct net_device *dev, |
| 3153 | struct iw_request_info *info, |
| 3154 | union iwreq_data *wrqu, char *extra) |
| 3155 | { |
| 3156 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3157 | hdd_wext_state_t *pWextState; |
| 3158 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3159 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 3160 | uint32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 3161 | uint32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 3162 | uint32_t i, rate; |
| 3163 | uint32_t valid_rate = false, active_phy_mode = 0; |
| 3164 | hdd_context_t *hdd_ctx; |
| 3165 | int ret; |
| 3166 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3167 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | |
| 3169 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3170 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3171 | if (0 != ret) |
| 3172 | return ret; |
| 3173 | |
| 3174 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3175 | |
| 3176 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 3177 | return -ENXIO; |
| 3178 | } |
| 3179 | |
| 3180 | rate = wrqu->bitrate.value; |
| 3181 | |
| 3182 | if (rate == -1) { |
| 3183 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 3184 | valid_rate = true; |
| 3185 | } else if (sme_cfg_get_int(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3186 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3187 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3188 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 3189 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 3190 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 3191 | if ((sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3192 | WNI_CFG_SUPPORTED_RATES_11A, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3193 | &a_len) == QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | && |
| 3195 | (sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3196 | WNI_CFG_SUPPORTED_RATES_11B, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3197 | &b_len) == QDF_STATUS_SUCCESS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | for (i = 0; i < (b_len + a_len); ++i) { |
| 3199 | /* supported rates returned is double |
| 3200 | * the actual rate so we divide it by 2 |
| 3201 | */ |
| 3202 | if ((supp_rates[i] & 0x7F) / 2 == |
| 3203 | rate) { |
| 3204 | valid_rate = true; |
| 3205 | rate = i + |
| 3206 | WNI_CFG_FIXED_RATE_1MBPS; |
| 3207 | break; |
| 3208 | } |
| 3209 | } |
| 3210 | } |
| 3211 | } |
| 3212 | } |
| 3213 | if (valid_rate != true) { |
| 3214 | return -EINVAL; |
| 3215 | } |
| 3216 | if (sme_cfg_set_int(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3217 | WNI_CFG_FIXED_RATE, rate) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3218 | hdd_err("failed to set ini parameter, WNI_CFG_FIXED_RATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3219 | return -EIO; |
| 3220 | } |
| 3221 | return 0; |
| 3222 | } |
| 3223 | |
| 3224 | /** |
| 3225 | * iw_set_bitrate() - SSR wrapper for __iw_set_bitrate() |
| 3226 | * @dev: pointer to net_device |
| 3227 | * @info: pointer to iw_request_info |
| 3228 | * @wrqu: pointer to iwreq_data |
| 3229 | * @extra: pointer to extra ioctl payload |
| 3230 | * |
| 3231 | * Return: 0 on success, error number otherwise |
| 3232 | */ |
| 3233 | static int iw_set_bitrate(struct net_device *dev, |
| 3234 | struct iw_request_info *info, |
| 3235 | union iwreq_data *wrqu, char *extra) |
| 3236 | { |
| 3237 | int ret; |
| 3238 | |
| 3239 | cds_ssr_protect(__func__); |
| 3240 | ret = __iw_set_bitrate(dev, info, wrqu, extra); |
| 3241 | cds_ssr_unprotect(__func__); |
| 3242 | |
| 3243 | return ret; |
| 3244 | } |
| 3245 | |
| 3246 | /** |
| 3247 | * __iw_set_genie() - SIOCSIWGENIE ioctl handler |
| 3248 | * @dev: device upon which the ioctl was received |
| 3249 | * @info: ioctl request information |
| 3250 | * @wrqu: ioctl request data |
| 3251 | * @extra: ioctl extra data |
| 3252 | * |
| 3253 | * Return: 0 on success, non-zero on error |
| 3254 | */ |
| 3255 | static int __iw_set_genie(struct net_device *dev, |
| 3256 | struct iw_request_info *info, |
| 3257 | union iwreq_data *wrqu, char *extra) |
| 3258 | { |
| 3259 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3260 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3261 | uint8_t *genie = NULL; |
| 3262 | uint8_t *base_genie = NULL; |
| 3263 | uint16_t remLen; |
| 3264 | hdd_context_t *hdd_ctx; |
| 3265 | int ret; |
| 3266 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3267 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | |
| 3269 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3270 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3271 | if (0 != ret) |
| 3272 | return ret; |
| 3273 | |
| 3274 | if (!wrqu->data.length) { |
| 3275 | hdd_clear_roam_profile_ie(pAdapter); |
| 3276 | EXIT(); |
| 3277 | return 0; |
| 3278 | } |
| 3279 | |
| 3280 | base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 3281 | wrqu->data.length); |
| 3282 | if (NULL == base_genie) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3283 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3284 | return -ENOMEM; |
| 3285 | } |
| 3286 | |
| 3287 | genie = base_genie; |
| 3288 | |
| 3289 | remLen = wrqu->data.length; |
| 3290 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3291 | 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] | 3292 | genie[1]); |
| 3293 | |
| 3294 | /* clear any previous genIE before this call */ |
| 3295 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 3296 | |
| 3297 | while (remLen >= 2) { |
| 3298 | uint16_t eLen = 0; |
| 3299 | uint8_t elementId; |
| 3300 | elementId = *genie++; |
| 3301 | eLen = *genie++; |
| 3302 | remLen -= 2; |
| 3303 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3304 | hdd_notice("IE[0x%X], LEN[%d]", elementId, eLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3305 | |
| 3306 | switch (elementId) { |
| 3307 | case IE_EID_VENDOR: |
| 3308 | 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] | 3309 | ret = -EINVAL; |
| 3310 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | } |
| 3312 | |
| 3313 | if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) { |
| 3314 | uint16_t curGenIELen = pWextState->genIE.length; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3315 | hdd_notice("Set WPS OUI(%02x %02x %02x %02x) IE(len %d)", |
| 3316 | genie[0], genie[1], genie[2], |
| 3317 | genie[3], eLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | |
| 3319 | if (SIR_MAC_MAX_IE_LENGTH < |
| 3320 | (pWextState->genIE.length + eLen)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3321 | hdd_alert("Cannot accommodate genIE. Need bigger buffer space"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3322 | QDF_ASSERT(0); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3323 | ret = -ENOMEM; |
| 3324 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | } |
| 3326 | /* save to Additional IE ; it should be accumulated to handle WPS IE + other IE */ |
| 3327 | memcpy(pWextState->genIE.addIEdata + |
| 3328 | curGenIELen, genie - 2, eLen + 2); |
| 3329 | pWextState->genIE.length += eLen + 2; |
| 3330 | } else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3331 | hdd_notice("Set WPA IE (len %d)", eLen + 2); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3332 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) { |
| 3333 | hdd_warn("Cannot accommodate genIE, Need bigger buffer space"); |
| 3334 | ret = -EINVAL; |
| 3335 | QDF_ASSERT(0); |
| 3336 | goto exit; |
| 3337 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | memset(pWextState->WPARSNIE, 0, |
| 3339 | MAX_WPA_RSN_IE_LEN); |
| 3340 | memcpy(pWextState->WPARSNIE, genie - 2, |
| 3341 | (eLen + 2)); |
| 3342 | pWextState->roamProfile.pWPAReqIE = |
| 3343 | pWextState->WPARSNIE; |
| 3344 | pWextState->roamProfile.nWPAReqIELength = |
| 3345 | eLen + 2; |
| 3346 | } else { /* any vendorId except WPA IE should be accumulated to genIE */ |
| 3347 | |
| 3348 | uint16_t curGenIELen = pWextState->genIE.length; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3349 | hdd_notice("Set OUI(%02x %02x %02x %02x) IE(len %d)", |
| 3350 | genie[0], genie[1], genie[2], |
| 3351 | genie[3], eLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3352 | |
| 3353 | if (SIR_MAC_MAX_IE_LENGTH < |
| 3354 | (pWextState->genIE.length + eLen)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3355 | hdd_alert("Cannot accommodate genIE. Need bigger buffer space"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3356 | QDF_ASSERT(0); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3357 | ret = -ENOMEM; |
| 3358 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3359 | } |
| 3360 | /* save to Additional IE ; it should be accumulated to handle WPS IE + other IE */ |
| 3361 | memcpy(pWextState->genIE.addIEdata + |
| 3362 | curGenIELen, genie - 2, eLen + 2); |
| 3363 | pWextState->genIE.length += eLen + 2; |
| 3364 | } |
| 3365 | break; |
| 3366 | case DOT11F_EID_RSN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3367 | hdd_notice("Set RSN IE (len %d)", eLen + 2); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3368 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) { |
| 3369 | hdd_warn("Cannot accommodate genIE, Need bigger buffer space"); |
| 3370 | ret = -EINVAL; |
| 3371 | QDF_ASSERT(0); |
| 3372 | goto exit; |
| 3373 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | memset(pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN); |
| 3375 | memcpy(pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 3376 | pWextState->roamProfile.pRSNReqIE = |
| 3377 | pWextState->WPARSNIE; |
| 3378 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; |
| 3379 | break; |
| 3380 | |
| 3381 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3382 | hdd_err("Set UNKNOWN IE %X", elementId); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3383 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | } |
| 3385 | genie += eLen; |
| 3386 | remLen -= eLen; |
| 3387 | } |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3388 | exit: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3389 | EXIT(); |
| 3390 | kfree(base_genie); |
Mahesh A Saptasagar | d639dde | 2015-11-06 12:39:13 +0530 | [diff] [blame] | 3391 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | } |
| 3393 | |
| 3394 | /** |
| 3395 | * iw_set_genie() - SSR wrapper for __iw_set_genie() |
| 3396 | * @dev: pointer to net_device |
| 3397 | * @info: pointer to iw_request_info |
| 3398 | * @wrqu: pointer to iwreq_data |
| 3399 | * @extra: pointer to extra ioctl payload |
| 3400 | * |
| 3401 | * Return: 0 on success, error number otherwise |
| 3402 | */ |
| 3403 | static int iw_set_genie(struct net_device *dev, |
| 3404 | struct iw_request_info *info, |
| 3405 | union iwreq_data *wrqu, char *extra) |
| 3406 | { |
| 3407 | int ret; |
| 3408 | |
| 3409 | cds_ssr_protect(__func__); |
| 3410 | ret = __iw_set_genie(dev, info, wrqu, extra); |
| 3411 | cds_ssr_unprotect(__func__); |
| 3412 | |
| 3413 | return ret; |
| 3414 | } |
| 3415 | |
| 3416 | /** |
| 3417 | * __iw_get_genie() - SIOCGIWGENIE ioctl handler |
| 3418 | * @dev: device upon which the ioctl was received |
| 3419 | * @info: ioctl request information |
| 3420 | * @wrqu: ioctl request data |
| 3421 | * @extra: ioctl extra data |
| 3422 | * |
| 3423 | * Return: 0 on success, non-zero on error |
| 3424 | */ |
| 3425 | static int __iw_get_genie(struct net_device *dev, |
| 3426 | struct iw_request_info *info, |
| 3427 | union iwreq_data *wrqu, char *extra) |
| 3428 | { |
| 3429 | hdd_wext_state_t *pWextState; |
| 3430 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3431 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3432 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | uint32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 3434 | uint8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 3435 | hdd_context_t *hdd_ctx; |
| 3436 | int ret; |
| 3437 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3438 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | |
| 3440 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3441 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3442 | if (0 != ret) |
| 3443 | return ret; |
| 3444 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3445 | hdd_notice("getGEN_IE ioctl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | |
| 3447 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3448 | |
| 3449 | if (pHddStaCtx->conn_info.connState == eConnectionState_NotConnected) { |
| 3450 | return -ENXIO; |
| 3451 | } |
| 3452 | |
| 3453 | /* Return something ONLY if we are associated with an RSN or |
| 3454 | * WPA network |
| 3455 | */ |
| 3456 | if (!hdd_is_auth_type_rsn(pWextState->roamProfile.negotiatedAuthType)) { |
| 3457 | return -ENXIO; |
| 3458 | } |
| 3459 | |
| 3460 | /* Actually retrieve the RSN IE from CSR. (We previously sent |
| 3461 | * it down in the CSR Roam Profile.) |
| 3462 | */ |
| 3463 | status = csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3464 | pAdapter->sessionId, |
| 3465 | &length, genIeBytes); |
Manjeet Singh | fde0c04 | 2016-09-03 12:08:09 +0530 | [diff] [blame] | 3466 | if (QDF_STATUS_SUCCESS != status) { |
| 3467 | hdd_notice("failed to get WPA-RSN IE data"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3468 | return -EFAULT; |
| 3469 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | wrqu->data.length = length; |
Manjeet Singh | fde0c04 | 2016-09-03 12:08:09 +0530 | [diff] [blame] | 3471 | if (length > DOT11F_IE_RSN_MAX_LEN) { |
| 3472 | hdd_notice("invalid buffer length length:%d", length); |
| 3473 | return -E2BIG; |
| 3474 | } |
| 3475 | qdf_mem_copy(extra, (void *)genIeBytes, length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3477 | hdd_notice("RSN IE of %d bytes returned", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3478 | wrqu->data.length); |
| 3479 | |
| 3480 | EXIT(); |
| 3481 | |
| 3482 | return 0; |
| 3483 | } |
| 3484 | |
| 3485 | /** |
| 3486 | * iw_get_genie() - SSR wrapper for __iw_get_genie() |
| 3487 | * @dev: pointer to net_device |
| 3488 | * @info: pointer to iw_request_info |
| 3489 | * @wrqu: pointer to iwreq_data |
| 3490 | * @extra: pointer to extra ioctl payload |
| 3491 | * |
| 3492 | * Return: 0 on success, error number otherwise |
| 3493 | */ |
| 3494 | static int iw_get_genie(struct net_device *dev, |
| 3495 | struct iw_request_info *info, |
| 3496 | union iwreq_data *wrqu, char *extra) |
| 3497 | { |
| 3498 | int ret; |
| 3499 | |
| 3500 | cds_ssr_protect(__func__); |
| 3501 | ret = __iw_get_genie(dev, info, wrqu, extra); |
| 3502 | cds_ssr_unprotect(__func__); |
| 3503 | |
| 3504 | return ret; |
| 3505 | } |
| 3506 | |
| 3507 | /** |
| 3508 | * __iw_get_encode() - SIOCGIWENCODE ioctl handler |
| 3509 | * @dev: device upon which the ioctl was received |
| 3510 | * @info: ioctl request information |
| 3511 | * @wrqu: ioctl request data |
| 3512 | * @extra: ioctl extra data |
| 3513 | * |
| 3514 | * Return: 0 on success, non-zero on error |
| 3515 | */ |
| 3516 | static int __iw_get_encode(struct net_device *dev, |
| 3517 | struct iw_request_info *info, |
| 3518 | struct iw_point *dwrq, char *extra) |
| 3519 | { |
| 3520 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3521 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3522 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3523 | int keyId; |
| 3524 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 3525 | int i; |
| 3526 | hdd_context_t *hdd_ctx; |
| 3527 | int ret; |
| 3528 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3529 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3530 | |
| 3531 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3532 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3533 | if (0 != ret) |
| 3534 | return ret; |
| 3535 | |
| 3536 | keyId = pRoamProfile->Keys.defaultIndex; |
| 3537 | |
| 3538 | if (keyId < 0 || keyId >= MAX_WEP_KEYS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3539 | hdd_notice("Invalid keyId : %d", keyId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3540 | return -EINVAL; |
| 3541 | } |
| 3542 | |
| 3543 | if (pRoamProfile->Keys.KeyLength[keyId] > 0) { |
| 3544 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3545 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3546 | qdf_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3547 | pRoamProfile->Keys.KeyLength[keyId]); |
| 3548 | |
| 3549 | dwrq->flags |= (keyId + 1); |
| 3550 | |
| 3551 | } else { |
| 3552 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3553 | } |
| 3554 | |
| 3555 | for (i = 0; i < MAX_WEP_KEYS; i++) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 3556 | if (pRoamProfile->Keys.KeyLength[i] == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3557 | continue; |
| 3558 | } else { |
| 3559 | break; |
| 3560 | } |
| 3561 | } |
| 3562 | |
| 3563 | if (MAX_WEP_KEYS == i) { |
| 3564 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 3565 | } |
| 3566 | |
| 3567 | authType = |
| 3568 | ((hdd_station_ctx_t *) WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))-> |
| 3569 | conn_info.authType; |
| 3570 | |
| 3571 | if (eCSR_AUTH_TYPE_OPEN_SYSTEM == authType) { |
| 3572 | dwrq->flags |= IW_ENCODE_OPEN; |
| 3573 | } else { |
| 3574 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 3575 | } |
| 3576 | EXIT(); |
| 3577 | return 0; |
| 3578 | } |
| 3579 | |
| 3580 | /** |
| 3581 | * iw_get_encode() - SSR wrapper for __iw_get_encode() |
| 3582 | * @dev: pointer to net_device |
| 3583 | * @info: pointer to iw_request_info |
| 3584 | * @dwrq: pointer to encoding information |
| 3585 | * @extra: pointer to extra ioctl payload |
| 3586 | * |
| 3587 | * Return: 0 on success, error number otherwise |
| 3588 | */ |
| 3589 | static int iw_get_encode(struct net_device *dev, struct iw_request_info *info, |
| 3590 | struct iw_point *dwrq, char *extra) |
| 3591 | { |
| 3592 | int ret; |
| 3593 | |
| 3594 | cds_ssr_protect(__func__); |
| 3595 | ret = __iw_get_encode(dev, info, dwrq, extra); |
| 3596 | cds_ssr_unprotect(__func__); |
| 3597 | |
| 3598 | return ret; |
| 3599 | } |
| 3600 | |
| 3601 | /** |
| 3602 | * __iw_get_rts_threshold() - SIOCGIWRTS ioctl handler |
| 3603 | * @dev: device upon which the ioctl was received |
| 3604 | * @info: ioctl request information |
| 3605 | * @wrqu: ioctl request data |
| 3606 | * @extra: ioctl extra data |
| 3607 | * |
| 3608 | * Return: 0 on success, non-zero on error |
| 3609 | */ |
| 3610 | static int __iw_get_rts_threshold(struct net_device *dev, |
| 3611 | struct iw_request_info *info, |
| 3612 | union iwreq_data *wrqu, char *extra) |
| 3613 | { |
| 3614 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3615 | uint32_t status = 0; |
| 3616 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3617 | ENTER_DEV(dev); |
| 3618 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3619 | status = hdd_wlan_get_rts_threshold(pAdapter, wrqu); |
| 3620 | |
| 3621 | return status; |
| 3622 | } |
| 3623 | |
| 3624 | /** |
| 3625 | * __iw_set_rts_threshold() - SIOCSIWRTS ioctl handler |
| 3626 | * @dev: device upon which the ioctl was received |
| 3627 | * @info: ioctl request information |
| 3628 | * @wrqu: ioctl request data |
| 3629 | * @extra: ioctl extra data |
| 3630 | * |
| 3631 | * Return: 0 on success, non-zero on error |
| 3632 | */ |
| 3633 | static int __iw_set_rts_threshold(struct net_device *dev, |
| 3634 | struct iw_request_info *info, |
| 3635 | union iwreq_data *wrqu, char *extra) |
| 3636 | { |
| 3637 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3638 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3639 | hdd_context_t *hdd_ctx; |
| 3640 | int ret; |
| 3641 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3642 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3643 | |
| 3644 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3645 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3646 | if (0 != ret) |
| 3647 | return ret; |
| 3648 | |
| 3649 | if (wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN |
| 3650 | || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX) { |
| 3651 | return -EINVAL; |
| 3652 | } |
| 3653 | |
| 3654 | 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] | 3655 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3656 | hdd_err("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3657 | return -EIO; |
| 3658 | } |
| 3659 | |
| 3660 | EXIT(); |
| 3661 | |
| 3662 | return 0; |
| 3663 | } |
| 3664 | |
| 3665 | /** |
| 3666 | * iw_get_rts_threshold() - SSR wrapper for __iw_get_rts_threshold() |
| 3667 | * @dev: pointer to net_device |
| 3668 | * @info: pointer to iw_request_info |
| 3669 | * @wrqu: pointer to iwreq_data |
| 3670 | * @extra: pointer to extra ioctl payload |
| 3671 | * |
| 3672 | * Return: 0 on success, error number otherwise |
| 3673 | */ |
| 3674 | static int iw_get_rts_threshold(struct net_device *dev, |
| 3675 | struct iw_request_info *info, |
| 3676 | union iwreq_data *wrqu, char *extra) |
| 3677 | { |
| 3678 | int ret; |
| 3679 | |
| 3680 | cds_ssr_protect(__func__); |
| 3681 | ret = __iw_get_rts_threshold(dev, info, wrqu, extra); |
| 3682 | cds_ssr_unprotect(__func__); |
| 3683 | |
| 3684 | return ret; |
| 3685 | } |
| 3686 | |
| 3687 | /** |
| 3688 | * iw_set_rts_threshold() - SSR wrapper for __iw_set_rts_threshold() |
| 3689 | * @dev: pointer to net_device |
| 3690 | * @info: pointer to iw_request_info |
| 3691 | * @wrqu: pointer to iwreq_data |
| 3692 | * @extra: pointer to extra ioctl payload |
| 3693 | * |
| 3694 | * Return: 0 on success, error number otherwise |
| 3695 | */ |
| 3696 | static int iw_set_rts_threshold(struct net_device *dev, |
| 3697 | struct iw_request_info *info, |
| 3698 | union iwreq_data *wrqu, char *extra) |
| 3699 | { |
| 3700 | int ret; |
| 3701 | |
| 3702 | cds_ssr_protect(__func__); |
| 3703 | ret = __iw_set_rts_threshold(dev, info, wrqu, extra); |
| 3704 | cds_ssr_unprotect(__func__); |
| 3705 | |
| 3706 | return ret; |
| 3707 | } |
| 3708 | |
| 3709 | /** |
| 3710 | * __iw_get_frag_threshold() - SIOCGIWFRAG ioctl handler |
| 3711 | * @dev: device upon which the ioctl was received |
| 3712 | * @info: ioctl request information |
| 3713 | * @wrqu: ioctl request data |
| 3714 | * @extra: ioctl extra data |
| 3715 | * |
| 3716 | * Return: 0 on success, non-zero on error |
| 3717 | */ |
| 3718 | static int __iw_get_frag_threshold(struct net_device *dev, |
| 3719 | struct iw_request_info *info, |
| 3720 | union iwreq_data *wrqu, char *extra) |
| 3721 | { |
| 3722 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3723 | uint32_t status = 0; |
| 3724 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3725 | ENTER_DEV(dev); |
| 3726 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | status = hdd_wlan_get_frag_threshold(pAdapter, wrqu); |
| 3728 | |
| 3729 | return status; |
| 3730 | } |
| 3731 | |
| 3732 | /** |
| 3733 | * iw_get_frag_threshold() - SSR wrapper for __iw_get_frag_threshold() |
| 3734 | * @dev: pointer to net_device |
| 3735 | * @info: pointer to iw_request_info |
| 3736 | * @wrqu: pointer to iwreq_data |
| 3737 | * @extra: pointer to extra ioctl payload |
| 3738 | * |
| 3739 | * Return: 0 on success, error number otherwise |
| 3740 | */ |
| 3741 | static int iw_get_frag_threshold(struct net_device *dev, |
| 3742 | struct iw_request_info *info, |
| 3743 | union iwreq_data *wrqu, char *extra) |
| 3744 | { |
| 3745 | int ret; |
| 3746 | |
| 3747 | cds_ssr_protect(__func__); |
| 3748 | ret = __iw_get_frag_threshold(dev, info, wrqu, extra); |
| 3749 | cds_ssr_unprotect(__func__); |
| 3750 | |
| 3751 | return ret; |
| 3752 | } |
| 3753 | |
| 3754 | /** |
| 3755 | * __iw_set_frag_threshold() - SIOCSIWFRAG ioctl handler |
| 3756 | * @dev: device upon which the ioctl was received |
| 3757 | * @info: ioctl request information |
| 3758 | * @wrqu: ioctl request data |
| 3759 | * @extra: ioctl extra data |
| 3760 | * |
| 3761 | * Return: 0 on success, non-zero on error |
| 3762 | */ |
| 3763 | static int __iw_set_frag_threshold(struct net_device *dev, |
| 3764 | struct iw_request_info *info, |
| 3765 | union iwreq_data *wrqu, char *extra) |
| 3766 | { |
| 3767 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3768 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3769 | hdd_context_t *hdd_ctx; |
| 3770 | int ret; |
| 3771 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3772 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3773 | |
| 3774 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3775 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3776 | if (0 != ret) |
| 3777 | return ret; |
| 3778 | |
| 3779 | if (wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN |
| 3780 | || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX) { |
| 3781 | return -EINVAL; |
| 3782 | } |
| 3783 | |
| 3784 | if (sme_cfg_set_int |
| 3785 | (hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3786 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3787 | hdd_err("failed to set ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3788 | return -EIO; |
| 3789 | } |
| 3790 | |
| 3791 | EXIT(); |
| 3792 | |
| 3793 | return 0; |
| 3794 | } |
| 3795 | |
| 3796 | /** |
| 3797 | * iw_set_frag_threshold() - SSR wrapper for __iw_set_frag_threshold() |
| 3798 | * @dev: pointer to net_device |
| 3799 | * @info: pointer to iw_request_info |
| 3800 | * @wrqu: pointer to iwreq_data |
| 3801 | * @extra: pointer to extra ioctl payload |
| 3802 | * |
| 3803 | * Return: 0 on success, error number otherwise |
| 3804 | */ |
| 3805 | static int iw_set_frag_threshold(struct net_device *dev, |
| 3806 | struct iw_request_info *info, |
| 3807 | union iwreq_data *wrqu, char *extra) |
| 3808 | { |
| 3809 | int ret; |
| 3810 | |
| 3811 | cds_ssr_protect(__func__); |
| 3812 | ret = __iw_set_frag_threshold(dev, info, wrqu, extra); |
| 3813 | cds_ssr_unprotect(__func__); |
| 3814 | |
| 3815 | return ret; |
| 3816 | } |
| 3817 | |
| 3818 | /** |
| 3819 | * __iw_get_power_mode() - SIOCGIWPOWER ioctl handler |
| 3820 | * @dev: device upon which the ioctl was received |
| 3821 | * @info: ioctl request information |
| 3822 | * @wrqu: ioctl request data |
| 3823 | * @extra: ioctl extra data |
| 3824 | * |
| 3825 | * Return: 0 on success, non-zero on error |
| 3826 | */ |
| 3827 | static int __iw_get_power_mode(struct net_device *dev, |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3828 | struct iw_request_info *info, |
| 3829 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3830 | { |
| 3831 | hdd_adapter_t *adapter; |
| 3832 | hdd_context_t *hdd_ctx; |
| 3833 | int ret; |
| 3834 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3835 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3836 | |
| 3837 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3838 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3839 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3840 | if (0 != ret) |
| 3841 | return ret; |
| 3842 | |
| 3843 | return -EOPNOTSUPP; |
| 3844 | } |
| 3845 | |
| 3846 | /** |
| 3847 | * iw_get_power_mode() - SSR wrapper function for __iw_get_power_mode |
| 3848 | * @dev: pointer to net_device |
| 3849 | * @info: pointer to iw_request_info |
| 3850 | * @wrqu: pointer to iwreq_data |
| 3851 | * @extra: extra |
| 3852 | * |
| 3853 | * Return: 0 on success, error number otherwise |
| 3854 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3855 | static int iw_get_power_mode(struct net_device *dev, |
| 3856 | struct iw_request_info *info, |
| 3857 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3858 | { |
| 3859 | int ret; |
| 3860 | |
| 3861 | cds_ssr_protect(__func__); |
| 3862 | ret = __iw_get_power_mode(dev, info, wrqu, extra); |
| 3863 | cds_ssr_unprotect(__func__); |
| 3864 | |
| 3865 | return ret; |
| 3866 | } |
| 3867 | |
| 3868 | /** |
| 3869 | * __iw_set_power_mode() - SIOCSIWPOWER ioctl handler |
| 3870 | * @dev: device upon which the ioctl was received |
| 3871 | * @info: ioctl request information |
| 3872 | * @wrqu: ioctl request data |
| 3873 | * @extra: ioctl extra data |
| 3874 | * |
| 3875 | * Return: 0 on success, non-zero on error |
| 3876 | */ |
| 3877 | static int __iw_set_power_mode(struct net_device *dev, |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3878 | struct iw_request_info *info, |
| 3879 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3880 | { |
| 3881 | hdd_adapter_t *adapter; |
| 3882 | hdd_context_t *hdd_ctx; |
| 3883 | int ret; |
| 3884 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3885 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3886 | |
| 3887 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3888 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3889 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3890 | if (0 != ret) |
| 3891 | return ret; |
| 3892 | |
| 3893 | return -EOPNOTSUPP; |
| 3894 | } |
| 3895 | |
| 3896 | /** |
| 3897 | * iw_set_power_mode() - SSR wrapper function for __iw_set_power_mode |
| 3898 | * @dev: pointer to net_device |
| 3899 | * @info: pointer to iw_request_info |
| 3900 | * @wrqu: pointer to iwreq_data |
| 3901 | * @extra: extra |
| 3902 | * |
| 3903 | * Return: 0 on success, error number otherwise |
| 3904 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3905 | static int iw_set_power_mode(struct net_device *dev, |
| 3906 | struct iw_request_info *info, |
| 3907 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | { |
| 3909 | int ret; |
| 3910 | |
| 3911 | cds_ssr_protect(__func__); |
| 3912 | ret = __iw_set_power_mode(dev, info, wrqu, extra); |
| 3913 | cds_ssr_unprotect(__func__); |
| 3914 | |
| 3915 | return ret; |
| 3916 | } |
| 3917 | |
| 3918 | /** |
| 3919 | * __iw_get_range() - SIOCGIWRANGE ioctl handler |
| 3920 | * @dev: device upon which the ioctl was received |
| 3921 | * @info: ioctl request information |
| 3922 | * @wrqu: ioctl request data |
| 3923 | * @extra: ioctl extra data |
| 3924 | * |
| 3925 | * Return: 0 on success, non-zero on error |
| 3926 | */ |
| 3927 | static int __iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 3928 | union iwreq_data *wrqu, char *extra) |
| 3929 | { |
| 3930 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3931 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3932 | struct iw_range *range = (struct iw_range *)extra; |
| 3933 | |
| 3934 | uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 3935 | |
| 3936 | uint32_t num_channels = sizeof(channels); |
| 3937 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 3938 | uint32_t a_len; |
| 3939 | uint32_t b_len; |
| 3940 | uint32_t active_phy_mode = 0; |
| 3941 | uint8_t index = 0, i; |
| 3942 | hdd_context_t *hdd_ctx; |
| 3943 | int ret; |
| 3944 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 3945 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3946 | |
| 3947 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3948 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 3949 | if (0 != ret) |
| 3950 | return ret; |
| 3951 | |
| 3952 | wrqu->data.length = sizeof(struct iw_range); |
| 3953 | memset(range, 0, sizeof(struct iw_range)); |
| 3954 | |
| 3955 | |
| 3956 | /*Get the phy mode */ |
| 3957 | if (sme_cfg_get_int(hHal, |
| 3958 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3959 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3960 | hdd_notice("active_phy_mode = %d", active_phy_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3961 | |
| 3962 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 3963 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G) { |
| 3964 | /*Get the supported rates for 11G band */ |
| 3965 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 3966 | if (sme_cfg_get_str(hHal, |
| 3967 | WNI_CFG_SUPPORTED_RATES_11A, |
| 3968 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3969 | &a_len) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) { |
| 3971 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 3972 | } |
| 3973 | for (i = 0; i < a_len; i++) { |
| 3974 | range->bitrate[i] = |
| 3975 | ((supp_rates[i] & 0x7F) / 2) * |
| 3976 | 1000000; |
| 3977 | } |
| 3978 | range->num_bitrates = a_len; |
| 3979 | } else { |
| 3980 | return -EIO; |
| 3981 | } |
| 3982 | } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 3983 | /*Get the supported rates for 11B band */ |
| 3984 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 3985 | if (sme_cfg_get_str(hHal, |
| 3986 | WNI_CFG_SUPPORTED_RATES_11B, |
| 3987 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3988 | &b_len) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3989 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) { |
| 3990 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 3991 | } |
| 3992 | for (i = 0; i < b_len; i++) { |
| 3993 | range->bitrate[i] = |
| 3994 | ((supp_rates[i] & 0x7F) / 2) * |
| 3995 | 1000000; |
| 3996 | } |
| 3997 | range->num_bitrates = b_len; |
| 3998 | } else { |
| 3999 | return -EIO; |
| 4000 | } |
| 4001 | } |
| 4002 | } |
| 4003 | |
| 4004 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 4005 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 4006 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 4007 | |
| 4008 | range->encoding_size[0] = 5; |
| 4009 | range->encoding_size[1] = 13; |
| 4010 | range->num_encoding_sizes = 2; |
| 4011 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 4012 | |
| 4013 | /* we support through Wireless Extensions 22 */ |
| 4014 | range->we_version_compiled = WIRELESS_EXT; |
| 4015 | range->we_version_source = 22; |
| 4016 | |
| 4017 | /*Supported Channels and Frequencies */ |
| 4018 | if (sme_cfg_get_str |
| 4019 | ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4020 | &num_channels) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4021 | hdd_warn("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4022 | return -EIO; |
| 4023 | } |
| 4024 | if (num_channels > IW_MAX_FREQUENCIES) { |
| 4025 | num_channels = IW_MAX_FREQUENCIES; |
| 4026 | } |
| 4027 | |
| 4028 | range->num_channels = num_channels; |
| 4029 | range->num_frequency = num_channels; |
| 4030 | |
| 4031 | for (index = 0; index < num_channels; index++) { |
| 4032 | uint32_t frq_indx = 0; |
| 4033 | |
| 4034 | range->freq[index].i = channels[index]; |
| 4035 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) { |
| 4036 | if (channels[index] == freq_chan_map[frq_indx].chan) { |
| 4037 | range->freq[index].m = |
| 4038 | freq_chan_map[frq_indx].freq * 100000; |
| 4039 | range->freq[index].e = 1; |
| 4040 | break; |
| 4041 | } |
| 4042 | frq_indx++; |
| 4043 | } |
| 4044 | } |
| 4045 | |
| 4046 | /* Event capability (kernel + driver) */ |
| 4047 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 4048 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 4049 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 4050 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 4051 | |
| 4052 | /*Encryption capability */ |
| 4053 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 4054 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 4055 | |
| 4056 | /* Txpower capability */ |
| 4057 | range->txpower_capa = IW_TXPOW_MWATT; |
| 4058 | |
| 4059 | /*Scanning capability */ |
| 4060 | #if WIRELESS_EXT >= 22 |
| 4061 | range->scan_capa = |
| 4062 | IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 4063 | #endif |
| 4064 | |
| 4065 | EXIT(); |
| 4066 | return 0; |
| 4067 | } |
| 4068 | |
| 4069 | /** |
| 4070 | * iw_get_range() - SSR wrapper for __iw_get_range() |
| 4071 | * @dev: pointer to net_device |
| 4072 | * @info: pointer to iw_request_info |
| 4073 | * @wrqu: pointer to iwreq_data |
| 4074 | * @extra: pointer to extra ioctl payload |
| 4075 | * |
| 4076 | * Return: 0 on success, error number otherwise |
| 4077 | */ |
| 4078 | static int iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 4079 | union iwreq_data *wrqu, char *extra) |
| 4080 | { |
| 4081 | int ret; |
| 4082 | |
| 4083 | cds_ssr_protect(__func__); |
| 4084 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 4085 | cds_ssr_unprotect(__func__); |
| 4086 | |
| 4087 | return ret; |
| 4088 | } |
| 4089 | |
| 4090 | /** |
| 4091 | * hdd_get_class_a_statistics_cb() - Get Class A stats callback function |
| 4092 | * @pStats: pointer to Class A stats |
| 4093 | * @pContext: user context originally registered with SME |
| 4094 | * |
| 4095 | * Return: None |
| 4096 | */ |
| 4097 | static void hdd_get_class_a_statistics_cb(void *pStats, void *pContext) |
| 4098 | { |
| 4099 | struct statsContext *pStatsContext; |
| 4100 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 4101 | hdd_adapter_t *pAdapter; |
| 4102 | |
| 4103 | if (ioctl_debug) { |
| 4104 | pr_info("%s: pStats [%p] pContext [%p]\n", |
| 4105 | __func__, pStats, pContext); |
| 4106 | } |
| 4107 | |
| 4108 | if ((NULL == pStats) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4109 | hdd_err("Bad param, pStats [%p] pContext [%p]", |
| 4110 | pStats, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4111 | return; |
| 4112 | } |
| 4113 | |
| 4114 | pClassAStats = pStats; |
| 4115 | pStatsContext = pContext; |
| 4116 | pAdapter = pStatsContext->pAdapter; |
| 4117 | |
| 4118 | /* there is a race condition that exists between this callback |
| 4119 | * function and the caller since the caller could time out |
| 4120 | * either before or while this code is executing. we use a |
| 4121 | * spinlock to serialize these actions |
| 4122 | */ |
| 4123 | spin_lock(&hdd_context_lock); |
| 4124 | |
| 4125 | if ((NULL == pAdapter) || |
| 4126 | (STATS_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 4127 | /* the caller presumably timed out so there is nothing |
| 4128 | * we can do |
| 4129 | */ |
| 4130 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4131 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 4132 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4133 | if (ioctl_debug) { |
| 4134 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 4135 | __func__, pAdapter, pStatsContext->magic); |
| 4136 | } |
| 4137 | return; |
| 4138 | } |
| 4139 | |
| 4140 | /* context is valid so caller is still waiting */ |
| 4141 | |
| 4142 | /* paranoia: invalidate the magic */ |
| 4143 | pStatsContext->magic = 0; |
| 4144 | |
| 4145 | /* copy over the stats. do so as a struct copy */ |
| 4146 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 4147 | |
| 4148 | /* notify the caller */ |
| 4149 | complete(&pStatsContext->completion); |
| 4150 | |
| 4151 | /* serialization is complete */ |
| 4152 | spin_unlock(&hdd_context_lock); |
| 4153 | } |
| 4154 | |
| 4155 | /** |
| 4156 | * wlan_hdd_get_class_astats() - Get Class A statistics |
| 4157 | * @pAdapter: adapter for which statistics are desired |
| 4158 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4159 | * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4161 | QDF_STATUS wlan_hdd_get_class_astats(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4162 | { |
| 4163 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4164 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | unsigned long rc; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 4166 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4167 | |
| 4168 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4169 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4170 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | } |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 4172 | if (cds_is_driver_recovering()) { |
| 4173 | hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", |
| 4174 | cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4175 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4176 | } |
| 4177 | |
| 4178 | /* we are connected so prepare our callback context */ |
| 4179 | init_completion(&context.completion); |
| 4180 | context.pAdapter = pAdapter; |
| 4181 | context.magic = STATS_CONTEXT_MAGIC; |
| 4182 | /* query only for Class A statistics (which include link speed) */ |
| 4183 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4184 | eCSR_HDD, SME_GLOBAL_CLASSA_STATS, |
| 4185 | hdd_get_class_a_statistics_cb, |
| 4186 | 0, /* not periodic */ |
| 4187 | false, /* non-cached results */ |
| 4188 | pHddStaCtx->conn_info.staId[0], |
| 4189 | &context, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4190 | if (QDF_STATUS_SUCCESS != hstatus) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 4191 | hdd_warn("Unable to retrieve Class A statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4192 | /* we'll returned a cached value below */ |
| 4193 | } else { |
| 4194 | /* request was sent -- wait for the response */ |
| 4195 | rc = wait_for_completion_timeout |
| 4196 | (&context.completion, |
| 4197 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 4198 | if (!rc) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 4199 | hdd_warn("SME timed out while retrieving Class A statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4200 | } |
| 4201 | } |
| 4202 | |
| 4203 | /* either we never sent a request, we sent a request and |
| 4204 | * received a response or we sent a request and timed out. if |
| 4205 | * we never sent a request or if we sent a request and got a |
| 4206 | * response, we want to clear the magic out of paranoia. if |
| 4207 | * we timed out there is a race condition such that the |
| 4208 | * callback function could be executing at the same time we |
| 4209 | * are. of primary concern is if the callback function had |
| 4210 | * already verified the "magic" but had not yet set the |
| 4211 | * completion variable when a timeout occurred. we serialize |
| 4212 | * these activities by invalidating the magic while holding a |
| 4213 | * shared spinlock which will cause us to block if the |
| 4214 | * callback is currently executing |
| 4215 | */ |
| 4216 | spin_lock(&hdd_context_lock); |
| 4217 | context.magic = 0; |
| 4218 | spin_unlock(&hdd_context_lock); |
| 4219 | |
| 4220 | /* either callback updated pAdapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4221 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | } |
| 4223 | |
| 4224 | /** |
| 4225 | * hdd_get_station_statistics_cb() - Get stats callback function |
| 4226 | * @pStats: pointer to Class A stats |
| 4227 | * @pContext: user context originally registered with SME |
| 4228 | * |
| 4229 | * Return: None |
| 4230 | */ |
| 4231 | static void hdd_get_station_statistics_cb(void *pStats, void *pContext) |
| 4232 | { |
| 4233 | struct statsContext *pStatsContext; |
| 4234 | tCsrSummaryStatsInfo *pSummaryStats; |
| 4235 | tCsrGlobalClassAStatsInfo *pClassAStats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 4236 | struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | hdd_adapter_t *pAdapter; |
| 4238 | |
| 4239 | if (ioctl_debug) { |
| 4240 | pr_info("%s: pStats [%p] pContext [%p]\n", |
| 4241 | __func__, pStats, pContext); |
| 4242 | } |
| 4243 | |
| 4244 | if ((NULL == pStats) || (NULL == pContext)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4245 | hdd_err("Bad param, pStats [%p] pContext [%p]", |
| 4246 | pStats, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4247 | return; |
| 4248 | } |
| 4249 | |
| 4250 | /* there is a race condition that exists between this callback |
| 4251 | * function and the caller since the caller could time out |
| 4252 | * either before or while this code is executing. we use a |
| 4253 | * spinlock to serialize these actions |
| 4254 | */ |
| 4255 | spin_lock(&hdd_context_lock); |
| 4256 | |
| 4257 | pSummaryStats = (tCsrSummaryStatsInfo *) pStats; |
| 4258 | pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 4259 | per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *) |
| 4260 | (pClassAStats + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4261 | pStatsContext = pContext; |
| 4262 | pAdapter = pStatsContext->pAdapter; |
| 4263 | if ((NULL == pAdapter) || |
| 4264 | (STATS_CONTEXT_MAGIC != pStatsContext->magic)) { |
| 4265 | /* the caller presumably timed out so there is nothing |
| 4266 | * we can do |
| 4267 | */ |
| 4268 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4269 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
| 4270 | pAdapter, pStatsContext->magic); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4271 | if (ioctl_debug) { |
| 4272 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 4273 | __func__, pAdapter, pStatsContext->magic); |
| 4274 | } |
| 4275 | return; |
| 4276 | } |
| 4277 | |
| 4278 | /* context is valid so caller is still waiting */ |
| 4279 | |
| 4280 | /* paranoia: invalidate the magic */ |
| 4281 | pStatsContext->magic = 0; |
| 4282 | |
| 4283 | /* copy over the stats. do so as a struct copy */ |
| 4284 | pAdapter->hdd_stats.summary_stat = *pSummaryStats; |
| 4285 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 4286 | pAdapter->hdd_stats.per_chain_rssi_stats = *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4287 | |
| 4288 | /* notify the caller */ |
| 4289 | complete(&pStatsContext->completion); |
| 4290 | |
| 4291 | /* serialization is complete */ |
| 4292 | spin_unlock(&hdd_context_lock); |
| 4293 | } |
| 4294 | |
| 4295 | /** |
| 4296 | * wlan_hdd_get_station_stats() - Get station statistics |
| 4297 | * @pAdapter: adapter for which statistics are desired |
| 4298 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4299 | * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4300 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4301 | QDF_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4302 | { |
| 4303 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4304 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4305 | unsigned long rc; |
Jeff Johnson | 5aacdf9 | 2016-11-04 18:08:11 -0700 | [diff] [blame] | 4306 | static struct statsContext context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4307 | |
| 4308 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4309 | hdd_err("pAdapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4310 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4311 | } |
| 4312 | |
| 4313 | /* we are connected so prepare our callback context */ |
| 4314 | init_completion(&context.completion); |
| 4315 | context.pAdapter = pAdapter; |
| 4316 | context.magic = STATS_CONTEXT_MAGIC; |
| 4317 | |
| 4318 | /* query only for Summary & Class A statistics */ |
| 4319 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4320 | eCSR_HDD, |
| 4321 | SME_SUMMARY_STATS | |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 4322 | SME_GLOBAL_CLASSA_STATS | |
| 4323 | SME_PER_CHAIN_RSSI_STATS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4324 | hdd_get_station_statistics_cb, |
| 4325 | 0, /* not periodic */ |
| 4326 | false, /* non-cached results */ |
| 4327 | pHddStaCtx->conn_info.staId[0], |
| 4328 | &context, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4329 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4330 | hdd_err("Unable to retrieve statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | /* we'll return with cached values */ |
| 4332 | } else { |
| 4333 | /* request was sent -- wait for the response */ |
| 4334 | rc = wait_for_completion_timeout |
| 4335 | (&context.completion, |
| 4336 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 4337 | |
| 4338 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4339 | hdd_err("SME timed out while retrieving statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4340 | } |
| 4341 | } |
| 4342 | |
| 4343 | /* either we never sent a request, we sent a request and |
| 4344 | * received a response or we sent a request and timed out. if |
| 4345 | * we never sent a request or if we sent a request and got a |
| 4346 | * response, we want to clear the magic out of paranoia. if |
| 4347 | * we timed out there is a race condition such that the |
| 4348 | * callback function could be executing at the same time we |
| 4349 | * are. of primary concern is if the callback function had |
| 4350 | * already verified the "magic" but had not yet set the |
| 4351 | * completion variable when a timeout occurred. we serialize |
| 4352 | * these activities by invalidating the magic while holding a |
| 4353 | * shared spinlock which will cause us to block if the |
| 4354 | * callback is currently executing |
| 4355 | */ |
| 4356 | spin_lock(&hdd_context_lock); |
| 4357 | context.magic = 0; |
| 4358 | spin_unlock(&hdd_context_lock); |
| 4359 | |
| 4360 | /* either callback updated pAdapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4361 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4362 | } |
| 4363 | |
| 4364 | /** |
| 4365 | * iw_get_linkspeed() - Get current link speed ioctl |
| 4366 | * @dev: device upon which the ioctl was received |
| 4367 | * @info: ioctl request information |
| 4368 | * @wrqu: ioctl request data |
| 4369 | * @extra: extra ioctl buffer |
| 4370 | * |
| 4371 | * Return: 0 on success, non-zero on error |
| 4372 | */ |
| 4373 | static int __iw_get_linkspeed(struct net_device *dev, |
| 4374 | struct iw_request_info *info, |
| 4375 | union iwreq_data *wrqu, char *extra) |
| 4376 | { |
| 4377 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4378 | char *pLinkSpeed = (char *)extra; |
| 4379 | int len = sizeof(uint32_t) + 1; |
| 4380 | uint32_t link_speed = 0; |
| 4381 | hdd_context_t *hdd_ctx; |
| 4382 | int rc, valid; |
| 4383 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 4384 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 4385 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4386 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4387 | valid = wlan_hdd_validate_context(hdd_ctx); |
| 4388 | if (0 != valid) |
| 4389 | return valid; |
| 4390 | |
| 4391 | rc = wlan_hdd_get_link_speed(pAdapter, &link_speed); |
| 4392 | if (0 != rc) { |
| 4393 | return rc; |
| 4394 | } |
| 4395 | |
| 4396 | wrqu->data.length = len; |
| 4397 | /* return the linkspeed as a string */ |
| 4398 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
| 4399 | if ((rc < 0) || (rc >= len)) { |
| 4400 | /* encoding or length error? */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4401 | hdd_err("Unable to encode link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4402 | return -EIO; |
| 4403 | } |
| 4404 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 4405 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4406 | /* a value is being successfully returned */ |
| 4407 | return 0; |
| 4408 | } |
| 4409 | |
| 4410 | static int iw_get_linkspeed(struct net_device *dev, |
| 4411 | struct iw_request_info *info, |
| 4412 | union iwreq_data *wrqu, char *extra) |
| 4413 | { |
| 4414 | int ret; |
| 4415 | |
| 4416 | cds_ssr_protect(__func__); |
| 4417 | ret = __iw_get_linkspeed(dev, info, wrqu, extra); |
| 4418 | cds_ssr_unprotect(__func__); |
| 4419 | |
| 4420 | return ret; |
| 4421 | } |
| 4422 | |
| 4423 | /** |
| 4424 | * wlan_hdd_change_country_code_callback() - Change country code callback |
| 4425 | * @context: opaque context originally passed to SME. All functions |
| 4426 | * which use this callback pass the adapter upon which the country |
| 4427 | * code change is active |
| 4428 | * |
| 4429 | * This function is registered as the callback function when |
| 4430 | * sme_change_country_code() is invoked. Callers of |
| 4431 | * sme_change_country_code() subsequently wait for the adapter's |
| 4432 | * @change_country_code completion variable, so all this function |
| 4433 | * needs to do is set that completion variable so that execution can |
| 4434 | * continue. |
| 4435 | * |
| 4436 | * Return: none |
| 4437 | */ |
| 4438 | void wlan_hdd_change_country_code_callback(void *context) |
| 4439 | { |
| 4440 | |
| 4441 | hdd_adapter_t *adapter = context; |
| 4442 | |
| 4443 | if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) |
| 4444 | complete(&adapter->change_country_code); |
| 4445 | |
| 4446 | return; |
| 4447 | } |
| 4448 | |
| 4449 | /** |
| 4450 | * __iw_set_nick() - SIOCSIWNICKN ioctl handler |
| 4451 | * @dev: device upon which the ioctl was received |
| 4452 | * @info: ioctl request information |
| 4453 | * @wrqu: ioctl request data |
| 4454 | * @extra: ioctl extra data |
| 4455 | * |
| 4456 | * Return: 0 on success, non-zero on error |
| 4457 | */ |
| 4458 | static int __iw_set_nick(struct net_device *dev, |
| 4459 | struct iw_request_info *info, |
| 4460 | union iwreq_data *wrqu, char *extra) |
| 4461 | { |
| 4462 | hdd_adapter_t *adapter; |
| 4463 | hdd_context_t *hdd_ctx; |
| 4464 | int ret; |
| 4465 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4466 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4467 | |
| 4468 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4469 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4470 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4471 | if (0 != ret) |
| 4472 | return ret; |
| 4473 | |
| 4474 | return 0; |
| 4475 | } |
| 4476 | |
| 4477 | /** |
| 4478 | * iw_set_nick() - SSR wrapper for __iw_set_nick |
| 4479 | * @dev: pointer to net_device |
| 4480 | * @info: pointer to iw_request_info |
| 4481 | * @wrqu: pointer to iwreq_data |
| 4482 | * @extra: extra |
| 4483 | * |
| 4484 | * Return: 0 on success, error number otherwise |
| 4485 | */ |
| 4486 | static int iw_set_nick(struct net_device *dev, |
| 4487 | struct iw_request_info *info, |
| 4488 | union iwreq_data *wrqu, char *extra) |
| 4489 | { |
| 4490 | int ret; |
| 4491 | |
| 4492 | cds_ssr_protect(__func__); |
| 4493 | ret = __iw_set_nick(dev, info, wrqu, extra); |
| 4494 | cds_ssr_unprotect(__func__); |
| 4495 | |
| 4496 | return ret; |
| 4497 | } |
| 4498 | |
| 4499 | /** |
| 4500 | * __iw_get_nick() - SIOCGIWNICKN ioctl handler |
| 4501 | * @dev: device upon which the ioctl was received |
| 4502 | * @info: ioctl request information |
| 4503 | * @wrqu: ioctl request data |
| 4504 | * @extra: ioctl extra data |
| 4505 | * |
| 4506 | * Return: 0 on success, non-zero on error |
| 4507 | */ |
| 4508 | static int __iw_get_nick(struct net_device *dev, |
| 4509 | struct iw_request_info *info, |
| 4510 | union iwreq_data *wrqu, char *extra) |
| 4511 | { |
| 4512 | hdd_adapter_t *adapter; |
| 4513 | hdd_context_t *hdd_ctx; |
| 4514 | int ret; |
| 4515 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4516 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4517 | |
| 4518 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4519 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4520 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4521 | if (0 != ret) |
| 4522 | return ret; |
| 4523 | |
| 4524 | return 0; |
| 4525 | } |
| 4526 | |
| 4527 | /** |
| 4528 | * iw_get_nick() - SSR wrapper for __iw_get_nick |
| 4529 | * @dev: pointer to net_device |
| 4530 | * @info: pointer to iw_request_info |
| 4531 | * @wrqu: pointer to iwreq_data |
| 4532 | * @extra: extra |
| 4533 | * |
| 4534 | * Return: 0 on success, error number otherwise |
| 4535 | */ |
| 4536 | static int iw_get_nick(struct net_device *dev, |
| 4537 | struct iw_request_info *info, |
| 4538 | union iwreq_data *wrqu, char *extra) |
| 4539 | { |
| 4540 | int ret; |
| 4541 | |
| 4542 | cds_ssr_protect(__func__); |
| 4543 | ret = __iw_get_nick(dev, info, wrqu, extra); |
| 4544 | cds_ssr_unprotect(__func__); |
| 4545 | |
| 4546 | return ret; |
| 4547 | } |
| 4548 | |
| 4549 | /** |
| 4550 | * __iw_set_encode() - SIOCSIWENCODE ioctl handler |
| 4551 | * @dev: device upon which the ioctl was received |
| 4552 | * @info: ioctl request information |
| 4553 | * @wrqu: ioctl request data |
| 4554 | * @extra: ioctl extra data |
| 4555 | * |
| 4556 | * Return: 0 on success, non-zero on error |
| 4557 | */ |
| 4558 | static int __iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 4559 | union iwreq_data *wrqu, char *extra) |
| 4560 | { |
| 4561 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4562 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4563 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4564 | hdd_context_t *hdd_ctx; |
| 4565 | struct iw_point *encoderq = &(wrqu->encoding); |
| 4566 | uint32_t keyId; |
| 4567 | uint8_t key_length; |
| 4568 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4569 | bool fKeyPresent = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4570 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4571 | int ret; |
| 4572 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4573 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4574 | |
| 4575 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4576 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4577 | if (0 != ret) |
| 4578 | return ret; |
| 4579 | |
| 4580 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 4581 | |
| 4582 | if (keyId) { |
| 4583 | if (keyId > MAX_WEP_KEYS) { |
| 4584 | return -EINVAL; |
| 4585 | } |
| 4586 | |
| 4587 | fKeyPresent = 1; |
| 4588 | keyId--; |
| 4589 | } else { |
| 4590 | fKeyPresent = 0; |
| 4591 | } |
| 4592 | |
| 4593 | if (wrqu->data.flags & IW_ENCODE_DISABLED) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4594 | hdd_notice("****iwconfig wlan0 key off*****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4595 | if (!fKeyPresent) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4596 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, |
| 4597 | CSR_MAX_NUM_KEY); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4598 | } |
| 4599 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4600 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 4601 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 4602 | eCSR_ENCRYPT_TYPE_NONE; |
| 4603 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 4604 | eCSR_ENCRYPT_TYPE_NONE; |
| 4605 | |
| 4606 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4607 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4608 | |
| 4609 | if (eConnectionState_Associated == |
| 4610 | pHddStaCtx->conn_info.connState) { |
| 4611 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4612 | status = |
| 4613 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4614 | pAdapter->sessionId, |
| 4615 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4616 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4617 | unsigned long rc; |
| 4618 | rc = wait_for_completion_timeout(&pAdapter-> |
| 4619 | disconnect_comp_var, |
| 4620 | msecs_to_jiffies |
| 4621 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 4622 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4623 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4624 | } |
| 4625 | } |
| 4626 | |
| 4627 | return status; |
| 4628 | |
| 4629 | } |
| 4630 | |
| 4631 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4632 | hdd_notice("iwconfig wlan0 key on"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | |
| 4634 | pHddStaCtx->conn_info.authType = |
| 4635 | (encoderq-> |
| 4636 | flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : |
| 4637 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4638 | |
| 4639 | } |
| 4640 | |
| 4641 | if (wrqu->data.length > 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4642 | hdd_notice("wrqu->data.length : %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | |
| 4644 | key_length = wrqu->data.length; |
| 4645 | |
| 4646 | /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued. */ |
| 4647 | |
| 4648 | if (5 == key_length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4649 | hdd_notice("Call with WEP40,key_len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4650 | key_length); |
| 4651 | |
| 4652 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 4653 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4654 | pHddStaCtx->conn_info.authType)) { |
| 4655 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 4656 | } else { |
| 4657 | encryptionType = |
| 4658 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4659 | } |
| 4660 | } else if (13 == key_length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4661 | hdd_notice("Call with WEP104,key_len:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4662 | key_length); |
| 4663 | |
| 4664 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 4665 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4666 | pHddStaCtx->conn_info.authType)) { |
| 4667 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 4668 | } else { |
| 4669 | encryptionType = |
| 4670 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4671 | } |
| 4672 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4673 | hdd_warn("Invalid WEP key length :%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4674 | key_length); |
| 4675 | return -EINVAL; |
| 4676 | } |
| 4677 | |
| 4678 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 4679 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 4680 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4681 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 4682 | encryptionType; |
| 4683 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 4684 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 4685 | encryptionType; |
| 4686 | |
| 4687 | if ((eConnectionState_NotConnected == |
| 4688 | pHddStaCtx->conn_info.connState) |
| 4689 | && |
| 4690 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 4691 | pHddStaCtx->conn_info.authType) |
| 4692 | || (eCSR_AUTH_TYPE_SHARED_KEY == |
| 4693 | pHddStaCtx->conn_info.authType))) { |
| 4694 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4695 | qdf_mem_copy(&pWextState->roamProfile.Keys. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | KeyMaterial[keyId][0], extra, key_length); |
| 4697 | |
| 4698 | pWextState->roamProfile.Keys.KeyLength[keyId] = |
| 4699 | (uint8_t) key_length; |
| 4700 | pWextState->roamProfile.Keys.defaultIndex = |
| 4701 | (uint8_t) keyId; |
| 4702 | |
| 4703 | return status; |
| 4704 | } |
| 4705 | } |
| 4706 | |
| 4707 | return 0; |
| 4708 | } |
| 4709 | |
| 4710 | /** |
| 4711 | * iw_set_encode() - SSR wrapper for __iw_set_encode() |
| 4712 | * @dev: pointer to net_device |
| 4713 | * @info: pointer to iw_request_info |
| 4714 | * @wrqu: pointer to iwreq_data |
| 4715 | * @extra: pointer to extra ioctl payload |
| 4716 | * |
| 4717 | * Return: 0 on success, error number otherwise |
| 4718 | */ |
| 4719 | static int iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 4720 | union iwreq_data *wrqu, char *extra) |
| 4721 | { |
| 4722 | int ret; |
| 4723 | |
| 4724 | cds_ssr_protect(__func__); |
| 4725 | ret = __iw_set_encode(dev, info, wrqu, extra); |
| 4726 | cds_ssr_unprotect(__func__); |
| 4727 | |
| 4728 | return ret; |
| 4729 | } |
| 4730 | |
| 4731 | /** |
| 4732 | * __iw_get_encodeext() - SIOCGIWENCODEEXT ioctl handler |
| 4733 | * @dev: device upon which the ioctl was received |
| 4734 | * @info: ioctl request information |
| 4735 | * @wrqu: ioctl request data |
| 4736 | * @extra: ioctl extra data |
| 4737 | * |
| 4738 | * Return: 0 on success, non-zero on error |
| 4739 | */ |
| 4740 | static int __iw_get_encodeext(struct net_device *dev, |
| 4741 | struct iw_request_info *info, |
| 4742 | struct iw_point *dwrq, char *extra) |
| 4743 | { |
| 4744 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4745 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4746 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 4747 | int keyId; |
| 4748 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4749 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 4750 | int i, ret; |
| 4751 | hdd_context_t *hdd_ctx; |
| 4752 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4753 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4754 | |
| 4755 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4756 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4757 | if (0 != ret) |
| 4758 | return ret; |
| 4759 | |
| 4760 | keyId = pRoamProfile->Keys.defaultIndex; |
| 4761 | |
| 4762 | if (keyId < 0 || keyId >= MAX_WEP_KEYS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4763 | hdd_notice("Invalid keyId : %d", keyId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | return -EINVAL; |
| 4765 | } |
| 4766 | |
| 4767 | if (pRoamProfile->Keys.KeyLength[keyId] > 0) { |
| 4768 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4769 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4770 | qdf_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4771 | pRoamProfile->Keys.KeyLength[keyId]); |
| 4772 | } else { |
| 4773 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4774 | } |
| 4775 | |
| 4776 | for (i = 0; i < MAX_WEP_KEYS; i++) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4777 | if (pRoamProfile->Keys.KeyLength[i] == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4778 | continue; |
| 4779 | } else { |
| 4780 | break; |
| 4781 | } |
| 4782 | } |
| 4783 | |
| 4784 | if (MAX_WEP_KEYS == i) { |
| 4785 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 4786 | } else { |
| 4787 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4788 | } |
| 4789 | |
| 4790 | encryptionType = pRoamProfile->EncryptionType.encryptionType[0]; |
| 4791 | |
| 4792 | if (eCSR_ENCRYPT_TYPE_NONE == encryptionType) { |
| 4793 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4794 | } |
| 4795 | |
| 4796 | authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 4797 | |
| 4798 | if (IW_AUTH_ALG_OPEN_SYSTEM == authType) { |
| 4799 | dwrq->flags |= IW_ENCODE_OPEN; |
| 4800 | } else { |
| 4801 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 4802 | } |
| 4803 | EXIT(); |
| 4804 | return 0; |
| 4805 | |
| 4806 | } |
| 4807 | |
| 4808 | /** |
| 4809 | * iw_get_encodeext() - SSR wrapper for __iw_get_encodeext() |
| 4810 | * @dev: pointer to net_device |
| 4811 | * @info: pointer to iw_request_info |
| 4812 | * @dwrq: pointer to encoding information |
| 4813 | * @extra: pointer to extra ioctl payload |
| 4814 | * |
| 4815 | * Return: 0 on success, error number otherwise |
| 4816 | */ |
| 4817 | static int iw_get_encodeext(struct net_device *dev, |
| 4818 | struct iw_request_info *info, |
| 4819 | struct iw_point *dwrq, char *extra) |
| 4820 | { |
| 4821 | int ret; |
| 4822 | |
| 4823 | cds_ssr_protect(__func__); |
| 4824 | ret = __iw_get_encodeext(dev, info, dwrq, extra); |
| 4825 | cds_ssr_unprotect(__func__); |
| 4826 | |
| 4827 | return ret; |
| 4828 | } |
| 4829 | |
| 4830 | /** |
| 4831 | * __iw_set_encodeext() - SIOCSIWENCODEEXT ioctl handler |
| 4832 | * @dev: device upon which the ioctl was received |
| 4833 | * @info: ioctl request information |
| 4834 | * @wrqu: ioctl request data |
| 4835 | * @extra: ioctl extra data |
| 4836 | * |
| 4837 | * Return: 0 on success, non-zero on error |
| 4838 | */ |
| 4839 | static int __iw_set_encodeext(struct net_device *dev, |
| 4840 | struct iw_request_info *info, |
| 4841 | union iwreq_data *wrqu, char *extra) |
| 4842 | { |
| 4843 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4844 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4845 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4846 | hdd_context_t *hdd_ctx; |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4847 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4848 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 4849 | int ret; |
| 4850 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
| 4851 | int key_index; |
| 4852 | struct iw_point *encoding = &wrqu->encoding; |
| 4853 | tCsrRoamSetKey setKey; |
| 4854 | uint32_t roamId = 0xFF; |
| 4855 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4856 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4857 | |
| 4858 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4859 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4860 | if (0 != ret) |
| 4861 | return ret; |
| 4862 | |
| 4863 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 4864 | |
| 4865 | if (key_index > 0) { |
| 4866 | |
| 4867 | /*Convert from 1-based to 0-based keying */ |
| 4868 | key_index--; |
| 4869 | } |
| 4870 | if (!ext->key_len) { |
| 4871 | |
| 4872 | /*Set the encrytion type to NONE */ |
| 4873 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 4874 | eCSR_ENCRYPT_TYPE_NONE; |
| 4875 | return ret; |
| 4876 | } |
| 4877 | |
| 4878 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState && |
| 4879 | (IW_ENCODE_ALG_WEP == ext->alg)) { |
| 4880 | if (IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { |
| 4881 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4882 | hdd_err("Invalid Configuration"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4883 | return -EINVAL; |
| 4884 | } else { |
| 4885 | /*Static wep, update the roam profile with the keys */ |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4886 | if (ext->key_len |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4887 | && (ext->key_len <= |
| 4888 | eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) |
| 4889 | && key_index < CSR_MAX_NUM_KEY) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4890 | qdf_mem_copy(&pRoamProfile->Keys. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4891 | KeyMaterial[key_index][0], |
| 4892 | ext->key, ext->key_len); |
| 4893 | pRoamProfile->Keys.KeyLength[key_index] = |
| 4894 | (uint8_t) ext->key_len; |
| 4895 | |
| 4896 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 4897 | pRoamProfile->Keys.defaultIndex = |
| 4898 | (uint8_t) key_index; |
| 4899 | |
| 4900 | } |
| 4901 | } |
| 4902 | return ret; |
| 4903 | } |
| 4904 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4905 | qdf_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4906 | |
| 4907 | setKey.keyId = key_index; |
| 4908 | setKey.keyLength = ext->key_len; |
| 4909 | |
| 4910 | if (ext->key_len <= CSR_MAX_KEY_LEN) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4911 | qdf_mem_copy(&setKey.Key[0], ext->key, ext->key_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4912 | } |
| 4913 | |
| 4914 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4915 | /*Key direction for group is RX only */ |
| 4916 | setKey.keyDirection = eSIR_RX_ONLY; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4917 | qdf_set_macaddr_broadcast(&setKey.peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4918 | } else { |
| 4919 | |
| 4920 | setKey.keyDirection = eSIR_TX_RX; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4921 | qdf_mem_copy(setKey.peerMac.bytes, ext->addr.sa_data, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4922 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4923 | } |
| 4924 | |
| 4925 | /*For supplicant pae role is zero */ |
| 4926 | setKey.paeRole = 0; |
| 4927 | |
| 4928 | switch (ext->alg) { |
| 4929 | case IW_ENCODE_ALG_NONE: |
| 4930 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4931 | break; |
| 4932 | |
| 4933 | case IW_ENCODE_ALG_WEP: |
| 4934 | setKey.encType = |
| 4935 | (ext->key_len == |
| 4936 | 5) ? eCSR_ENCRYPT_TYPE_WEP40 : eCSR_ENCRYPT_TYPE_WEP104; |
| 4937 | break; |
| 4938 | |
| 4939 | case IW_ENCODE_ALG_TKIP: |
| 4940 | { |
| 4941 | uint8_t *pKey = &setKey.Key[0]; |
| 4942 | |
| 4943 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 4944 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4945 | qdf_mem_zero(pKey, CSR_MAX_KEY_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4946 | |
| 4947 | /* Supplicant sends the 32bytes key in this order |
| 4948 | * |--------------|----------|----------| |
| 4949 | * | Tk1 | TX MIC | RX MIC | |
| 4950 | * |--------------|----------|----------| |
| 4951 | * <---16bytes---><--8bytes--><--8bytes--> |
| 4952 | * |
| 4953 | * |
| 4954 | * Sme expects the 32 bytes key to be in the below order |
| 4955 | * |--------------|----------|----------| |
| 4956 | * | Tk1 | RX MIC | TX MIC | |
| 4957 | * |--------------|----------|----------| |
| 4958 | * <---16bytes---><--8bytes--><--8bytes--> |
| 4959 | */ |
| 4960 | |
| 4961 | /* Copy the Temporal Key 1 (TK1) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4962 | qdf_mem_copy(pKey, ext->key, 16); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4963 | |
| 4964 | /* Copy the rx mic first */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4965 | qdf_mem_copy(&pKey[16], &ext->key[24], 8); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4966 | |
| 4967 | /* Copy the tx mic */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4968 | qdf_mem_copy(&pKey[24], &ext->key[16], 8); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4969 | |
| 4970 | } |
| 4971 | break; |
| 4972 | |
| 4973 | case IW_ENCODE_ALG_CCMP: |
| 4974 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4975 | break; |
| 4976 | |
| 4977 | #ifdef FEATURE_WLAN_ESE |
| 4978 | #define IW_ENCODE_ALG_KRK 6 |
| 4979 | case IW_ENCODE_ALG_KRK: |
| 4980 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 4981 | break; |
| 4982 | #endif /* FEATURE_WLAN_ESE */ |
| 4983 | |
| 4984 | default: |
| 4985 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4986 | break; |
| 4987 | } |
| 4988 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4989 | hdd_notice("cipher_alg:%d key_len:%d EncryptionType:%d", |
| 4990 | (int)ext->alg, (int)ext->key_len, setKey.encType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4991 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4992 | /* The supplicant may attempt to set the PTK once |
| 4993 | * pre-authentication is done. Save the key in the UMAC and |
| 4994 | * include it in the ADD BSS request |
| 4995 | */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4996 | 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] | 4997 | pAdapter->sessionId, &setKey); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4998 | if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4999 | hdd_info("Update PreAuth Key success"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5000 | return 0; |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5001 | } else if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_FAILED) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5002 | hdd_err("Update PreAuth Key failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5003 | return -EINVAL; |
| 5004 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5005 | |
| 5006 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5007 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5008 | 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] | 5009 | pAdapter->sessionId, |
| 5010 | &setKey, &roamId); |
| 5011 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5012 | if (qdf_ret_status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5013 | hdd_err("[%4d] sme_roam_set_key returned ERROR status= %d", |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5014 | __LINE__, qdf_ret_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5015 | |
| 5016 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5017 | } |
| 5018 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5019 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5020 | } |
| 5021 | |
| 5022 | /** |
| 5023 | * iw_set_encodeext() - SSR wrapper for __iw_set_encodeext() |
| 5024 | * @dev: pointer to net_device |
| 5025 | * @info: pointer to iw_request_info |
| 5026 | * @wrqu: pointer to iwreq_data |
| 5027 | * @extra: pointer to extra ioctl payload |
| 5028 | * |
| 5029 | * Return: 0 on success, error number otherwise |
| 5030 | */ |
| 5031 | static int iw_set_encodeext(struct net_device *dev, |
| 5032 | struct iw_request_info *info, |
| 5033 | union iwreq_data *wrqu, char *extra) |
| 5034 | { |
| 5035 | int ret; |
| 5036 | |
| 5037 | cds_ssr_protect(__func__); |
| 5038 | ret = __iw_set_encodeext(dev, info, wrqu, extra); |
| 5039 | cds_ssr_unprotect(__func__); |
| 5040 | |
| 5041 | return ret; |
| 5042 | } |
| 5043 | |
| 5044 | /** |
| 5045 | * __iw_set_retry() - SIOCSIWRETRY ioctl handler |
| 5046 | * @dev: device upon which the ioctl was received |
| 5047 | * @info: ioctl request information |
| 5048 | * @wrqu: ioctl request data |
| 5049 | * @extra: ioctl extra data |
| 5050 | * |
| 5051 | * Return: 0 on success, non-zero on error |
| 5052 | */ |
| 5053 | static int __iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 5054 | union iwreq_data *wrqu, char *extra) |
| 5055 | { |
| 5056 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5057 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5058 | hdd_context_t *hdd_ctx; |
| 5059 | int ret; |
| 5060 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5061 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5062 | |
| 5063 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5064 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5065 | if (0 != ret) |
| 5066 | return ret; |
| 5067 | |
| 5068 | if (wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 5069 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 5070 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5071 | hdd_err("Invalid Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5072 | |
| 5073 | return -EINVAL; |
| 5074 | } |
| 5075 | |
| 5076 | if (wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 5077 | |
| 5078 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 5079 | if (sme_cfg_set_int (hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 5080 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5081 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5082 | hdd_err("failed to set ini parameter, WNI_CFG_LONG_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5083 | return -EIO; |
| 5084 | } |
| 5085 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 5086 | if (sme_cfg_set_int (hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 5087 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5088 | QDF_STATUS_SUCCESS) { |
Anurag Chouhan | d29e760 | 2016-10-17 15:20:22 +0530 | [diff] [blame] | 5089 | hdd_err("failed to set ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5090 | return -EIO; |
| 5091 | } |
| 5092 | } |
| 5093 | } else { |
| 5094 | return -EOPNOTSUPP; |
| 5095 | } |
| 5096 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5097 | hdd_notice("Set Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5098 | |
| 5099 | EXIT(); |
| 5100 | |
| 5101 | return 0; |
| 5102 | |
| 5103 | } |
| 5104 | |
| 5105 | /** |
| 5106 | * iw_set_retry() - SSR wrapper for __iw_set_retry() |
| 5107 | * @dev: pointer to net_device |
| 5108 | * @info: pointer to iw_request_info |
| 5109 | * @wrqu: pointer to iwreq_data |
| 5110 | * @extra: pointer to extra ioctl payload |
| 5111 | * |
| 5112 | * Return: 0 on success, error number otherwise |
| 5113 | */ |
| 5114 | static int iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 5115 | union iwreq_data *wrqu, char *extra) |
| 5116 | { |
| 5117 | int ret; |
| 5118 | |
| 5119 | cds_ssr_protect(__func__); |
| 5120 | ret = __iw_set_retry(dev, info, wrqu, extra); |
| 5121 | cds_ssr_unprotect(__func__); |
| 5122 | |
| 5123 | return ret; |
| 5124 | } |
| 5125 | |
| 5126 | /** |
| 5127 | * __iw_get_retry() - SIOCGIWRETRY ioctl handler |
| 5128 | * @dev: device upon which the ioctl was received |
| 5129 | * @info: ioctl request information |
| 5130 | * @wrqu: ioctl request data |
| 5131 | * @extra: ioctl extra data |
| 5132 | * |
| 5133 | * Return: 0 on success, non-zero on error |
| 5134 | */ |
| 5135 | static int __iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 5136 | union iwreq_data *wrqu, char *extra) |
| 5137 | { |
| 5138 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5139 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5140 | uint32_t retry = 0; |
| 5141 | hdd_context_t *hdd_ctx; |
| 5142 | int ret; |
| 5143 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5144 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5145 | |
| 5146 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5147 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5148 | if (0 != ret) |
| 5149 | return ret; |
| 5150 | |
| 5151 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 5152 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 5153 | |
| 5154 | if (sme_cfg_get_int(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5155 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5156 | hdd_warn("failed to get ini parameter, WNI_CFG_LONG_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5157 | return -EIO; |
| 5158 | } |
| 5159 | |
| 5160 | wrqu->retry.value = retry; |
| 5161 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 5162 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 5163 | |
| 5164 | if (sme_cfg_get_int(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5165 | QDF_STATUS_SUCCESS) { |
Anurag Chouhan | d29e760 | 2016-10-17 15:20:22 +0530 | [diff] [blame] | 5166 | hdd_warn("failed to get ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5167 | return -EIO; |
| 5168 | } |
| 5169 | |
| 5170 | wrqu->retry.value = retry; |
| 5171 | } else { |
| 5172 | return -EOPNOTSUPP; |
| 5173 | } |
| 5174 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5175 | hdd_notice("Retry-Limit=%d!!", retry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5176 | |
| 5177 | EXIT(); |
| 5178 | |
| 5179 | return 0; |
| 5180 | } |
| 5181 | |
| 5182 | /** |
| 5183 | * iw_get_retry() - SSR wrapper for __iw_get_retry() |
| 5184 | * @dev: pointer to net_device |
| 5185 | * @info: pointer to iw_request_info |
| 5186 | * @wrqu: pointer to iwreq_data |
| 5187 | * @extra: pointer to extra ioctl payload |
| 5188 | * |
| 5189 | * Return: 0 on success, error number otherwise |
| 5190 | */ |
| 5191 | static int iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 5192 | union iwreq_data *wrqu, char *extra) |
| 5193 | { |
| 5194 | int ret; |
| 5195 | |
| 5196 | cds_ssr_protect(__func__); |
| 5197 | ret = __iw_get_retry(dev, info, wrqu, extra); |
| 5198 | cds_ssr_unprotect(__func__); |
| 5199 | |
| 5200 | return ret; |
| 5201 | } |
| 5202 | |
| 5203 | /** |
| 5204 | * __iw_set_mlme() - SIOCSIWMLME ioctl handler |
| 5205 | * @dev: device upon which the ioctl was received |
| 5206 | * @info: ioctl request information |
| 5207 | * @wrqu: ioctl request data |
| 5208 | * @extra: ioctl extra data |
| 5209 | * |
| 5210 | * Return: 0 on success, non-zero on error |
| 5211 | */ |
| 5212 | static int __iw_set_mlme(struct net_device *dev, |
| 5213 | struct iw_request_info *info, |
| 5214 | union iwreq_data *wrqu, char *extra) |
| 5215 | { |
| 5216 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5217 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5218 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5219 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5220 | hdd_context_t *hdd_ctx; |
| 5221 | int ret; |
| 5222 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5223 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5224 | |
| 5225 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5226 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5227 | if (0 != ret) |
| 5228 | return ret; |
| 5229 | |
| 5230 | /* reason_code is unused. By default it is set to |
| 5231 | * eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 5232 | */ |
| 5233 | switch (mlme->cmd) { |
| 5234 | case IW_MLME_DISASSOC: |
| 5235 | case IW_MLME_DEAUTH: |
| 5236 | |
| 5237 | if (pHddStaCtx->conn_info.connState == |
| 5238 | eConnectionState_Associated) { |
| 5239 | eCsrRoamDisconnectReason reason = |
| 5240 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 5241 | |
| 5242 | if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE) |
| 5243 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 5244 | |
| 5245 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 5246 | status = |
| 5247 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5248 | pAdapter->sessionId, reason); |
| 5249 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5250 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5251 | unsigned long rc; |
| 5252 | rc = wait_for_completion_timeout(&pAdapter-> |
| 5253 | disconnect_comp_var, |
| 5254 | msecs_to_jiffies |
| 5255 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 5256 | if (!rc) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5257 | hdd_err("failed wait on disconnect_comp_var"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5258 | } else |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5259 | hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d", |
| 5260 | (int)mlme->cmd, (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5261 | |
| 5262 | /* Resetting authKeyMgmt */ |
| 5263 | (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = |
| 5264 | 0; |
| 5265 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5266 | hdd_notice("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5267 | wlan_hdd_netif_queue_control(pAdapter, |
| 5268 | WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 5269 | WLAN_CONTROL_PATH); |
| 5270 | |
| 5271 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5272 | hdd_err("%d Command Disassociate/Deauthenticate called but station is not in associated state", |
| 5273 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5274 | } |
| 5275 | break; |
| 5276 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5277 | hdd_err("%d Command should be Disassociate/Deauthenticate", |
| 5278 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5279 | return -EINVAL; |
| 5280 | } /* end of switch */ |
| 5281 | |
| 5282 | EXIT(); |
| 5283 | |
| 5284 | return status; |
| 5285 | |
| 5286 | } |
| 5287 | |
| 5288 | /** |
| 5289 | * iw_set_mlme() - SSR wrapper for __iw_set_mlme() |
| 5290 | * @dev: pointer to net_device |
| 5291 | * @info: pointer to iw_request_info |
| 5292 | * @wrqu: pointer to iwreq_data |
| 5293 | * @extra: pointer to extra ioctl payload |
| 5294 | * |
| 5295 | * Return: 0 on success, error number otherwise |
| 5296 | */ |
| 5297 | static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info, |
| 5298 | union iwreq_data *wrqu, char *extra) |
| 5299 | { |
| 5300 | int ret; |
| 5301 | |
| 5302 | cds_ssr_protect(__func__); |
| 5303 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 5304 | cds_ssr_unprotect(__func__); |
| 5305 | |
| 5306 | return ret; |
| 5307 | } |
| 5308 | |
| 5309 | /** |
| 5310 | * wlan_hdd_update_phymode() - handle change in PHY mode |
| 5311 | * @net: device upon which PHY mode change was received |
| 5312 | * @hal: umac handle for the driver |
| 5313 | * @new_phymode: new PHY mode for the device |
| 5314 | * @phddctx: pointer to the HDD context |
| 5315 | * |
| 5316 | * This function is called when the device is set to a new PHY mode. |
| 5317 | * It takes a holistic look at the desired PHY mode along with the |
| 5318 | * configured capabilities of the driver and the reported capabilities |
| 5319 | * of the hardware in order to correctly configure all PHY-related |
| 5320 | * parameters. |
| 5321 | * |
| 5322 | * Return: 0 on success, negative errno value on error |
| 5323 | */ |
| 5324 | int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, |
| 5325 | int new_phymode, hdd_context_t *phddctx) |
| 5326 | { |
| 5327 | #ifdef QCA_HT_2040_COEX |
| 5328 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(net); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5329 | QDF_STATUS halStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5330 | #endif |
| 5331 | bool band_24 = false, band_5g = false; |
| 5332 | bool ch_bond24 = false, ch_bond5g = false; |
| 5333 | tSmeConfigParams smeconfig; |
| 5334 | uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5335 | uint32_t vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5336 | eCsrPhyMode phymode = -EIO, old_phymode; |
| 5337 | eHddDot11Mode hdd_dot11mode = phddctx->config->dot11Mode; |
| 5338 | eCsrBand curr_band = eCSR_BAND_ALL; |
| 5339 | |
| 5340 | old_phymode = sme_get_phy_mode(hal); |
| 5341 | |
| 5342 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 5343 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 5344 | nChannelBondingMode24GHz)) |
| 5345 | ch_bond24 = true; |
| 5346 | |
| 5347 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 5348 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 5349 | nChannelBondingMode5GHz)) |
| 5350 | ch_bond5g = true; |
| 5351 | |
| 5352 | if (phddctx->config->nBandCapability == eCSR_BAND_ALL) { |
| 5353 | band_24 = band_5g = true; |
| 5354 | } else if (phddctx->config->nBandCapability == eCSR_BAND_24) { |
| 5355 | band_24 = true; |
| 5356 | } else if (phddctx->config->nBandCapability == eCSR_BAND_5G) { |
| 5357 | band_5g = true; |
| 5358 | } |
| 5359 | |
| 5360 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5361 | 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] | 5362 | ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth); |
| 5363 | |
| 5364 | switch (new_phymode) { |
| 5365 | case IEEE80211_MODE_AUTO: |
| 5366 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 5367 | if (hdd_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
| 5368 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5369 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5370 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5371 | curr_band = eCSR_BAND_ALL; |
| 5372 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5373 | } else { |
| 5374 | sme_set_phy_mode(hal, old_phymode); |
| 5375 | return -EIO; |
| 5376 | } |
| 5377 | break; |
| 5378 | case IEEE80211_MODE_11A: |
| 5379 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a); |
| 5380 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5381 | phymode = eCSR_DOT11_MODE_11a; |
| 5382 | hdd_dot11mode = eHDD_DOT11_MODE_11a; |
| 5383 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5384 | curr_band = eCSR_BAND_5G; |
| 5385 | } else { |
| 5386 | sme_set_phy_mode(hal, old_phymode); |
| 5387 | return -EIO; |
| 5388 | } |
| 5389 | break; |
| 5390 | case IEEE80211_MODE_11B: |
| 5391 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b); |
| 5392 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5393 | phymode = eCSR_DOT11_MODE_11b; |
| 5394 | hdd_dot11mode = eHDD_DOT11_MODE_11b; |
| 5395 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5396 | curr_band = eCSR_BAND_24; |
| 5397 | } else { |
| 5398 | sme_set_phy_mode(hal, old_phymode); |
| 5399 | return -EIO; |
| 5400 | } |
| 5401 | break; |
| 5402 | case IEEE80211_MODE_11G: |
| 5403 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g); |
| 5404 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5405 | phymode = eCSR_DOT11_MODE_11g; |
| 5406 | hdd_dot11mode = eHDD_DOT11_MODE_11g; |
| 5407 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5408 | curr_band = eCSR_BAND_24; |
| 5409 | } else { |
| 5410 | sme_set_phy_mode(hal, old_phymode); |
| 5411 | return -EIO; |
| 5412 | } |
| 5413 | break; |
| 5414 | /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode |
| 5415 | * so setting phymode as eCSR_DOT11_MODE_11n and updating the band |
| 5416 | * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG |
| 5417 | */ |
| 5418 | case IEEE80211_MODE_11NA_HT20: |
| 5419 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5420 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5421 | phymode = eCSR_DOT11_MODE_11n; |
| 5422 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5423 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5424 | curr_band = eCSR_BAND_5G; |
| 5425 | } else { |
| 5426 | sme_set_phy_mode(hal, old_phymode); |
| 5427 | return -EIO; |
| 5428 | } |
| 5429 | break; |
| 5430 | case IEEE80211_MODE_11NA_HT40: |
| 5431 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5432 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5433 | phymode = eCSR_DOT11_MODE_11n; |
| 5434 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5435 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5436 | curr_band = eCSR_BAND_5G; |
| 5437 | } else { |
| 5438 | sme_set_phy_mode(hal, old_phymode); |
| 5439 | return -EIO; |
| 5440 | } |
| 5441 | break; |
| 5442 | case IEEE80211_MODE_11NG_HT20: |
| 5443 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5444 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5445 | phymode = eCSR_DOT11_MODE_11n; |
| 5446 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5447 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5448 | curr_band = eCSR_BAND_24; |
| 5449 | } else { |
| 5450 | sme_set_phy_mode(hal, old_phymode); |
| 5451 | return -EIO; |
| 5452 | } |
| 5453 | break; |
| 5454 | case IEEE80211_MODE_11NG_HT40: |
| 5455 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5456 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5457 | phymode = eCSR_DOT11_MODE_11n; |
| 5458 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5459 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5460 | curr_band = eCSR_BAND_24; |
| 5461 | } else { |
| 5462 | sme_set_phy_mode(hal, old_phymode); |
| 5463 | return -EIO; |
| 5464 | } |
| 5465 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5466 | case IEEE80211_MODE_11AC_VHT20: |
| 5467 | case IEEE80211_MODE_11AC_VHT40: |
| 5468 | case IEEE80211_MODE_11AC_VHT80: |
| 5469 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac); |
| 5470 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5471 | phymode = eCSR_DOT11_MODE_11ac; |
| 5472 | hdd_dot11mode = eHDD_DOT11_MODE_11ac; |
| 5473 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5474 | curr_band = eCSR_BAND_5G; |
| 5475 | } else { |
| 5476 | sme_set_phy_mode(hal, old_phymode); |
| 5477 | return -EIO; |
| 5478 | } |
| 5479 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5480 | case IEEE80211_MODE_2G_AUTO: |
| 5481 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 5482 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0)) { |
| 5483 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5484 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5485 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5486 | curr_band = eCSR_BAND_24; |
| 5487 | } else { |
| 5488 | sme_set_phy_mode(hal, old_phymode); |
| 5489 | return -EIO; |
| 5490 | } |
| 5491 | break; |
| 5492 | case IEEE80211_MODE_5G_AUTO: |
| 5493 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
| 5494 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0)) { |
| 5495 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5496 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5497 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5498 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5499 | curr_band = eCSR_BAND_5G; |
| 5500 | } else { |
| 5501 | sme_set_phy_mode(hal, old_phymode); |
| 5502 | return -EIO; |
| 5503 | } |
| 5504 | break; |
| 5505 | case IEEE80211_MODE_11AGN: |
| 5506 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
| 5507 | if ((hdd_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0)) { |
| 5508 | phymode = eCSR_DOT11_MODE_11n; |
| 5509 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5510 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5511 | curr_band = eCSR_BAND_ALL; |
| 5512 | } else { |
| 5513 | sme_set_phy_mode(hal, old_phymode); |
| 5514 | return -EIO; |
| 5515 | } |
| 5516 | break; |
| 5517 | default: |
| 5518 | return -EIO; |
| 5519 | } |
| 5520 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5521 | switch (new_phymode) { |
| 5522 | case IEEE80211_MODE_11AC_VHT20: |
| 5523 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5524 | vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ; |
| 5525 | break; |
| 5526 | case IEEE80211_MODE_11AC_VHT40: |
| 5527 | vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ; |
| 5528 | break; |
| 5529 | case IEEE80211_MODE_11AC_VHT80: |
| 5530 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5531 | break; |
| 5532 | default: |
| 5533 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
| 5534 | break; |
| 5535 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5536 | |
| 5537 | if (phymode != -EIO) { |
| 5538 | sme_get_config_param(hal, &smeconfig); |
| 5539 | smeconfig.csrConfig.phyMode = phymode; |
| 5540 | #ifdef QCA_HT_2040_COEX |
| 5541 | if (phymode == eCSR_DOT11_MODE_11n && |
| 5542 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { |
| 5543 | smeconfig.csrConfig.obssEnabled = false; |
| 5544 | halStatus = sme_set_ht2040_mode(hal, |
| 5545 | pAdapter->sessionId, |
| 5546 | eHT_CHAN_HT20, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5547 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5548 | hdd_err("Failed to disable OBSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5549 | return -EIO; |
| 5550 | } |
| 5551 | } else if (phymode == eCSR_DOT11_MODE_11n && |
| 5552 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) { |
| 5553 | smeconfig.csrConfig.obssEnabled = true; |
| 5554 | halStatus = sme_set_ht2040_mode(hal, |
| 5555 | pAdapter->sessionId, |
| 5556 | eHT_CHAN_HT20, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5557 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5558 | hdd_err("Failed to enable OBSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5559 | return -EIO; |
| 5560 | } |
| 5561 | } |
| 5562 | #endif |
| 5563 | smeconfig.csrConfig.eBand = curr_band; |
| 5564 | smeconfig.csrConfig.bandCapability = curr_band; |
| 5565 | if (curr_band == eCSR_BAND_24) |
| 5566 | smeconfig.csrConfig.Is11hSupportEnabled = 0; |
| 5567 | else |
| 5568 | smeconfig.csrConfig.Is11hSupportEnabled = |
| 5569 | phddctx->config->Is11hSupportEnabled; |
| 5570 | if (curr_band == eCSR_BAND_24) |
| 5571 | smeconfig.csrConfig.channelBondingMode24GHz = chwidth; |
| 5572 | else if (curr_band == eCSR_BAND_24) |
| 5573 | smeconfig.csrConfig.channelBondingMode5GHz = chwidth; |
| 5574 | else { |
| 5575 | smeconfig.csrConfig.channelBondingMode24GHz = chwidth; |
| 5576 | smeconfig.csrConfig.channelBondingMode5GHz = chwidth; |
| 5577 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5578 | smeconfig.csrConfig.nVhtChannelWidth = vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5579 | sme_update_config(hal, &smeconfig); |
| 5580 | |
| 5581 | phddctx->config->dot11Mode = hdd_dot11mode; |
| 5582 | phddctx->config->nBandCapability = curr_band; |
| 5583 | phddctx->config->nChannelBondingMode24GHz = |
| 5584 | smeconfig.csrConfig.channelBondingMode24GHz; |
| 5585 | phddctx->config->nChannelBondingMode5GHz = |
| 5586 | smeconfig.csrConfig.channelBondingMode5GHz; |
| 5587 | phddctx->config->vhtChannelWidth = vhtchanwidth; |
Krunal Soni | df0f874 | 2016-09-26 14:56:31 -0700 | [diff] [blame] | 5588 | if (hdd_update_config_cfg(phddctx) == false) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5589 | hdd_err("could not update config_dat"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5590 | return -EIO; |
| 5591 | } |
| 5592 | if (phddctx->config->nChannelBondingMode5GHz) |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 5593 | phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5594 | |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5595 | else |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 5596 | phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5597 | &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5598 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5599 | 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] | 5600 | phymode, chwidth, curr_band, vhtchanwidth); |
| 5601 | } |
| 5602 | |
| 5603 | return 0; |
| 5604 | } |
| 5605 | |
| 5606 | /** |
| 5607 | * hdd_get_temperature_cb() - "Get Temperature" callback function |
| 5608 | * @temperature: measured temperature |
| 5609 | * @pContext: callback context |
| 5610 | * |
| 5611 | * This function is passed to sme_get_temperature() as the callback |
| 5612 | * function to be invoked when the temperature measurement is |
| 5613 | * available. |
| 5614 | * |
| 5615 | * Return: None |
| 5616 | */ |
| 5617 | static void hdd_get_temperature_cb(int temperature, void *pContext) |
| 5618 | { |
| 5619 | struct statsContext *pTempContext; |
| 5620 | hdd_adapter_t *pAdapter; |
| 5621 | ENTER(); |
| 5622 | if (NULL == pContext) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5623 | hdd_err("pContext is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5624 | return; |
| 5625 | } |
| 5626 | pTempContext = pContext; |
| 5627 | pAdapter = pTempContext->pAdapter; |
| 5628 | spin_lock(&hdd_context_lock); |
| 5629 | if ((NULL == pAdapter) || (TEMP_CONTEXT_MAGIC != pTempContext->magic)) { |
| 5630 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5631 | hdd_warn("Invalid context, pAdapter [%p] magic [%08x]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | pAdapter, pTempContext->magic); |
| 5633 | return; |
| 5634 | } |
| 5635 | if (temperature != 0) { |
| 5636 | pAdapter->temperature = temperature; |
| 5637 | } |
| 5638 | complete(&pTempContext->completion); |
| 5639 | spin_unlock(&hdd_context_lock); |
| 5640 | EXIT(); |
| 5641 | } |
| 5642 | |
| 5643 | /** |
| 5644 | * wlan_hdd_get_temperature() - get current device temperature |
| 5645 | * @pAdapter: device upon which the request was made |
| 5646 | * @temperature: pointer to where the temperature is to be returned |
| 5647 | * |
| 5648 | * Return: 0 if a temperature value (either current or cached) was |
| 5649 | * returned, otherwise a negative errno is returned. |
| 5650 | * |
| 5651 | */ |
| 5652 | int wlan_hdd_get_temperature(hdd_adapter_t *pAdapter, int *temperature) |
| 5653 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5654 | QDF_STATUS status; |
Houston Hoffman | 59c097f | 2016-11-09 15:50:25 -0800 | [diff] [blame] | 5655 | static struct statsContext tempContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5656 | unsigned long rc; |
| 5657 | |
| 5658 | ENTER(); |
| 5659 | if (NULL == pAdapter) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5660 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5661 | return -EPERM; |
| 5662 | } |
| 5663 | init_completion(&tempContext.completion); |
| 5664 | tempContext.pAdapter = pAdapter; |
| 5665 | tempContext.magic = TEMP_CONTEXT_MAGIC; |
| 5666 | status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5667 | &tempContext, hdd_get_temperature_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5668 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5669 | hdd_err("Unable to retrieve temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5670 | } else { |
| 5671 | rc = wait_for_completion_timeout(&tempContext.completion, |
| 5672 | msecs_to_jiffies |
| 5673 | (WLAN_WAIT_TIME_STATS)); |
| 5674 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5675 | hdd_err("SME timed out while retrieving temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5676 | } |
| 5677 | } |
| 5678 | spin_lock(&hdd_context_lock); |
| 5679 | tempContext.magic = 0; |
| 5680 | spin_unlock(&hdd_context_lock); |
| 5681 | *temperature = pAdapter->temperature; |
| 5682 | EXIT(); |
| 5683 | return 0; |
| 5684 | } |
| 5685 | |
| 5686 | /** |
| 5687 | * iw_setint_getnone() - Generic "set integer" private ioctl handler |
| 5688 | * @dev: device upon which the ioctl was received |
| 5689 | * @info: ioctl request information |
| 5690 | * @wrqu: ioctl request data |
| 5691 | * @extra: ioctl extra data |
| 5692 | * |
| 5693 | * Return: 0 on success, non-zero on error |
| 5694 | */ |
| 5695 | static int __iw_setint_getnone(struct net_device *dev, |
| 5696 | struct iw_request_info *info, |
| 5697 | union iwreq_data *wrqu, char *extra) |
| 5698 | { |
| 5699 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5700 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5701 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5702 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5703 | hdd_context_t *hdd_ctx; |
| 5704 | tSmeConfigParams smeConfig; |
| 5705 | int *value = (int *)extra; |
| 5706 | int sub_cmd = value[0]; |
| 5707 | int set_value = value[1]; |
| 5708 | int ret; |
| 5709 | int enable_pbm, enable_mp; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5710 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5711 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 5712 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 5713 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5714 | INIT_COMPLETION(pWextState->completion_var); |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 5715 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5716 | |
| 5717 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5718 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5719 | if (0 != ret) |
| 5720 | return ret; |
| 5721 | |
| 5722 | switch (sub_cmd) { |
| 5723 | case WE_SET_11D_STATE: |
| 5724 | { |
| 5725 | if ((ENABLE_11D == set_value) |
| 5726 | || (DISABLE_11D == set_value)) { |
| 5727 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5728 | sme_get_config_param(hHal, &smeConfig); |
| 5729 | smeConfig.csrConfig.Is11dSupportEnabled = |
| 5730 | (bool) set_value; |
| 5731 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5732 | hdd_notice("11D state=%d!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5733 | smeConfig.csrConfig. |
| 5734 | Is11dSupportEnabled); |
| 5735 | |
| 5736 | sme_update_config(hHal, &smeConfig); |
| 5737 | } else { |
| 5738 | return -EINVAL; |
| 5739 | } |
| 5740 | break; |
| 5741 | } |
| 5742 | |
| 5743 | case WE_WOWL: |
| 5744 | { |
| 5745 | switch (set_value) { |
| 5746 | case 0x00: |
| 5747 | hdd_exit_wowl(pAdapter); |
| 5748 | break; |
| 5749 | case 0x01: |
| 5750 | case 0x02: |
| 5751 | case 0x03: |
| 5752 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 5753 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5754 | hdd_err("magic packet ? = %s pattern byte matching ? = %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5755 | (enable_mp ? "YES" : "NO"), |
| 5756 | (enable_pbm ? "YES" : "NO")); |
| 5757 | hdd_enter_wowl(pAdapter, enable_mp, enable_pbm); |
| 5758 | break; |
| 5759 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5760 | hdd_err("Invalid arg %d in WE_WOWL IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5761 | set_value); |
| 5762 | ret = -EINVAL; |
| 5763 | break; |
| 5764 | } |
| 5765 | |
| 5766 | break; |
| 5767 | } |
| 5768 | case WE_SET_POWER: |
| 5769 | { |
| 5770 | switch (set_value) { |
| 5771 | case 1: |
| 5772 | /* Enable PowerSave */ |
| 5773 | sme_ps_enable_disable(hHal, pAdapter->sessionId, |
| 5774 | SME_PS_ENABLE); |
| 5775 | break; |
| 5776 | case 2: |
| 5777 | /* Disable PowerSave */ |
| 5778 | sme_ps_enable_disable(hHal, pAdapter->sessionId, |
| 5779 | SME_PS_DISABLE); |
| 5780 | break; |
| 5781 | case 3: /* Enable UASPD */ |
| 5782 | sme_ps_uapsd_enable(hHal, pAdapter->sessionId); |
| 5783 | break; |
| 5784 | case 4: /* Disable UASPD */ |
| 5785 | sme_ps_uapsd_disable(hHal, pAdapter->sessionId); |
| 5786 | break; |
| 5787 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5788 | hdd_err("Invalid arg %d in WE_SET_POWER IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5789 | set_value); |
| 5790 | ret = -EINVAL; |
| 5791 | break; |
| 5792 | } |
| 5793 | break; |
| 5794 | } |
| 5795 | |
| 5796 | case WE_SET_MAX_ASSOC: |
| 5797 | { |
| 5798 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 5799 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) { |
| 5800 | ret = -EINVAL; |
| 5801 | } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 5802 | set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5803 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5804 | hdd_err("failed to set ini parameter, WNI_CFG_ASSOC_STA_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5805 | ret = -EIO; |
| 5806 | } |
| 5807 | break; |
| 5808 | } |
| 5809 | |
| 5810 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 5811 | if (set_value == 0 || set_value == 1) |
| 5812 | (WLAN_HDD_GET_CTX(pAdapter))->config->force_sap_acs = |
| 5813 | set_value; |
| 5814 | else |
| 5815 | ret = -EINVAL; |
| 5816 | break; |
| 5817 | |
| 5818 | case WE_SET_DATA_INACTIVITY_TO: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5819 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 5820 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
| 5821 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 5822 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5823 | set_value) == QDF_STATUS_E_FAILURE)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5824 | 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] | 5825 | ret = -EINVAL; |
| 5826 | } |
| 5827 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5828 | case WE_SET_MC_RATE: |
| 5829 | { |
| 5830 | ret = wlan_hdd_set_mc_rate(pAdapter, set_value); |
| 5831 | break; |
| 5832 | } |
| 5833 | case WE_SET_TX_POWER: |
| 5834 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5835 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5836 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5837 | qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5838 | if (sme_set_tx_power |
| 5839 | (hHal, pAdapter->sessionId, bssid, |
| 5840 | pAdapter->device_mode, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5841 | set_value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5842 | hdd_err("Setting tx power failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5843 | return -EIO; |
| 5844 | } |
| 5845 | break; |
| 5846 | } |
| 5847 | case WE_SET_MAX_TX_POWER: |
| 5848 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5849 | struct qdf_mac_addr bssid; |
| 5850 | struct qdf_mac_addr selfMac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5851 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5852 | hdd_notice("Setting maximum tx power %d dBm", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5853 | set_value); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5854 | qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId); |
| 5855 | qdf_copy_macaddr(&selfMac, &pHddStaCtx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5856 | |
| 5857 | if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5858 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5859 | hdd_err("Setting maximum tx power failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5860 | return -EIO; |
| 5861 | } |
| 5862 | |
| 5863 | break; |
| 5864 | } |
| 5865 | case WE_SET_MAX_TX_POWER_2_4: |
| 5866 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5867 | hdd_notice("Setting maximum tx power %d dBm for 2.4 GHz band", |
| 5868 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5869 | 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] | 5870 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5871 | hdd_err("Setting maximum tx power failed for 2.4 GHz band"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5872 | return -EIO; |
| 5873 | } |
| 5874 | |
| 5875 | break; |
| 5876 | } |
| 5877 | case WE_SET_MAX_TX_POWER_5_0: |
| 5878 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5879 | hdd_notice("Setting maximum tx power %d dBm for 5.0 GHz band", |
| 5880 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5881 | 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] | 5882 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5883 | hdd_err("Setting maximum tx power failed for 5.0 GHz band"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5884 | return -EIO; |
| 5885 | } |
| 5886 | |
| 5887 | break; |
| 5888 | } |
| 5889 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 5890 | { |
| 5891 | if (!((set_value == false) || (set_value == true))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5892 | hdd_err("Dynamic DTIM Incorrect data:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5893 | set_value); |
| 5894 | ret = -EINVAL; |
| 5895 | } else { |
| 5896 | if (pAdapter->higherDtimTransition != set_value) { |
| 5897 | pAdapter->higherDtimTransition = |
| 5898 | set_value; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5899 | hdd_notice("higherDtimTransition set to :%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5900 | pAdapter->higherDtimTransition); |
| 5901 | } |
| 5902 | } |
| 5903 | |
| 5904 | break; |
| 5905 | } |
| 5906 | |
| 5907 | case WE_SET_TM_LEVEL: |
| 5908 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5909 | hdd_notice("Set Thermal Mitigation Level %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5910 | (void)sme_set_thermal_level(hHal, set_value); |
| 5911 | break; |
| 5912 | } |
| 5913 | |
| 5914 | case WE_SET_PHYMODE: |
| 5915 | { |
| 5916 | hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5917 | |
| 5918 | ret = |
| 5919 | wlan_hdd_update_phymode(dev, hHal, set_value, |
| 5920 | phddctx); |
| 5921 | break; |
| 5922 | } |
| 5923 | |
| 5924 | case WE_SET_NSS: |
| 5925 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5926 | hdd_notice("Set NSS = %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5927 | if ((set_value > 2) || (set_value <= 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5928 | hdd_err("NSS greater than 2 not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5929 | ret = -EINVAL; |
| 5930 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5931 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5932 | hdd_update_nss(WLAN_HDD_GET_CTX(pAdapter), |
| 5933 | set_value)) |
| 5934 | ret = -EINVAL; |
| 5935 | } |
| 5936 | break; |
| 5937 | } |
| 5938 | |
| 5939 | case WE_SET_GTX_HT_MCS: |
| 5940 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5941 | hdd_notice("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5943 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 5944 | set_value, GTX_CMD); |
| 5945 | break; |
| 5946 | } |
| 5947 | |
| 5948 | case WE_SET_GTX_VHT_MCS: |
| 5949 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5950 | hdd_notice("WMI_VDEV_PARAM_GTX_VHT_MCS %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | set_value); |
| 5952 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5953 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 5954 | set_value, GTX_CMD); |
| 5955 | break; |
| 5956 | } |
| 5957 | |
| 5958 | case WE_SET_GTX_USRCFG: |
| 5959 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5960 | hdd_notice("WMI_VDEV_PARAM_GTX_USR_CFG %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5961 | set_value); |
| 5962 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5963 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 5964 | set_value, GTX_CMD); |
| 5965 | break; |
| 5966 | } |
| 5967 | |
| 5968 | case WE_SET_GTX_THRE: |
| 5969 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5970 | hdd_notice("WMI_VDEV_PARAM_GTX_THRE %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5971 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5972 | WMI_VDEV_PARAM_GTX_THRE, |
| 5973 | set_value, GTX_CMD); |
| 5974 | break; |
| 5975 | } |
| 5976 | |
| 5977 | case WE_SET_GTX_MARGIN: |
| 5978 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5979 | hdd_notice("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5980 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5981 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 5982 | set_value, GTX_CMD); |
| 5983 | break; |
| 5984 | } |
| 5985 | |
| 5986 | case WE_SET_GTX_STEP: |
| 5987 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5988 | hdd_notice("WMI_VDEV_PARAM_GTX_STEP %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5989 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5990 | WMI_VDEV_PARAM_GTX_STEP, |
| 5991 | set_value, GTX_CMD); |
| 5992 | break; |
| 5993 | } |
| 5994 | |
| 5995 | case WE_SET_GTX_MINTPC: |
| 5996 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5997 | hdd_notice("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5998 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 5999 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 6000 | set_value, GTX_CMD); |
| 6001 | break; |
| 6002 | } |
| 6003 | |
| 6004 | case WE_SET_GTX_BWMASK: |
| 6005 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6006 | hdd_notice("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6007 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6008 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 6009 | set_value, GTX_CMD); |
| 6010 | break; |
| 6011 | } |
| 6012 | |
| 6013 | case WE_SET_LDPC: |
| 6014 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6015 | ret = hdd_set_ldpc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6016 | break; |
| 6017 | } |
| 6018 | |
| 6019 | case WE_SET_TX_STBC: |
| 6020 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6021 | ret = hdd_set_tx_stbc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | break; |
| 6023 | } |
| 6024 | |
| 6025 | case WE_SET_RX_STBC: |
| 6026 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 6027 | ret = hdd_set_rx_stbc(pAdapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6028 | break; |
| 6029 | } |
| 6030 | |
| 6031 | case WE_SET_SHORT_GI: |
| 6032 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6033 | hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6034 | ret = sme_update_ht_config(hHal, pAdapter->sessionId, |
| 6035 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ, |
| 6036 | set_value); |
| 6037 | if (ret) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6038 | hdd_err("Failed to set ShortGI value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6039 | break; |
| 6040 | } |
| 6041 | |
| 6042 | case WE_SET_RTSCTS: |
| 6043 | { |
| 6044 | uint32_t value; |
| 6045 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6046 | hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6047 | set_value); |
| 6048 | |
| 6049 | if ((set_value & HDD_RTSCTS_EN_MASK) == |
| 6050 | HDD_RTSCTS_ENABLE) |
| 6051 | value = |
| 6052 | (WLAN_HDD_GET_CTX(pAdapter))->config-> |
| 6053 | RTSThreshold; |
| 6054 | else if (((set_value & HDD_RTSCTS_EN_MASK) == 0) |
| 6055 | || ((set_value & HDD_RTSCTS_EN_MASK) == |
| 6056 | HDD_CTS_ENABLE)) |
| 6057 | value = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 6058 | else |
| 6059 | return -EIO; |
| 6060 | |
| 6061 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6062 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 6063 | set_value, VDEV_CMD); |
| 6064 | if (!ret) { |
| 6065 | if (sme_cfg_set_int |
| 6066 | (hHal, WNI_CFG_RTS_THRESHOLD, value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6067 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6068 | hdd_err("FAILED TO SET RTSCTS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6069 | return -EIO; |
| 6070 | } |
| 6071 | } |
| 6072 | |
| 6073 | break; |
| 6074 | } |
| 6075 | |
| 6076 | case WE_SET_CHWIDTH: |
| 6077 | { |
| 6078 | bool chwidth = false; |
| 6079 | hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6080 | /*updating channel bonding only on 5Ghz */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6081 | hdd_notice("WMI_VDEV_PARAM_CHWIDTH val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6082 | set_value); |
| 6083 | if (set_value > eHT_CHANNEL_WIDTH_80MHZ) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6084 | hdd_err("Invalid channel width 0->20 1->40 2->80"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6085 | return -EINVAL; |
| 6086 | } |
| 6087 | |
| 6088 | if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 6089 | csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config-> |
| 6090 | nChannelBondingMode5GHz))) |
| 6091 | chwidth = true; |
| 6092 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6093 | sme_get_config_param(hHal, &smeConfig); |
| 6094 | switch (set_value) { |
| 6095 | case eHT_CHANNEL_WIDTH_20MHZ: |
| 6096 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 6097 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6098 | break; |
| 6099 | case eHT_CHANNEL_WIDTH_40MHZ: |
| 6100 | if (chwidth) |
| 6101 | smeConfig.csrConfig. |
| 6102 | channelBondingMode5GHz = |
| 6103 | phddctx->config-> |
| 6104 | nChannelBondingMode5GHz; |
| 6105 | else |
| 6106 | return -EINVAL; |
| 6107 | |
| 6108 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6109 | case eHT_CHANNEL_WIDTH_80MHZ: |
| 6110 | if (chwidth) |
| 6111 | smeConfig.csrConfig. |
| 6112 | channelBondingMode5GHz = |
| 6113 | phddctx->config-> |
| 6114 | nChannelBondingMode5GHz; |
| 6115 | else |
| 6116 | return -EINVAL; |
| 6117 | |
| 6118 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6119 | |
| 6120 | default: |
| 6121 | return -EINVAL; |
| 6122 | } |
| 6123 | |
| 6124 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6125 | WMI_VDEV_PARAM_CHWIDTH, |
| 6126 | set_value, VDEV_CMD); |
| 6127 | if (!ret) |
| 6128 | sme_update_config(hHal, &smeConfig); |
| 6129 | |
| 6130 | break; |
| 6131 | } |
| 6132 | |
| 6133 | case WE_SET_ANI_EN_DIS: |
| 6134 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6135 | hdd_notice("WMI_PDEV_PARAM_ANI_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6136 | set_value); |
| 6137 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6138 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 6139 | set_value, PDEV_CMD); |
| 6140 | break; |
| 6141 | } |
| 6142 | |
| 6143 | case WE_SET_ANI_POLL_PERIOD: |
| 6144 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6145 | hdd_notice("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6146 | set_value); |
| 6147 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6148 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 6149 | set_value, PDEV_CMD); |
| 6150 | break; |
| 6151 | } |
| 6152 | |
| 6153 | case WE_SET_ANI_LISTEN_PERIOD: |
| 6154 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6155 | hdd_notice("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6156 | set_value); |
| 6157 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6158 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 6159 | set_value, PDEV_CMD); |
| 6160 | break; |
| 6161 | } |
| 6162 | |
| 6163 | case WE_SET_ANI_OFDM_LEVEL: |
| 6164 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6165 | hdd_notice("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6166 | set_value); |
| 6167 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6168 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 6169 | set_value, PDEV_CMD); |
| 6170 | break; |
| 6171 | } |
| 6172 | |
| 6173 | case WE_SET_ANI_CCK_LEVEL: |
| 6174 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6175 | hdd_notice("WMI_PDEV_PARAM_ANI_CCK_LEVEL 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_PDEV_PARAM_ANI_CCK_LEVEL, |
| 6179 | set_value, PDEV_CMD); |
| 6180 | break; |
| 6181 | } |
| 6182 | |
| 6183 | case WE_SET_DYNAMIC_BW: |
| 6184 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6185 | hdd_notice("WMI_PDEV_PARAM_DYNAMIC_BW val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6186 | set_value); |
| 6187 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6188 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 6189 | set_value, PDEV_CMD); |
| 6190 | break; |
| 6191 | } |
| 6192 | |
| 6193 | case WE_SET_CTS_CBW: |
| 6194 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6195 | hdd_notice("WE_SET_CTS_CBW val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6196 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6197 | WMI_PDEV_PARAM_CTS_CBW, |
| 6198 | set_value, PDEV_CMD); |
| 6199 | break; |
| 6200 | } |
| 6201 | |
| 6202 | case WE_SET_11N_RATE: |
| 6203 | { |
| 6204 | uint8_t preamble = 0, nss = 0, rix = 0; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6205 | hdd_notice("WMI_VDEV_PARAM_FIXED_RATE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6206 | set_value); |
| 6207 | |
| 6208 | if (set_value != 0xff) { |
| 6209 | rix = RC_2_RATE_IDX(set_value); |
| 6210 | if (set_value & 0x80) { |
| 6211 | preamble = WMI_RATE_PREAMBLE_HT; |
| 6212 | nss = HT_RC_2_STREAMS(set_value) - 1; |
| 6213 | } else { |
| 6214 | nss = 0; |
| 6215 | rix = RC_2_RATE_IDX(set_value); |
| 6216 | if (set_value & 0x10) { |
| 6217 | preamble = |
| 6218 | WMI_RATE_PREAMBLE_CCK; |
| 6219 | if (rix != 0x3) |
| 6220 | /* Enable Short |
| 6221 | * preamble always for |
| 6222 | * CCK except 1mbps |
| 6223 | */ |
| 6224 | rix |= 0x4; |
| 6225 | } else { |
| 6226 | preamble = |
| 6227 | WMI_RATE_PREAMBLE_OFDM; |
| 6228 | } |
| 6229 | } |
| 6230 | set_value = (preamble << 6) | (nss << 4) | rix; |
| 6231 | } |
| 6232 | hdd_info("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
| 6233 | set_value, rix, preamble, nss); |
| 6234 | |
| 6235 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6236 | WMI_VDEV_PARAM_FIXED_RATE, |
| 6237 | set_value, VDEV_CMD); |
| 6238 | break; |
| 6239 | } |
| 6240 | |
| 6241 | case WE_SET_VHT_RATE: |
| 6242 | { |
| 6243 | uint8_t preamble = 0, nss = 0, rix = 0; |
| 6244 | |
| 6245 | if (set_value != 0xff) { |
| 6246 | rix = RC_2_RATE_IDX_11AC(set_value); |
| 6247 | preamble = WMI_RATE_PREAMBLE_VHT; |
| 6248 | nss = HT_RC_2_STREAMS_11AC(set_value) - 1; |
| 6249 | |
| 6250 | set_value = (preamble << 6) | (nss << 4) | rix; |
| 6251 | } |
| 6252 | hdd_info("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
| 6253 | set_value, rix, preamble, nss); |
| 6254 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6255 | WMI_VDEV_PARAM_FIXED_RATE, |
| 6256 | set_value, VDEV_CMD); |
| 6257 | break; |
| 6258 | } |
| 6259 | |
| 6260 | case WE_SET_AMPDU: |
| 6261 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6262 | hdd_notice("SET AMPDU val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6263 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6264 | GEN_VDEV_PARAM_AMPDU, |
| 6265 | set_value, GEN_CMD); |
| 6266 | break; |
| 6267 | } |
| 6268 | |
| 6269 | case WE_SET_AMSDU: |
| 6270 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6271 | hdd_notice("SET AMSDU val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6272 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6273 | GEN_VDEV_PARAM_AMSDU, |
| 6274 | set_value, GEN_CMD); |
| 6275 | break; |
| 6276 | } |
| 6277 | |
| 6278 | case WE_SET_BURST_ENABLE: |
| 6279 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6280 | hdd_notice("SET Burst enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6281 | if ((set_value == 0) || (set_value == 1)) { |
| 6282 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6283 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 6284 | set_value, PDEV_CMD); |
| 6285 | } else |
| 6286 | ret = -EINVAL; |
| 6287 | break; |
| 6288 | } |
| 6289 | case WE_SET_BURST_DUR: |
| 6290 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6291 | hdd_notice("SET Burst duration val %d", set_value); |
Jeff Johnson | da5ee77 | 2016-08-04 17:18:47 -0700 | [diff] [blame] | 6292 | if ((set_value > 0) && (set_value <= 102400)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6293 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6294 | WMI_PDEV_PARAM_BURST_DUR, |
| 6295 | set_value, PDEV_CMD); |
| 6296 | else |
| 6297 | ret = -EINVAL; |
| 6298 | break; |
| 6299 | } |
| 6300 | |
| 6301 | case WE_SET_TX_CHAINMASK: |
| 6302 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6303 | hdd_notice("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6304 | set_value); |
| 6305 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6306 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 6307 | set_value, PDEV_CMD); |
| 6308 | break; |
| 6309 | } |
| 6310 | |
| 6311 | case WE_SET_RX_CHAINMASK: |
| 6312 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6313 | hdd_notice("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6314 | set_value); |
| 6315 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6316 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 6317 | set_value, PDEV_CMD); |
| 6318 | break; |
| 6319 | } |
| 6320 | |
| 6321 | case WE_SET_TXPOW_2G: |
| 6322 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6323 | hdd_notice("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6324 | set_value); |
| 6325 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6326 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 6327 | set_value, PDEV_CMD); |
| 6328 | break; |
| 6329 | } |
| 6330 | |
| 6331 | case WE_SET_TXPOW_5G: |
| 6332 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6333 | hdd_notice("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6334 | set_value); |
| 6335 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6336 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 6337 | set_value, PDEV_CMD); |
| 6338 | break; |
| 6339 | } |
| 6340 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6341 | /* Firmware debug log */ |
| 6342 | case WE_DBGLOG_LOG_LEVEL: |
| 6343 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6344 | hdd_notice("WE_DBGLOG_LOG_LEVEL val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6345 | hdd_ctx->fw_log_settings.dl_loglevel = set_value; |
| 6346 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6347 | WMI_DBGLOG_LOG_LEVEL, |
| 6348 | set_value, DBG_CMD); |
| 6349 | break; |
| 6350 | } |
| 6351 | |
| 6352 | case WE_DBGLOG_VAP_ENABLE: |
| 6353 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6354 | hdd_notice("WE_DBGLOG_VAP_ENABLE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6355 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6356 | WMI_DBGLOG_VAP_ENABLE, |
| 6357 | set_value, DBG_CMD); |
| 6358 | break; |
| 6359 | } |
| 6360 | |
| 6361 | case WE_DBGLOG_VAP_DISABLE: |
| 6362 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6363 | hdd_notice("WE_DBGLOG_VAP_DISABLE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6364 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6365 | WMI_DBGLOG_VAP_DISABLE, |
| 6366 | set_value, DBG_CMD); |
| 6367 | break; |
| 6368 | } |
| 6369 | |
| 6370 | case WE_DBGLOG_MODULE_ENABLE: |
| 6371 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6372 | hdd_notice("WE_DBGLOG_MODULE_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6373 | set_value); |
| 6374 | hdd_ctx->fw_log_settings.enable = set_value; |
| 6375 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6376 | WMI_DBGLOG_MODULE_ENABLE, |
| 6377 | set_value, DBG_CMD); |
| 6378 | break; |
| 6379 | } |
| 6380 | |
| 6381 | case WE_DBGLOG_MODULE_DISABLE: |
| 6382 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6383 | hdd_notice("WE_DBGLOG_MODULE_DISABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6384 | set_value); |
| 6385 | hdd_ctx->fw_log_settings.enable = set_value; |
| 6386 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6387 | WMI_DBGLOG_MODULE_DISABLE, |
| 6388 | set_value, DBG_CMD); |
| 6389 | break; |
| 6390 | } |
| 6391 | case WE_DBGLOG_MOD_LOG_LEVEL: |
| 6392 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6393 | hdd_notice("WE_DBGLOG_MOD_LOG_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6394 | set_value); |
| 6395 | |
| 6396 | if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL) |
| 6397 | hdd_ctx->fw_log_settings.index = 0; |
| 6398 | |
| 6399 | hdd_ctx->fw_log_settings. |
| 6400 | dl_mod_loglevel[hdd_ctx->fw_log_settings.index] = |
| 6401 | set_value; |
| 6402 | hdd_ctx->fw_log_settings.index++; |
| 6403 | |
| 6404 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6405 | WMI_DBGLOG_MOD_LOG_LEVEL, |
| 6406 | set_value, DBG_CMD); |
| 6407 | break; |
| 6408 | } |
| 6409 | |
| 6410 | case WE_DBGLOG_TYPE: |
| 6411 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6412 | hdd_notice("WE_DBGLOG_TYPE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6413 | hdd_ctx->fw_log_settings.dl_type = set_value; |
| 6414 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6415 | WMI_DBGLOG_TYPE, |
| 6416 | set_value, DBG_CMD); |
| 6417 | break; |
| 6418 | } |
| 6419 | case WE_DBGLOG_REPORT_ENABLE: |
| 6420 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6421 | hdd_notice("WE_DBGLOG_REPORT_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6422 | set_value); |
| 6423 | hdd_ctx->fw_log_settings.dl_report = set_value; |
| 6424 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6425 | WMI_DBGLOG_REPORT_ENABLE, |
| 6426 | set_value, DBG_CMD); |
| 6427 | break; |
| 6428 | } |
| 6429 | |
| 6430 | case WE_SET_TXRX_FWSTATS: |
| 6431 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6432 | hdd_notice("WE_SET_TXRX_FWSTATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6433 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6434 | WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID, |
| 6435 | set_value, VDEV_CMD); |
| 6436 | break; |
| 6437 | } |
| 6438 | |
| 6439 | case WE_TXRX_FWSTATS_RESET: |
| 6440 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6441 | hdd_notice("WE_TXRX_FWSTATS_RESET val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6442 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6443 | WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, |
| 6444 | set_value, VDEV_CMD); |
| 6445 | break; |
| 6446 | } |
| 6447 | |
| 6448 | case WE_DUMP_STATS: |
| 6449 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6450 | hdd_notice("WE_DUMP_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6451 | hdd_wlan_dump_stats(pAdapter, set_value); |
| 6452 | break; |
| 6453 | } |
| 6454 | |
| 6455 | case WE_CLEAR_STATS: |
| 6456 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6457 | hdd_notice("WE_CLEAR_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6458 | switch (set_value) { |
| 6459 | case WLAN_HDD_STATS: |
| 6460 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 6461 | memset(&pAdapter->hdd_stats, 0, |
| 6462 | sizeof(pAdapter->hdd_stats)); |
| 6463 | break; |
| 6464 | case WLAN_TXRX_HIST_STATS: |
| 6465 | wlan_hdd_clear_tx_rx_histogram(hdd_ctx); |
| 6466 | break; |
| 6467 | case WLAN_HDD_NETIF_OPER_HISTORY: |
| 6468 | wlan_hdd_clear_netif_queue_history(hdd_ctx); |
| 6469 | break; |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 6470 | case WLAN_HIF_STATS: |
| 6471 | hdd_clear_hif_stats(); |
| 6472 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6473 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 6474 | cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 6475 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6476 | } |
| 6477 | break; |
| 6478 | } |
| 6479 | |
| 6480 | case WE_PPS_PAID_MATCH: |
| 6481 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6482 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6483 | return EINVAL; |
| 6484 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6485 | hdd_notice("WMI_VDEV_PPS_PAID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6486 | set_value); |
| 6487 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6488 | WMI_VDEV_PPS_PAID_MATCH, |
| 6489 | set_value, PPS_CMD); |
| 6490 | break; |
| 6491 | } |
| 6492 | |
| 6493 | case WE_PPS_GID_MATCH: |
| 6494 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6495 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6496 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6497 | hdd_notice("WMI_VDEV_PPS_GID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6498 | set_value); |
| 6499 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6500 | WMI_VDEV_PPS_GID_MATCH, |
| 6501 | set_value, PPS_CMD); |
| 6502 | break; |
| 6503 | } |
| 6504 | |
| 6505 | case WE_PPS_EARLY_TIM_CLEAR: |
| 6506 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6507 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6508 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6509 | hdd_notice(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6510 | set_value); |
| 6511 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6512 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 6513 | set_value, PPS_CMD); |
| 6514 | break; |
| 6515 | } |
| 6516 | |
| 6517 | case WE_PPS_EARLY_DTIM_CLEAR: |
| 6518 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6519 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6520 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6521 | hdd_notice("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6522 | set_value); |
| 6523 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6524 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 6525 | set_value, PPS_CMD); |
| 6526 | break; |
| 6527 | } |
| 6528 | |
| 6529 | case WE_PPS_EOF_PAD_DELIM: |
| 6530 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6531 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6532 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6533 | hdd_notice("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6534 | set_value); |
| 6535 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6536 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 6537 | set_value, PPS_CMD); |
| 6538 | break; |
| 6539 | } |
| 6540 | |
| 6541 | case WE_PPS_MACADDR_MISMATCH: |
| 6542 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6543 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6544 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6545 | hdd_notice("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6546 | set_value); |
| 6547 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6548 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 6549 | set_value, PPS_CMD); |
| 6550 | break; |
| 6551 | } |
| 6552 | |
| 6553 | case WE_PPS_DELIM_CRC_FAIL: |
| 6554 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6555 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6556 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6557 | hdd_notice("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6558 | set_value); |
| 6559 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6560 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 6561 | set_value, PPS_CMD); |
| 6562 | break; |
| 6563 | } |
| 6564 | |
| 6565 | case WE_PPS_GID_NSTS_ZERO: |
| 6566 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6567 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6568 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6569 | hdd_notice("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6570 | set_value); |
| 6571 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6572 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 6573 | set_value, PPS_CMD); |
| 6574 | break; |
| 6575 | } |
| 6576 | |
| 6577 | case WE_PPS_RSSI_CHECK: |
| 6578 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6579 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6580 | return EINVAL; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6581 | hdd_notice("WMI_VDEV_PPS_RSSI_CHECK val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6582 | set_value); |
| 6583 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6584 | WMI_VDEV_PPS_RSSI_CHECK, |
| 6585 | set_value, PPS_CMD); |
| 6586 | break; |
| 6587 | } |
| 6588 | |
| 6589 | case WE_PPS_5G_EBT: |
| 6590 | { |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6591 | if (pAdapter->device_mode != QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6592 | return -EINVAL; |
| 6593 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6594 | hdd_notice("WMI_VDEV_PPS_5G_EBT val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6595 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6596 | WMI_VDEV_PPS_5G_EBT, |
| 6597 | set_value, PPS_CMD); |
| 6598 | break; |
| 6599 | } |
| 6600 | |
| 6601 | case WE_SET_HTSMPS: |
| 6602 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6603 | hdd_notice("WE_SET_HTSMPS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6604 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6605 | WMI_STA_SMPS_FORCE_MODE_CMDID, |
| 6606 | set_value, VDEV_CMD); |
| 6607 | break; |
| 6608 | } |
| 6609 | |
| 6610 | case WE_SET_QPOWER_MAX_PSPOLL_COUNT: |
| 6611 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6612 | hdd_notice("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6613 | set_value); |
| 6614 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6615 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 6616 | set_value, QPOWER_CMD); |
| 6617 | break; |
| 6618 | } |
| 6619 | |
| 6620 | case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 6621 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6622 | hdd_notice("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6623 | set_value); |
| 6624 | ret = wma_cli_set_command( |
| 6625 | pAdapter->sessionId, |
| 6626 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 6627 | set_value, QPOWER_CMD); |
| 6628 | break; |
| 6629 | } |
| 6630 | |
| 6631 | case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 6632 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6633 | hdd_notice("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6634 | set_value); |
| 6635 | ret = wma_cli_set_command( |
| 6636 | pAdapter->sessionId, |
| 6637 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 6638 | set_value, QPOWER_CMD); |
| 6639 | break; |
| 6640 | } |
| 6641 | |
| 6642 | case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 6643 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6644 | hdd_notice("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6645 | set_value); |
| 6646 | ret = wma_cli_set_command( |
| 6647 | pAdapter->sessionId, |
| 6648 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 6649 | set_value, QPOWER_CMD); |
| 6650 | break; |
| 6651 | } |
| 6652 | |
| 6653 | case WE_MCC_CONFIG_LATENCY: |
| 6654 | { |
| 6655 | cds_set_mcc_latency(pAdapter, set_value); |
| 6656 | break; |
| 6657 | } |
| 6658 | |
| 6659 | case WE_MCC_CONFIG_QUOTA: |
| 6660 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6661 | hdd_notice("iwpriv cmd to set MCC quota with val %dms", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6662 | set_value); |
| 6663 | ret = cds_set_mcc_p2p_quota(pAdapter, set_value); |
| 6664 | break; |
| 6665 | } |
| 6666 | case WE_SET_DEBUG_LOG: |
| 6667 | { |
| 6668 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 6669 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6670 | hdd_ctx->config->gEnableDebugLog = set_value; |
| 6671 | sme_update_connect_debug(hdd_ctx->hHal, set_value); |
| 6672 | break; |
| 6673 | } |
| 6674 | case WE_SET_EARLY_RX_ADJUST_ENABLE: |
| 6675 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6676 | hdd_notice("SET early_rx enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6677 | if ((set_value == 0) || (set_value == 1)) |
| 6678 | ret = wma_cli_set_command( |
| 6679 | pAdapter->sessionId, |
| 6680 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, |
| 6681 | set_value, VDEV_CMD); |
| 6682 | else |
| 6683 | ret = -EINVAL; |
| 6684 | break; |
| 6685 | } |
| 6686 | case WE_SET_EARLY_RX_TGT_BMISS_NUM: |
| 6687 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6688 | hdd_notice("SET early_rx bmiss val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6689 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6690 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, |
| 6691 | set_value, VDEV_CMD); |
| 6692 | break; |
| 6693 | } |
| 6694 | case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 6695 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6696 | hdd_notice("SET early_rx bmiss sample cycle %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6697 | set_value); |
| 6698 | ret = wma_cli_set_command( |
| 6699 | pAdapter->sessionId, |
| 6700 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 6701 | set_value, VDEV_CMD); |
| 6702 | break; |
| 6703 | } |
| 6704 | case WE_SET_EARLY_RX_SLOP_STEP: |
| 6705 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6706 | hdd_notice("SET early_rx bmiss slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6707 | set_value); |
| 6708 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6709 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP, |
| 6710 | set_value, VDEV_CMD); |
| 6711 | break; |
| 6712 | } |
| 6713 | case WE_SET_EARLY_RX_INIT_SLOP: |
| 6714 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6715 | hdd_notice("SET early_rx init slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6716 | set_value); |
| 6717 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6718 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP, |
| 6719 | set_value, VDEV_CMD); |
| 6720 | break; |
| 6721 | } |
| 6722 | case WE_SET_EARLY_RX_ADJUST_PAUSE: |
| 6723 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6724 | hdd_notice("SET early_rx adjust pause %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6725 | if ((set_value == 0) || (set_value == 1)) |
| 6726 | ret = wma_cli_set_command( |
| 6727 | pAdapter->sessionId, |
| 6728 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, |
| 6729 | set_value, VDEV_CMD); |
| 6730 | else |
| 6731 | ret = -EINVAL; |
| 6732 | break; |
| 6733 | } |
| 6734 | case WE_SET_EARLY_RX_DRIFT_SAMPLE: |
| 6735 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6736 | hdd_notice("SET early_rx drift sample %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6737 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6738 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE, |
| 6739 | set_value, VDEV_CMD); |
| 6740 | break; |
| 6741 | } |
| 6742 | case WE_SET_SCAN_DISABLE: |
| 6743 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6744 | hdd_notice("SET SCAN DISABLE %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6745 | sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(pAdapter), set_value); |
| 6746 | break; |
| 6747 | } |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 6748 | case WE_START_FW_PROFILE: |
| 6749 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6750 | hdd_notice("WE_START_FW_PROFILE %d", set_value); |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 6751 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 6752 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 6753 | set_value, DBG_CMD); |
| 6754 | break; |
| 6755 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6756 | case WE_SET_CHANNEL: |
| 6757 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6758 | hdd_notice("Set Channel %d Session ID %d mode %d", set_value, |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6759 | pAdapter->sessionId, pAdapter->device_mode); |
| 6760 | |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 6761 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 6762 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6763 | |
| 6764 | status = sme_ext_change_channel(hHal, |
| 6765 | set_value, pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6766 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6767 | hdd_err("Error in change channel status %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6768 | status); |
| 6769 | ret = -EINVAL; |
| 6770 | } |
| 6771 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6772 | hdd_err("change channel not supported for device mode %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6773 | pAdapter->device_mode); |
| 6774 | ret = -EINVAL; |
| 6775 | } |
| 6776 | break; |
| 6777 | } |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 6778 | case WE_SET_CONC_SYSTEM_PREF: |
| 6779 | { |
| 6780 | hdd_info("New preference: %d", set_value); |
| 6781 | if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) && |
| 6782 | (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) { |
| 6783 | hdd_err("Invalid system preference %d", set_value); |
| 6784 | return -EINVAL; |
| 6785 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 6786 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 6787 | /* hdd_ctx, hdd_ctx->config are already checked for null */ |
| 6788 | hdd_ctx->config->conc_system_pref = set_value; |
| 6789 | break; |
| 6790 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6791 | default: |
| 6792 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6793 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6794 | sub_cmd); |
| 6795 | ret = -EINVAL; |
| 6796 | break; |
| 6797 | } |
| 6798 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6799 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6800 | return ret; |
| 6801 | } |
| 6802 | |
| 6803 | static int iw_setint_getnone(struct net_device *dev, |
| 6804 | struct iw_request_info *info, |
| 6805 | union iwreq_data *wrqu, |
| 6806 | char *extra) |
| 6807 | { |
| 6808 | int ret; |
| 6809 | |
| 6810 | cds_ssr_protect(__func__); |
| 6811 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 6812 | cds_ssr_unprotect(__func__); |
| 6813 | |
| 6814 | return ret; |
| 6815 | } |
| 6816 | |
| 6817 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 6818 | * __iw_setnone_get_threeint() - return three value to up layer. |
| 6819 | * |
| 6820 | * @dev: pointer of net_device of this wireless card |
| 6821 | * @info: meta data about Request sent |
| 6822 | * @wrqu: include request info |
| 6823 | * @extra: buf used for in/Output |
| 6824 | * |
| 6825 | * Return: execute result |
| 6826 | */ |
| 6827 | static int __iw_setnone_get_threeint(struct net_device *dev, |
| 6828 | struct iw_request_info *info, |
| 6829 | union iwreq_data *wrqu, char *extra) |
| 6830 | { |
| 6831 | int ret = 0; /* success */ |
| 6832 | uint32_t *value = (int *)extra; |
| 6833 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6834 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6835 | |
| 6836 | ENTER_DEV(dev); |
| 6837 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6838 | if (0 != ret) |
| 6839 | return ret; |
| 6840 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6841 | hdd_info("param = %d", value[0]); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 6842 | switch (value[0]) { |
| 6843 | case WE_GET_TSF: |
| 6844 | ret = hdd_indicate_tsf(adapter, value, 3); |
| 6845 | break; |
| 6846 | default: |
| 6847 | hdd_err("Invalid IOCTL get_value command %d", value[0]); |
| 6848 | break; |
| 6849 | } |
| 6850 | return ret; |
| 6851 | } |
| 6852 | |
| 6853 | /** |
| 6854 | * iw_setnone_get_threeint() - return three value to up layer. |
| 6855 | * |
| 6856 | * @dev: pointer of net_device of this wireless card |
| 6857 | * @info: meta data about Request sent |
| 6858 | * @wrqu: include request info |
| 6859 | * @extra: buf used for in/Output |
| 6860 | * |
| 6861 | * Return: execute result |
| 6862 | */ |
| 6863 | static int iw_setnone_get_threeint(struct net_device *dev, |
| 6864 | struct iw_request_info *info, |
| 6865 | union iwreq_data *wrqu, char *extra) |
| 6866 | { |
| 6867 | int ret; |
| 6868 | |
| 6869 | cds_ssr_protect(__func__); |
| 6870 | ret = __iw_setnone_get_threeint(dev, info, wrqu, extra); |
| 6871 | cds_ssr_unprotect(__func__); |
| 6872 | |
| 6873 | return ret; |
| 6874 | } |
| 6875 | |
| 6876 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6877 | * iw_setchar_getnone() - Generic "set string" private ioctl handler |
| 6878 | * @dev: device upon which the ioctl was received |
| 6879 | * @info: ioctl request information |
| 6880 | * @wrqu: ioctl request data |
| 6881 | * @extra: ioctl extra data |
| 6882 | * |
| 6883 | * Return: 0 on success, non-zero on error |
| 6884 | */ |
| 6885 | static int __iw_setchar_getnone(struct net_device *dev, |
| 6886 | struct iw_request_info *info, |
| 6887 | union iwreq_data *wrqu, char *extra) |
| 6888 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6889 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6890 | int sub_cmd; |
| 6891 | int ret; |
| 6892 | char *pBuffer = NULL; |
| 6893 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 6894 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6895 | struct hdd_config *pConfig = hdd_ctx->config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6896 | struct iw_point s_priv_data; |
| 6897 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 6898 | ENTER_DEV(dev); |
| 6899 | |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 6900 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6901 | hdd_err("permission check failed"); |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 6902 | return -EPERM; |
| 6903 | } |
| 6904 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6905 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6906 | if (0 != ret) |
| 6907 | return ret; |
| 6908 | |
| 6909 | /* helper function to get iwreq_data with compat handling. */ |
| 6910 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 6911 | return -EINVAL; |
| 6912 | } |
| 6913 | |
| 6914 | /* make sure all params are correctly passed to function */ |
| 6915 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) { |
| 6916 | return -EINVAL; |
| 6917 | } |
| 6918 | |
| 6919 | sub_cmd = s_priv_data.flags; |
| 6920 | |
| 6921 | /* ODD number is used for set, copy data using copy_from_user */ |
| 6922 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 6923 | s_priv_data.length); |
| 6924 | if (NULL == pBuffer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6925 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6926 | return -ENOMEM; |
| 6927 | } |
| 6928 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6929 | hdd_notice("Received length %d", s_priv_data.length); |
| 6930 | hdd_notice("Received data %s", pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6931 | |
| 6932 | switch (sub_cmd) { |
| 6933 | case WE_WOWL_ADD_PTRN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6934 | hdd_notice("ADD_PTRN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6935 | hdd_add_wowl_ptrn(pAdapter, pBuffer); |
| 6936 | break; |
| 6937 | case WE_WOWL_DEL_PTRN: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6938 | hdd_notice("DEL_PTRN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6939 | hdd_del_wowl_ptrn(pAdapter, pBuffer); |
| 6940 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6941 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 6942 | { |
| 6943 | tRrmNeighborReq neighborReq; |
| 6944 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 6945 | |
| 6946 | if (pConfig->fRrmEnable) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6947 | hdd_notice("Neighbor Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6948 | neighborReq.no_ssid = |
| 6949 | (s_priv_data.length - 1) ? false : true; |
| 6950 | if (!neighborReq.no_ssid) { |
| 6951 | neighborReq.ssid.length = |
| 6952 | (s_priv_data.length - 1) > |
| 6953 | 32 ? 32 : (s_priv_data.length - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6954 | qdf_mem_copy(neighborReq.ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6955 | pBuffer, |
| 6956 | neighborReq.ssid.length); |
| 6957 | } |
| 6958 | |
| 6959 | callbackInfo.neighborRspCallback = NULL; |
| 6960 | callbackInfo.neighborRspCallbackContext = NULL; |
| 6961 | callbackInfo.timeout = 5000; /* 5 seconds */ |
| 6962 | sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX |
| 6963 | (pAdapter), |
| 6964 | pAdapter->sessionId, |
| 6965 | &neighborReq, |
| 6966 | &callbackInfo); |
| 6967 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6968 | hdd_err("Ignoring neighbor request as RRM is not enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6969 | ret = -EINVAL; |
| 6970 | } |
| 6971 | } |
| 6972 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6973 | case WE_SET_AP_WPS_IE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6974 | hdd_err("Received WE_SET_AP_WPS_IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6975 | sme_update_p2p_ie(WLAN_HDD_GET_HAL_CTX(pAdapter), pBuffer, |
| 6976 | s_priv_data.length); |
| 6977 | break; |
| 6978 | case WE_SET_CONFIG: |
| 6979 | vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6980 | if (QDF_STATUS_SUCCESS != vstatus) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6981 | ret = -EINVAL; |
| 6982 | } |
| 6983 | break; |
| 6984 | default: |
| 6985 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6986 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6987 | sub_cmd); |
| 6988 | ret = -EINVAL; |
| 6989 | break; |
| 6990 | } |
| 6991 | } |
| 6992 | kfree(pBuffer); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6993 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6994 | return ret; |
| 6995 | } |
| 6996 | |
| 6997 | static int iw_setchar_getnone(struct net_device *dev, |
| 6998 | struct iw_request_info *info, |
| 6999 | union iwreq_data *wrqu, char *extra) |
| 7000 | { |
| 7001 | int ret; |
| 7002 | |
| 7003 | cds_ssr_protect(__func__); |
| 7004 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 7005 | cds_ssr_unprotect(__func__); |
| 7006 | |
| 7007 | return ret; |
| 7008 | } |
| 7009 | |
| 7010 | /** |
| 7011 | * iw_setnone_getint() - Generic "get integer" private ioctl handler |
| 7012 | * @dev: device upon which the ioctl was received |
| 7013 | * @info: ioctl request information |
| 7014 | * @wrqu: ioctl request data |
| 7015 | * @extra: ioctl extra data |
| 7016 | * |
| 7017 | * Return: 0 on success, non-zero on error |
| 7018 | */ |
| 7019 | static int __iw_setnone_getint(struct net_device *dev, |
| 7020 | struct iw_request_info *info, |
| 7021 | union iwreq_data *wrqu, char *extra) |
| 7022 | { |
| 7023 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7024 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7025 | int *value = (int *)extra; |
| 7026 | int ret; |
| 7027 | tSmeConfigParams smeConfig; |
| 7028 | hdd_context_t *hdd_ctx; |
| 7029 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7030 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7031 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7032 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7033 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7034 | if (0 != ret) |
| 7035 | return ret; |
| 7036 | |
| 7037 | switch (value[0]) { |
| 7038 | case WE_GET_11D_STATE: |
| 7039 | { |
| 7040 | sme_get_config_param(hHal, &smeConfig); |
| 7041 | |
| 7042 | *value = smeConfig.csrConfig.Is11dSupportEnabled; |
| 7043 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7044 | hdd_notice("11D state=%d!!", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7045 | |
| 7046 | break; |
| 7047 | } |
| 7048 | |
| 7049 | case WE_IBSS_STATUS: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7050 | hdd_notice("****Return IBSS Status*****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7051 | break; |
| 7052 | |
| 7053 | case WE_GET_WLAN_DBG: |
| 7054 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7055 | qdf_trace_display(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7056 | *value = 0; |
| 7057 | break; |
| 7058 | } |
| 7059 | case WE_GET_MAX_ASSOC: |
| 7060 | { |
| 7061 | if (sme_cfg_get_int |
| 7062 | (hHal, WNI_CFG_ASSOC_STA_LIMIT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7063 | (uint32_t *) value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7064 | hdd_warn("failed to get ini parameter, WNI_CFG_ASSOC_STA_LIMIT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7065 | ret = -EIO; |
| 7066 | } |
| 7067 | break; |
| 7068 | } |
| 7069 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 7070 | *value = (WLAN_HDD_GET_CTX( |
| 7071 | pAdapter))->config->force_sap_acs; |
| 7072 | break; |
| 7073 | |
| 7074 | case WE_GET_CONCURRENCY_MODE: |
| 7075 | { |
| 7076 | *value = cds_get_concurrency_mode(); |
| 7077 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7078 | hdd_notice("concurrency mode=%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7079 | break; |
| 7080 | } |
| 7081 | |
| 7082 | case WE_GET_NSS: |
| 7083 | { |
| 7084 | sme_get_config_param(hHal, &smeConfig); |
| 7085 | *value = (smeConfig.csrConfig.enable2x2 == 0) ? 1 : 2; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7086 | hdd_notice("GET_NSS: Current NSS:%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7087 | break; |
| 7088 | } |
| 7089 | |
| 7090 | case WE_GET_GTX_HT_MCS: |
| 7091 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7092 | hdd_notice("GET WMI_VDEV_PARAM_GTX_HT_MCS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7093 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7094 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 7095 | GTX_CMD); |
| 7096 | break; |
| 7097 | } |
| 7098 | |
| 7099 | case WE_GET_GTX_VHT_MCS: |
| 7100 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7101 | hdd_notice("GET WMI_VDEV_PARAM_GTX_VHT_MCS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7102 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7103 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 7104 | GTX_CMD); |
| 7105 | break; |
| 7106 | } |
| 7107 | |
| 7108 | case WE_GET_GTX_USRCFG: |
| 7109 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7110 | hdd_notice("GET WMI_VDEV_PARAM_GTX_USR_CFG"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7111 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7112 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 7113 | GTX_CMD); |
| 7114 | break; |
| 7115 | } |
| 7116 | |
| 7117 | case WE_GET_GTX_THRE: |
| 7118 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7119 | hdd_notice("GET WMI_VDEV_PARAM_GTX_THRE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7120 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7121 | WMI_VDEV_PARAM_GTX_THRE, |
| 7122 | GTX_CMD); |
| 7123 | break; |
| 7124 | } |
| 7125 | |
| 7126 | case WE_GET_GTX_MARGIN: |
| 7127 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7128 | hdd_notice("GET WMI_VDEV_PARAM_GTX_MARGIN"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7129 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7130 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 7131 | GTX_CMD); |
| 7132 | break; |
| 7133 | } |
| 7134 | |
| 7135 | case WE_GET_GTX_STEP: |
| 7136 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7137 | hdd_notice("GET WMI_VDEV_PARAM_GTX_STEP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7138 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7139 | WMI_VDEV_PARAM_GTX_STEP, |
| 7140 | GTX_CMD); |
| 7141 | break; |
| 7142 | } |
| 7143 | |
| 7144 | case WE_GET_GTX_MINTPC: |
| 7145 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7146 | hdd_notice("GET WMI_VDEV_PARAM_GTX_MINTPC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7147 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7148 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 7149 | GTX_CMD); |
| 7150 | break; |
| 7151 | } |
| 7152 | |
| 7153 | case WE_GET_GTX_BWMASK: |
| 7154 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7155 | hdd_notice("GET WMI_VDEV_PARAM_GTX_BW_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7156 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7157 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 7158 | GTX_CMD); |
| 7159 | break; |
| 7160 | } |
| 7161 | |
| 7162 | case WE_GET_LDPC: |
| 7163 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 7164 | ret = hdd_get_ldpc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7165 | break; |
| 7166 | } |
| 7167 | |
| 7168 | case WE_GET_TX_STBC: |
| 7169 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 7170 | ret = hdd_get_tx_stbc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7171 | break; |
| 7172 | } |
| 7173 | |
| 7174 | case WE_GET_RX_STBC: |
| 7175 | { |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 7176 | ret = hdd_get_rx_stbc(pAdapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7177 | break; |
| 7178 | } |
| 7179 | |
| 7180 | case WE_GET_SHORT_GI: |
| 7181 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7182 | hdd_notice("GET WMI_VDEV_PARAM_SGI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7183 | *value = sme_get_ht_config(hHal, pAdapter->sessionId, |
| 7184 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ); |
| 7185 | break; |
| 7186 | } |
| 7187 | |
| 7188 | case WE_GET_RTSCTS: |
| 7189 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7190 | hdd_notice("GET WMI_VDEV_PARAM_ENABLE_RTSCTS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7191 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7192 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 7193 | VDEV_CMD); |
| 7194 | break; |
| 7195 | } |
| 7196 | |
| 7197 | case WE_GET_CHWIDTH: |
| 7198 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7199 | hdd_notice("GET WMI_VDEV_PARAM_CHWIDTH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7200 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7201 | WMI_VDEV_PARAM_CHWIDTH, |
| 7202 | VDEV_CMD); |
| 7203 | break; |
| 7204 | } |
| 7205 | |
| 7206 | case WE_GET_ANI_EN_DIS: |
| 7207 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7208 | hdd_notice("GET WMI_PDEV_PARAM_ANI_ENABLE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7209 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7210 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 7211 | PDEV_CMD); |
| 7212 | break; |
| 7213 | } |
| 7214 | |
| 7215 | case WE_GET_ANI_POLL_PERIOD: |
| 7216 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7217 | hdd_notice("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7218 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7219 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 7220 | PDEV_CMD); |
| 7221 | break; |
| 7222 | } |
| 7223 | |
| 7224 | case WE_GET_ANI_LISTEN_PERIOD: |
| 7225 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7226 | hdd_notice("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7227 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7228 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 7229 | PDEV_CMD); |
| 7230 | break; |
| 7231 | } |
| 7232 | |
| 7233 | case WE_GET_ANI_OFDM_LEVEL: |
| 7234 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7235 | hdd_notice("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7236 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7237 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 7238 | PDEV_CMD); |
| 7239 | break; |
| 7240 | } |
| 7241 | |
| 7242 | case WE_GET_ANI_CCK_LEVEL: |
| 7243 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7244 | hdd_notice("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7245 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7246 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 7247 | PDEV_CMD); |
| 7248 | break; |
| 7249 | } |
| 7250 | |
| 7251 | case WE_GET_DYNAMIC_BW: |
| 7252 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7253 | hdd_notice("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7254 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7255 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 7256 | PDEV_CMD); |
| 7257 | break; |
| 7258 | } |
| 7259 | |
| 7260 | case WE_GET_11N_RATE: |
| 7261 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7262 | hdd_notice("GET WMI_VDEV_PARAM_FIXED_RATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7263 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7264 | WMI_VDEV_PARAM_FIXED_RATE, |
| 7265 | VDEV_CMD); |
| 7266 | break; |
| 7267 | } |
| 7268 | |
| 7269 | case WE_GET_AMPDU: |
| 7270 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7271 | hdd_notice("GET AMPDU"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7272 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7273 | GEN_VDEV_PARAM_AMPDU, |
| 7274 | GEN_CMD); |
| 7275 | break; |
| 7276 | } |
| 7277 | |
| 7278 | case WE_GET_AMSDU: |
| 7279 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7280 | hdd_notice("GET AMSDU"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7281 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7282 | GEN_VDEV_PARAM_AMSDU, |
| 7283 | GEN_CMD); |
| 7284 | break; |
| 7285 | } |
| 7286 | |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 7287 | case WE_GET_ROAM_SYNCH_DELAY: |
| 7288 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7289 | hdd_notice("GET ROAM SYNCH DELAY"); |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 7290 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7291 | GEN_VDEV_ROAM_SYNCH_DELAY, |
| 7292 | GEN_CMD); |
| 7293 | break; |
| 7294 | } |
| 7295 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7296 | case WE_GET_BURST_ENABLE: |
| 7297 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7298 | hdd_notice("GET Burst enable value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7299 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7300 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 7301 | PDEV_CMD); |
| 7302 | break; |
| 7303 | } |
| 7304 | case WE_GET_BURST_DUR: |
| 7305 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7306 | hdd_notice("GET Burst Duration value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7307 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7308 | WMI_PDEV_PARAM_BURST_DUR, |
| 7309 | PDEV_CMD); |
| 7310 | break; |
| 7311 | } |
| 7312 | |
| 7313 | case WE_GET_TX_CHAINMASK: |
| 7314 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7315 | hdd_notice("GET WMI_PDEV_PARAM_TX_CHAIN_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7316 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7317 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 7318 | PDEV_CMD); |
| 7319 | break; |
| 7320 | } |
| 7321 | |
| 7322 | case WE_GET_RX_CHAINMASK: |
| 7323 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7324 | hdd_notice("GET WMI_PDEV_PARAM_RX_CHAIN_MASK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7325 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7326 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 7327 | PDEV_CMD); |
| 7328 | break; |
| 7329 | } |
| 7330 | |
| 7331 | case WE_GET_TXPOW_2G: |
| 7332 | { |
| 7333 | uint32_t txpow2g = 0; |
| 7334 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7335 | hdd_notice("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7336 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7337 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 7338 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7339 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7340 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 7341 | &txpow2g)) { |
| 7342 | return -EIO; |
| 7343 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7344 | hdd_notice("2G tx_power %d", txpow2g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7345 | break; |
| 7346 | } |
| 7347 | |
| 7348 | case WE_GET_TXPOW_5G: |
| 7349 | { |
| 7350 | uint32_t txpow5g = 0; |
| 7351 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7352 | hdd_notice("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7353 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7354 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 7355 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7356 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7357 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 7358 | &txpow5g)) { |
| 7359 | return -EIO; |
| 7360 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7361 | hdd_notice("5G tx_power %d", txpow5g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7362 | break; |
| 7363 | } |
| 7364 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7365 | case WE_GET_PPS_PAID_MATCH: |
| 7366 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7367 | hdd_notice("GET WMI_VDEV_PPS_PAID_MATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7368 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7369 | WMI_VDEV_PPS_PAID_MATCH, |
| 7370 | PPS_CMD); |
| 7371 | break; |
| 7372 | } |
| 7373 | |
| 7374 | case WE_GET_PPS_GID_MATCH: |
| 7375 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7376 | hdd_notice("GET WMI_VDEV_PPS_GID_MATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7377 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7378 | WMI_VDEV_PPS_GID_MATCH, |
| 7379 | PPS_CMD); |
| 7380 | break; |
| 7381 | } |
| 7382 | |
| 7383 | case WE_GET_PPS_EARLY_TIM_CLEAR: |
| 7384 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7385 | hdd_notice("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7386 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7387 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 7388 | PPS_CMD); |
| 7389 | break; |
| 7390 | } |
| 7391 | |
| 7392 | case WE_GET_PPS_EARLY_DTIM_CLEAR: |
| 7393 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7394 | hdd_notice("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7395 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7396 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 7397 | PPS_CMD); |
| 7398 | break; |
| 7399 | } |
| 7400 | |
| 7401 | case WE_GET_PPS_EOF_PAD_DELIM: |
| 7402 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7403 | hdd_notice("GET WMI_VDEV_PPS_EOF_PAD_DELIM"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7404 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7405 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 7406 | PPS_CMD); |
| 7407 | break; |
| 7408 | } |
| 7409 | |
| 7410 | case WE_GET_PPS_MACADDR_MISMATCH: |
| 7411 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7412 | hdd_notice("GET WMI_VDEV_PPS_MACADDR_MISMATCH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7413 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7414 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 7415 | PPS_CMD); |
| 7416 | break; |
| 7417 | } |
| 7418 | |
| 7419 | case WE_GET_PPS_DELIM_CRC_FAIL: |
| 7420 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7421 | hdd_notice("GET WMI_VDEV_PPS_DELIM_CRC_FAIL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7422 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7423 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 7424 | PPS_CMD); |
| 7425 | break; |
| 7426 | } |
| 7427 | |
| 7428 | case WE_GET_PPS_GID_NSTS_ZERO: |
| 7429 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7430 | hdd_notice("GET WMI_VDEV_PPS_GID_NSTS_ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7431 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7432 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 7433 | PPS_CMD); |
| 7434 | break; |
| 7435 | } |
| 7436 | |
| 7437 | case WE_GET_PPS_RSSI_CHECK: |
| 7438 | { |
| 7439 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7440 | hdd_notice("GET WMI_VDEV_PPS_RSSI_CHECK"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7441 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7442 | WMI_VDEV_PPS_RSSI_CHECK, |
| 7443 | PPS_CMD); |
| 7444 | break; |
| 7445 | } |
| 7446 | |
| 7447 | case WE_GET_QPOWER_MAX_PSPOLL_COUNT: |
| 7448 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7449 | hdd_notice("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7450 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7451 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 7452 | QPOWER_CMD); |
| 7453 | break; |
| 7454 | } |
| 7455 | |
| 7456 | case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 7457 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7458 | hdd_notice("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7459 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7460 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 7461 | QPOWER_CMD); |
| 7462 | break; |
| 7463 | } |
| 7464 | |
| 7465 | case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 7466 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7467 | hdd_notice("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7468 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7469 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 7470 | QPOWER_CMD); |
| 7471 | break; |
| 7472 | } |
| 7473 | |
| 7474 | case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 7475 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7476 | hdd_notice("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7477 | *value = wma_cli_get_command(pAdapter->sessionId, |
| 7478 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 7479 | QPOWER_CMD); |
| 7480 | break; |
| 7481 | } |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7482 | case WE_CAP_TSF: |
| 7483 | ret = hdd_capture_tsf(pAdapter, (uint32_t *)value, 1); |
| 7484 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7485 | case WE_GET_TEMPERATURE: |
| 7486 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7487 | hdd_notice("WE_GET_TEMPERATURE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7488 | ret = wlan_hdd_get_temperature(pAdapter, value); |
| 7489 | break; |
| 7490 | } |
| 7491 | default: |
| 7492 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7493 | hdd_err("Invalid IOCTL get_value command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7494 | value[0]); |
| 7495 | break; |
| 7496 | } |
| 7497 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7498 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7499 | return ret; |
| 7500 | } |
| 7501 | |
| 7502 | static int iw_setnone_getint(struct net_device *dev, |
| 7503 | struct iw_request_info *info, |
| 7504 | union iwreq_data *wrqu, char *extra) |
| 7505 | { |
| 7506 | int ret; |
| 7507 | |
| 7508 | cds_ssr_protect(__func__); |
| 7509 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 7510 | cds_ssr_unprotect(__func__); |
| 7511 | |
| 7512 | return ret; |
| 7513 | } |
| 7514 | |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 7515 | static int hdd_set_fwtest(int argc, int cmd, int value) |
| 7516 | { |
| 7517 | struct set_fwtest_params *fw_test; |
| 7518 | |
| 7519 | /* check for max number of arguments */ |
| 7520 | if (argc > (WMA_MAX_NUM_ARGS) || |
| 7521 | argc != HDD_FWTEST_PARAMS) { |
| 7522 | hdd_err("Too Many args %d", argc); |
| 7523 | return -EINVAL; |
| 7524 | } |
| 7525 | /* |
| 7526 | * check if number of arguments are 3 then, check |
| 7527 | * then set the default value for sounding interval. |
| 7528 | */ |
| 7529 | if (HDD_FWTEST_PARAMS == argc) { |
| 7530 | if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value) |
| 7531 | value = HDD_FWTEST_SU_DEFAULT_VALUE; |
| 7532 | if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value) |
| 7533 | value = HDD_FWTEST_MU_DEFAULT_VALUE; |
| 7534 | } |
| 7535 | /* check sounding interval value should not exceed to max */ |
| 7536 | if (value > HDD_FWTEST_MAX_VALUE) { |
| 7537 | hdd_err("Invalid arguments value should not exceed max: %d", |
| 7538 | value); |
| 7539 | return -EINVAL; |
| 7540 | } |
| 7541 | fw_test = qdf_mem_malloc(sizeof(*fw_test)); |
| 7542 | if (NULL == fw_test) { |
| 7543 | hdd_err("qdf_mem_malloc failed for fw_test"); |
| 7544 | return -ENOMEM; |
| 7545 | } |
| 7546 | fw_test->arg = cmd; |
| 7547 | fw_test->value = value; |
| 7548 | if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) { |
| 7549 | qdf_mem_free(fw_test); |
| 7550 | hdd_err("Not able to post FW_TEST_CMD message to WMA"); |
| 7551 | return -EINVAL; |
| 7552 | } |
| 7553 | return 0; |
| 7554 | } |
| 7555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7556 | /** |
| 7557 | * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler |
| 7558 | * @dev: device upon which the ioctl was received |
| 7559 | * @info: ioctl request information |
| 7560 | * @wrqu: ioctl request data |
| 7561 | * @extra: ioctl extra data |
| 7562 | * |
| 7563 | * Return: 0 on success, non-zero on error |
| 7564 | */ |
| 7565 | static int __iw_set_three_ints_getnone(struct net_device *dev, |
| 7566 | struct iw_request_info *info, |
| 7567 | union iwreq_data *wrqu, char *extra) |
| 7568 | { |
| 7569 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7570 | int *value = (int *)extra; |
| 7571 | int sub_cmd = value[0]; |
| 7572 | int ret; |
| 7573 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7574 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7575 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7576 | |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 7577 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7578 | hdd_err("permission check failed"); |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 7579 | return -EPERM; |
| 7580 | } |
| 7581 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7582 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7583 | if (0 != ret) |
| 7584 | return ret; |
| 7585 | |
| 7586 | switch (sub_cmd) { |
| 7587 | |
| 7588 | case WE_SET_WLAN_DBG: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7589 | qdf_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7590 | break; |
| 7591 | case WE_SET_DP_TRACE: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7592 | qdf_dp_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7593 | break; |
| 7594 | |
| 7595 | /* value[3] the acs band is not required as start and end channels are |
| 7596 | * enough but this cmd is maintained under set three ints for historic |
| 7597 | * reasons. |
| 7598 | */ |
| 7599 | case WE_SET_SAP_CHANNELS: |
| 7600 | if (wlan_hdd_validate_operation_channel(pAdapter, value[1]) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7601 | QDF_STATUS_SUCCESS || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7602 | wlan_hdd_validate_operation_channel(pAdapter, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7603 | value[2]) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7604 | ret = -EINVAL; |
| 7605 | } else { |
| 7606 | hdd_ctx->config->force_sap_acs_st_ch = value[1]; |
| 7607 | hdd_ctx->config->force_sap_acs_end_ch = value[2]; |
| 7608 | } |
| 7609 | break; |
| 7610 | case WE_SET_DUAL_MAC_SCAN_CONFIG: |
| 7611 | hdd_debug("Ioctl to set dual mac scan config"); |
| 7612 | if (hdd_ctx->config->dual_mac_feature_disable) { |
| 7613 | hdd_err("Dual mac feature is disabled from INI"); |
| 7614 | return -EPERM; |
| 7615 | } |
| 7616 | hdd_debug("%d %d %d", value[1], value[2], value[3]); |
Tushnim Bhattacharyya | 4adb368 | 2016-01-07 15:07:12 -0800 | [diff] [blame] | 7617 | cds_set_dual_mac_scan_config(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7618 | break; |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 7619 | case WE_SET_FW_TEST: |
| 7620 | { |
| 7621 | ret = hdd_set_fwtest(value[1], value[2], value[3]); |
| 7622 | if (ret) { |
| 7623 | hdd_err("Not able to set fwtest %d", ret); |
| 7624 | return ret; |
| 7625 | } |
| 7626 | } |
| 7627 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7628 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7629 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7630 | break; |
| 7631 | |
| 7632 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7633 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7634 | return ret; |
| 7635 | } |
| 7636 | |
| 7637 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 7638 | struct iw_request_info *info, |
| 7639 | union iwreq_data *wrqu, char *extra) |
| 7640 | { |
| 7641 | int ret; |
| 7642 | |
| 7643 | cds_ssr_protect(__func__); |
| 7644 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 7645 | cds_ssr_unprotect(__func__); |
| 7646 | |
| 7647 | return ret; |
| 7648 | } |
| 7649 | |
| 7650 | /** |
| 7651 | * hdd_connection_state_string() - Get connection state string |
| 7652 | * @connection_state: enum to be converted to a string |
| 7653 | * |
| 7654 | * Return: the string equivalent of @connection_state |
| 7655 | */ |
| 7656 | static const char * |
| 7657 | hdd_connection_state_string(eConnectionState connection_state) |
| 7658 | { |
| 7659 | switch (connection_state) { |
| 7660 | CASE_RETURN_STRING(eConnectionState_NotConnected); |
| 7661 | CASE_RETURN_STRING(eConnectionState_Connecting); |
| 7662 | CASE_RETURN_STRING(eConnectionState_Associated); |
| 7663 | CASE_RETURN_STRING(eConnectionState_IbssDisconnected); |
| 7664 | CASE_RETURN_STRING(eConnectionState_IbssConnected); |
| 7665 | CASE_RETURN_STRING(eConnectionState_Disconnecting); |
| 7666 | default: |
| 7667 | return "UNKNOWN"; |
| 7668 | } |
| 7669 | } |
| 7670 | |
| 7671 | /** |
| 7672 | * iw_get_char_setnone() - Generic "get string" private ioctl handler |
| 7673 | * @dev: device upon which the ioctl was received |
| 7674 | * @info: ioctl request information |
| 7675 | * @wrqu: ioctl request data |
| 7676 | * @extra: ioctl extra data |
| 7677 | * |
| 7678 | * Return: 0 on success, non-zero on error |
| 7679 | */ |
| 7680 | static int __iw_get_char_setnone(struct net_device *dev, |
| 7681 | struct iw_request_info *info, |
| 7682 | union iwreq_data *wrqu, char *extra) |
| 7683 | { |
| 7684 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7685 | int sub_cmd = wrqu->data.flags; |
| 7686 | hdd_context_t *hdd_ctx; |
| 7687 | int ret; |
| 7688 | #ifdef WLAN_FEATURE_11W |
| 7689 | hdd_wext_state_t *pWextState; |
| 7690 | #endif |
| 7691 | |
| 7692 | #ifdef WLAN_FEATURE_11W |
| 7693 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7694 | #endif |
| 7695 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7696 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7697 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7699 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7700 | if (0 != ret) |
| 7701 | return ret; |
| 7702 | |
| 7703 | switch (sub_cmd) { |
| 7704 | case WE_WLAN_VERSION: |
| 7705 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 7706 | hdd_wlan_get_version(hdd_ctx, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7707 | break; |
| 7708 | } |
| 7709 | |
| 7710 | case WE_GET_STATS: |
| 7711 | { |
| 7712 | hdd_wlan_get_stats(pAdapter, &(wrqu->data.length), |
| 7713 | extra, WE_MAX_STR_LEN); |
| 7714 | break; |
| 7715 | } |
| 7716 | |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 7717 | case WE_GET_SUSPEND_RESUME_STATS: |
| 7718 | { |
| 7719 | ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra, |
| 7720 | WE_MAX_STR_LEN); |
| 7721 | if (ret >= 0) { |
| 7722 | wrqu->data.length = ret; |
| 7723 | ret = 0; |
| 7724 | } |
| 7725 | |
| 7726 | break; |
| 7727 | } |
| 7728 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7729 | case WE_LIST_FW_PROFILE: |
| 7730 | hdd_wlan_list_fw_profile(&(wrqu->data.length), |
| 7731 | extra, WE_MAX_STR_LEN); |
| 7732 | break; |
| 7733 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7734 | /* The case prints the current state of the HDD, SME, CSR, PE, |
| 7735 | * TL it can be extended for WDI Global State as well. And |
| 7736 | * currently it only checks P2P_CLIENT adapter. P2P_DEVICE |
| 7737 | * and P2P_GO have not been added as of now. |
| 7738 | */ |
| 7739 | case WE_GET_STATES: |
| 7740 | { |
| 7741 | int buf = 0, len = 0; |
| 7742 | int adapter_num = 0; |
| 7743 | int count = 0, check = 1; |
| 7744 | |
| 7745 | tHalHandle hHal = NULL; |
| 7746 | tpAniSirGlobal pMac = NULL; |
| 7747 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 7748 | |
| 7749 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7750 | hdd_adapter_t *useAdapter = NULL; |
| 7751 | |
| 7752 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 7753 | * by using the correct adapter |
| 7754 | */ |
| 7755 | while (adapter_num < 2) { |
| 7756 | if (WLAN_ADAPTER == adapter_num) { |
| 7757 | useAdapter = pAdapter; |
| 7758 | buf = |
| 7759 | scnprintf(extra + len, |
| 7760 | WE_MAX_STR_LEN - len, |
| 7761 | "\n\n wlan0 States:-"); |
| 7762 | len += buf; |
| 7763 | } else if (P2P_ADAPTER == adapter_num) { |
| 7764 | buf = |
| 7765 | scnprintf(extra + len, |
| 7766 | WE_MAX_STR_LEN - len, |
| 7767 | "\n\n p2p0 States:-"); |
| 7768 | len += buf; |
| 7769 | |
| 7770 | if (!pHddCtx) { |
| 7771 | buf = |
| 7772 | scnprintf(extra + len, |
| 7773 | WE_MAX_STR_LEN - |
| 7774 | len, |
| 7775 | "\n pHddCtx is NULL"); |
| 7776 | len += buf; |
| 7777 | break; |
| 7778 | } |
| 7779 | |
| 7780 | /* Printing p2p0 states only in the |
| 7781 | * case when the device is configured |
| 7782 | * as a p2p_client |
| 7783 | */ |
| 7784 | useAdapter = |
| 7785 | hdd_get_adapter(pHddCtx, |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 7786 | QDF_P2P_CLIENT_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7787 | if (!useAdapter) { |
| 7788 | buf = |
| 7789 | scnprintf(extra + len, |
| 7790 | WE_MAX_STR_LEN - |
| 7791 | len, |
| 7792 | "\n Device not configured as P2P_CLIENT."); |
| 7793 | len += buf; |
| 7794 | break; |
| 7795 | } |
| 7796 | } |
| 7797 | |
| 7798 | hHal = WLAN_HDD_GET_HAL_CTX(useAdapter); |
| 7799 | if (!hHal) { |
| 7800 | buf = |
| 7801 | scnprintf(extra + len, |
| 7802 | WE_MAX_STR_LEN - len, |
| 7803 | "\n pMac is NULL"); |
| 7804 | len += buf; |
| 7805 | break; |
| 7806 | } |
| 7807 | pMac = PMAC_STRUCT(hHal); |
| 7808 | if (!pMac) { |
| 7809 | buf = |
| 7810 | scnprintf(extra + len, |
| 7811 | WE_MAX_STR_LEN - len, |
| 7812 | "\n pMac is NULL"); |
| 7813 | len += buf; |
| 7814 | break; |
| 7815 | } |
| 7816 | pHddStaCtx = |
| 7817 | WLAN_HDD_GET_STATION_CTX_PTR(useAdapter); |
| 7818 | |
| 7819 | |
| 7820 | buf = |
| 7821 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7822 | "\n HDD Conn State - %s " |
| 7823 | "\n \n SME State:" |
| 7824 | "\n Neighbour Roam State - %s" |
| 7825 | "\n CSR State - %s" |
| 7826 | "\n CSR Substate - %s", |
| 7827 | hdd_connection_state_string |
| 7828 | (pHddStaCtx->conn_info.connState), |
| 7829 | mac_trace_get_neighbour_roam_state |
| 7830 | (sme_get_neighbor_roam_state |
| 7831 | (hHal, useAdapter->sessionId)), |
| 7832 | mac_trace_getcsr_roam_state |
| 7833 | (sme_get_current_roam_state |
| 7834 | (hHal, useAdapter->sessionId)), |
| 7835 | mac_trace_getcsr_roam_sub_state |
| 7836 | (sme_get_current_roam_sub_state |
| 7837 | (hHal, useAdapter->sessionId)) |
| 7838 | ); |
| 7839 | len += buf; |
| 7840 | adapter_num++; |
| 7841 | } |
| 7842 | |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 7843 | if (hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7844 | /* Printing Lim State starting with global lim states */ |
| 7845 | buf = |
| 7846 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7847 | "\n \n LIM STATES:-" |
| 7848 | "\n Global Sme State - %s " |
| 7849 | "\n Global mlm State - %s " "\n", |
| 7850 | mac_trace_get_lim_sme_state |
| 7851 | (sme_get_lim_sme_state(hHal)), |
| 7852 | mac_trace_get_lim_mlm_state |
| 7853 | (sme_get_lim_sme_state(hHal)) |
| 7854 | ); |
| 7855 | len += buf; |
| 7856 | |
| 7857 | /* Printing the PE Sme and Mlm states for valid lim sessions */ |
| 7858 | while (check < 3 && count < 255) { |
| 7859 | if (sme_is_lim_session_valid(hHal, count)) { |
| 7860 | buf = |
| 7861 | scnprintf(extra + len, |
| 7862 | WE_MAX_STR_LEN - |
| 7863 | len, |
| 7864 | "\n Lim Valid Session %d:-" |
| 7865 | "\n PE Sme State - %s " |
| 7866 | "\n PE Mlm State - %s " |
| 7867 | "\n", check, |
| 7868 | mac_trace_get_lim_sme_state |
| 7869 | (sme_get_lim_sme_session_state |
| 7870 | (hHal, count)), |
| 7871 | mac_trace_get_lim_mlm_state |
| 7872 | (sme_get_lim_mlm_session_state |
| 7873 | (hHal, count)) |
| 7874 | ); |
| 7875 | |
| 7876 | len += buf; |
| 7877 | check++; |
| 7878 | } |
| 7879 | count++; |
| 7880 | } |
| 7881 | } |
| 7882 | |
| 7883 | wrqu->data.length = strlen(extra) + 1; |
| 7884 | break; |
| 7885 | } |
| 7886 | |
| 7887 | case WE_GET_CFG: |
| 7888 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7889 | hdd_notice("Printing CLD global INI Config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7890 | hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(pAdapter), |
| 7891 | extra, |
| 7892 | QCSAP_IOCTL_MAX_STR_LEN); |
| 7893 | wrqu->data.length = strlen(extra) + 1; |
| 7894 | break; |
| 7895 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7896 | case WE_GET_RSSI: |
| 7897 | { |
| 7898 | int8_t s7Rssi = 0; |
| 7899 | wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 7900 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 7901 | wrqu->data.length = strlen(extra) + 1; |
| 7902 | break; |
| 7903 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7904 | |
| 7905 | case WE_GET_WMM_STATUS: |
| 7906 | { |
| 7907 | snprintf(extra, WE_MAX_STR_LEN, |
| 7908 | "\nDir: 0=up, 1=down, 3=both\n" |
| 7909 | "|------------------------|\n" |
| 7910 | "|AC | ACM |Admitted| Dir |\n" |
| 7911 | "|------------------------|\n" |
| 7912 | "|VO | %d | %3s | %d |\n" |
| 7913 | "|VI | %d | %3s | %d |\n" |
| 7914 | "|BE | %d | %3s | %d |\n" |
| 7915 | "|BK | %d | %3s | %d |\n" |
| 7916 | "|------------------------|\n", |
| 7917 | pAdapter->hddWmmStatus. |
| 7918 | wmmAcStatus[SME_AC_VO].wmmAcAccessRequired, |
| 7919 | pAdapter->hddWmmStatus. |
| 7920 | wmmAcStatus[SME_AC_VO]. |
| 7921 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7922 | pAdapter->hddWmmStatus. |
| 7923 | wmmAcStatus[SME_AC_VO].wmmAcTspecInfo. |
| 7924 | ts_info.direction, |
| 7925 | pAdapter->hddWmmStatus. |
| 7926 | wmmAcStatus[SME_AC_VI].wmmAcAccessRequired, |
| 7927 | pAdapter->hddWmmStatus. |
| 7928 | wmmAcStatus[SME_AC_VI]. |
| 7929 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7930 | pAdapter->hddWmmStatus. |
| 7931 | wmmAcStatus[SME_AC_VI].wmmAcTspecInfo. |
| 7932 | ts_info.direction, |
| 7933 | pAdapter->hddWmmStatus. |
| 7934 | wmmAcStatus[SME_AC_BE].wmmAcAccessRequired, |
| 7935 | pAdapter->hddWmmStatus. |
| 7936 | wmmAcStatus[SME_AC_BE]. |
| 7937 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7938 | pAdapter->hddWmmStatus. |
| 7939 | wmmAcStatus[SME_AC_BE].wmmAcTspecInfo. |
| 7940 | ts_info.direction, |
| 7941 | pAdapter->hddWmmStatus. |
| 7942 | wmmAcStatus[SME_AC_BK].wmmAcAccessRequired, |
| 7943 | pAdapter->hddWmmStatus. |
| 7944 | wmmAcStatus[SME_AC_BK]. |
| 7945 | wmmAcAccessAllowed ? "YES" : "NO", |
| 7946 | pAdapter->hddWmmStatus. |
| 7947 | wmmAcStatus[SME_AC_BK].wmmAcTspecInfo. |
| 7948 | ts_info.direction); |
| 7949 | |
| 7950 | wrqu->data.length = strlen(extra) + 1; |
| 7951 | break; |
| 7952 | } |
| 7953 | case WE_GET_CHANNEL_LIST: |
| 7954 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7955 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7956 | uint8_t i, len; |
| 7957 | char *buf; |
| 7958 | uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN]; |
| 7959 | uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN; |
| 7960 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 7961 | |
| 7962 | tChannelListInfo channel_list; |
| 7963 | |
| 7964 | memset(&channel_list, 0, sizeof(channel_list)); |
Agrawal Ashish | 6c9bca7 | 2016-09-04 13:37:59 +0530 | [diff] [blame] | 7965 | status = iw_get_channel_list(dev, info, wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7966 | (char *)&channel_list); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7967 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7968 | hdd_err("GetChannelList Failed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7969 | return -EINVAL; |
| 7970 | } |
| 7971 | buf = extra; |
| 7972 | /* |
| 7973 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. |
| 7974 | * Maximum buffer needed = 5 * number of channels. |
| 7975 | * Check ifsufficient buffer is available and then |
| 7976 | * proceed to fill the buffer. |
| 7977 | */ |
| 7978 | if (WE_MAX_STR_LEN < |
| 7979 | (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7980 | hdd_err("Insufficient Buffer to populate channel list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7981 | return -EINVAL; |
| 7982 | } |
| 7983 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 7984 | channel_list.num_channels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7985 | if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7986 | ubuf, &ubuf_len)) { |
| 7987 | /* Printing Country code in getChannelList */ |
| 7988 | for (i = 0; i < (ubuf_len - 1); i++) |
| 7989 | len += scnprintf(buf + len, |
| 7990 | WE_MAX_STR_LEN - len, |
| 7991 | "%c", ubuf[i]); |
| 7992 | } |
| 7993 | for (i = 0; i < channel_list.num_channels; i++) { |
| 7994 | len += |
| 7995 | scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 7996 | " %u", channel_list.channels[i]); |
| 7997 | } |
| 7998 | wrqu->data.length = strlen(extra) + 1; |
| 7999 | |
| 8000 | break; |
| 8001 | } |
| 8002 | #ifdef FEATURE_WLAN_TDLS |
| 8003 | case WE_GET_TDLS_PEERS: |
| 8004 | { |
| 8005 | wrqu->data.length = |
| 8006 | wlan_hdd_tdls_get_all_peers(pAdapter, extra, |
| 8007 | WE_MAX_STR_LEN) + 1; |
| 8008 | break; |
| 8009 | } |
| 8010 | #endif |
| 8011 | #ifdef WLAN_FEATURE_11W |
| 8012 | case WE_GET_11W_INFO: |
| 8013 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8014 | hdd_err("WE_GET_11W_ENABLED = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8015 | pWextState->roamProfile.MFPEnabled); |
| 8016 | |
| 8017 | snprintf(extra, WE_MAX_STR_LEN, |
| 8018 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 8019 | "\n Number of Unprotected Disassocs %d" |
| 8020 | "\n Number of Unprotected Deauths %d", |
| 8021 | pWextState->roamProfile.BSSIDs.bssid->bytes[0], |
| 8022 | pWextState->roamProfile.BSSIDs.bssid->bytes[1], |
| 8023 | pWextState->roamProfile.BSSIDs.bssid->bytes[2], |
| 8024 | pWextState->roamProfile.BSSIDs.bssid->bytes[3], |
| 8025 | pWextState->roamProfile.BSSIDs.bssid->bytes[4], |
| 8026 | pWextState->roamProfile.BSSIDs.bssid->bytes[5], |
| 8027 | pWextState->roamProfile.MFPEnabled, |
| 8028 | pAdapter->hdd_stats.hddPmfStats. |
| 8029 | numUnprotDisassocRx, |
| 8030 | pAdapter->hdd_stats.hddPmfStats. |
| 8031 | numUnprotDeauthRx); |
| 8032 | |
| 8033 | wrqu->data.length = strlen(extra) + 1; |
| 8034 | break; |
| 8035 | } |
| 8036 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8037 | case WE_GET_IBSS_STA_INFO: |
| 8038 | { |
| 8039 | hdd_station_ctx_t *pHddStaCtx = |
| 8040 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8041 | int idx = 0; |
| 8042 | int length = 0, buf = 0; |
| 8043 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 8044 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8045 | if (0 != pHddStaCtx->conn_info.staId[idx]) { |
| 8046 | buf = snprintf |
| 8047 | ((extra + length), |
| 8048 | WE_MAX_STR_LEN - length, |
| 8049 | "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
| 8050 | pHddStaCtx->conn_info.staId[idx], |
| 8051 | pHddStaCtx->conn_info. |
| 8052 | peerMacAddress[idx].bytes[0], |
| 8053 | pHddStaCtx->conn_info. |
| 8054 | peerMacAddress[idx].bytes[1], |
| 8055 | pHddStaCtx->conn_info. |
| 8056 | peerMacAddress[idx].bytes[2], |
| 8057 | pHddStaCtx->conn_info. |
| 8058 | peerMacAddress[idx].bytes[3], |
| 8059 | pHddStaCtx->conn_info. |
| 8060 | peerMacAddress[idx].bytes[4], |
| 8061 | pHddStaCtx->conn_info. |
| 8062 | peerMacAddress[idx].bytes[5] |
| 8063 | ); |
| 8064 | length += buf; |
| 8065 | } |
| 8066 | } |
| 8067 | wrqu->data.length = strlen(extra) + 1; |
| 8068 | break; |
| 8069 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8070 | case WE_GET_PHYMODE: |
| 8071 | { |
| 8072 | bool ch_bond24 = false, ch_bond5g = false; |
| 8073 | hdd_context_t *hddctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8074 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8075 | eCsrPhyMode phymode; |
| 8076 | eCsrBand currBand; |
| 8077 | tSmeConfigParams smeconfig; |
| 8078 | |
| 8079 | sme_get_config_param(hal, &smeconfig); |
| 8080 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 8081 | smeconfig.csrConfig.channelBondingMode24GHz) |
| 8082 | ch_bond24 = true; |
| 8083 | |
| 8084 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 8085 | smeconfig.csrConfig.channelBondingMode5GHz) |
| 8086 | ch_bond5g = true; |
| 8087 | |
| 8088 | phymode = sme_get_phy_mode(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8089 | if ((QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8090 | sme_get_freq_band(hal, &currBand))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8091 | hdd_notice("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8092 | return -EIO; |
| 8093 | } |
| 8094 | |
| 8095 | switch (phymode) { |
| 8096 | case eCSR_DOT11_MODE_AUTO: |
| 8097 | snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE"); |
| 8098 | break; |
| 8099 | case eCSR_DOT11_MODE_11n: |
| 8100 | case eCSR_DOT11_MODE_11n_ONLY: |
| 8101 | if (currBand == eCSR_BAND_24) { |
| 8102 | if (ch_bond24) |
| 8103 | snprintf(extra, WE_MAX_STR_LEN, |
| 8104 | "11NGHT40"); |
| 8105 | else |
| 8106 | snprintf(extra, WE_MAX_STR_LEN, |
| 8107 | "11NGHT20"); |
| 8108 | } else if (currBand == eCSR_BAND_5G) { |
| 8109 | if (ch_bond5g) |
| 8110 | snprintf(extra, WE_MAX_STR_LEN, |
| 8111 | "11NAHT40"); |
| 8112 | else |
| 8113 | snprintf(extra, WE_MAX_STR_LEN, |
| 8114 | "11NAHT20"); |
| 8115 | } else { |
| 8116 | snprintf(extra, WE_MAX_STR_LEN, "11N"); |
| 8117 | } |
| 8118 | break; |
| 8119 | case eCSR_DOT11_MODE_abg: |
| 8120 | snprintf(extra, WE_MAX_STR_LEN, "11ABG"); |
| 8121 | break; |
| 8122 | case eCSR_DOT11_MODE_11a: |
| 8123 | snprintf(extra, WE_MAX_STR_LEN, "11A"); |
| 8124 | break; |
| 8125 | case eCSR_DOT11_MODE_11b: |
| 8126 | case eCSR_DOT11_MODE_11b_ONLY: |
| 8127 | snprintf(extra, WE_MAX_STR_LEN, "11B"); |
| 8128 | break; |
| 8129 | case eCSR_DOT11_MODE_11g: |
| 8130 | case eCSR_DOT11_MODE_11g_ONLY: |
| 8131 | snprintf(extra, WE_MAX_STR_LEN, "11G"); |
| 8132 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8133 | case eCSR_DOT11_MODE_11ac: |
| 8134 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 8135 | if (hddctx->config->vhtChannelWidth == |
| 8136 | eHT_CHANNEL_WIDTH_20MHZ) |
| 8137 | snprintf(extra, WE_MAX_STR_LEN, |
| 8138 | "11ACVHT20"); |
| 8139 | else if (hddctx->config->vhtChannelWidth == |
| 8140 | eHT_CHANNEL_WIDTH_40MHZ) |
| 8141 | snprintf(extra, WE_MAX_STR_LEN, |
| 8142 | "11ACVHT40"); |
| 8143 | else if (hddctx->config->vhtChannelWidth == |
| 8144 | eHT_CHANNEL_WIDTH_80MHZ) |
| 8145 | snprintf(extra, WE_MAX_STR_LEN, |
| 8146 | "11ACVHT80"); |
| 8147 | else if (hddctx->config->vhtChannelWidth == |
| 8148 | eHT_CHANNEL_WIDTH_160MHZ) |
| 8149 | snprintf(extra, WE_MAX_STR_LEN, |
| 8150 | "11ACVHT160"); |
| 8151 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8152 | } |
| 8153 | |
| 8154 | wrqu->data.length = strlen(extra) + 1; |
| 8155 | break; |
| 8156 | } |
| 8157 | |
| 8158 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 8159 | case WE_GET_OEM_DATA_CAP: |
| 8160 | { |
| 8161 | return iw_get_oem_data_cap(dev, info, wrqu, extra); |
| 8162 | } |
| 8163 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 8164 | case WE_GET_SNR: |
| 8165 | { |
| 8166 | int8_t s7snr = 0; |
| 8167 | int status = 0; |
| 8168 | hdd_context_t *pHddCtx; |
| 8169 | hdd_station_ctx_t *pHddStaCtx; |
| 8170 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8171 | status = wlan_hdd_validate_context(pHddCtx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 8172 | if (status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8173 | return status; |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 8174 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8175 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8176 | if (0 == pHddCtx->config->fEnableSNRMonitoring || |
| 8177 | eConnectionState_Associated != |
| 8178 | pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8179 | hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8180 | pHddCtx->config->fEnableSNRMonitoring, |
| 8181 | pHddStaCtx->conn_info.connState); |
| 8182 | return -ENONET; |
| 8183 | } |
| 8184 | wlan_hdd_get_snr(pAdapter, &s7snr); |
| 8185 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr); |
| 8186 | wrqu->data.length = strlen(extra) + 1; |
| 8187 | break; |
| 8188 | } |
| 8189 | default: |
| 8190 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8191 | hdd_err("Invalid IOCTL command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8192 | sub_cmd); |
| 8193 | break; |
| 8194 | } |
| 8195 | } |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 8196 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8197 | EXIT(); |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 8198 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8199 | } |
| 8200 | |
| 8201 | static int iw_get_char_setnone(struct net_device *dev, |
| 8202 | struct iw_request_info *info, |
| 8203 | union iwreq_data *wrqu, char *extra) |
| 8204 | { |
| 8205 | int ret; |
| 8206 | |
| 8207 | cds_ssr_protect(__func__); |
| 8208 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 8209 | cds_ssr_unprotect(__func__); |
| 8210 | |
| 8211 | return ret; |
| 8212 | } |
| 8213 | |
| 8214 | /** |
| 8215 | * iw_setnone_getnone() - Generic "action" private ioctl handler |
| 8216 | * @dev: device upon which the ioctl was received |
| 8217 | * @info: ioctl request information |
| 8218 | * @wrqu: ioctl request data |
| 8219 | * @extra: ioctl extra data |
| 8220 | * |
| 8221 | * Return: 0 on success, non-zero on error |
| 8222 | */ |
| 8223 | static int __iw_setnone_getnone(struct net_device *dev, |
| 8224 | struct iw_request_info *info, |
| 8225 | union iwreq_data *wrqu, char *extra) |
| 8226 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8227 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8228 | hdd_context_t *hdd_ctx; |
| 8229 | int ret; |
| 8230 | int sub_cmd; |
| 8231 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8232 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8233 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8234 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8235 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8236 | if (0 != ret) |
| 8237 | return ret; |
| 8238 | |
| 8239 | #ifdef CONFIG_COMPAT |
| 8240 | /* this ioctl is a special case where a sub-ioctl is used and both |
| 8241 | * the number of get and set args is 0. in this specific case the |
| 8242 | * logic in iwpriv places the sub_cmd in the data.flags portion of |
| 8243 | * the iwreq. unfortunately the location of this field will be |
| 8244 | * different between 32-bit and 64-bit userspace, and the standard |
| 8245 | * compat support in the kernel does not handle this case. so we |
| 8246 | * need to explicitly handle it here. |
| 8247 | */ |
| 8248 | if (is_compat_task()) { |
| 8249 | struct compat_iw_point *compat_iw_point = |
| 8250 | (struct compat_iw_point *)&wrqu->data; |
| 8251 | sub_cmd = compat_iw_point->flags; |
| 8252 | } else { |
| 8253 | sub_cmd = wrqu->data.flags; |
| 8254 | } |
| 8255 | #else |
| 8256 | sub_cmd = wrqu->data.flags; |
| 8257 | #endif |
| 8258 | |
| 8259 | switch (sub_cmd) { |
| 8260 | case WE_GET_RECOVERY_STAT: |
| 8261 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8262 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8263 | sme_get_recovery_stats(hal); |
| 8264 | break; |
| 8265 | } |
| 8266 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 8267 | case WE_GET_FW_PROFILE_DATA: |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8268 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 8269 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 8270 | 0, DBG_CMD); |
| 8271 | break; |
| 8272 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8273 | case WE_IBSS_GET_PEER_INFO_ALL: |
| 8274 | { |
| 8275 | hdd_wlan_get_ibss_peer_info_all(adapter); |
| 8276 | break; |
| 8277 | } |
| 8278 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8279 | case WE_SET_REASSOC_TRIGGER: |
| 8280 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8281 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8282 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 8283 | tSirMacAddr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8284 | uint32_t roamId = 0; |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 8285 | uint8_t operating_ch = |
| 8286 | adapter->sessionCtx.station.conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8287 | tCsrRoamModifyProfileFields modProfileFields; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8288 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8289 | sme_get_modify_profile_fields(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8290 | &modProfileFields); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 8291 | if (roaming_offload_enabled(hdd_ctx)) { |
| 8292 | qdf_mem_copy(bssid, |
| 8293 | &adapter->sessionCtx.station.conn_info.bssId, |
| 8294 | sizeof(bssid)); |
| 8295 | hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId, |
| 8296 | bssid, operating_ch); |
| 8297 | } else { |
| 8298 | sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, |
| 8299 | NULL, modProfileFields, &roamId, 1); |
| 8300 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8301 | return 0; |
| 8302 | } |
| 8303 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8304 | case WE_STOP_OBSS_SCAN: |
| 8305 | { |
| 8306 | /* |
| 8307 | * 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 8308 | * 2.OBSS scan is stopped by Firmware during the disassociation |
| 8309 | * 3.OBSS stop comamnd is added for debugging purpose |
| 8310 | */ |
| 8311 | tHalHandle hal; |
| 8312 | |
| 8313 | hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 8314 | if (hal == NULL) { |
| 8315 | hdd_err("hal context is NULL"); |
| 8316 | return -EINVAL; |
| 8317 | } |
| 8318 | sme_ht40_stop_obss_scan(hal, adapter->sessionId); |
| 8319 | } |
| 8320 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8321 | default: |
| 8322 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8323 | hdd_err("unknown ioctl %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8324 | break; |
| 8325 | } |
| 8326 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8327 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8328 | return ret; |
| 8329 | } |
| 8330 | |
| 8331 | static int iw_setnone_getnone(struct net_device *dev, |
| 8332 | struct iw_request_info *info, |
| 8333 | union iwreq_data *wrqu, char *extra) |
| 8334 | { |
| 8335 | int ret; |
| 8336 | |
| 8337 | cds_ssr_protect(__func__); |
| 8338 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 8339 | cds_ssr_unprotect(__func__); |
| 8340 | |
| 8341 | return ret; |
| 8342 | } |
| 8343 | |
| 8344 | /** |
| 8345 | * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 8346 | * @dev: device upon which the ioctl was received |
| 8347 | * @info: ioctl request information |
| 8348 | * @wrqu: ioctl request data |
| 8349 | * @extra: ioctl extra data |
| 8350 | * |
| 8351 | * This is an SSR-protected generic handler for private ioctls which |
| 8352 | * take multiple arguments. Note that this implementation is also |
| 8353 | * somewhat unique in that it is shared by both STA-mode and SAP-mode |
| 8354 | * interfaces. |
| 8355 | * |
| 8356 | * Return: 0 on success, non-zero on error |
| 8357 | */ |
| 8358 | static int __iw_set_var_ints_getnone(struct net_device *dev, |
| 8359 | struct iw_request_info *info, |
| 8360 | union iwreq_data *wrqu, char *extra) |
| 8361 | { |
| 8362 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8363 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8364 | int sub_cmd; |
| 8365 | int *apps_args = (int *) extra; |
| 8366 | hdd_context_t *hdd_ctx; |
| 8367 | int ret, num_args; |
| 8368 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8369 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8370 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8371 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8372 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8373 | if (0 != ret) |
| 8374 | return ret; |
| 8375 | |
| 8376 | if (extra == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8377 | hdd_err("NULL extra buffer pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8378 | return -EINVAL; |
| 8379 | } |
| 8380 | |
| 8381 | sub_cmd = wrqu->data.flags; |
| 8382 | num_args = wrqu->data.length; |
| 8383 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8384 | hdd_notice("Received length %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8385 | |
| 8386 | switch (sub_cmd) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8387 | case WE_IBSS_GET_PEER_INFO: |
| 8388 | { |
| 8389 | pr_info("Station ID = %d\n", apps_args[0]); |
| 8390 | hdd_wlan_get_ibss_peer_info(pAdapter, apps_args[0]); |
| 8391 | } |
| 8392 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8393 | |
| 8394 | case WE_P2P_NOA_CMD: |
| 8395 | { |
| 8396 | p2p_app_setP2pPs_t p2pNoA; |
| 8397 | |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 8398 | if (pAdapter->device_mode != QDF_P2P_GO_MODE) { |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 8399 | hdd_err("Setting NoA is not allowed in Device mode %s(%d)", |
| 8400 | hdd_device_mode_to_string( |
| 8401 | pAdapter->device_mode), |
| 8402 | pAdapter->device_mode); |
| 8403 | return -EINVAL; |
| 8404 | } |
| 8405 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8406 | p2pNoA.opp_ps = apps_args[0]; |
| 8407 | p2pNoA.ctWindow = apps_args[1]; |
| 8408 | p2pNoA.duration = apps_args[2]; |
| 8409 | p2pNoA.interval = apps_args[3]; |
| 8410 | p2pNoA.count = apps_args[4]; |
| 8411 | p2pNoA.single_noa_duration = apps_args[5]; |
| 8412 | p2pNoA.psSelection = apps_args[6]; |
| 8413 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8414 | hdd_notice("P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x", |
| 8415 | apps_args[0], apps_args[1], apps_args[2], |
| 8416 | apps_args[3], apps_args[4], |
| 8417 | apps_args[5], apps_args[6]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8418 | |
| 8419 | hdd_set_p2p_ps(dev, &p2pNoA); |
| 8420 | |
| 8421 | } |
| 8422 | break; |
| 8423 | |
| 8424 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 8425 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8426 | hdd_notice("SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
| 8427 | apps_args[0], apps_args[1]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8428 | qdf_trace_enable(apps_args[0], apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8429 | } |
| 8430 | break; |
| 8431 | |
| 8432 | case WE_MTRACE_DUMP_CMD: |
| 8433 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8434 | hdd_notice("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ", |
| 8435 | apps_args[0], apps_args[1], |
| 8436 | apps_args[2], apps_args[3]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8437 | qdf_trace_dump_all((void *)hHal, apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8438 | apps_args[1], apps_args[2], |
| 8439 | apps_args[3]); |
| 8440 | |
| 8441 | } |
| 8442 | break; |
| 8443 | |
| 8444 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 8445 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8446 | hdd_err("<iwpriv wlan0 pm_clist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8447 | cds_incr_connection_count_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8448 | apps_args[1], apps_args[2], apps_args[3], |
| 8449 | apps_args[4], apps_args[5], apps_args[6], |
| 8450 | apps_args[7]); |
| 8451 | } |
| 8452 | break; |
| 8453 | |
| 8454 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 8455 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8456 | hdd_err("<iwpriv wlan0 pm_dlist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8457 | cds_decr_connection_count_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8458 | apps_args[1]); |
| 8459 | } |
| 8460 | break; |
| 8461 | |
| 8462 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 8463 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8464 | hdd_err("<iwpriv wlan0 pm_ulist> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8465 | cds_update_connection_info_utfw(apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8466 | apps_args[1], apps_args[2], apps_args[3], |
| 8467 | apps_args[4], apps_args[5], apps_args[6], |
| 8468 | apps_args[7]); |
| 8469 | } |
| 8470 | break; |
| 8471 | |
| 8472 | case WE_POLICY_MANAGER_DBS_CMD: |
| 8473 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8474 | hdd_err("<iwpriv wlan0 pm_dbs> is called"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8475 | if (apps_args[0] == 0) |
| 8476 | wma_set_dbs_capability_ut(0); |
| 8477 | else |
| 8478 | wma_set_dbs_capability_ut(1); |
| 8479 | |
| 8480 | if (apps_args[1] >= CDS_THROUGHPUT && |
| 8481 | apps_args[1] <= CDS_LATENCY) { |
| 8482 | pr_info("setting system pref to [%d]\n", apps_args[1]); |
| 8483 | hdd_ctx->config->conc_system_pref = apps_args[1]; |
| 8484 | } |
| 8485 | } |
| 8486 | break; |
| 8487 | |
| 8488 | case WE_POLICY_MANAGER_PCL_CMD: |
| 8489 | { |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 8490 | uint8_t pcl[QDF_MAX_NUM_CHAN] = {0}; |
| 8491 | uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8492 | uint32_t pcl_len = 0, i = 0; |
| 8493 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8494 | hdd_err("<iwpriv wlan0 pm_pcl> is called"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8495 | |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8496 | cds_get_pcl(apps_args[0], |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8497 | pcl, &pcl_len, |
| 8498 | weight_list, QDF_ARRAY_SIZE(weight_list)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8499 | pr_info("PCL list for role[%d] is {", apps_args[0]); |
| 8500 | for (i = 0 ; i < pcl_len; i++) |
| 8501 | pr_info(" %d, ", pcl[i]); |
| 8502 | pr_info("}--------->\n"); |
| 8503 | } |
| 8504 | break; |
| 8505 | |
| 8506 | case WE_POLICY_MANAGER_CINFO_CMD: |
| 8507 | { |
| 8508 | struct cds_conc_connection_info *conn_info; |
| 8509 | uint32_t i = 0, len = 0; |
| 8510 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8511 | hdd_err("<iwpriv wlan0 pm_cinfo> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8512 | conn_info = cds_get_conn_info(&len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8513 | pr_info("+-----------------------------+\n"); |
| 8514 | for (i = 0; i < len; i++) { |
| 8515 | pr_info("|table_index[%d]\t\t|\n", i); |
| 8516 | 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] | 8517 | pr_info("|\t|chan - %d\t\t|\n", conn_info->chan); |
Tushnim Bhattacharyya | 7624a18 | 2016-03-30 13:30:46 -0700 | [diff] [blame] | 8518 | pr_info("|\t|bw - %d\t\t|\n", conn_info->bw); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8519 | pr_info("|\t|mode - %d\t\t|\n", conn_info->mode); |
| 8520 | pr_info("|\t|mac - %d\t\t|\n", conn_info->mac); |
| 8521 | pr_info("|\t|in_use - %d\t\t|\n", conn_info->in_use); |
| 8522 | pr_info("+-----------------------------+\n"); |
| 8523 | conn_info++; |
| 8524 | } |
| 8525 | } |
| 8526 | break; |
| 8527 | |
| 8528 | case WE_POLICY_SET_HW_MODE_CMD: |
| 8529 | { |
| 8530 | if (apps_args[0] == 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8531 | hdd_err("set hw mode for single mac"); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8532 | cds_pdev_set_hw_mode( |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8533 | pAdapter->sessionId, |
| 8534 | HW_MODE_SS_2x2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8535 | HW_MODE_80_MHZ, |
| 8536 | HW_MODE_SS_0x0, HW_MODE_BW_NONE, |
| 8537 | HW_MODE_DBS_NONE, |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8538 | HW_MODE_AGILE_DFS_NONE, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 8539 | HW_MODE_SBS_NONE, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8540 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8541 | } else if (apps_args[0] == 1) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8542 | hdd_err("set hw mode for dual mac"); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8543 | cds_pdev_set_hw_mode( |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8544 | pAdapter->sessionId, |
| 8545 | HW_MODE_SS_1x1, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8546 | HW_MODE_80_MHZ, |
| 8547 | HW_MODE_SS_1x1, HW_MODE_40_MHZ, |
| 8548 | HW_MODE_DBS, |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8549 | HW_MODE_AGILE_DFS_NONE, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 8550 | HW_MODE_SBS_NONE, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8551 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8552 | } |
| 8553 | } |
| 8554 | break; |
| 8555 | |
| 8556 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 8557 | { |
| 8558 | enum cds_conc_next_action action; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8559 | hdd_err("<iwpriv wlan0 pm_query_action> is called"); |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 8560 | action = cds_current_connections_update(pAdapter->sessionId, |
| 8561 | apps_args[0], |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 8562 | SIR_UPDATE_REASON_UT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8563 | pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action); |
| 8564 | } |
| 8565 | break; |
| 8566 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 8567 | { |
| 8568 | bool allow; |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8569 | hdd_err("<iwpriv wlan0 pm_query_allow> is called"); |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 8570 | allow = cds_allow_concurrency( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8571 | apps_args[0], apps_args[1], apps_args[2]); |
| 8572 | pr_info("allow %d {0 = don't allow, 1 = allow}", allow); |
| 8573 | } |
| 8574 | break; |
| 8575 | |
| 8576 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 8577 | { |
| 8578 | clean_report(hdd_ctx); |
| 8579 | if (apps_args[0] == 1) { |
| 8580 | wlan_hdd_one_connection_scenario(hdd_ctx); |
| 8581 | } else if (apps_args[0] == 2) { |
| 8582 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8583 | 6, CDS_TWO_TWO); |
| 8584 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8585 | 36, CDS_TWO_TWO); |
| 8586 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8587 | 6, CDS_ONE_ONE); |
| 8588 | wlan_hdd_two_connections_scenario(hdd_ctx, |
| 8589 | 36, CDS_ONE_ONE); |
| 8590 | } else if (apps_args[0] == 3) { |
| 8591 | /* MCC on same band with 2x2 same mac*/ |
| 8592 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8593 | 6, 11, CDS_TWO_TWO, 0); |
| 8594 | /* MCC on diff band with 2x2 same mac*/ |
| 8595 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8596 | 6, 36, CDS_TWO_TWO, 0); |
| 8597 | /* MCC on diff band with 1x1 diff mac */ |
| 8598 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8599 | 36, 6, CDS_ONE_ONE, 0); |
| 8600 | /* MCC on diff band with 1x1 same mac */ |
| 8601 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8602 | 36, 6, CDS_ONE_ONE, 1); |
| 8603 | /* SCC on same band with 2x2 same mac */ |
| 8604 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8605 | 36, 36, CDS_TWO_TWO, 0); |
| 8606 | /* SCC on same band with 1x1 same mac */ |
| 8607 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8608 | 36, 36, CDS_ONE_ONE, 1); |
| 8609 | /* MCC on same band with 2x2 same mac */ |
| 8610 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8611 | 36, 149, CDS_TWO_TWO, 0); |
| 8612 | /* MCC on same band with 1x1 same mac */ |
| 8613 | wlan_hdd_three_connections_scenario(hdd_ctx, |
| 8614 | 36, 149, CDS_ONE_ONE, 1); |
| 8615 | } |
| 8616 | print_report(hdd_ctx); |
| 8617 | } |
| 8618 | break; |
| 8619 | |
| 8620 | #ifdef FEATURE_WLAN_TDLS |
| 8621 | case WE_TDLS_CONFIG_PARAMS: |
| 8622 | { |
| 8623 | tdls_config_params_t tdlsParams; |
| 8624 | |
| 8625 | tdlsParams.tdls = apps_args[0]; |
| 8626 | tdlsParams.tx_period_t = apps_args[1]; |
| 8627 | tdlsParams.tx_packet_n = apps_args[2]; |
| 8628 | /* ignore args[3] as discovery_period is not used anymore */ |
| 8629 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 8630 | /* ignore args[5] as idle_timeout is not used anymore */ |
| 8631 | tdlsParams.idle_packet_n = apps_args[6]; |
| 8632 | /* ignore args[7] as rssi_hysteresis is not used anymore */ |
| 8633 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 8634 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
| 8635 | tdlsParams.rssi_delta = apps_args[10]; |
| 8636 | |
| 8637 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
| 8638 | } |
| 8639 | break; |
| 8640 | #endif |
| 8641 | case WE_UNIT_TEST_CMD: |
| 8642 | { |
| 8643 | t_wma_unit_test_cmd *unitTestArgs; |
| 8644 | cds_msg_t msg = { 0 }; |
| 8645 | int i, j; |
| 8646 | if ((apps_args[0] < WLAN_MODULE_ID_MIN) || |
| 8647 | (apps_args[0] >= WLAN_MODULE_ID_MAX)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8648 | hdd_err("Invalid MODULE ID %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8649 | apps_args[0]); |
| 8650 | return -EINVAL; |
| 8651 | } |
Anurag Chouhan | 7756418 | 2016-09-03 16:38:01 +0530 | [diff] [blame] | 8652 | if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) || |
| 8653 | (apps_args[1] < 0)) { |
| 8654 | hdd_err("Too Many/Few args %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8655 | apps_args[1]); |
| 8656 | return -EINVAL; |
| 8657 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8658 | unitTestArgs = qdf_mem_malloc(sizeof(*unitTestArgs)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8659 | if (NULL == unitTestArgs) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8660 | hdd_err("qdf_mem_malloc failed for unitTestArgs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8661 | return -ENOMEM; |
| 8662 | } |
| 8663 | unitTestArgs->vdev_id = (int)pAdapter->sessionId; |
| 8664 | unitTestArgs->module_id = apps_args[0]; |
| 8665 | unitTestArgs->num_args = apps_args[1]; |
| 8666 | for (i = 0, j = 2; i < unitTestArgs->num_args; i++, j++) { |
| 8667 | unitTestArgs->args[i] = apps_args[j]; |
| 8668 | } |
| 8669 | msg.type = SIR_HAL_UNIT_TEST_CMD; |
| 8670 | msg.reserved = 0; |
| 8671 | msg.bodyptr = unitTestArgs; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8672 | if (QDF_STATUS_SUCCESS != |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8673 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8674 | qdf_mem_free(unitTestArgs); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8675 | hdd_err("Not able to post UNIT_TEST_CMD message to WMA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8676 | return -EINVAL; |
| 8677 | } |
| 8678 | } |
| 8679 | break; |
| 8680 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 8681 | case WE_LED_FLASHING_PARAM: |
| 8682 | { |
| 8683 | int i; |
| 8684 | if (num_args != 4) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8685 | hdd_err("gpio_control: 4 parameters are required"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8686 | return -EINVAL; |
| 8687 | } |
| 8688 | for (i = 0; i < num_args; i++) { |
| 8689 | if (apps_args[i] >= 0x7fffffff) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8690 | hdd_err("gpio_control: parameter should be less than 0x7fffffff"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8691 | return -EINVAL; |
| 8692 | } |
| 8693 | } |
| 8694 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8695 | 0, apps_args[0], apps_args[1]); |
| 8696 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8697 | 1, apps_args[2], apps_args[3]); |
| 8698 | } |
| 8699 | break; |
| 8700 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 8701 | case WE_SET_PKTLOG: |
| 8702 | { |
| 8703 | int ret; |
| 8704 | |
| 8705 | if (num_args < 1 || num_args > 2) { |
| 8706 | hdd_err("pktlog: either 1 or 2 parameters are required"); |
| 8707 | return -EINVAL; |
| 8708 | } |
| 8709 | |
| 8710 | ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0], |
| 8711 | apps_args[1]); |
| 8712 | if (ret) |
| 8713 | return ret; |
| 8714 | break; |
| 8715 | } |
| 8716 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 8717 | case WE_MAC_PWR_DEBUG_CMD: |
| 8718 | { |
| 8719 | struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args; |
| 8720 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8721 | int i, j; |
| 8722 | |
| 8723 | if (num_args < 3) { |
| 8724 | hdd_err("number of arguments can't be null %d", |
| 8725 | num_args); |
| 8726 | return -EINVAL; |
| 8727 | } |
| 8728 | if (num_args - 3 != apps_args[2]) { |
| 8729 | hdd_err("arg list of size %d doesn't match num_args %d", |
| 8730 | num_args-3, apps_args[2]); |
| 8731 | return -EINVAL; |
| 8732 | } |
| 8733 | if ((apps_args[1] < WLAN_MODULE_ID_MIN) || |
| 8734 | (apps_args[1] >= WLAN_MODULE_ID_MAX)) { |
| 8735 | hdd_err("Invalid MODULE ID %d", apps_args[1]); |
| 8736 | return -EINVAL; |
| 8737 | } |
| 8738 | if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) { |
| 8739 | hdd_err("Too Many args %d", apps_args[2]); |
| 8740 | return -EINVAL; |
| 8741 | } |
| 8742 | mac_pwr_dbg_args.pdev_id = apps_args[0]; |
| 8743 | mac_pwr_dbg_args.module_id = apps_args[1]; |
| 8744 | mac_pwr_dbg_args.num_args = apps_args[2]; |
| 8745 | |
| 8746 | for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++) |
| 8747 | mac_pwr_dbg_args.args[i] = apps_args[j]; |
| 8748 | |
| 8749 | if (QDF_STATUS_SUCCESS != |
| 8750 | sme_process_mac_pwr_dbg_cmd(hal, pAdapter->sessionId, |
| 8751 | &mac_pwr_dbg_args)) { |
| 8752 | return -EINVAL; |
| 8753 | } |
| 8754 | } |
| 8755 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8756 | default: |
| 8757 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8758 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8759 | } |
| 8760 | break; |
| 8761 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8762 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8763 | return 0; |
| 8764 | } |
| 8765 | |
| 8766 | /** |
| 8767 | * iw_hdd_set_var_ints_getnone() - set var ints getnone callback |
| 8768 | * @dev: pointer to net_device structure |
| 8769 | * @info: pointer to iw_request_info structure |
| 8770 | * @wrqu: pointer to iwreq_data |
| 8771 | * @extra; extra |
| 8772 | * |
| 8773 | * Return: 0 on success, error number otherwise |
| 8774 | * |
| 8775 | */ |
| 8776 | static int iw_hdd_set_var_ints_getnone(struct net_device *dev, |
| 8777 | struct iw_request_info *info, |
| 8778 | union iwreq_data *wrqu, char *extra) |
| 8779 | { |
| 8780 | union iwreq_data u_priv_wrqu; |
| 8781 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 8782 | int ret, num_args; |
| 8783 | |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 8784 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8785 | hdd_err("permission check failed"); |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 8786 | return -EPERM; |
| 8787 | } |
| 8788 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8789 | /* Helper function to get iwreq_data with compat handling. */ |
| 8790 | if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) |
| 8791 | return -EINVAL; |
| 8792 | |
| 8793 | if (NULL == u_priv_wrqu.data.pointer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8794 | hdd_err("NULL data pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8795 | return -EINVAL; |
| 8796 | } |
| 8797 | |
| 8798 | num_args = u_priv_wrqu.data.length; |
| 8799 | if (num_args > MAX_VAR_ARGS) |
| 8800 | num_args = MAX_VAR_ARGS; |
| 8801 | |
| 8802 | if (copy_from_user(apps_args, u_priv_wrqu.data.pointer, |
| 8803 | (sizeof(int)) * num_args)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8804 | hdd_err("failed to copy data from user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8805 | return -EFAULT; |
| 8806 | } |
| 8807 | |
| 8808 | cds_ssr_protect(__func__); |
| 8809 | ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu, |
| 8810 | (char *)&apps_args); |
| 8811 | cds_ssr_unprotect(__func__); |
| 8812 | return ret; |
| 8813 | } |
| 8814 | |
| 8815 | /** |
| 8816 | * iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 8817 | * @dev: device upon which the ioctl was received |
| 8818 | * @info: ioctl request information |
| 8819 | * @wrqu: ioctl request data |
| 8820 | * @extra: ioctl extra data |
| 8821 | * |
| 8822 | * This is a generic handler for private ioctls which take multiple |
| 8823 | * arguments. Note that this implementation is also somewhat unique |
| 8824 | * in that it is shared by both STA-mode and SAP-mode interfaces. |
| 8825 | * |
| 8826 | * Return: 0 on success, non-zero on error |
| 8827 | */ |
| 8828 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 8829 | struct iw_request_info *info, |
| 8830 | union iwreq_data *wrqu, char *extra) |
| 8831 | { |
| 8832 | int ret; |
| 8833 | |
| 8834 | cds_ssr_protect(__func__); |
| 8835 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 8836 | cds_ssr_unprotect(__func__); |
| 8837 | return ret; |
| 8838 | } |
| 8839 | |
| 8840 | /** |
| 8841 | * iw_add_tspec - Add TSpec private ioctl handler |
| 8842 | * @dev: device upon which the ioctl was received |
| 8843 | * @info: ioctl request information |
| 8844 | * @wrqu: ioctl request data |
| 8845 | * @extra: ioctl extra data |
| 8846 | * |
| 8847 | * Return: 0 on success, non-zero on error |
| 8848 | */ |
| 8849 | static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info, |
| 8850 | union iwreq_data *wrqu, char *extra) |
| 8851 | { |
| 8852 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8853 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8854 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 8855 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
| 8856 | sme_QosWmmTspecInfo tSpec; |
| 8857 | uint32_t handle; |
| 8858 | struct iw_point s_priv_data; |
| 8859 | hdd_context_t *hdd_ctx; |
| 8860 | int ret; |
| 8861 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8862 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8863 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8864 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 8865 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8866 | if (0 != ret) |
| 8867 | return ret; |
| 8868 | |
| 8869 | /* make sure the application is sufficiently priviledged */ |
| 8870 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 8871 | /* this ioctl wants to return status to user space it must be */ |
| 8872 | /* defined as a "get" ioctl */ |
| 8873 | if (!capable(CAP_NET_ADMIN)) { |
| 8874 | return -EPERM; |
| 8875 | } |
| 8876 | |
| 8877 | /* we must be associated in order to add a tspec */ |
| 8878 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 8879 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8880 | return 0; |
| 8881 | } |
| 8882 | /* since we are defined to be a "get" ioctl, and since the number */ |
| 8883 | /* of params exceeds the number of params that wireless extensions */ |
| 8884 | /* will pass down in the iwreq_data, we must copy the "set" params. */ |
| 8885 | /* We must handle the compat for iwreq_data in 32U/64K environment. */ |
| 8886 | |
| 8887 | /* helper function to get iwreq_data with compat handling. */ |
| 8888 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 8889 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8890 | return 0; |
| 8891 | } |
| 8892 | /* make sure all params are correctly passed to function */ |
| 8893 | if ((NULL == s_priv_data.pointer) || |
| 8894 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) { |
| 8895 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8896 | return 0; |
| 8897 | } |
| 8898 | /* from user space ourselves */ |
| 8899 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) { |
| 8900 | /* hmmm, can't get them */ |
| 8901 | return -EIO; |
| 8902 | } |
| 8903 | /* clear the tspec */ |
| 8904 | memset(&tSpec, 0, sizeof(tSpec)); |
| 8905 | |
| 8906 | /* validate the handle */ |
| 8907 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8908 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 8909 | /* that one is reserved */ |
| 8910 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8911 | return 0; |
| 8912 | } |
| 8913 | /* validate the TID */ |
| 8914 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) { |
| 8915 | /* out of range */ |
| 8916 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8917 | return 0; |
| 8918 | } |
| 8919 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 8920 | |
| 8921 | /* validate the direction */ |
| 8922 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) { |
| 8923 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 8924 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 8925 | break; |
| 8926 | |
| 8927 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 8928 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 8929 | break; |
| 8930 | |
| 8931 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 8932 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 8933 | break; |
| 8934 | |
| 8935 | default: |
| 8936 | /* unknown */ |
| 8937 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8938 | return 0; |
| 8939 | } |
| 8940 | |
| 8941 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 8942 | |
| 8943 | /* validate the user priority */ |
| 8944 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) { |
| 8945 | /* out of range */ |
| 8946 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8947 | return 0; |
| 8948 | } |
| 8949 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
| 8950 | 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] | 8951 | hdd_err("***ts_info.up out of bounds***"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8952 | return 0; |
| 8953 | } |
| 8954 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8955 | hdd_info("TS_INFO PSB %d UP %d !!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8956 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 8957 | |
| 8958 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 8959 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 8960 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 8961 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 8962 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 8963 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 8964 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 8965 | tSpec.surplus_bw_allowance = |
| 8966 | params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 8967 | tSpec.min_service_interval = |
| 8968 | params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 8969 | tSpec.max_service_interval = |
| 8970 | params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 8971 | tSpec.suspension_interval = |
| 8972 | params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 8973 | tSpec.inactivity_interval = |
| 8974 | params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 8975 | |
| 8976 | tSpec.ts_info.burst_size_defn = |
| 8977 | params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 8978 | |
| 8979 | /* validate the ts info ack policy */ |
| 8980 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) { |
| 8981 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 8982 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 8983 | break; |
| 8984 | |
| 8985 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 8986 | tSpec.ts_info.ack_policy = |
| 8987 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 8988 | break; |
| 8989 | |
| 8990 | default: |
| 8991 | /* unknown */ |
| 8992 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8993 | return 0; |
| 8994 | } |
| 8995 | |
| 8996 | *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8997 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8998 | return 0; |
| 8999 | } |
| 9000 | |
| 9001 | static int iw_add_tspec(struct net_device *dev, |
| 9002 | struct iw_request_info *info, |
| 9003 | union iwreq_data *wrqu, char *extra) |
| 9004 | { |
| 9005 | int ret; |
| 9006 | |
| 9007 | cds_ssr_protect(__func__); |
| 9008 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 9009 | cds_ssr_unprotect(__func__); |
| 9010 | |
| 9011 | return ret; |
| 9012 | } |
| 9013 | |
| 9014 | /** |
| 9015 | * iw_del_tspec - Delete TSpec private ioctl handler |
| 9016 | * @dev: device upon which the ioctl was received |
| 9017 | * @info: ioctl request information |
| 9018 | * @wrqu: ioctl request data |
| 9019 | * @extra: ioctl extra data |
| 9020 | * |
| 9021 | * Return: 0 on success, non-zero on error |
| 9022 | */ |
| 9023 | static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info, |
| 9024 | union iwreq_data *wrqu, char *extra) |
| 9025 | { |
| 9026 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9027 | hdd_context_t *hdd_ctx; |
| 9028 | int *params = (int *)extra; |
| 9029 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 9030 | uint32_t handle; |
| 9031 | int ret; |
| 9032 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9033 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9034 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9035 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9036 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9037 | if (0 != ret) |
| 9038 | return ret; |
| 9039 | |
| 9040 | /* make sure the application is sufficiently priviledged */ |
| 9041 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 9042 | /* this ioctl wants to return status to user space it must be */ |
| 9043 | /* defined as a "get" ioctl */ |
| 9044 | if (!capable(CAP_NET_ADMIN)) { |
| 9045 | return -EPERM; |
| 9046 | } |
| 9047 | |
| 9048 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 9049 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 9050 | /* is no need to copy the params from user space */ |
| 9051 | |
| 9052 | /* validate the handle */ |
| 9053 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 9054 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 9055 | /* that one is reserved */ |
| 9056 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9057 | return 0; |
| 9058 | } |
| 9059 | |
| 9060 | *pStatus = hdd_wmm_delts(pAdapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9061 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9062 | return 0; |
| 9063 | } |
| 9064 | |
| 9065 | static int iw_del_tspec(struct net_device *dev, |
| 9066 | struct iw_request_info *info, |
| 9067 | union iwreq_data *wrqu, char *extra) |
| 9068 | { |
| 9069 | int ret; |
| 9070 | |
| 9071 | cds_ssr_protect(__func__); |
| 9072 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 9073 | cds_ssr_unprotect(__func__); |
| 9074 | |
| 9075 | return ret; |
| 9076 | } |
| 9077 | |
| 9078 | /** |
| 9079 | * iw_get_tspec - Get TSpec private ioctl handler |
| 9080 | * @dev: device upon which the ioctl was received |
| 9081 | * @info: ioctl request information |
| 9082 | * @wrqu: ioctl request data |
| 9083 | * @extra: ioctl extra data |
| 9084 | * |
| 9085 | * Return: 0 on success, non-zero on error |
| 9086 | */ |
| 9087 | static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info, |
| 9088 | union iwreq_data *wrqu, char *extra) |
| 9089 | { |
| 9090 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9091 | hdd_context_t *hdd_ctx; |
| 9092 | int *params = (int *)extra; |
| 9093 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 9094 | uint32_t handle; |
| 9095 | int ret; |
| 9096 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9097 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9098 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9099 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9100 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9101 | if (0 != ret) |
| 9102 | return ret; |
| 9103 | |
| 9104 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 9105 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 9106 | /* is no need to copy the params from user space */ |
| 9107 | |
| 9108 | /* validate the handle */ |
| 9109 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 9110 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 9111 | /* that one is reserved */ |
| 9112 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9113 | return 0; |
| 9114 | } |
| 9115 | |
| 9116 | *pStatus = hdd_wmm_checkts(pAdapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9117 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9118 | return 0; |
| 9119 | } |
| 9120 | |
| 9121 | static int iw_get_tspec(struct net_device *dev, |
| 9122 | struct iw_request_info *info, |
| 9123 | union iwreq_data *wrqu, char *extra) |
| 9124 | { |
| 9125 | int ret; |
| 9126 | |
| 9127 | cds_ssr_protect(__func__); |
| 9128 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 9129 | cds_ssr_unprotect(__func__); |
| 9130 | |
| 9131 | return ret; |
| 9132 | } |
| 9133 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9134 | /** |
| 9135 | * iw_set_fties - Set FT IEs private ioctl handler |
| 9136 | * @dev: device upon which the ioctl was received |
| 9137 | * @info: ioctl request information |
| 9138 | * @wrqu: ioctl request data |
| 9139 | * @extra: ioctl extra data |
| 9140 | * |
| 9141 | * Each time the supplicant has the auth_request or reassoc request |
| 9142 | * IEs ready they are pushed to the driver. The driver will in turn |
| 9143 | * use it to send out the auth req and reassoc req for 11r FT Assoc. |
| 9144 | * |
| 9145 | * Return: 0 on success, non-zero on error |
| 9146 | */ |
| 9147 | static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info, |
| 9148 | union iwreq_data *wrqu, char *extra) |
| 9149 | { |
| 9150 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9151 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9152 | hdd_context_t *hdd_ctx; |
| 9153 | int ret; |
| 9154 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9155 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9156 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9157 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9158 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9159 | if (0 != ret) |
| 9160 | return ret; |
| 9161 | |
| 9162 | if (!wrqu->data.length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9163 | hdd_err("called with 0 length IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9164 | return -EINVAL; |
| 9165 | } |
| 9166 | if (wrqu->data.pointer == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9167 | hdd_err("called with NULL IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9168 | return -EINVAL; |
| 9169 | } |
| 9170 | /* Added for debug on reception of Re-assoc Req. */ |
| 9171 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9172 | hdd_err("Called with Ie of length = %d when not associated", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9173 | wrqu->data.length); |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9174 | hdd_err("Should be Re-assoc Req IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9175 | } |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9176 | hdd_notice("called with Ie of length = %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9177 | |
| 9178 | /* Pass the received FT IEs to SME */ |
| 9179 | sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 9180 | extra, wrqu->data.length); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9181 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9182 | return 0; |
| 9183 | } |
| 9184 | |
| 9185 | static int iw_set_fties(struct net_device *dev, |
| 9186 | struct iw_request_info *info, |
| 9187 | union iwreq_data *wrqu, char *extra) |
| 9188 | { |
| 9189 | int ret; |
| 9190 | |
| 9191 | cds_ssr_protect(__func__); |
| 9192 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 9193 | cds_ssr_unprotect(__func__); |
| 9194 | |
| 9195 | return ret; |
| 9196 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9197 | |
| 9198 | /** |
| 9199 | * iw_set_host_offload - Set host offload ioctl handler |
| 9200 | * @dev: device upon which the ioctl was received |
| 9201 | * @info: ioctl request information |
| 9202 | * @wrqu: ioctl request data |
| 9203 | * @extra: ioctl extra data |
| 9204 | * |
| 9205 | * Return: 0 on success, non-zero on error |
| 9206 | */ |
| 9207 | static int __iw_set_host_offload(struct net_device *dev, |
| 9208 | struct iw_request_info *info, |
| 9209 | union iwreq_data *wrqu, char *extra) |
| 9210 | { |
| 9211 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9212 | tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra; |
| 9213 | tSirHostOffloadReq offloadRequest; |
| 9214 | hdd_context_t *hdd_ctx; |
| 9215 | int ret; |
| 9216 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9217 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9218 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9219 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9220 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9221 | if (0 != ret) |
| 9222 | return ret; |
| 9223 | |
| 9224 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9225 | hdd_err("dev is not in CONNECTED state, ignore!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9226 | return -EINVAL; |
| 9227 | } |
| 9228 | |
| 9229 | /* Debug display of request components. */ |
| 9230 | switch (pRequest->offloadType) { |
| 9231 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9232 | hdd_warn("Host offload request: ARP reply"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9233 | switch (pRequest->enableOrDisable) { |
| 9234 | case WLAN_OFFLOAD_DISABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9235 | hdd_warn(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9236 | break; |
| 9237 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9238 | hdd_warn(" BC Filtering enable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9239 | case WLAN_OFFLOAD_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9240 | hdd_warn(" ARP offload enable"); |
| 9241 | hdd_warn(" IP address: %d.%d.%d.%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9242 | pRequest->params.hostIpv4Addr[0], |
| 9243 | pRequest->params.hostIpv4Addr[1], |
| 9244 | pRequest->params.hostIpv4Addr[2], |
| 9245 | pRequest->params.hostIpv4Addr[3]); |
| 9246 | } |
| 9247 | break; |
| 9248 | |
| 9249 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9250 | hdd_info("Host offload request: neighbor discovery"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9251 | switch (pRequest->enableOrDisable) { |
| 9252 | case WLAN_OFFLOAD_DISABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9253 | hdd_info(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9254 | break; |
| 9255 | case WLAN_OFFLOAD_ENABLE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9256 | hdd_info(" enable"); |
| 9257 | hdd_info(" IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9258 | *(uint16_t *) (pRequest->params.hostIpv6Addr), |
| 9259 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9260 | 2), |
| 9261 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9262 | 4), |
| 9263 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9264 | 6), |
| 9265 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9266 | 8), |
| 9267 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9268 | 10), |
| 9269 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9270 | 12), |
| 9271 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 9272 | 14)); |
| 9273 | } |
| 9274 | } |
| 9275 | |
| 9276 | /* Execute offload request. The reason that we can copy the |
| 9277 | * request information from the ioctl structure to the SME |
| 9278 | * structure is that they are laid out exactly the same. |
| 9279 | * Otherwise, each piece of information would have to be |
| 9280 | * copied individually. |
| 9281 | */ |
| 9282 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9283 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9284 | sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9285 | pAdapter->sessionId, &offloadRequest)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9286 | hdd_err("Failure to execute host offload request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9287 | return -EINVAL; |
| 9288 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9289 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9290 | return 0; |
| 9291 | } |
| 9292 | |
| 9293 | static int iw_set_host_offload(struct net_device *dev, |
| 9294 | struct iw_request_info *info, |
| 9295 | union iwreq_data *wrqu, char *extra) |
| 9296 | { |
| 9297 | int ret; |
| 9298 | |
| 9299 | cds_ssr_protect(__func__); |
| 9300 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 9301 | cds_ssr_unprotect(__func__); |
| 9302 | |
| 9303 | return ret; |
| 9304 | } |
| 9305 | |
| 9306 | /** |
| 9307 | * iw_set_keepalive_params - Set keepalive params ioctl handler |
| 9308 | * @dev: device upon which the ioctl was received |
| 9309 | * @info: ioctl request information |
| 9310 | * @wrqu: ioctl request data |
| 9311 | * @extra: ioctl extra data |
| 9312 | * |
| 9313 | * Return: 0 on success, non-zero on error |
| 9314 | */ |
| 9315 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 9316 | struct iw_request_info *info, |
| 9317 | union iwreq_data *wrqu, char *extra) |
| 9318 | { |
| 9319 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9320 | tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9321 | hdd_context_t *hdd_ctx; |
| 9322 | int ret; |
| 9323 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9324 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9325 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9326 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9327 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9328 | if (0 != ret) |
| 9329 | return ret; |
| 9330 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9331 | if (wrqu->data.length != sizeof(*request)) { |
| 9332 | hdd_err("Invalid length %d", wrqu->data.length); |
| 9333 | return -EINVAL; |
| 9334 | } |
| 9335 | |
| 9336 | if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) { |
| 9337 | hdd_err("Value of timePeriod %d exceed Max limit %d", |
| 9338 | request->timePeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9339 | WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX); |
| 9340 | return -EINVAL; |
| 9341 | } |
| 9342 | |
| 9343 | /* Debug display of request components. */ |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9344 | hdd_info("Set Keep Alive Request : TimePeriod %d size %zu", |
| 9345 | request->timePeriod, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9346 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9347 | switch (request->packetType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9348 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9349 | hdd_info("Keep Alive Request: Tx NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9350 | break; |
| 9351 | |
| 9352 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9353 | hdd_info("Keep Alive Request: Tx UnSolicited ARP RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9354 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9355 | hdd_info("Host IP address: %d.%d.%d.%d", |
| 9356 | request->hostIpv4Addr[0], request->hostIpv4Addr[1], |
| 9357 | request->hostIpv4Addr[2], request->hostIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9358 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9359 | hdd_info("Dest IP address: %d.%d.%d.%d", |
| 9360 | request->destIpv4Addr[0], request->destIpv4Addr[1], |
| 9361 | request->destIpv4Addr[2], request->destIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9362 | |
Srinivas Girigowda | 9c330a9 | 2015-11-24 12:28:25 -0800 | [diff] [blame] | 9363 | hdd_info("Dest MAC address: "MAC_ADDRESS_STR, |
| 9364 | MAC_ADDR_ARRAY(request->dest_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9365 | break; |
| 9366 | } |
| 9367 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9368 | hdd_info("Keep alive period %d", request->timePeriod); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9369 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9370 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9371 | sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 9372 | pAdapter->sessionId, request)) { |
| 9373 | hdd_err("Failure to execute Keep Alive"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9374 | return -EINVAL; |
| 9375 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9376 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9377 | return 0; |
| 9378 | } |
| 9379 | |
| 9380 | static int iw_set_keepalive_params(struct net_device *dev, |
| 9381 | struct iw_request_info *info, |
| 9382 | union iwreq_data *wrqu, |
| 9383 | char *extra) |
| 9384 | { |
| 9385 | int ret; |
| 9386 | |
| 9387 | cds_ssr_protect(__func__); |
| 9388 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 9389 | cds_ssr_unprotect(__func__); |
| 9390 | |
| 9391 | return ret; |
| 9392 | } |
| 9393 | |
| 9394 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 9395 | /** |
| 9396 | * wlan_hdd_set_filter() - Set packet filter |
| 9397 | * @hdd_ctx: Global HDD context |
| 9398 | * @request: Packet filter request struct |
| 9399 | * @sessionId: Target session for the request |
| 9400 | * |
| 9401 | * Return: 0 on success, non-zero on error |
| 9402 | */ |
| 9403 | static int wlan_hdd_set_filter(hdd_context_t *hdd_ctx, |
| 9404 | struct pkt_filter_cfg *request, |
| 9405 | uint8_t sessionId) |
| 9406 | { |
| 9407 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 9408 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
| 9409 | int i = 0; |
| 9410 | |
| 9411 | if (hdd_ctx->config->disablePacketFilter) { |
| 9412 | hdd_err("packet filtering disabled in ini returning"); |
| 9413 | return 0; |
| 9414 | } |
| 9415 | |
| 9416 | /* Debug display of request components. */ |
| 9417 | hdd_info("Packet Filter Request : FA %d params %d", |
| 9418 | request->filter_action, request->num_params); |
| 9419 | |
| 9420 | switch (request->filter_action) { |
| 9421 | case HDD_RCV_FILTER_SET: |
| 9422 | hdd_info("Set Packet Filter Request for Id: %d", |
| 9423 | request->filter_id); |
| 9424 | |
| 9425 | packetFilterSetReq.filterId = request->filter_id; |
| 9426 | if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) { |
| 9427 | hdd_err("Number of Params exceed Max limit %d", |
| 9428 | request->num_params); |
| 9429 | return -EINVAL; |
| 9430 | } |
| 9431 | packetFilterSetReq.numFieldParams = request->num_params; |
| 9432 | packetFilterSetReq.coalesceTime = 0; |
| 9433 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 9434 | for (i = 0; i < request->num_params; i++) { |
| 9435 | packetFilterSetReq.paramsData[i].protocolLayer = |
| 9436 | request->params_data[i].protocol_layer; |
| 9437 | packetFilterSetReq.paramsData[i].cmpFlag = |
| 9438 | request->params_data[i].compare_flag; |
| 9439 | packetFilterSetReq.paramsData[i].dataOffset = |
| 9440 | request->params_data[i].data_offset; |
| 9441 | packetFilterSetReq.paramsData[i].dataLength = |
| 9442 | request->params_data[i].data_length; |
| 9443 | packetFilterSetReq.paramsData[i].reserved = 0; |
| 9444 | |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 9445 | if (request->params_data[i].data_offset > |
| 9446 | SIR_MAX_FILTER_TEST_DATA_OFFSET) { |
| 9447 | hdd_err("Invalid data offset %u for param %d (max = %d)", |
| 9448 | request->params_data[i].data_offset, |
| 9449 | i, |
| 9450 | SIR_MAX_FILTER_TEST_DATA_OFFSET); |
| 9451 | return -EINVAL; |
| 9452 | } |
| 9453 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9454 | if (request->params_data[i].data_length > |
| 9455 | SIR_MAX_FILTER_TEST_DATA_LEN) { |
| 9456 | hdd_err("Error invalid data length %d", |
| 9457 | request->params_data[i].data_length); |
| 9458 | return -EINVAL; |
| 9459 | } |
| 9460 | |
| 9461 | hdd_info("Proto %d Comp Flag %d Filter Type %d", |
| 9462 | request->params_data[i].protocol_layer, |
| 9463 | request->params_data[i].compare_flag, |
| 9464 | packetFilterSetReq.filterType); |
| 9465 | |
| 9466 | hdd_info("Data Offset %d Data Len %d", |
| 9467 | request->params_data[i].data_offset, |
| 9468 | request->params_data[i].data_length); |
| 9469 | |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 9470 | if (sizeof(packetFilterSetReq.paramsData[i].compareData) |
| 9471 | < (request->params_data[i].data_length)) { |
| 9472 | hdd_err("Error invalid data length %d", |
| 9473 | request->params_data[i].data_length); |
| 9474 | return -EINVAL; |
| 9475 | } |
| 9476 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9477 | memcpy(&packetFilterSetReq.paramsData[i].compareData, |
| 9478 | request->params_data[i].compare_data, |
| 9479 | request->params_data[i].data_length); |
| 9480 | memcpy(&packetFilterSetReq.paramsData[i].dataMask, |
| 9481 | request->params_data[i].data_mask, |
| 9482 | request->params_data[i].data_length); |
| 9483 | |
| 9484 | hdd_info("CData %d CData %d CData %d CData %d CData %d CData %d", |
| 9485 | request->params_data[i].compare_data[0], |
| 9486 | request->params_data[i].compare_data[1], |
| 9487 | request->params_data[i].compare_data[2], |
| 9488 | request->params_data[i].compare_data[3], |
| 9489 | request->params_data[i].compare_data[4], |
| 9490 | request->params_data[i].compare_data[5]); |
| 9491 | |
| 9492 | hdd_info("MData %d MData %d MData %d MData %d MData %d MData %d", |
| 9493 | request->params_data[i].data_mask[0], |
| 9494 | request->params_data[i].data_mask[1], |
| 9495 | request->params_data[i].data_mask[2], |
| 9496 | request->params_data[i].data_mask[3], |
| 9497 | request->params_data[i].data_mask[4], |
| 9498 | request->params_data[i].data_mask[5]); |
| 9499 | } |
| 9500 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9501 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9502 | sme_receive_filter_set_filter(hdd_ctx->hHal, |
| 9503 | &packetFilterSetReq, |
| 9504 | sessionId)) { |
| 9505 | hdd_err("Failure to execute Set Filter"); |
| 9506 | return -EINVAL; |
| 9507 | } |
| 9508 | |
| 9509 | break; |
| 9510 | |
| 9511 | case HDD_RCV_FILTER_CLEAR: |
| 9512 | |
| 9513 | hdd_info("Clear Packet Filter Request for Id: %d", |
| 9514 | request->filter_id); |
| 9515 | packetFilterClrReq.filterId = request->filter_id; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9516 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9517 | sme_receive_filter_clear_filter(hdd_ctx->hHal, |
| 9518 | &packetFilterClrReq, |
| 9519 | sessionId)) { |
| 9520 | hdd_err("Failure to execute Clear Filter"); |
| 9521 | return -EINVAL; |
| 9522 | } |
| 9523 | break; |
| 9524 | |
| 9525 | default: |
| 9526 | hdd_err("Packet Filter Request: Invalid %d", |
| 9527 | request->filter_action); |
| 9528 | return -EINVAL; |
| 9529 | } |
| 9530 | return 0; |
| 9531 | } |
| 9532 | |
| 9533 | /** |
| 9534 | * __iw_set_packet_filter_params() - set packet filter parameters in target |
| 9535 | * @dev: Pointer to netdev |
| 9536 | * @info: Pointer to iw request info |
| 9537 | * @wrqu: Pointer to data |
| 9538 | * @extra: Pointer to extra data |
| 9539 | * |
| 9540 | * Return: 0 on success, non-zero on error |
| 9541 | */ |
| 9542 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 9543 | struct iw_request_info *info, |
| 9544 | union iwreq_data *wrqu, char *extra) |
| 9545 | { |
| 9546 | int ret; |
| 9547 | hdd_context_t *hdd_ctx; |
| 9548 | struct iw_point priv_data; |
| 9549 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9550 | struct pkt_filter_cfg *request = NULL; |
| 9551 | |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 9552 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9553 | hdd_err("permission check failed"); |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 9554 | return -EPERM; |
| 9555 | } |
| 9556 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9557 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9558 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9559 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 9560 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9561 | if (0 != ret) |
| 9562 | return ret; |
| 9563 | |
| 9564 | if (hdd_priv_get_data(&priv_data, wrqu)) { |
| 9565 | hdd_err("failed to get priv data"); |
| 9566 | return -EINVAL; |
| 9567 | } |
| 9568 | |
| 9569 | if ((NULL == priv_data.pointer) || (0 == priv_data.length)) { |
| 9570 | hdd_err("invalid priv data %p or invalid priv data length %d", |
| 9571 | priv_data.pointer, priv_data.length); |
| 9572 | return -EINVAL; |
| 9573 | } |
| 9574 | |
| 9575 | /* copy data using copy_from_user */ |
| 9576 | request = mem_alloc_copy_from_user_helper(priv_data.pointer, |
| 9577 | priv_data.length); |
| 9578 | if (NULL == request) { |
| 9579 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
| 9580 | return -ENOMEM; |
| 9581 | } |
| 9582 | |
| 9583 | ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId); |
| 9584 | |
| 9585 | kfree(request); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9586 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9587 | return ret; |
| 9588 | } |
| 9589 | |
| 9590 | /** |
| 9591 | * iw_set_packet_filter_params() - set packet filter parameters in target |
| 9592 | * @dev: Pointer to netdev |
| 9593 | * @info: Pointer to iw request info |
| 9594 | * @wrqu: Pointer to data |
| 9595 | * @extra: Pointer to extra data |
| 9596 | * |
| 9597 | * Return: 0 on success, non-zero on error |
| 9598 | */ |
| 9599 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 9600 | struct iw_request_info *info, |
| 9601 | union iwreq_data *wrqu, char *extra) |
| 9602 | { |
| 9603 | int ret; |
| 9604 | |
| 9605 | cds_ssr_protect(__func__); |
| 9606 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 9607 | cds_ssr_unprotect(__func__); |
| 9608 | |
| 9609 | return ret; |
| 9610 | } |
| 9611 | #endif |
| 9612 | |
| 9613 | |
| 9614 | static int __iw_get_statistics(struct net_device *dev, |
| 9615 | struct iw_request_info *info, |
| 9616 | union iwreq_data *wrqu, char *extra) |
| 9617 | { |
| 9618 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9619 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9620 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9621 | hdd_wext_state_t *pWextState; |
| 9622 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9623 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 9624 | char *p = extra; |
| 9625 | int tlen = 0; |
| 9626 | tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat); |
| 9627 | tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat); |
| 9628 | tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat); |
| 9629 | int ret; |
| 9630 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9631 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9632 | |
| 9633 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9634 | if (0 != ret) |
| 9635 | return ret; |
| 9636 | |
| 9637 | if (eConnectionState_Associated != |
| 9638 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { |
| 9639 | |
| 9640 | wrqu->txpower.value = 0; |
| 9641 | } else { |
| 9642 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 9643 | SME_SUMMARY_STATS | |
| 9644 | SME_GLOBAL_CLASSA_STATS | |
| 9645 | SME_GLOBAL_CLASSB_STATS | |
| 9646 | SME_GLOBAL_CLASSC_STATS | |
| 9647 | SME_GLOBAL_CLASSD_STATS | |
| 9648 | SME_PER_STA_STATS, |
| 9649 | hdd_statistics_cb, 0, false, |
| 9650 | (WLAN_HDD_GET_STATION_CTX_PTR |
| 9651 | (pAdapter))->conn_info.staId[0], |
| 9652 | pAdapter, pAdapter->sessionId); |
| 9653 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9654 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9655 | hdd_err("Unable to retrieve SME statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9656 | return -EINVAL; |
| 9657 | } |
| 9658 | |
| 9659 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9660 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9661 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 9662 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9663 | WLAN_WAIT_TIME_STATS); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 9664 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9665 | hdd_err("SME timeout while retrieving statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9666 | /*Remove the SME statistics list by passing NULL in callback argument */ |
| 9667 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 9668 | SME_SUMMARY_STATS | |
| 9669 | SME_GLOBAL_CLASSA_STATS | |
| 9670 | SME_GLOBAL_CLASSB_STATS | |
| 9671 | SME_GLOBAL_CLASSC_STATS | |
| 9672 | SME_GLOBAL_CLASSD_STATS | |
| 9673 | SME_PER_STA_STATS, |
| 9674 | NULL, 0, false, |
| 9675 | (WLAN_HDD_GET_STATION_CTX_PTR |
| 9676 | (pAdapter))->conn_info. |
| 9677 | staId[0], pAdapter, |
| 9678 | pAdapter->sessionId); |
| 9679 | |
| 9680 | return -EINVAL; |
| 9681 | } |
| 9682 | FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT, |
| 9683 | (uint8_t) sizeof(pStats->retry_cnt), |
| 9684 | (char *)&(pStats->retry_cnt[0]), tlen); |
| 9685 | |
| 9686 | FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT, |
| 9687 | (uint8_t) sizeof(pStats->multiple_retry_cnt), |
| 9688 | (char *)&(pStats->multiple_retry_cnt[0]), tlen); |
| 9689 | |
| 9690 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT, |
| 9691 | (uint8_t) sizeof(pStats->tx_frm_cnt), |
| 9692 | (char *)&(pStats->tx_frm_cnt[0]), tlen); |
| 9693 | |
| 9694 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT, |
| 9695 | (uint8_t) sizeof(pStats->rx_frm_cnt), |
| 9696 | (char *)&(pStats->rx_frm_cnt), tlen); |
| 9697 | |
| 9698 | FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT, |
| 9699 | (uint8_t) sizeof(pStats->frm_dup_cnt), |
| 9700 | (char *)&(pStats->frm_dup_cnt), tlen); |
| 9701 | |
| 9702 | FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT, |
| 9703 | (uint8_t) sizeof(pStats->fail_cnt), |
| 9704 | (char *)&(pStats->fail_cnt[0]), tlen); |
| 9705 | |
| 9706 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT, |
| 9707 | (uint8_t) sizeof(pStats->rts_fail_cnt), |
| 9708 | (char *)&(pStats->rts_fail_cnt), tlen); |
| 9709 | |
| 9710 | FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT, |
| 9711 | (uint8_t) sizeof(pStats->ack_fail_cnt), |
| 9712 | (char *)&(pStats->ack_fail_cnt), tlen); |
| 9713 | |
| 9714 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT, |
| 9715 | (uint8_t) sizeof(pStats->rts_succ_cnt), |
| 9716 | (char *)&(pStats->rts_succ_cnt), tlen); |
| 9717 | |
| 9718 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT, |
| 9719 | (uint8_t) sizeof(pStats->rx_discard_cnt), |
| 9720 | (char *)&(pStats->rx_discard_cnt), tlen); |
| 9721 | |
| 9722 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT, |
| 9723 | (uint8_t) sizeof(pStats->rx_error_cnt), |
| 9724 | (char *)&(pStats->rx_error_cnt), tlen); |
| 9725 | |
| 9726 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT, |
| 9727 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 9728 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 9729 | |
| 9730 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT, |
| 9731 | (uint8_t) sizeof(dStats->rx_byte_cnt), |
| 9732 | (char *)&(dStats->rx_byte_cnt), tlen); |
| 9733 | |
| 9734 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE, |
| 9735 | (uint8_t) sizeof(dStats->rx_rate), |
| 9736 | (char *)&(dStats->rx_rate), tlen); |
| 9737 | |
| 9738 | /* Transmit rate, in units of 500 kbit/sec */ |
| 9739 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE, |
| 9740 | (uint8_t) sizeof(aStats->tx_rate), |
| 9741 | (char *)&(aStats->tx_rate), tlen); |
| 9742 | |
| 9743 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT, |
| 9744 | (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]), |
| 9745 | (char *)&(dStats->rx_uc_byte_cnt[0]), tlen); |
| 9746 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT, |
| 9747 | (uint8_t) sizeof(dStats->rx_mc_byte_cnt), |
| 9748 | (char *)&(dStats->rx_mc_byte_cnt), tlen); |
| 9749 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT, |
| 9750 | (uint8_t) sizeof(dStats->rx_bc_byte_cnt), |
| 9751 | (char *)&(dStats->rx_bc_byte_cnt), tlen); |
| 9752 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT, |
| 9753 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 9754 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 9755 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT, |
| 9756 | (uint8_t) sizeof(dStats->tx_mc_byte_cnt), |
| 9757 | (char *)&(dStats->tx_mc_byte_cnt), tlen); |
| 9758 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT, |
| 9759 | (uint8_t) sizeof(dStats->tx_bc_byte_cnt), |
| 9760 | (char *)&(dStats->tx_bc_byte_cnt), tlen); |
| 9761 | |
| 9762 | wrqu->data.length = tlen; |
| 9763 | |
| 9764 | } |
| 9765 | |
| 9766 | EXIT(); |
| 9767 | |
| 9768 | return 0; |
| 9769 | } |
| 9770 | |
| 9771 | static int iw_get_statistics(struct net_device *dev, |
| 9772 | struct iw_request_info *info, |
| 9773 | union iwreq_data *wrqu, char *extra) |
| 9774 | { |
| 9775 | int ret; |
| 9776 | |
| 9777 | cds_ssr_protect(__func__); |
| 9778 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 9779 | cds_ssr_unprotect(__func__); |
| 9780 | |
| 9781 | return ret; |
| 9782 | } |
| 9783 | |
| 9784 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 9785 | |
| 9786 | /*Max Len for PNO notification*/ |
| 9787 | #define MAX_PNO_NOTIFY_LEN 100 |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 9788 | static void found_pref_network_cb(void *callbackContext, |
| 9789 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9790 | { |
| 9791 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) callbackContext; |
| 9792 | union iwreq_data wrqu; |
| 9793 | char buf[MAX_PNO_NOTIFY_LEN + 1]; |
| 9794 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9795 | hdd_warn("A preferred network was found: %s with rssi: -%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9796 | pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi); |
| 9797 | |
| 9798 | /* create the event */ |
| 9799 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9800 | memset(buf, 0, sizeof(buf)); |
| 9801 | |
| 9802 | snprintf(buf, MAX_PNO_NOTIFY_LEN, |
| 9803 | "QCOM: Found preferred network: %s with RSSI of -%u", |
| 9804 | pPrefNetworkFoundInd->ssId.ssId, |
| 9805 | (unsigned int)pPrefNetworkFoundInd->rssi); |
| 9806 | |
| 9807 | wrqu.data.pointer = buf; |
| 9808 | wrqu.data.length = strlen(buf); |
| 9809 | |
| 9810 | /* send the event */ |
| 9811 | |
| 9812 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 9813 | |
| 9814 | } |
| 9815 | |
| 9816 | /** |
| 9817 | * __iw_set_pno() - Preferred Network Offload ioctl handler |
| 9818 | * @dev: device upon which the ioctl was received |
| 9819 | * @info: ioctl request information |
| 9820 | * @wrqu: ioctl request data |
| 9821 | * @extra: ioctl extra data |
| 9822 | * |
| 9823 | * This function parses a Preferred Network Offload command |
| 9824 | * Input is string based and expected to be of the form: |
| 9825 | * |
| 9826 | * <enable(1) | disable(0)> |
| 9827 | * when enabling: |
| 9828 | * <number of networks> |
| 9829 | * for each network: |
| 9830 | * <ssid_len> <ssid> <authentication> <encryption> |
| 9831 | * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9832 | * <scan_time (seconds)> |
| 9833 | * <scan_repeat_count (0 means indefinite)> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9834 | * <suspend mode> |
| 9835 | * |
| 9836 | * e.g: |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9837 | * 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] | 9838 | * |
| 9839 | * this translates into: |
| 9840 | * ----------------------------- |
| 9841 | * enable PNO |
| 9842 | * 2 networks |
| 9843 | * Network 1: |
| 9844 | * test - with authentication type 0 and encryption type 0, |
| 9845 | * search on 3 channels: 1 6 and 11, |
| 9846 | * SSID bcast type is unknown (directed probe will be sent if |
| 9847 | * AP not found) and must meet -40dBm RSSI |
| 9848 | * Network 2: |
| 9849 | * test2 - with authentication type 4 and encryption type 4, |
| 9850 | * search on 6 channels 1, 2, 3, 4, 5 and 6 |
| 9851 | * bcast type is non-bcast (directed probe will be sent) |
| 9852 | * and must not meet any RSSI threshold |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9853 | * scan every 5 seconds 2 times |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 9854 | * enable on suspend |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9855 | */ |
| 9856 | static int __iw_set_pno(struct net_device *dev, |
| 9857 | struct iw_request_info *info, |
| 9858 | union iwreq_data *wrqu, char *extra) |
| 9859 | { |
| 9860 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9861 | hdd_context_t *hdd_ctx; |
| 9862 | int ret; |
| 9863 | int offset; |
| 9864 | char *ptr; |
| 9865 | uint8_t i, j, params, mode; |
| 9866 | |
| 9867 | /* request is a large struct, so we make it static to avoid |
| 9868 | * stack overflow. This API is only invoked via ioctl, so it |
| 9869 | * is serialized by the kernel rtnl_lock and hence does not |
| 9870 | * need to be reentrant |
| 9871 | */ |
| 9872 | static tSirPNOScanReq request; |
| 9873 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9874 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9875 | |
| 9876 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 9877 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9878 | if (ret) |
| 9879 | return ret; |
| 9880 | |
| 9881 | hdd_notice("PNO data len %d data %s", wrqu->data.length, extra); |
| 9882 | |
| 9883 | request.enable = 0; |
| 9884 | request.ucNetworksCount = 0; |
| 9885 | |
| 9886 | ptr = extra; |
| 9887 | |
| 9888 | if (1 != sscanf(ptr, "%hhu%n", &(request.enable), &offset)) { |
| 9889 | hdd_err("PNO enable input is not valid %s", ptr); |
| 9890 | return -EINVAL; |
| 9891 | } |
| 9892 | |
| 9893 | if (0 == request.enable) { |
| 9894 | /* Disable PNO, ignore any other params */ |
| 9895 | memset(&request, 0, sizeof(request)); |
| 9896 | sme_set_preferred_network_list(WLAN_HDD_GET_HAL_CTX(adapter), |
| 9897 | &request, adapter->sessionId, |
| 9898 | found_pref_network_cb, adapter); |
| 9899 | return 0; |
| 9900 | } |
| 9901 | |
| 9902 | ptr += offset; |
| 9903 | |
| 9904 | if (1 != |
| 9905 | sscanf(ptr, "%hhu %n", &(request.ucNetworksCount), &offset)) { |
| 9906 | hdd_err("PNO count input not valid %s", ptr); |
| 9907 | return -EINVAL; |
| 9908 | |
| 9909 | } |
| 9910 | |
| 9911 | hdd_info("PNO enable %d networks count %d offset %d", |
| 9912 | request.enable, request.ucNetworksCount, offset); |
| 9913 | |
| 9914 | if ((0 == request.ucNetworksCount) || |
| 9915 | (request.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS)) { |
| 9916 | hdd_err("Network count %d invalid", |
| 9917 | request.ucNetworksCount); |
| 9918 | return -EINVAL; |
| 9919 | } |
| 9920 | |
| 9921 | ptr += offset; |
| 9922 | |
| 9923 | for (i = 0; i < request.ucNetworksCount; i++) { |
| 9924 | |
| 9925 | request.aNetworks[i].ssId.length = 0; |
| 9926 | |
| 9927 | params = sscanf(ptr, "%hhu %n", |
| 9928 | &(request.aNetworks[i].ssId.length), |
| 9929 | &offset); |
| 9930 | |
| 9931 | if (1 != params) { |
| 9932 | hdd_err("PNO ssid length input is not valid %s", ptr); |
| 9933 | return -EINVAL; |
| 9934 | } |
| 9935 | |
| 9936 | if ((0 == request.aNetworks[i].ssId.length) || |
| 9937 | (request.aNetworks[i].ssId.length > 32)) { |
| 9938 | hdd_err("SSID Len %d is not correct for network %d", |
| 9939 | request.aNetworks[i].ssId.length, i); |
| 9940 | return -EINVAL; |
| 9941 | } |
| 9942 | |
| 9943 | /* Advance to SSID */ |
| 9944 | ptr += offset; |
| 9945 | |
| 9946 | memcpy(request.aNetworks[i].ssId.ssId, ptr, |
| 9947 | request.aNetworks[i].ssId.length); |
| 9948 | ptr += request.aNetworks[i].ssId.length; |
| 9949 | |
| 9950 | params = sscanf(ptr, "%u %u %hhu %n", |
| 9951 | &(request.aNetworks[i].authentication), |
| 9952 | &(request.aNetworks[i].encryption), |
| 9953 | &(request.aNetworks[i].ucChannelCount), |
| 9954 | &offset); |
| 9955 | |
| 9956 | if (3 != params) { |
| 9957 | hdd_warn("Incorrect cmd %s", ptr); |
| 9958 | return -EINVAL; |
| 9959 | } |
| 9960 | |
| 9961 | hdd_notice("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d", |
| 9962 | request.aNetworks[i].ssId.length, |
| 9963 | request.aNetworks[i].ssId.length, |
| 9964 | request.aNetworks[i].ssId.ssId, |
| 9965 | request.aNetworks[i].authentication, |
| 9966 | request.aNetworks[i].encryption, |
| 9967 | request.aNetworks[i].ucChannelCount, offset); |
| 9968 | |
| 9969 | /* Advance to channel list */ |
| 9970 | ptr += offset; |
| 9971 | |
| 9972 | if (SIR_PNO_MAX_NETW_CHANNELS < |
| 9973 | request.aNetworks[i].ucChannelCount) { |
| 9974 | hdd_warn("Incorrect number of channels"); |
| 9975 | return -EINVAL; |
| 9976 | } |
| 9977 | |
| 9978 | if (0 != request.aNetworks[i].ucChannelCount) { |
| 9979 | for (j = 0; j < request.aNetworks[i].ucChannelCount; |
| 9980 | j++) { |
| 9981 | if (1 != |
| 9982 | sscanf(ptr, "%hhu %n", |
| 9983 | &(request.aNetworks[i]. |
| 9984 | aChannels[j]), &offset)) { |
| 9985 | hdd_err("PNO network channel input is not valid %s", |
| 9986 | ptr); |
| 9987 | return -EINVAL; |
| 9988 | } |
| 9989 | /* Advance to next channel number */ |
| 9990 | ptr += offset; |
| 9991 | } |
| 9992 | } |
| 9993 | |
| 9994 | if (1 != sscanf(ptr, "%u %n", |
| 9995 | &(request.aNetworks[i].bcastNetwType), |
| 9996 | &offset)) { |
| 9997 | hdd_err("PNO broadcast network type input is not valid %s", |
| 9998 | ptr); |
| 9999 | return -EINVAL; |
| 10000 | } |
| 10001 | |
| 10002 | hdd_notice("PNO bcastNetwType %d offset %d", |
| 10003 | request.aNetworks[i].bcastNetwType, offset); |
| 10004 | |
| 10005 | /* Advance to rssi Threshold */ |
| 10006 | ptr += offset; |
| 10007 | if (1 != sscanf(ptr, "%d %n", |
| 10008 | &(request.aNetworks[i].rssiThreshold), |
| 10009 | &offset)) { |
| 10010 | hdd_err("PNO rssi threshold input is not valid %s", |
| 10011 | ptr); |
| 10012 | return -EINVAL; |
| 10013 | } |
| 10014 | hdd_notice("PNO rssi %d offset %d", |
| 10015 | request.aNetworks[i].rssiThreshold, offset); |
| 10016 | /* Advance to next network */ |
| 10017 | ptr += offset; |
| 10018 | } /* For ucNetworkCount */ |
| 10019 | |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10020 | request.fast_scan_period = 0; |
| 10021 | if (sscanf(ptr, "%u %n", &(request.fast_scan_period), &offset) > 0) { |
| 10022 | request.fast_scan_period *= MSEC_PER_SEC; |
| 10023 | ptr += offset; |
| 10024 | } |
| 10025 | |
| 10026 | request.fast_scan_max_cycles = 0; |
| 10027 | if (sscanf(ptr, "%hhu %n", &(request.fast_scan_max_cycles), |
| 10028 | &offset) > 0) |
| 10029 | ptr += offset; |
| 10030 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10031 | params = sscanf(ptr, "%hhu %n", &(mode), &offset); |
| 10032 | |
| 10033 | request.modePNO = mode; |
| 10034 | /* for LA we just expose suspend option */ |
| 10035 | if ((1 != params) || (mode >= SIR_PNO_MODE_MAX)) { |
| 10036 | request.modePNO = SIR_PNO_MODE_ON_SUSPEND; |
| 10037 | } |
| 10038 | |
| 10039 | sme_set_preferred_network_list(WLAN_HDD_GET_HAL_CTX(adapter), |
| 10040 | &request, |
| 10041 | adapter->sessionId, |
| 10042 | found_pref_network_cb, adapter); |
| 10043 | |
| 10044 | return 0; |
| 10045 | } |
| 10046 | |
| 10047 | static int iw_set_pno(struct net_device *dev, |
| 10048 | struct iw_request_info *info, |
| 10049 | union iwreq_data *wrqu, char *extra) |
| 10050 | { |
| 10051 | int ret; |
| 10052 | |
| 10053 | cds_ssr_protect(__func__); |
| 10054 | ret = __iw_set_pno(dev, info, wrqu, extra); |
| 10055 | cds_ssr_unprotect(__func__); |
| 10056 | |
| 10057 | return ret; |
| 10058 | } |
| 10059 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 10060 | |
| 10061 | /* Common function to SetBand */ |
| 10062 | int hdd_set_band(struct net_device *dev, u8 ui_band) |
| 10063 | { |
| 10064 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10065 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10066 | eCsrBand band; |
| 10067 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10068 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10069 | hdd_context_t *pHddCtx; |
| 10070 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 10071 | eCsrBand currBand = eCSR_BAND_MAX; |
| 10072 | eCsrBand connectedBand; |
| 10073 | |
| 10074 | pAdapterNode = NULL; |
| 10075 | pNext = NULL; |
| 10076 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10077 | |
| 10078 | switch (ui_band) { |
| 10079 | case WLAN_HDD_UI_BAND_AUTO: |
| 10080 | band = eCSR_BAND_ALL; |
| 10081 | break; |
| 10082 | case WLAN_HDD_UI_BAND_5_GHZ: |
| 10083 | band = eCSR_BAND_5G; |
| 10084 | break; |
| 10085 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
| 10086 | band = eCSR_BAND_24; |
| 10087 | break; |
| 10088 | default: |
| 10089 | band = eCSR_BAND_MAX; |
| 10090 | } |
| 10091 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10092 | hdd_notice("change band to %u", band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10093 | |
| 10094 | if (band == eCSR_BAND_MAX) { |
| 10095 | /* Received change band request with invalid band value */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10096 | hdd_err("Invalid band value %u", ui_band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10097 | return -EINVAL; |
| 10098 | } |
| 10099 | |
| 10100 | if ((band == eCSR_BAND_24 && pHddCtx->config->nBandCapability == 2) || |
| 10101 | (band == eCSR_BAND_5G && pHddCtx->config->nBandCapability == 1)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10102 | hdd_err("band value %u violate INI settings %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10103 | band, pHddCtx->config->nBandCapability); |
| 10104 | return -EIO; |
| 10105 | } |
| 10106 | |
| 10107 | if (band == eCSR_BAND_ALL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10108 | hdd_notice("Auto band received. Setting band same as ini value %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10109 | pHddCtx->config->nBandCapability); |
| 10110 | band = pHddCtx->config->nBandCapability; |
| 10111 | } |
| 10112 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10113 | if (QDF_STATUS_SUCCESS != sme_get_freq_band(hHal, &currBand)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10114 | hdd_notice("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10115 | return -EIO; |
| 10116 | } |
| 10117 | |
| 10118 | if (currBand != band) { |
| 10119 | /* Change band request received. |
| 10120 | * Abort pending scan requests, flush the existing scan results, |
| 10121 | * and change the band capability |
| 10122 | */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10123 | hdd_notice("Current band value = %u, new setting %u ", |
| 10124 | currBand, band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10125 | |
| 10126 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10127 | while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10128 | pAdapter = pAdapterNode->pAdapter; |
| 10129 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10130 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 10131 | eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE); |
| 10132 | connectedBand = |
| 10133 | hdd_conn_get_connected_band |
| 10134 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 10135 | |
| 10136 | /* Handling is done only for STA and P2P */ |
| 10137 | if (band != eCSR_BAND_ALL && |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 10138 | ((pAdapter->device_mode == QDF_STA_MODE) |
| 10139 | || (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10140 | && |
| 10141 | (hdd_conn_is_connected |
| 10142 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) |
| 10143 | && (connectedBand != band)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10144 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10145 | long lrc; |
| 10146 | |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame^] | 10147 | /* STA already connected on current |
| 10148 | * band, So issue disconnect first, |
| 10149 | * then change the band |
| 10150 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10151 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10152 | 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] | 10153 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 10154 | pAdapter->device_mode, currBand, band); |
| 10155 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10156 | |
| 10157 | status = |
| 10158 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX |
| 10159 | (pAdapter), |
| 10160 | pAdapter->sessionId, |
| 10161 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 10162 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10163 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10164 | hdd_err("csr_roam_disconnect failure, returned %d", |
| 10165 | (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10166 | return -EINVAL; |
| 10167 | } |
| 10168 | |
| 10169 | lrc = |
| 10170 | wait_for_completion_timeout(&pAdapter-> |
| 10171 | disconnect_comp_var, |
| 10172 | msecs_to_jiffies |
| 10173 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 10174 | |
| 10175 | if (lrc == 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10176 | hdd_err("Timeout while waiting for csr_roam_disconnect"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10177 | return -ETIMEDOUT; |
| 10178 | } |
| 10179 | } |
| 10180 | |
| 10181 | sme_scan_flush_result(hHal); |
| 10182 | |
| 10183 | status = |
| 10184 | hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext); |
| 10185 | pAdapterNode = pNext; |
| 10186 | } |
| 10187 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10188 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10189 | sme_set_freq_band(hHal, pAdapter->sessionId, band)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10190 | hdd_alert("Failed to set the band value to %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10191 | band); |
| 10192 | return -EINVAL; |
| 10193 | } |
| 10194 | wlan_hdd_cfg80211_update_band(pHddCtx->wiphy, (eCsrBand) band); |
| 10195 | } |
| 10196 | return 0; |
| 10197 | } |
| 10198 | |
| 10199 | int hdd_set_band_helper(struct net_device *dev, const char *command) |
| 10200 | { |
| 10201 | uint8_t band; |
| 10202 | int ret; |
| 10203 | |
| 10204 | /* Convert the band value from ascii to integer */ |
| 10205 | command += WLAN_HDD_UI_SET_BAND_VALUE_OFFSET; |
| 10206 | ret = kstrtou8(command, 10, &band); |
| 10207 | if (ret < 0) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10208 | hdd_err("kstrtou8 failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10209 | return -EINVAL; |
| 10210 | } |
| 10211 | |
| 10212 | return hdd_set_band(dev, band); |
| 10213 | } |
| 10214 | |
| 10215 | static int __iw_set_band_config(struct net_device *dev, |
| 10216 | struct iw_request_info *info, |
| 10217 | union iwreq_data *wrqu, char *extra) |
| 10218 | { |
| 10219 | int *value = (int *)extra; |
| 10220 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10221 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10222 | |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 10223 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10224 | hdd_err("permission check failed"); |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 10225 | return -EPERM; |
| 10226 | } |
| 10227 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10228 | return hdd_set_band(dev, value[0]); |
| 10229 | } |
| 10230 | |
| 10231 | static int iw_set_band_config(struct net_device *dev, |
| 10232 | struct iw_request_info *info, |
| 10233 | union iwreq_data *wrqu, char *extra) |
| 10234 | { |
| 10235 | int ret; |
| 10236 | |
| 10237 | cds_ssr_protect(__func__); |
| 10238 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 10239 | cds_ssr_unprotect(__func__); |
| 10240 | |
| 10241 | return ret; |
| 10242 | } |
| 10243 | |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 10244 | /** |
| 10245 | * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface. |
| 10246 | * @adapter: Handle to adapter |
| 10247 | * @chan: Monitor mode channel |
| 10248 | * @bandwidth: Capture channel bandwidth |
| 10249 | * |
| 10250 | * Return: 0 on success else error code. |
| 10251 | */ |
| 10252 | static int wlan_hdd_set_mon_chan(hdd_adapter_t *adapter, uint32_t chan, |
| 10253 | uint32_t bandwidth) |
| 10254 | { |
| 10255 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 10256 | hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 10257 | struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info; |
| 10258 | QDF_STATUS status; |
| 10259 | tHalHandle hal_hdl = hdd_ctx->hHal; |
| 10260 | struct qdf_mac_addr bssid; |
| 10261 | tCsrRoamProfile roam_profile; |
| 10262 | struct ch_params_s ch_params; |
| 10263 | |
| 10264 | if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { |
| 10265 | hdd_err("Not supported, device is not in monitor mode"); |
| 10266 | return -EINVAL; |
| 10267 | } |
| 10268 | |
| 10269 | hdd_info("Set monitor mode Channel %d", chan); |
Hong Shi | e531d1f | 2016-11-14 14:08:03 +0800 | [diff] [blame] | 10270 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 10271 | roam_profile.ChannelInfo.ChannelList = &ch_info->channel; |
| 10272 | roam_profile.ChannelInfo.numOfChannels = 1; |
| 10273 | roam_profile.phyMode = ch_info->phy_mode; |
| 10274 | roam_profile.ch_params.ch_width = bandwidth; |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 10275 | hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 10276 | |
| 10277 | qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes, |
| 10278 | QDF_MAC_ADDR_SIZE); |
| 10279 | |
| 10280 | ch_params.ch_width = bandwidth; |
Sandeep Puligilla | 1cc23f6 | 2016-04-27 16:52:49 -0700 | [diff] [blame] | 10281 | cds_set_channel_params(chan, 0, &ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 10282 | status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, |
| 10283 | &roam_profile); |
| 10284 | if (status) { |
| 10285 | hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", |
| 10286 | status); |
| 10287 | } |
| 10288 | |
| 10289 | return qdf_status_to_os_return(status); |
| 10290 | } |
| 10291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10292 | static int __iw_set_two_ints_getnone(struct net_device *dev, |
| 10293 | struct iw_request_info *info, |
| 10294 | union iwreq_data *wrqu, char *extra) |
| 10295 | { |
| 10296 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10297 | int *value = (int *)extra; |
| 10298 | int sub_cmd = value[0]; |
| 10299 | int ret; |
| 10300 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 10301 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10302 | ENTER_DEV(dev); |
| 10303 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10304 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10305 | if (0 != ret) |
| 10306 | return ret; |
| 10307 | |
| 10308 | switch (sub_cmd) { |
| 10309 | case WE_SET_SMPS_PARAM: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10310 | 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] | 10311 | ret = wma_cli_set_command(pAdapter->sessionId, |
| 10312 | WMI_STA_SMPS_PARAM_CMDID, |
| 10313 | value[1] << WMA_SMPS_PARAM_VALUE_S |
| 10314 | | value[2], |
| 10315 | VDEV_CMD); |
| 10316 | break; |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 10317 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10318 | case WE_SET_FW_CRASH_INJECT: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10319 | hdd_err("WE_SET_FW_CRASH_INJECT: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10320 | value[1], value[2]); |
DARAM SUDHA | 7e7e91b | 2015-05-29 11:38:47 +0530 | [diff] [blame] | 10321 | pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n", |
| 10322 | value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10323 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 10324 | GEN_PARAM_CRASH_INJECT, |
| 10325 | value[1], value[2], GEN_CMD); |
| 10326 | break; |
| 10327 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10328 | case WE_ENABLE_FW_PROFILE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10329 | hdd_err("WE_ENABLE_FW_PROFILE: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10330 | value[1], value[2]); |
| 10331 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 10332 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 10333 | value[1], value[2], DBG_CMD); |
| 10334 | break; |
| 10335 | case WE_SET_FW_PROFILE_HIST_INTVL: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10336 | hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10337 | value[1], value[2]); |
| 10338 | ret = wma_cli_set2_command(pAdapter->sessionId, |
| 10339 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 10340 | value[1], value[2], DBG_CMD); |
| 10341 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10342 | case WE_SET_DUAL_MAC_FW_MODE_CONFIG: |
| 10343 | hdd_debug("Ioctl to set dual fw mode config"); |
| 10344 | if (hdd_ctx->config->dual_mac_feature_disable) { |
| 10345 | hdd_err("Dual mac feature is disabled from INI"); |
| 10346 | return -EPERM; |
| 10347 | } |
| 10348 | hdd_debug("%d %d", value[1], value[2]); |
Tushnim Bhattacharyya | 4adb368 | 2016-01-07 15:07:12 -0800 | [diff] [blame] | 10349 | cds_set_dual_mac_fw_mode_config(value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10350 | break; |
| 10351 | case WE_DUMP_DP_TRACE_LEVEL: |
| 10352 | hdd_info("WE_DUMP_DP_TRACE_LEVEL: %d %d", |
| 10353 | value[1], value[2]); |
| 10354 | if (value[1] == DUMP_DP_TRACE) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10355 | qdf_dp_trace_dump_all(value[2]); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 10356 | else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE) |
| 10357 | qdf_dp_trace_enable_live_mode(); |
Nirav Shah | da00834 | 2016-05-17 18:50:40 +0530 | [diff] [blame] | 10358 | else if (value[1] == CLEAR_DP_TRACE_BUFFER) |
| 10359 | qdf_dp_trace_clear_buffer(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10360 | break; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 10361 | case WE_SET_MON_MODE_CHAN: |
| 10362 | ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]); |
| 10363 | break; |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 10364 | case WE_SET_WLAN_SUSPEND: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 10365 | ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 10366 | break; |
| 10367 | case WE_SET_WLAN_RESUME: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 10368 | ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 10369 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10370 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10371 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10372 | break; |
| 10373 | } |
| 10374 | |
| 10375 | return ret; |
| 10376 | } |
| 10377 | |
| 10378 | static int iw_set_two_ints_getnone(struct net_device *dev, |
| 10379 | struct iw_request_info *info, |
| 10380 | union iwreq_data *wrqu, char *extra) |
| 10381 | { |
| 10382 | int ret; |
| 10383 | |
| 10384 | cds_ssr_protect(__func__); |
| 10385 | ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra); |
| 10386 | cds_ssr_unprotect(__func__); |
| 10387 | |
| 10388 | return ret; |
| 10389 | } |
| 10390 | |
| 10391 | /* Define the Wireless Extensions to the Linux Network Device structure */ |
| 10392 | /* A number of these routines are NULL (meaning they are not implemented.) */ |
| 10393 | |
| 10394 | static const iw_handler we_handler[] = { |
| 10395 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 10396 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 10397 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 10398 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 10399 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 10400 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 10401 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 10402 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 10403 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 10404 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 10405 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 10406 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 10407 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 10408 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 10409 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 10410 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 10411 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 10412 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 10413 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 10414 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 10415 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 10416 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 10417 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 10418 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 10419 | (iw_handler) iw_set_scan, /* SIOCSIWSCAN */ |
| 10420 | (iw_handler) iw_get_scan, /* SIOCGIWSCAN */ |
| 10421 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 10422 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 10423 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 10424 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 10425 | (iw_handler) NULL, /* -- hole -- */ |
| 10426 | (iw_handler) NULL, /* -- hole -- */ |
| 10427 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 10428 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 10429 | (iw_handler) iw_set_rts_threshold, /* SIOCSIWRTS */ |
| 10430 | (iw_handler) iw_get_rts_threshold, /* SIOCGIWRTS */ |
| 10431 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 10432 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 10433 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 10434 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 10435 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 10436 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 10437 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
| 10438 | (iw_handler) iw_get_encode, /* SIOCGIWENCODE */ |
| 10439 | (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */ |
| 10440 | (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */ |
| 10441 | (iw_handler) NULL, /* -- hole -- */ |
| 10442 | (iw_handler) NULL, /* -- hole -- */ |
| 10443 | (iw_handler) iw_set_genie, /* SIOCSIWGENIE */ |
| 10444 | (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ |
| 10445 | (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ |
| 10446 | (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ |
| 10447 | (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ |
| 10448 | (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */ |
| 10449 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 10450 | }; |
| 10451 | |
| 10452 | static const iw_handler we_private[] = { |
| 10453 | |
| 10454 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, /* set priv ioctl */ |
| 10455 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, /* get priv ioctl */ |
| 10456 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, /* get priv ioctl */ |
| 10457 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10458 | iw_set_three_ints_getnone, |
| 10459 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
| 10460 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, /* action priv ioctl */ |
| 10461 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10462 | iw_hdd_set_var_ints_getnone, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 10463 | [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = |
| 10464 | iw_setnone_get_threeint, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10465 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 10466 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 10467 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10468 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10469 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 10470 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 10471 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = |
| 10472 | iw_set_keepalive_params, |
| 10473 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 10474 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = |
| 10475 | iw_set_packet_filter_params, |
| 10476 | #endif |
| 10477 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 10478 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno, |
| 10479 | #endif |
| 10480 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
| 10481 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed, |
| 10482 | [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10483 | iw_set_two_ints_getnone, |
| 10484 | [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] = |
| 10485 | iw_set_dot11p_channel_sched, |
| 10486 | }; |
| 10487 | |
| 10488 | /*Maximum command length can be only 15 */ |
| 10489 | static const struct iw_priv_args we_private_args[] = { |
| 10490 | |
| 10491 | /* handlers for main ioctl */ |
| 10492 | {WLAN_PRIV_SET_INT_GET_NONE, |
| 10493 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10494 | 0, |
| 10495 | ""}, |
| 10496 | |
| 10497 | /* handlers for sub-ioctl */ |
| 10498 | {WE_SET_11D_STATE, |
| 10499 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10500 | 0, |
| 10501 | "set11Dstate"}, |
| 10502 | |
| 10503 | {WE_WOWL, |
| 10504 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10505 | 0, |
| 10506 | "wowl"}, |
| 10507 | |
| 10508 | {WE_SET_POWER, |
| 10509 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10510 | 0, |
| 10511 | "setPower"}, |
| 10512 | |
| 10513 | {WE_SET_MAX_ASSOC, |
| 10514 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10515 | 0, |
| 10516 | "setMaxAssoc"}, |
| 10517 | |
| 10518 | {WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 10519 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, |
| 10520 | "setAutoChannel" }, |
| 10521 | |
| 10522 | {WE_SET_SCAN_DISABLE, |
| 10523 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10524 | 0, |
| 10525 | "scan_disable"}, |
| 10526 | |
| 10527 | {WE_SET_DATA_INACTIVITY_TO, |
| 10528 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10529 | 0, |
| 10530 | "inactivityTO"}, |
| 10531 | |
| 10532 | {WE_SET_MAX_TX_POWER, |
| 10533 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10534 | 0, |
| 10535 | "setMaxTxPower"}, |
| 10536 | |
| 10537 | {WE_SET_TX_POWER, |
| 10538 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10539 | 0, |
| 10540 | "setTxPower"}, |
| 10541 | |
| 10542 | {WE_SET_MC_RATE, |
| 10543 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10544 | 0, |
| 10545 | "setMcRate"}, |
| 10546 | |
| 10547 | {WE_SET_MAX_TX_POWER_2_4, |
| 10548 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10549 | 0, |
| 10550 | "setTxMaxPower2G"}, |
| 10551 | |
| 10552 | {WE_SET_MAX_TX_POWER_5_0, |
| 10553 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10554 | 0, |
| 10555 | "setTxMaxPower5G"}, |
| 10556 | |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 10557 | {WE_SET_PKTLOG, |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 10558 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 10559 | 0, |
| 10560 | "pktlog"}, |
| 10561 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10562 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 10563 | * as well to keep same syntax as in SAP. Now onwards, STA |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame^] | 10564 | * will support both |
| 10565 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10566 | {WE_SET_MAX_TX_POWER, |
| 10567 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10568 | 0, |
| 10569 | "setTxMaxPower"}, |
| 10570 | |
| 10571 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame^] | 10572 | * 1 = enable and 0 = disable |
| 10573 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10574 | { |
| 10575 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 10576 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10577 | 0, |
| 10578 | "setHDtimTransn" |
| 10579 | }, |
| 10580 | |
| 10581 | {WE_SET_TM_LEVEL, |
| 10582 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10583 | 0, |
| 10584 | "setTmLevel"}, |
| 10585 | |
| 10586 | {WE_SET_PHYMODE, |
| 10587 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10588 | 0, |
| 10589 | "setphymode"}, |
| 10590 | |
| 10591 | {WE_SET_NSS, |
| 10592 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10593 | 0, |
| 10594 | "nss"}, |
| 10595 | |
| 10596 | {WE_SET_LDPC, |
| 10597 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10598 | 0, |
| 10599 | "ldpc"}, |
| 10600 | |
| 10601 | {WE_SET_TX_STBC, |
| 10602 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10603 | 0, |
| 10604 | "tx_stbc"}, |
| 10605 | |
| 10606 | {WE_SET_RX_STBC, |
| 10607 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10608 | 0, |
| 10609 | "rx_stbc"}, |
| 10610 | |
| 10611 | {WE_SET_SHORT_GI, |
| 10612 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10613 | 0, |
| 10614 | "shortgi"}, |
| 10615 | |
| 10616 | {WE_SET_RTSCTS, |
| 10617 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10618 | 0, |
| 10619 | "enablertscts"}, |
| 10620 | |
| 10621 | {WE_SET_CHWIDTH, |
| 10622 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10623 | 0, |
| 10624 | "chwidth"}, |
| 10625 | |
| 10626 | {WE_SET_ANI_EN_DIS, |
| 10627 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10628 | 0, |
| 10629 | "anienable"}, |
| 10630 | |
| 10631 | {WE_SET_ANI_POLL_PERIOD, |
| 10632 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10633 | 0, |
| 10634 | "aniplen"}, |
| 10635 | |
| 10636 | {WE_SET_ANI_LISTEN_PERIOD, |
| 10637 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10638 | 0, |
| 10639 | "anilislen"}, |
| 10640 | |
| 10641 | {WE_SET_ANI_OFDM_LEVEL, |
| 10642 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10643 | 0, |
| 10644 | "aniofdmlvl"}, |
| 10645 | |
| 10646 | {WE_SET_ANI_CCK_LEVEL, |
| 10647 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10648 | 0, |
| 10649 | "aniccklvl"}, |
| 10650 | |
| 10651 | {WE_SET_DYNAMIC_BW, |
| 10652 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10653 | 0, |
| 10654 | "cwmenable"}, |
| 10655 | |
| 10656 | {WE_SET_CTS_CBW, |
| 10657 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10658 | 0, |
| 10659 | "cts_cbw" }, |
| 10660 | |
| 10661 | {WE_SET_GTX_HT_MCS, |
| 10662 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10663 | 0, |
| 10664 | "gtxHTMcs"}, |
| 10665 | |
| 10666 | {WE_SET_GTX_VHT_MCS, |
| 10667 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10668 | 0, |
| 10669 | "gtxVHTMcs"}, |
| 10670 | |
| 10671 | {WE_SET_GTX_USRCFG, |
| 10672 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10673 | 0, |
| 10674 | "gtxUsrCfg"}, |
| 10675 | |
| 10676 | {WE_SET_GTX_THRE, |
| 10677 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10678 | 0, |
| 10679 | "gtxThre"}, |
| 10680 | |
| 10681 | {WE_SET_GTX_MARGIN, |
| 10682 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10683 | 0, |
| 10684 | "gtxMargin"}, |
| 10685 | |
| 10686 | {WE_SET_GTX_STEP, |
| 10687 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10688 | 0, |
| 10689 | "gtxStep"}, |
| 10690 | |
| 10691 | {WE_SET_GTX_MINTPC, |
| 10692 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10693 | 0, |
| 10694 | "gtxMinTpc"}, |
| 10695 | |
| 10696 | {WE_SET_GTX_BWMASK, |
| 10697 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10698 | 0, |
| 10699 | "gtxBWMask"}, |
| 10700 | |
| 10701 | {WE_SET_TX_CHAINMASK, |
| 10702 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10703 | 0, |
| 10704 | "txchainmask"}, |
| 10705 | |
| 10706 | {WE_SET_RX_CHAINMASK, |
| 10707 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10708 | 0, |
| 10709 | "rxchainmask"}, |
| 10710 | |
| 10711 | {WE_SET_11N_RATE, |
| 10712 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10713 | 0, |
| 10714 | "set11NRates"}, |
| 10715 | |
| 10716 | {WE_SET_VHT_RATE, |
| 10717 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10718 | 0, |
| 10719 | "set11ACRates"}, |
| 10720 | |
| 10721 | {WE_SET_AMPDU, |
| 10722 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10723 | 0, |
| 10724 | "ampdu"}, |
| 10725 | |
| 10726 | {WE_SET_AMSDU, |
| 10727 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10728 | 0, |
| 10729 | "amsdu"}, |
| 10730 | |
| 10731 | {WE_SET_BURST_ENABLE, |
| 10732 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10733 | 0, |
| 10734 | "burst_enable"}, |
| 10735 | |
| 10736 | {WE_SET_BURST_DUR, |
| 10737 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10738 | 0, |
| 10739 | "burst_dur"}, |
| 10740 | |
| 10741 | {WE_SET_TXPOW_2G, |
| 10742 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10743 | 0, |
| 10744 | "txpow2g"}, |
| 10745 | |
| 10746 | {WE_SET_TXPOW_5G, |
| 10747 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10748 | 0, |
| 10749 | "txpow5g"}, |
| 10750 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10751 | /* Sub-cmds DBGLOG specific commands */ |
| 10752 | {WE_DBGLOG_LOG_LEVEL, |
| 10753 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10754 | 0, |
| 10755 | "dl_loglevel"}, |
| 10756 | |
| 10757 | {WE_DBGLOG_VAP_ENABLE, |
| 10758 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10759 | 0, |
| 10760 | "dl_vapon"}, |
| 10761 | |
| 10762 | {WE_DBGLOG_VAP_DISABLE, |
| 10763 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10764 | 0, |
| 10765 | "dl_vapoff"}, |
| 10766 | |
| 10767 | {WE_DBGLOG_MODULE_ENABLE, |
| 10768 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10769 | 0, |
| 10770 | "dl_modon"}, |
| 10771 | |
| 10772 | {WE_DBGLOG_MODULE_DISABLE, |
| 10773 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10774 | 0, |
| 10775 | "dl_modoff"}, |
| 10776 | |
| 10777 | {WE_DBGLOG_MOD_LOG_LEVEL, |
| 10778 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10779 | 0, |
| 10780 | "dl_mod_loglevel"}, |
| 10781 | |
| 10782 | {WE_DBGLOG_TYPE, |
| 10783 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10784 | 0, |
| 10785 | "dl_type"}, |
| 10786 | {WE_DBGLOG_REPORT_ENABLE, |
| 10787 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10788 | 0, |
| 10789 | "dl_report"}, |
| 10790 | |
| 10791 | {WE_SET_TXRX_FWSTATS, |
| 10792 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10793 | 0, |
| 10794 | "txrx_fw_stats"}, |
| 10795 | |
| 10796 | {WE_TXRX_FWSTATS_RESET, |
| 10797 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10798 | 0, |
| 10799 | "txrx_fw_st_rst"}, |
| 10800 | |
| 10801 | {WE_PPS_PAID_MATCH, |
| 10802 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10803 | 0, "paid_match"}, |
| 10804 | |
| 10805 | {WE_PPS_GID_MATCH, |
| 10806 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10807 | 0, "gid_match"}, |
| 10808 | |
| 10809 | {WE_PPS_EARLY_TIM_CLEAR, |
| 10810 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10811 | 0, "tim_clear"}, |
| 10812 | |
| 10813 | {WE_PPS_EARLY_DTIM_CLEAR, |
| 10814 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10815 | 0, "dtim_clear"}, |
| 10816 | |
| 10817 | {WE_PPS_EOF_PAD_DELIM, |
| 10818 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10819 | 0, "eof_delim"}, |
| 10820 | |
| 10821 | {WE_PPS_MACADDR_MISMATCH, |
| 10822 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10823 | 0, "mac_match"}, |
| 10824 | |
| 10825 | {WE_PPS_DELIM_CRC_FAIL, |
| 10826 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10827 | 0, "delim_fail"}, |
| 10828 | |
| 10829 | {WE_PPS_GID_NSTS_ZERO, |
| 10830 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10831 | 0, "nsts_zero"}, |
| 10832 | |
| 10833 | {WE_PPS_RSSI_CHECK, |
| 10834 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10835 | 0, "rssi_chk"}, |
| 10836 | |
| 10837 | {WE_PPS_5G_EBT, |
| 10838 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10839 | 0, "5g_ebt"}, |
| 10840 | |
| 10841 | {WE_SET_HTSMPS, |
| 10842 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10843 | 0, "htsmps"}, |
| 10844 | |
| 10845 | {WE_SET_QPOWER_MAX_PSPOLL_COUNT, |
| 10846 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10847 | 0, "set_qpspollcnt"}, |
| 10848 | |
| 10849 | {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 10850 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10851 | 0, "set_qtxwake"}, |
| 10852 | |
| 10853 | {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 10854 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10855 | 0, "set_qwakeintv"}, |
| 10856 | |
| 10857 | {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 10858 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10859 | 0, "set_qnodatapoll"}, |
| 10860 | |
| 10861 | /* handlers for MCC time quota and latency sub ioctls */ |
| 10862 | {WE_MCC_CONFIG_LATENCY, |
| 10863 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10864 | 0, "setMccLatency"}, |
| 10865 | |
| 10866 | {WE_MCC_CONFIG_QUOTA, |
| 10867 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10868 | 0, "setMccQuota"}, |
| 10869 | |
| 10870 | {WE_SET_DEBUG_LOG, |
| 10871 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10872 | 0, "setDbgLvl"}, |
| 10873 | |
| 10874 | /* handlers for early_rx power save */ |
| 10875 | {WE_SET_EARLY_RX_ADJUST_ENABLE, |
| 10876 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10877 | 0, "erx_enable"}, |
| 10878 | |
| 10879 | {WE_SET_EARLY_RX_TGT_BMISS_NUM, |
| 10880 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10881 | 0, "erx_bmiss_val"}, |
| 10882 | |
| 10883 | {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 10884 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10885 | 0, "erx_bmiss_smpl"}, |
| 10886 | |
| 10887 | {WE_SET_EARLY_RX_SLOP_STEP, |
| 10888 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10889 | 0, "erx_slop_step"}, |
| 10890 | |
| 10891 | {WE_SET_EARLY_RX_INIT_SLOP, |
| 10892 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10893 | 0, "erx_init_slop"}, |
| 10894 | |
| 10895 | {WE_SET_EARLY_RX_ADJUST_PAUSE, |
| 10896 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10897 | 0, "erx_adj_pause"}, |
| 10898 | |
| 10899 | {WE_SET_EARLY_RX_DRIFT_SAMPLE, |
| 10900 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10901 | 0, "erx_dri_sample"}, |
| 10902 | |
| 10903 | {WE_DUMP_STATS, |
| 10904 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10905 | 0, "dumpStats"}, |
| 10906 | |
| 10907 | {WE_CLEAR_STATS, |
| 10908 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10909 | 0, "clearStats"}, |
| 10910 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 10911 | {WE_START_FW_PROFILE, |
| 10912 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10913 | 0, "startProfile"}, |
| 10914 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 10915 | {WE_SET_CHANNEL, |
| 10916 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10917 | 0, "setChanChange" }, |
| 10918 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 10919 | {WE_SET_CONC_SYSTEM_PREF, |
| 10920 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10921 | 0, "setConcSysPref" }, |
| 10922 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10923 | {WLAN_PRIV_SET_NONE_GET_INT, |
| 10924 | 0, |
| 10925 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10926 | ""}, |
| 10927 | |
| 10928 | /* handlers for sub-ioctl */ |
| 10929 | {WE_GET_11D_STATE, |
| 10930 | 0, |
| 10931 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10932 | "get11Dstate"}, |
| 10933 | |
| 10934 | {WE_IBSS_STATUS, |
| 10935 | 0, |
| 10936 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10937 | "getAdhocStatus"}, |
| 10938 | |
| 10939 | {WE_GET_WLAN_DBG, |
| 10940 | 0, |
| 10941 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10942 | "getwlandbg"}, |
| 10943 | |
| 10944 | {WE_GET_MAX_ASSOC, |
| 10945 | 0, |
| 10946 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10947 | "getMaxAssoc"}, |
| 10948 | |
| 10949 | {WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 10950 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10951 | "getAutoChannel" }, |
| 10952 | |
| 10953 | {WE_GET_CONCURRENCY_MODE, |
| 10954 | 0, |
| 10955 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10956 | "getconcurrency"}, |
| 10957 | |
| 10958 | {WE_GET_NSS, |
| 10959 | 0, |
| 10960 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10961 | "get_nss"}, |
| 10962 | |
| 10963 | {WE_GET_LDPC, |
| 10964 | 0, |
| 10965 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10966 | "get_ldpc"}, |
| 10967 | |
| 10968 | {WE_GET_TX_STBC, |
| 10969 | 0, |
| 10970 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10971 | "get_tx_stbc"}, |
| 10972 | |
| 10973 | {WE_GET_RX_STBC, |
| 10974 | 0, |
| 10975 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10976 | "get_rx_stbc"}, |
| 10977 | |
| 10978 | {WE_GET_SHORT_GI, |
| 10979 | 0, |
| 10980 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10981 | "get_shortgi"}, |
| 10982 | |
| 10983 | {WE_GET_RTSCTS, |
| 10984 | 0, |
| 10985 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10986 | "get_rtscts"}, |
| 10987 | |
| 10988 | {WE_GET_CHWIDTH, |
| 10989 | 0, |
| 10990 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10991 | "get_chwidth"}, |
| 10992 | |
| 10993 | {WE_GET_ANI_EN_DIS, |
| 10994 | 0, |
| 10995 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10996 | "get_anienable"}, |
| 10997 | |
| 10998 | {WE_GET_ANI_POLL_PERIOD, |
| 10999 | 0, |
| 11000 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11001 | "get_aniplen"}, |
| 11002 | |
| 11003 | {WE_GET_ANI_LISTEN_PERIOD, |
| 11004 | 0, |
| 11005 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11006 | "get_anilislen"}, |
| 11007 | |
| 11008 | {WE_GET_ANI_OFDM_LEVEL, |
| 11009 | 0, |
| 11010 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11011 | "get_aniofdmlvl"}, |
| 11012 | |
| 11013 | {WE_GET_ANI_CCK_LEVEL, |
| 11014 | 0, |
| 11015 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11016 | "get_aniccklvl"}, |
| 11017 | |
| 11018 | {WE_GET_DYNAMIC_BW, |
| 11019 | 0, |
| 11020 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11021 | "get_cwmenable"}, |
| 11022 | |
| 11023 | {WE_GET_GTX_HT_MCS, |
| 11024 | 0, |
| 11025 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11026 | "get_gtxHTMcs"}, |
| 11027 | |
| 11028 | {WE_GET_GTX_VHT_MCS, |
| 11029 | 0, |
| 11030 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11031 | "get_gtxVHTMcs"}, |
| 11032 | |
| 11033 | {WE_GET_GTX_USRCFG, |
| 11034 | 0, |
| 11035 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11036 | "get_gtxUsrCfg"}, |
| 11037 | |
| 11038 | {WE_GET_GTX_THRE, |
| 11039 | 0, |
| 11040 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11041 | "get_gtxThre"}, |
| 11042 | |
| 11043 | {WE_GET_GTX_MARGIN, |
| 11044 | 0, |
| 11045 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11046 | "get_gtxMargin"}, |
| 11047 | |
| 11048 | {WE_GET_GTX_STEP, |
| 11049 | 0, |
| 11050 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11051 | "get_gtxStep"}, |
| 11052 | |
| 11053 | {WE_GET_GTX_MINTPC, |
| 11054 | 0, |
| 11055 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11056 | "get_gtxMinTpc"}, |
| 11057 | |
| 11058 | {WE_GET_GTX_BWMASK, |
| 11059 | 0, |
| 11060 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11061 | "get_gtxBWMask"}, |
| 11062 | |
| 11063 | {WE_GET_TX_CHAINMASK, |
| 11064 | 0, |
| 11065 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11066 | "get_txchainmask"}, |
| 11067 | |
| 11068 | {WE_GET_RX_CHAINMASK, |
| 11069 | 0, |
| 11070 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11071 | "get_rxchainmask"}, |
| 11072 | |
| 11073 | {WE_GET_11N_RATE, |
| 11074 | 0, |
| 11075 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11076 | "get_11nrate"}, |
| 11077 | |
| 11078 | {WE_GET_AMPDU, |
| 11079 | 0, |
| 11080 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11081 | "get_ampdu"}, |
| 11082 | |
| 11083 | {WE_GET_AMSDU, |
| 11084 | 0, |
| 11085 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11086 | "get_amsdu"}, |
| 11087 | |
| 11088 | {WE_GET_BURST_ENABLE, |
| 11089 | 0, |
| 11090 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11091 | "get_burst_en"}, |
| 11092 | |
| 11093 | {WE_GET_BURST_DUR, |
| 11094 | 0, |
| 11095 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11096 | "get_burst_dur"}, |
| 11097 | |
| 11098 | {WE_GET_TXPOW_2G, |
| 11099 | 0, |
| 11100 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11101 | "get_txpow2g"}, |
| 11102 | |
| 11103 | {WE_GET_TXPOW_5G, |
| 11104 | 0, |
| 11105 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11106 | "get_txpow5g"}, |
| 11107 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11108 | {WE_GET_PPS_PAID_MATCH, |
| 11109 | 0, |
| 11110 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11111 | "get_paid_match"}, |
| 11112 | |
| 11113 | {WE_GET_PPS_GID_MATCH, |
| 11114 | 0, |
| 11115 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11116 | "get_gid_match"}, |
| 11117 | |
| 11118 | {WE_GET_PPS_EARLY_TIM_CLEAR, |
| 11119 | 0, |
| 11120 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11121 | "get_tim_clear"}, |
| 11122 | |
| 11123 | {WE_GET_PPS_EARLY_DTIM_CLEAR, |
| 11124 | 0, |
| 11125 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11126 | "get_dtim_clear"}, |
| 11127 | |
| 11128 | {WE_GET_PPS_EOF_PAD_DELIM, |
| 11129 | 0, |
| 11130 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11131 | "get_eof_delim"}, |
| 11132 | |
| 11133 | {WE_GET_PPS_MACADDR_MISMATCH, |
| 11134 | 0, |
| 11135 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11136 | "get_mac_match"}, |
| 11137 | |
| 11138 | {WE_GET_PPS_DELIM_CRC_FAIL, |
| 11139 | 0, |
| 11140 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11141 | "get_delim_fail"}, |
| 11142 | |
| 11143 | {WE_GET_PPS_GID_NSTS_ZERO, |
| 11144 | 0, |
| 11145 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11146 | "get_nsts_zero"}, |
| 11147 | |
| 11148 | {WE_GET_PPS_RSSI_CHECK, |
| 11149 | 0, |
| 11150 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11151 | "get_rssi_chk"}, |
| 11152 | |
| 11153 | {WE_GET_QPOWER_MAX_PSPOLL_COUNT, |
| 11154 | 0, |
| 11155 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11156 | "get_qpspollcnt"}, |
| 11157 | |
| 11158 | {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 11159 | 0, |
| 11160 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11161 | "get_qtxwake"}, |
| 11162 | |
| 11163 | {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 11164 | 0, |
| 11165 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11166 | "get_qwakeintv"}, |
| 11167 | |
| 11168 | {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 11169 | 0, |
| 11170 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11171 | "get_qnodatapoll"}, |
| 11172 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 11173 | {WE_CAP_TSF, |
| 11174 | 0, |
| 11175 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11176 | "cap_tsf"}, |
| 11177 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11178 | {WE_GET_TEMPERATURE, |
| 11179 | 0, |
| 11180 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11181 | "get_temp"}, |
| 11182 | /* handlers for main ioctl */ |
| 11183 | {WLAN_PRIV_SET_CHAR_GET_NONE, |
| 11184 | IW_PRIV_TYPE_CHAR | 512, |
| 11185 | 0, |
| 11186 | ""}, |
| 11187 | |
| 11188 | /* handlers for sub-ioctl */ |
| 11189 | {WE_WOWL_ADD_PTRN, |
| 11190 | IW_PRIV_TYPE_CHAR | 512, |
| 11191 | 0, |
| 11192 | "wowlAddPtrn"}, |
| 11193 | |
| 11194 | {WE_WOWL_DEL_PTRN, |
| 11195 | IW_PRIV_TYPE_CHAR | 512, |
| 11196 | 0, |
| 11197 | "wowlDelPtrn"}, |
| 11198 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11199 | /* handlers for sub-ioctl */ |
| 11200 | {WE_NEIGHBOR_REPORT_REQUEST, |
| 11201 | IW_PRIV_TYPE_CHAR | 512, |
| 11202 | 0, |
| 11203 | "neighbor"}, |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 11204 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11205 | {WE_SET_AP_WPS_IE, |
| 11206 | IW_PRIV_TYPE_CHAR | 512, |
| 11207 | 0, |
| 11208 | "set_ap_wps_ie"}, |
| 11209 | |
| 11210 | {WE_SET_CONFIG, |
| 11211 | IW_PRIV_TYPE_CHAR | 512, |
| 11212 | 0, |
| 11213 | "setConfig"}, |
| 11214 | |
| 11215 | /* handlers for main ioctl */ |
| 11216 | {WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 11217 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11218 | 0, |
| 11219 | ""}, |
| 11220 | |
| 11221 | /* handlers for sub-ioctl */ |
| 11222 | {WE_SET_WLAN_DBG, |
| 11223 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11224 | 0, |
| 11225 | "setwlandbg"}, |
| 11226 | |
| 11227 | /* handlers for sub-ioctl */ |
| 11228 | {WE_SET_DP_TRACE, |
| 11229 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11230 | 0, |
| 11231 | "set_dp_trace"}, |
| 11232 | |
| 11233 | {WE_SET_SAP_CHANNELS, |
| 11234 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11235 | 0, |
| 11236 | "setsapchannels"}, |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 11237 | |
| 11238 | {WE_SET_FW_TEST, |
| 11239 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11240 | 0, "fw_test"}, |
| 11241 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 11242 | /* handlers for main ioctl */ |
| 11243 | {WLAN_PRIV_SET_NONE_GET_THREE_INT, |
| 11244 | 0, |
| 11245 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11246 | "" }, |
| 11247 | {WE_GET_TSF, |
| 11248 | 0, |
| 11249 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11250 | "get_tsf" }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11251 | |
| 11252 | {WE_SET_DUAL_MAC_SCAN_CONFIG, |
| 11253 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11254 | 0, |
| 11255 | "set_scan_cfg"}, |
| 11256 | |
| 11257 | /* handlers for main ioctl */ |
| 11258 | {WLAN_PRIV_GET_CHAR_SET_NONE, |
| 11259 | 0, |
| 11260 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11261 | ""}, |
| 11262 | |
| 11263 | /* handlers for sub-ioctl */ |
| 11264 | {WE_WLAN_VERSION, |
| 11265 | 0, |
| 11266 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11267 | "version"}, |
| 11268 | {WE_GET_STATS, |
| 11269 | 0, |
| 11270 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11271 | "getStats"}, |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 11272 | {WE_GET_SUSPEND_RESUME_STATS, |
| 11273 | 0, |
| 11274 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11275 | "getSuspendStats"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11276 | {WE_LIST_FW_PROFILE, |
| 11277 | 0, |
| 11278 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11279 | "listProfile"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11280 | {WE_GET_STATES, |
| 11281 | 0, |
| 11282 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11283 | "getHostStates"}, |
| 11284 | {WE_GET_CFG, |
| 11285 | 0, |
| 11286 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11287 | "getConfig"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11288 | {WE_GET_RSSI, |
| 11289 | 0, |
| 11290 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11291 | "getRSSI"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11292 | {WE_GET_WMM_STATUS, |
| 11293 | 0, |
| 11294 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11295 | "getWmmStatus"}, |
| 11296 | { |
| 11297 | WE_GET_CHANNEL_LIST, |
| 11298 | 0, |
| 11299 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11300 | "getChannelList" |
| 11301 | }, |
| 11302 | #ifdef FEATURE_WLAN_TDLS |
| 11303 | { |
| 11304 | WE_GET_TDLS_PEERS, |
| 11305 | 0, |
| 11306 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11307 | "getTdlsPeers" |
| 11308 | }, |
| 11309 | #endif |
| 11310 | #ifdef WLAN_FEATURE_11W |
| 11311 | { |
| 11312 | WE_GET_11W_INFO, |
| 11313 | 0, |
| 11314 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11315 | "getPMFInfo" |
| 11316 | }, |
| 11317 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 11318 | { |
| 11319 | WE_GET_IBSS_STA_INFO, |
| 11320 | 0, |
| 11321 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11322 | "getIbssSTAs" |
| 11323 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11324 | {WE_GET_PHYMODE, |
| 11325 | 0, |
| 11326 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11327 | "getphymode"}, |
| 11328 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 11329 | {WE_GET_OEM_DATA_CAP, |
| 11330 | 0, |
| 11331 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11332 | "getOemDataCap"}, |
| 11333 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 11334 | {WE_GET_SNR, |
| 11335 | 0, |
| 11336 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11337 | "getSNR"}, |
| 11338 | |
| 11339 | /* handlers for main ioctl */ |
| 11340 | {WLAN_PRIV_SET_NONE_GET_NONE, |
| 11341 | 0, |
| 11342 | 0, |
| 11343 | ""}, |
| 11344 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 11345 | /* handlers for sub-ioctl */ |
| 11346 | { |
| 11347 | WE_IBSS_GET_PEER_INFO_ALL, |
| 11348 | 0, |
| 11349 | 0, |
| 11350 | "ibssPeerInfoAll" |
| 11351 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11352 | {WE_GET_RECOVERY_STAT, |
| 11353 | 0, |
| 11354 | 0, |
| 11355 | "getRecoverStat"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11356 | |
| 11357 | {WE_GET_FW_PROFILE_DATA, |
| 11358 | 0, |
| 11359 | 0, |
| 11360 | "getProfileData"}, |
| 11361 | |
| 11362 | {WE_SET_REASSOC_TRIGGER, |
| 11363 | 0, |
| 11364 | 0, |
| 11365 | "reassoc"}, |
| 11366 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 11367 | {WE_STOP_OBSS_SCAN, |
| 11368 | 0, |
| 11369 | 0, |
| 11370 | "stop_obss_scan"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11371 | /* handlers for main ioctl */ |
| 11372 | {WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 11373 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11374 | 0, |
| 11375 | ""}, |
| 11376 | |
| 11377 | /* handlers for sub-ioctl */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 11378 | {WE_IBSS_GET_PEER_INFO, |
| 11379 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11380 | 0, |
| 11381 | "ibssPeerInfo"}, |
| 11382 | |
| 11383 | /* handlers for sub-ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11384 | {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 11385 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11386 | 0, |
| 11387 | "setdumplog"}, |
| 11388 | |
| 11389 | {WE_MTRACE_DUMP_CMD, |
| 11390 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11391 | 0, |
| 11392 | "dumplog"}, |
| 11393 | #ifdef MPC_UT_FRAMEWORK |
| 11394 | {WE_POLICY_MANAGER_CLIST_CMD, |
| 11395 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11396 | 0, |
| 11397 | "pm_clist"}, |
| 11398 | |
| 11399 | {WE_POLICY_MANAGER_DLIST_CMD, |
| 11400 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11401 | 0, |
| 11402 | "pm_dlist"}, |
| 11403 | |
| 11404 | {WE_POLICY_MANAGER_DBS_CMD, |
| 11405 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11406 | 0, |
| 11407 | "pm_dbs"}, |
| 11408 | |
| 11409 | {WE_POLICY_MANAGER_PCL_CMD, |
| 11410 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11411 | 0, |
| 11412 | "pm_pcl"}, |
| 11413 | |
| 11414 | {WE_POLICY_MANAGER_CINFO_CMD, |
| 11415 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11416 | 0, |
| 11417 | "pm_cinfo"}, |
| 11418 | |
| 11419 | {WE_POLICY_MANAGER_ULIST_CMD, |
| 11420 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11421 | 0, |
| 11422 | "pm_ulist"}, |
| 11423 | |
| 11424 | {WE_POLICY_MANAGER_QUERY_ACTION_CMD, |
| 11425 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11426 | 0, |
| 11427 | "pm_query_action"}, |
| 11428 | |
| 11429 | {WE_POLICY_MANAGER_QUERY_ALLOW_CMD, |
| 11430 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11431 | 0, |
| 11432 | "pm_query_allow"}, |
| 11433 | |
| 11434 | {WE_POLICY_MANAGER_SCENARIO_CMD, |
| 11435 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11436 | 0, |
| 11437 | "pm_run_scenario"}, |
| 11438 | |
| 11439 | {WE_POLICY_SET_HW_MODE_CMD, |
| 11440 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11441 | 0, |
| 11442 | "pm_set_hw_mode"}, |
| 11443 | #endif |
| 11444 | #ifdef FEATURE_WLAN_TDLS |
| 11445 | /* handlers for sub ioctl */ |
| 11446 | { |
| 11447 | WE_TDLS_CONFIG_PARAMS, |
| 11448 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11449 | 0, |
| 11450 | "setTdlsConfig" |
| 11451 | }, |
| 11452 | #endif |
| 11453 | { |
| 11454 | WE_UNIT_TEST_CMD, |
| 11455 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11456 | 0, |
| 11457 | "setUnitTestCmd" |
| 11458 | }, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 11459 | { |
| 11460 | WE_MAC_PWR_DEBUG_CMD, |
| 11461 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11462 | 0, |
| 11463 | "halPwrDebug" |
| 11464 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11465 | |
| 11466 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 11467 | {WE_LED_FLASHING_PARAM, |
| 11468 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11469 | 0, |
| 11470 | "gpio_control"}, |
| 11471 | #endif |
| 11472 | /* handlers for main ioctl */ |
| 11473 | {WLAN_PRIV_ADD_TSPEC, |
| 11474 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 11475 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11476 | "addTspec"}, |
| 11477 | |
| 11478 | /* handlers for main ioctl */ |
| 11479 | {WLAN_PRIV_DEL_TSPEC, |
| 11480 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11481 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11482 | "delTspec"}, |
| 11483 | |
| 11484 | /* handlers for main ioctl */ |
| 11485 | {WLAN_PRIV_GET_TSPEC, |
| 11486 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11487 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11488 | "getTspec"}, |
| 11489 | |
| 11490 | /* handlers for main ioctl - host offload */ |
| 11491 | { |
| 11492 | WLAN_PRIV_SET_HOST_OFFLOAD, |
| 11493 | IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest), |
| 11494 | 0, |
| 11495 | "setHostOffload" |
| 11496 | } |
| 11497 | , |
| 11498 | |
| 11499 | { |
| 11500 | WLAN_GET_WLAN_STATISTICS, |
| 11501 | 0, |
| 11502 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 11503 | "getWlanStats" |
| 11504 | } |
| 11505 | , |
| 11506 | |
| 11507 | { |
| 11508 | WLAN_SET_KEEPALIVE_PARAMS, |
Mahesh A Saptasagar | 72d2e4b | 2016-04-20 12:44:17 +0530 | [diff] [blame] | 11509 | IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | |
| 11510 | IW_PRIV_SIZE_FIXED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11511 | 0, |
| 11512 | "setKeepAlive" |
| 11513 | } |
| 11514 | , |
| 11515 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 11516 | { |
| 11517 | WLAN_SET_PACKET_FILTER_PARAMS, |
Hanumanth Reddy Pothula | b3ef416 | 2016-10-25 15:13:26 +0530 | [diff] [blame] | 11518 | IW_PRIV_TYPE_BYTE | |
| 11519 | sizeof(struct pkt_filter_cfg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11520 | 0, |
| 11521 | "setPktFilter" |
| 11522 | } |
| 11523 | , |
| 11524 | #endif |
| 11525 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 11526 | { |
| 11527 | WLAN_SET_PNO, |
| 11528 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 11529 | 0, |
| 11530 | "setpno" |
| 11531 | } |
| 11532 | , |
| 11533 | #endif |
| 11534 | { |
| 11535 | WLAN_SET_BAND_CONFIG, |
| 11536 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11537 | 0, |
| 11538 | "SETBAND" |
| 11539 | } |
| 11540 | , |
| 11541 | { |
| 11542 | WLAN_GET_LINK_SPEED, |
| 11543 | IW_PRIV_TYPE_CHAR | 18, |
| 11544 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" |
| 11545 | } |
| 11546 | , |
| 11547 | |
| 11548 | /* handlers for main ioctl */ |
| 11549 | {WLAN_PRIV_SET_TWO_INT_GET_NONE, |
| 11550 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11551 | 0, |
| 11552 | ""} |
| 11553 | , |
| 11554 | {WE_SET_SMPS_PARAM, |
| 11555 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11556 | 0, "set_smps_param"} |
| 11557 | , |
| 11558 | {WLAN_SET_DOT11P_CHANNEL_SCHED, |
| 11559 | IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched), |
| 11560 | 0, "set_dot11p" } |
| 11561 | , |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 11562 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11563 | {WE_SET_FW_CRASH_INJECT, |
| 11564 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11565 | 0, "crash_inject"} |
| 11566 | , |
| 11567 | #endif |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 11568 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 11569 | {WE_SET_WLAN_SUSPEND, |
| 11570 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11571 | 0, "wlan_suspend"} |
| 11572 | , |
| 11573 | {WE_SET_WLAN_RESUME, |
| 11574 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11575 | 0, "wlan_resume"} |
| 11576 | , |
| 11577 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11578 | {WE_ENABLE_FW_PROFILE, |
| 11579 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11580 | 0, "enableProfile"} |
| 11581 | , |
| 11582 | {WE_SET_FW_PROFILE_HIST_INTVL, |
| 11583 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11584 | 0, "set_hist_intvl"} |
| 11585 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11586 | {WE_SET_DUAL_MAC_FW_MODE_CONFIG, |
| 11587 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11588 | 0, "set_fw_mode_cfg"} |
| 11589 | , |
| 11590 | {WE_DUMP_DP_TRACE_LEVEL, |
| 11591 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11592 | 0, "dump_dp_trace"} |
| 11593 | , |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11594 | {WE_SET_MON_MODE_CHAN, |
| 11595 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 11596 | 0, "setMonChan"} |
| 11597 | , |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 11598 | |
| 11599 | {WE_GET_ROAM_SYNCH_DELAY, |
| 11600 | 0, |
| 11601 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11602 | "hostroamdelay"} |
| 11603 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11604 | }; |
| 11605 | |
| 11606 | const struct iw_handler_def we_handler_def = { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11607 | .num_standard = QDF_ARRAY_SIZE(we_handler), |
| 11608 | .num_private = QDF_ARRAY_SIZE(we_private), |
| 11609 | .num_private_args = QDF_ARRAY_SIZE(we_private_args), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11610 | |
| 11611 | .standard = (iw_handler *) we_handler, |
| 11612 | .private = (iw_handler *) we_private, |
| 11613 | .private_args = we_private_args, |
| 11614 | .get_wireless_stats = NULL, |
| 11615 | }; |
| 11616 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11617 | /* hdd_set_wext() - configures bss parameters |
| 11618 | * @pAdapter: handle to adapter context |
| 11619 | * |
| 11620 | * Returns: none |
| 11621 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 11622 | static int hdd_set_wext(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11623 | { |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11624 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11625 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11626 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11627 | ENTER(); |
| 11628 | |
| 11629 | if (!pwextBuf) { |
| 11630 | hdd_err("ERROR: pwextBuf is NULL"); |
| 11631 | return QDF_STATUS_E_FAILURE; |
| 11632 | } |
| 11633 | |
| 11634 | if (!pHddStaCtx) { |
| 11635 | hdd_err("ERROR: pHddStaCtx is NULL"); |
| 11636 | return QDF_STATUS_E_FAILURE; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11637 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11638 | |
| 11639 | /* Now configure the roaming profile links. To SSID and bssid. */ |
| 11640 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11641 | pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11642 | |
| 11643 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11644 | pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11645 | |
| 11646 | /*Set the numOfChannels to zero to scan all the channels */ |
| 11647 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 11648 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 11649 | |
| 11650 | /* Default is no encryption */ |
| 11651 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 11652 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = |
| 11653 | eCSR_ENCRYPT_TYPE_NONE; |
| 11654 | |
| 11655 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 11656 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = |
| 11657 | eCSR_ENCRYPT_TYPE_NONE; |
| 11658 | |
| 11659 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 11660 | |
| 11661 | /* Default is no authentication */ |
| 11662 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 11663 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11664 | |
| 11665 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO; |
| 11666 | pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11667 | |
| 11668 | /*Set the default scan mode */ |
| 11669 | pAdapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 11670 | |
| 11671 | hdd_clear_roam_profile_ie(pAdapter); |
| 11672 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11673 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11674 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11675 | |
| 11676 | } |
| 11677 | |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11678 | /** |
| 11679 | * hdd_register_wext() - register wext context |
| 11680 | * @dev: net device handle |
| 11681 | * |
| 11682 | * Registers wext interface context for a given net device |
| 11683 | * |
| 11684 | * Returns: 0 on success, errno on failure |
| 11685 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11686 | int hdd_register_wext(struct net_device *dev) |
| 11687 | { |
| 11688 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11689 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11690 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11691 | |
| 11692 | ENTER(); |
| 11693 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 11694 | if (!pwextBuf) { |
| 11695 | hdd_err(FL("ERROR: pwextBuf is NULL")); |
| 11696 | return QDF_STATUS_E_FAILURE; |
| 11697 | } |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 11698 | |
| 11699 | /* Zero the memory. This zeros the profile structure */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11700 | memset(pwextBuf, 0, sizeof(hdd_wext_state_t)); |
| 11701 | |
| 11702 | init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))-> |
| 11703 | completion_var); |
| 11704 | |
| 11705 | status = hdd_set_wext(pAdapter); |
| 11706 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11707 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11708 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11709 | hdd_err("ERROR: hdd_set_wext failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11710 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11711 | } |
| 11712 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 11713 | if (!QDF_IS_STATUS_SUCCESS(qdf_event_create(&pwextBuf->hdd_qdf_event))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11714 | hdd_err("ERROR: HDD qdf event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11715 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11716 | } |
| 11717 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11718 | if (!QDF_IS_STATUS_SUCCESS(qdf_event_create(&pwextBuf->scanevent))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11719 | hdd_err("ERROR: HDD scan event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11720 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11721 | } |
| 11722 | /* Register as a wireless device */ |
| 11723 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 11724 | |
| 11725 | EXIT(); |
| 11726 | return 0; |
| 11727 | } |
| 11728 | |
| 11729 | int hdd_unregister_wext(struct net_device *dev) |
| 11730 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11731 | hdd_notice("dev(%p)", dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11732 | |
| 11733 | if (dev != NULL) { |
| 11734 | rtnl_lock(); |
| 11735 | dev->wireless_handlers = NULL; |
| 11736 | rtnl_unlock(); |
| 11737 | } |
| 11738 | |
| 11739 | return 0; |
| 11740 | } |