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> |
Rajeev Kumar | ea95edd | 2017-01-11 20:49:36 -0800 | [diff] [blame] | 42 | #include "scheduler_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 43 | #include <net/arp.h> |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 44 | #include <cdp_txrx_cmn.h> |
Manjunathappa Prakash | 3454fd6 | 2016-04-01 08:52:06 -0700 | [diff] [blame] | 45 | #include <cdp_txrx_stats.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "sir_params.h" |
| 47 | #include "csr_api.h" |
| 48 | #include "csr_inside_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | #include "sme_rrm_internal.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include <ani_global.h> |
| 51 | #include "dot11f.h" |
| 52 | #include <wlan_hdd_wowl.h> |
| 53 | #include <wlan_hdd_cfg.h> |
| 54 | #include <wlan_hdd_wmm.h> |
| 55 | #include "utils_api.h" |
| 56 | #include "wlan_hdd_p2p.h" |
| 57 | #ifdef FEATURE_WLAN_TDLS |
| 58 | #include "wlan_hdd_tdls.h" |
| 59 | #endif |
| 60 | |
| 61 | #include "cds_ieee80211_common.h" |
| 62 | #include "ol_if_athvar.h" |
| 63 | #include "dbglog_host.h" |
| 64 | #include "wma.h" |
| 65 | |
| 66 | #include "wlan_hdd_power.h" |
| 67 | #include "qwlan_version.h" |
| 68 | #include "wlan_hdd_host_offload.h" |
| 69 | |
| 70 | #include <linux/wireless.h> |
| 71 | #include <net/cfg80211.h> |
| 72 | |
| 73 | #include "wlan_hdd_misc.h" |
| 74 | |
| 75 | #include "qc_sap_ioctl.h" |
| 76 | #include "sme_api.h" |
| 77 | #include "wma_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 78 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | #include "wlan_hdd_assoc.h" |
| 80 | #include "wlan_hdd_ioctl.h" |
| 81 | #include "wlan_hdd_scan.h" |
| 82 | #include "sme_power_save_api.h" |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 83 | #include "wlan_policy_mgr_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | #include "wlan_hdd_conc_ut.h" |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 85 | #include "wlan_hdd_fips.h" |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 86 | #include "wlan_hdd_tsf.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | #include "wlan_hdd_ocb.h" |
| 88 | #include "wlan_hdd_napi.h" |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 89 | #include "cdp_txrx_flow_ctrl_legacy.h" |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 90 | #include "wlan_hdd_nan_datapath.h" |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 91 | #include "wlan_hdd_stats.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 92 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 93 | #include "wlan_hdd_driver_ops.h" |
| 94 | #include "hif.h" |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 95 | #include "pld_common.h" |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 96 | #endif |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_lro.h" |
yeshwanth sriram guntuka | 310b3ac | 2016-11-15 23:25:26 +0530 | [diff] [blame] | 98 | #include "cds_utils.h" |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 99 | #include "wlan_hdd_request_manager.h" |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 100 | #include "os_if_wifi_pos.h" |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 101 | #include <cdp_txrx_stats.h> |
| 102 | #include <cds_api.h> |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 103 | #include <wlan_osif_priv.h> |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 104 | #include "wlan_hdd_regulatory.h" |
| 105 | #include "wlan_reg_ucfg_api.h" |
Hanumanth Reddy Pothula | 3def894 | 2017-10-05 16:19:36 +0530 | [diff] [blame] | 106 | #include "wlan_hdd_packet_filter_api.h" |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 107 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 108 | #define HDD_FINISH_ULA_TIME_OUT 800 |
| 109 | #define HDD_SET_MCBC_FILTERS_TO_FW 1 |
| 110 | #define HDD_DELETE_MCBC_FILTERS_FROM_FW 0 |
| 111 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | /* To Validate Channel against the Frequency and Vice-Versa */ |
Srinivas Girigowda | 4859267 | 2017-03-25 14:58:44 -0700 | [diff] [blame] | 113 | static const struct ccp_freq_chan_map freq_chan_map[] = { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | {2412, 1}, {2417, 2}, {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, |
| 115 | {2442, 7}, {2447, 8}, {2452, 9}, {2457, 10}, {2462, 11}, {2467, 12}, |
| 116 | {2472, 13}, {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, |
| 117 | {4980, 252}, {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, |
| 118 | {5200, 40}, {5220, 44}, {5240, 48}, {5260, 52}, {5280, 56}, |
| 119 | {5300, 60}, {5320, 64}, {5500, 100}, {5520, 104}, {5540, 108}, |
| 120 | {5560, 112}, {5580, 116}, {5600, 120}, {5620, 124}, {5640, 128}, |
| 121 | {5660, 132}, {5680, 136}, {5700, 140}, {5720, 144}, {5745, 149}, |
| 122 | {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165}, {5852, 170}, |
| 123 | {5855, 171}, {5860, 172}, {5865, 173}, {5870, 174}, {5875, 175}, |
| 124 | {5880, 176}, {5885, 177}, {5890, 178}, {5895, 179}, {5900, 180}, |
| 125 | {5905, 181}, {5910, 182}, {5915, 183}, {5920, 184} }; |
| 126 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 127 | #define FREQ_CHAN_MAP_TABLE_SIZE QDF_ARRAY_SIZE(freq_chan_map) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 128 | |
| 129 | /* Private ioctls and their sub-ioctls */ |
| 130 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 131 | #define WE_SET_11D_STATE 1 |
| 132 | #define WE_WOWL 2 |
| 133 | #define WE_SET_POWER 3 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 134 | /* |
| 135 | * <ioctl> |
| 136 | * setMaxAssoc - Sets the maximum number of associated stations |
| 137 | * |
| 138 | * @INPUT: 1 to 32 |
| 139 | * |
| 140 | * @OUTPUT: None |
| 141 | * |
| 142 | * This IOTCL sets the maximum number of associated stations |
| 143 | * |
| 144 | * @E.g: iwpriv wlan0 setMaxAssoc <value> |
| 145 | * |
| 146 | * Supported Feature: STA |
| 147 | * |
| 148 | * Usage: Internal/External |
| 149 | * |
| 150 | * </ioctl> |
| 151 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | #define WE_SET_MAX_ASSOC 4 |
yeshwanth sriram guntuka | bdfe435 | 2017-02-16 14:44:31 +0530 | [diff] [blame] | 153 | /* |
| 154 | * <ioctl> |
| 155 | * scan_diable - Disable scan |
| 156 | * |
| 157 | * @INPUT: set_value |
| 158 | * |
| 159 | * @OUTPUT: None |
| 160 | * |
| 161 | * This IOCTL is used to set disable scan |
| 162 | * |
| 163 | * @E.g: iwpriv wlan0 scan_disable 1 |
| 164 | * |
| 165 | * Supported Feature: Scan |
| 166 | * |
| 167 | * Usage: Internal/External |
| 168 | * |
| 169 | * </ioctl> |
| 170 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | #define WE_SET_SCAN_DISABLE 5 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 172 | /* |
| 173 | * <ioctl> |
| 174 | * inactivityTO - sets the timeout value for inactivity data while |
| 175 | * in power save mode |
| 176 | * |
| 177 | * @INPUT: int1…..int255 |
| 178 | * |
| 179 | * @OUTPUT: None |
| 180 | * |
| 181 | * This IOCTL set the timeout value for inactivity data in power save mode |
| 182 | * |
| 183 | * @E.g: iwpriv wlan0 inactivityTO 20 |
| 184 | * |
| 185 | * Supported Feature: STA |
| 186 | * |
| 187 | * Usage: Internal/External |
| 188 | * |
| 189 | * </ioctl> |
| 190 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 191 | #define WE_SET_DATA_INACTIVITY_TO 6 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 192 | /* |
| 193 | * <ioctl> |
| 194 | * setMaxTxPower - Dynamically sets the maximum transmission power |
| 195 | * |
| 196 | * @INPUT: Transmission power in dBm |
| 197 | * |
| 198 | * @OUTPUT: None |
| 199 | * |
| 200 | * This IOCTL dynamically sets the maximum transmission power |
| 201 | * This setting does not persist over reboots |
| 202 | * |
| 203 | * @E.g: iwpriv wlan0 setMaxTxPower <value in db) |
| 204 | * |
| 205 | * Supported Feature: STA |
| 206 | * |
| 207 | * Usage: Internal/External |
| 208 | * |
| 209 | * </ioctl> |
| 210 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 211 | #define WE_SET_MAX_TX_POWER 7 |
| 212 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 213 | #define WE_SET_TM_LEVEL 9 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 214 | /* |
| 215 | * <ioctl> |
| 216 | * setphymode - Set the phymode dynamically |
| 217 | * |
| 218 | * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN |
| 219 | * |
| 220 | * @OUTPUT: None |
| 221 | * |
| 222 | * This IOCTL sets the phymode dynamically |
| 223 | * |
| 224 | * @E.g: iwpriv wlan0 setphymode 10 |
| 225 | * |
| 226 | * Supported Feature: STA |
| 227 | * |
| 228 | * Usage: Internal/External |
| 229 | * |
| 230 | * </ioctl> |
| 231 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | #define WE_SET_PHYMODE 10 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 233 | /* |
| 234 | * <ioctl> |
| 235 | * nss - Set the number of spatial streams |
| 236 | * |
| 237 | * @INPUT: int1…..int3 |
| 238 | * |
| 239 | * @OUTPUT: None |
| 240 | * |
| 241 | * This IOCTL sets the number of spatial streams. Supported values are 1 and 2 |
| 242 | * |
| 243 | * @E.g: iwpriv wlan0 nss 2 |
| 244 | * |
| 245 | * Supported Feature: STA |
| 246 | * |
| 247 | * Usage: Internal/External |
| 248 | * |
| 249 | * </ioctl> |
| 250 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 251 | #define WE_SET_NSS 11 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 252 | /* |
| 253 | * <ioctl> |
| 254 | * ldpc - Enables or disables LDPC |
| 255 | * |
| 256 | * @INPUT: 0 – Disable, 1 - Enable |
| 257 | * |
| 258 | * @OUTPUT: None |
| 259 | * |
| 260 | * This IOCTL enables or disables LDPC |
| 261 | * |
| 262 | * @E.g: iwpriv wlan0 ldpc 1 |
| 263 | * |
| 264 | * Supported Feature: STA |
| 265 | * |
| 266 | * Usage: Internal/External |
| 267 | * |
| 268 | * </ioctl> |
| 269 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 270 | #define WE_SET_LDPC 12 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 271 | /* |
| 272 | * <ioctl> |
| 273 | * tx_stbc - Enables or disables tx_stbc |
| 274 | * |
| 275 | * @INPUT: Int 0 – Disable, 1 - Enable |
| 276 | * |
| 277 | * @OUTPUT: None |
| 278 | * |
| 279 | * This IOTCL used to enables or disables tx_stbc |
| 280 | * |
| 281 | * @E.g: iwpriv wlan0 tx_stbc <value> |
| 282 | * |
| 283 | * Supported Feature: STA |
| 284 | * |
| 285 | * Usage: Internal/External |
| 286 | * |
| 287 | * </ioctl> |
| 288 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | #define WE_SET_TX_STBC 13 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 290 | /* |
| 291 | * <ioctl> |
| 292 | * rx_stbc - Set the rx_stbc parameter |
| 293 | * |
| 294 | * @INPUT: Int 0 – Disable, 1 - Enable |
| 295 | * |
| 296 | * @OUTPUT: None |
| 297 | * |
| 298 | * This IOTCL used to set rx_stbc parameter |
| 299 | * |
| 300 | * @E.g: iwpriv wlan0 rx_stbc <value> |
| 301 | * |
| 302 | * Supported Feature: STA |
| 303 | * |
| 304 | * Usage: Internal/External |
| 305 | * |
| 306 | * </ioctl> |
| 307 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 308 | #define WE_SET_RX_STBC 14 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 309 | /* |
| 310 | * <ioctl> |
| 311 | * shortgi - Enables or disables a short-guard interval |
| 312 | * |
| 313 | * @INPUT: Int 0 – Disable, 1 - Enable |
| 314 | * |
| 315 | * @OUTPUT: None |
| 316 | * |
| 317 | * This IOCTL enables or disables a short-guard interval. |
| 318 | * |
| 319 | * @E.g: iwpriv wlan0 shortgi <value> |
| 320 | * |
| 321 | * Supported Feature: STA |
| 322 | * |
| 323 | * Usage: Internal/External |
| 324 | * |
| 325 | * </ioctl> |
| 326 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 327 | #define WE_SET_SHORT_GI 15 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 328 | /* |
| 329 | * <ioctl> |
| 330 | * enablertscts - enables or disables rts/cts. |
| 331 | * |
| 332 | * @INPUT: 1-Enable , 0-Disable |
| 333 | * |
| 334 | * @OUTPUT: None |
| 335 | * |
| 336 | * This IOCTL enables or disables rts/cts. |
| 337 | * |
| 338 | * @E.g: iwpriv wlan0 enablertscts <value> |
| 339 | * |
| 340 | * Supported Feature: STA |
| 341 | * |
| 342 | * Usage: Internal/External |
| 343 | * |
| 344 | * </ioctl> |
| 345 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 346 | #define WE_SET_RTSCTS 16 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 347 | /* |
| 348 | * <ioctl> |
| 349 | * chwidth - Set the channel bandwidth |
| 350 | * |
| 351 | * @INPUT: 0-20mhz to 3-160mhz |
| 352 | * |
| 353 | * @OUTPUT: None |
| 354 | * |
| 355 | * This IOTCL used to set the channel bandwidth |
| 356 | * |
| 357 | * @E.g: iwpriv wlan0 chwidth 1 |
| 358 | * |
| 359 | * Supported Feature: STA |
| 360 | * |
| 361 | * Usage: Internal/External |
| 362 | * |
| 363 | * </ioctl> |
| 364 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | #define WE_SET_CHWIDTH 17 |
| 366 | #define WE_SET_ANI_EN_DIS 18 |
| 367 | #define WE_SET_ANI_POLL_PERIOD 19 |
| 368 | #define WE_SET_ANI_LISTEN_PERIOD 20 |
| 369 | #define WE_SET_ANI_OFDM_LEVEL 21 |
| 370 | #define WE_SET_ANI_CCK_LEVEL 22 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 371 | /* |
| 372 | * <ioctl> |
| 373 | * cwmenable - Enables or disables the dynamic channel bandwidth |
| 374 | * |
| 375 | * @INPUT: 0-Disable, 1-Enable |
| 376 | * |
| 377 | * @OUTPUT: None |
| 378 | * |
| 379 | * This IOTCL used to enables or disables the dynamic channel bandwidth |
| 380 | * |
| 381 | * @E.g: iwpriv wlan0 cwmenable <value> |
| 382 | * |
| 383 | * Supported Feature: STA |
| 384 | * |
| 385 | * Usage: Internal/External |
| 386 | * |
| 387 | * </ioctl> |
| 388 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 389 | #define WE_SET_DYNAMIC_BW 23 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 390 | /* |
| 391 | * <ioctl> |
| 392 | * txchainmask - This IOCTL sets the current Tx chain mask |
| 393 | * |
| 394 | * @INPUT: Mask Value |
| 395 | * |
| 396 | * @OUTPUT: None |
| 397 | * |
| 398 | * This IOCTL sets the current Tx chain mask |
| 399 | * |
| 400 | * @E.g: iwpriv wlan0 txchainmask 1 |
| 401 | * |
| 402 | * Supported Feature: STA |
| 403 | * |
| 404 | * Usage: Internal/External |
| 405 | * |
| 406 | * </ioctl> |
| 407 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 408 | #define WE_SET_TX_CHAINMASK 24 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 409 | /* |
| 410 | * <ioctl> |
| 411 | * rxchainmask - Sets the current Rx chain mask |
| 412 | * |
| 413 | * @INPUT: Mask Value |
| 414 | * |
| 415 | * @OUTPUT: None |
| 416 | * |
| 417 | * This IOCTL sets the current Rx chain mask. This command is the |
| 418 | * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini. |
| 419 | * |
| 420 | * @E.g: iwpriv wlan0 rxchainmask <value> |
| 421 | * |
| 422 | * Supported Feature: STA |
| 423 | * |
| 424 | * Usage: Internal/External |
| 425 | * |
| 426 | * </ioctl> |
| 427 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | #define WE_SET_RX_CHAINMASK 25 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 429 | /* |
| 430 | * <ioctl> |
| 431 | * set11NRates - Fixes the Tx data rate of the 11N mode. |
| 432 | * |
| 433 | * @INPUT: 0x1b to 0x8f |
| 434 | * |
| 435 | * @OUTPUT: None |
| 436 | * |
| 437 | * This IOCTL fixes the Tx data rate of the 11N mode. |
| 438 | * |
| 439 | * @E.g: iwpriv wlan0 set11NRates 0x85 |
| 440 | * |
| 441 | * Supported Feature: STA |
| 442 | * |
| 443 | * Usage: Internal/External |
| 444 | * |
| 445 | * </ioctl> |
| 446 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 447 | #define WE_SET_11N_RATE 26 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 448 | /* |
| 449 | * <ioctl> |
| 450 | * ampdu - Set the the maximum subframe of ampdu |
| 451 | * |
| 452 | * @INPUT: int 1 to int 63 |
| 453 | * |
| 454 | * @OUTPUT: None |
| 455 | * |
| 456 | * This IOCTL sets the maximum subframe of ampdu. |
| 457 | * |
| 458 | * @E.g: iwpriv wlan0 ampdu 9 |
| 459 | * |
| 460 | * Supported Feature: STA |
| 461 | * |
| 462 | * Usage: Internal/External |
| 463 | * |
| 464 | * </ioctl> |
| 465 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 466 | #define WE_SET_AMPDU 27 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 467 | /* |
| 468 | * <ioctl> |
| 469 | * amsdu - Sets the maximum subframe of amsdu. |
| 470 | * |
| 471 | * @INPUT: int 1 to int 31 |
| 472 | * |
| 473 | * @OUTPUT: None |
| 474 | * |
| 475 | * This IOCTL sets the maximum subframe of amsdu. |
| 476 | * |
| 477 | * @E.g: iwpriv wlan0 amsdu 9 |
| 478 | * |
| 479 | * Supported Feature: STA |
| 480 | * |
| 481 | * Usage: Internal/External |
| 482 | * |
| 483 | * </ioctl> |
| 484 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 485 | #define WE_SET_AMSDU 28 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 486 | /* |
| 487 | * <ioctl> |
| 488 | * txpow2g - current 2 GHz Tx power setting |
| 489 | * |
| 490 | * @INPUT: Tx power in dBm |
| 491 | * |
| 492 | * @OUTPUT: None |
| 493 | * |
| 494 | * This IOTCL used to set 2 ghz tx power |
| 495 | * |
| 496 | * @E.g: iwpriv wlan0 txpow2g |
| 497 | * |
| 498 | * Supported Feature: STA |
| 499 | * |
| 500 | * Usage: Internal/External |
| 501 | * |
| 502 | * </ioctl> |
| 503 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 504 | #define WE_SET_TXPOW_2G 29 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 505 | /* |
| 506 | * <ioctl> |
| 507 | * txpow5g - Current 5 GHz tx power setting |
| 508 | * |
| 509 | * @INPUT: Tx power in dBm |
| 510 | * |
| 511 | * @OUTPUT: None |
| 512 | * |
| 513 | * This IOTCL used to set the 5 ghz txpower |
| 514 | * |
| 515 | * @E.g: iwpriv wlan0 txpow5g |
| 516 | * |
| 517 | * Supported Feature: STA |
| 518 | * |
| 519 | * Usage: Internal/External |
| 520 | * |
| 521 | * </ioctl> |
| 522 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 523 | #define WE_SET_TXPOW_5G 30 |
| 524 | /* Private ioctl for firmware debug log */ |
| 525 | #define WE_DBGLOG_LOG_LEVEL 31 |
| 526 | #define WE_DBGLOG_VAP_ENABLE 32 |
| 527 | #define WE_DBGLOG_VAP_DISABLE 33 |
| 528 | #define WE_DBGLOG_MODULE_ENABLE 34 |
| 529 | #define WE_DBGLOG_MODULE_DISABLE 35 |
| 530 | #define WE_DBGLOG_MOD_LOG_LEVEL 36 |
| 531 | #define WE_DBGLOG_TYPE 37 |
| 532 | #define WE_SET_TXRX_FWSTATS 38 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 533 | /* |
| 534 | * <ioctl> |
| 535 | * set11ACRates - Fixes the Tx data rate of 11AC |
| 536 | * |
| 537 | * @INPUT: 0x1 to 0x9 |
| 538 | * |
| 539 | * @OUTPUT: None |
| 540 | * |
| 541 | * This IOCTL fixes the Tx data rate of 11AC. |
| 542 | * |
| 543 | * @E.g: iwpriv wlan0 set11ACRates 0x9 |
| 544 | * |
| 545 | * Supported Feature: STA |
| 546 | * |
| 547 | * Usage: Internal/External |
| 548 | * |
| 549 | * </ioctl> |
| 550 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 551 | #define WE_SET_VHT_RATE 39 |
| 552 | #define WE_DBGLOG_REPORT_ENABLE 40 |
| 553 | #define WE_TXRX_FWSTATS_RESET 41 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 554 | /* |
| 555 | * <ioctl> |
| 556 | * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band |
| 557 | * |
| 558 | * @INPUT: Transmission power in dBm |
| 559 | * |
| 560 | * @OUTPUT: None |
| 561 | * |
| 562 | * This IOCTL sets the maximum transmit power for the 2.4-GHz band |
| 563 | * This setting does not persist over reboots |
| 564 | * |
| 565 | * @E.g: iwpriv wlan0 setTxMaxPower2G 10 |
| 566 | * |
| 567 | * Supported Feature: STA |
| 568 | * |
| 569 | * Usage: Internal/External |
| 570 | * |
| 571 | * </ioctl> |
| 572 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 573 | #define WE_SET_MAX_TX_POWER_2_4 42 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 574 | /* |
| 575 | * <ioctl> |
| 576 | * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band |
| 577 | * |
| 578 | * @INPUT: Transmission power in dBm |
| 579 | * |
| 580 | * @OUTPUT: None |
| 581 | * |
| 582 | * This IOCTL sets the maximum transmit power for the 5-GHz band |
| 583 | * This setting does not persist over reboots |
| 584 | * |
| 585 | * @E.g: iwpriv wlan0 setTxMaxPower5G 10 |
| 586 | * |
| 587 | * Supported Feature: STA |
| 588 | * |
| 589 | * Usage: Internal/External |
| 590 | * |
| 591 | * </ioctl> |
| 592 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | #define WE_SET_MAX_TX_POWER_5_0 43 |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 594 | #define WE_SET_PKTLOG 44 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 595 | /* Private ioctl for packet powe save */ |
| 596 | #define WE_PPS_PAID_MATCH 45 |
| 597 | #define WE_PPS_GID_MATCH 46 |
| 598 | #define WE_PPS_EARLY_TIM_CLEAR 47 |
| 599 | #define WE_PPS_EARLY_DTIM_CLEAR 48 |
| 600 | #define WE_PPS_EOF_PAD_DELIM 49 |
| 601 | #define WE_PPS_MACADDR_MISMATCH 50 |
| 602 | #define WE_PPS_DELIM_CRC_FAIL 51 |
| 603 | #define WE_PPS_GID_NSTS_ZERO 52 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 604 | /* |
| 605 | * <ioctl> |
| 606 | * rssi_chk - Chek the rssi |
| 607 | * |
| 608 | * @INPUT: One argument as input |
| 609 | * |
| 610 | * @OUTPUT: rssi |
| 611 | * wlan0 rssi_chk:56 |
| 612 | * |
| 613 | * This IOTCL used to chek rssi |
| 614 | * |
| 615 | * @E.g: iwpriv wlan0 rssi_chk <value> |
| 616 | * |
| 617 | * Supported Feature: STA |
| 618 | * |
| 619 | * Usage: Internal/External |
| 620 | * |
| 621 | * </ioctl> |
| 622 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | #define WE_PPS_RSSI_CHECK 53 |
Agrawal Ashish | bafaff1 | 2016-12-27 17:43:08 +0530 | [diff] [blame] | 624 | /* |
| 625 | * <ioctl> |
| 626 | * setAutoChannel - set ACS enable/disable |
| 627 | * |
| 628 | * @INPUT: None |
| 629 | * |
| 630 | * @OUTPUT: None |
| 631 | * |
| 632 | * This IOCTL is used to set SAP ACS eanble/disable |
| 633 | * |
| 634 | * @E.g: iwpriv wlan0 setAutoChannel 0 |
| 635 | * |
| 636 | * Supported Feature: SAP |
| 637 | * |
| 638 | * Usage: Internal/External |
| 639 | * |
| 640 | * </ioctl> |
| 641 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 642 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 54 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 643 | /* |
| 644 | * <ioctl> |
| 645 | * htsmps - Sets the htsmps |
| 646 | * |
| 647 | * @INPUT: Atleast one int argument |
| 648 | * |
| 649 | * @OUTPUT: None |
| 650 | * |
| 651 | * This IOTCL used to set htsmps |
| 652 | * |
| 653 | * @E.g: iwpriv wlan0 htsmps <value> |
| 654 | * |
| 655 | * Supported Feature: STA |
| 656 | * |
| 657 | * Usage: Internal/External |
| 658 | * |
| 659 | * </ioctl> |
| 660 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | #define WE_SET_HTSMPS 55 |
| 662 | /* Private ioctl for QPower */ |
| 663 | #define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56 |
| 664 | #define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57 |
| 665 | #define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58 |
| 666 | #define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 667 | /* |
| 668 | * <ioctl> |
| 669 | * burst_enable - Enables or disables the burst feature |
| 670 | * |
| 671 | * @INPUT: 0-Disable, 1-Enable |
| 672 | * |
| 673 | * @OUTPUT: None |
| 674 | * |
| 675 | * This IOCTL enables or disables the burst feature. |
| 676 | * |
| 677 | * @E.g: iwpriv wlan0 burst_enable 0 |
| 678 | * |
| 679 | * Supported Feature: STA |
| 680 | * |
| 681 | * Usage: Internal/External |
| 682 | * |
| 683 | * </ioctl> |
| 684 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 685 | #define WE_SET_BURST_ENABLE 60 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 686 | /* |
| 687 | * <ioctl> |
| 688 | * burst_dur - Enables or disables the burst feature |
| 689 | * |
| 690 | * @INPUT: int 1…..int 8191 in microseconds |
| 691 | * |
| 692 | * @OUTPUT: None |
| 693 | * |
| 694 | * This IOCTL sets the burst duration. |
| 695 | * |
| 696 | * @E.g: iwpriv wlan0 burst_dur <value> |
| 697 | * |
| 698 | * Supported Feature: STA |
| 699 | * |
| 700 | * Usage: Internal/External |
| 701 | * |
| 702 | * </ioctl> |
| 703 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | #define WE_SET_BURST_DUR 61 |
| 705 | /* GTX Commands */ |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 706 | /* |
| 707 | * <ioctl> |
| 708 | * gtxHTMcs - Set the tx HTM value |
| 709 | * |
| 710 | * @INPUT: Atleast one int orgument |
| 711 | * |
| 712 | * @OUTPUT: None |
| 713 | * |
| 714 | * This IOTCL sets htm tx value |
| 715 | * |
| 716 | * @E.g: iwpriv wlan0 gtxHTMcs <value> |
| 717 | * |
| 718 | * Supported Feature: STA |
| 719 | * |
| 720 | * Usage: Internal/External |
| 721 | * |
| 722 | * </ioctl> |
| 723 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 724 | #define WE_SET_GTX_HT_MCS 62 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 725 | /* |
| 726 | * <ioctl> |
| 727 | * gtxVHTMcs - Set gtxVHTMcs value |
| 728 | * |
| 729 | * @INPUT: Atleast one int argument |
| 730 | * |
| 731 | * @OUTPUT: None |
| 732 | * |
| 733 | * This IOTCL used to set gtxVHTMcs value |
| 734 | * |
| 735 | * @E.g: iwpriv wlan0 gtxVHTMcs <value> |
| 736 | * |
| 737 | * Supported Feature: STA |
| 738 | * |
| 739 | * Usage: Internal/External |
| 740 | * |
| 741 | * </ioctl> |
| 742 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | #define WE_SET_GTX_VHT_MCS 63 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 744 | /* |
| 745 | * <ioctl> |
| 746 | * gtxUsrCfg - Host request for GTX mask |
| 747 | * |
| 748 | * @INPUT: Atleast one int orgument |
| 749 | * |
| 750 | * @OUTPUT: None |
| 751 | * |
| 752 | * This IOTCL used send the host request for GTX mask |
| 753 | * |
| 754 | * @E.g: iwpriv wlan0 gtxUsrCfg <value> |
| 755 | * |
| 756 | * Supported Feature: STA |
| 757 | * |
| 758 | * Usage: Internal/External |
| 759 | * |
| 760 | * </ioctl> |
| 761 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 762 | #define WE_SET_GTX_USRCFG 64 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 763 | /* |
| 764 | * <ioctl> |
| 765 | * gtxThre - Set the tx threshold |
| 766 | * |
| 767 | * @INPUT: Atleast one int argument |
| 768 | * |
| 769 | * @OUTPUT: None |
| 770 | * |
| 771 | * This IOTCL used to set tx threshold |
| 772 | * |
| 773 | * @E.g: iwpriv wlan0 gtxThre <value> |
| 774 | * |
| 775 | * Supported Feature: STA |
| 776 | * |
| 777 | * Usage: Internal/External |
| 778 | * |
| 779 | * </ioctl> |
| 780 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 781 | #define WE_SET_GTX_THRE 65 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 782 | /* |
| 783 | * <ioctl> |
| 784 | * gtxMargin - Set the gtxMargin |
| 785 | * |
| 786 | * @INPUT: 1 to 32 |
| 787 | * |
| 788 | * @OUTPUT: None |
| 789 | * |
| 790 | * This IOTCL use dto set gtxMargin |
| 791 | * |
| 792 | * @E.g: iwpriv wlan0 gtxMargini <value> |
| 793 | * |
| 794 | * Supported Feature: STA |
| 795 | * |
| 796 | * Usage: Internal/External |
| 797 | * |
| 798 | * </ioctl> |
| 799 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | #define WE_SET_GTX_MARGIN 66 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 801 | /* |
| 802 | * <ioctl> |
| 803 | * gtxStep - Set the gtxStep |
| 804 | * |
| 805 | * @INPUT: None |
| 806 | * |
| 807 | * @OUTPUT: None |
| 808 | * |
| 809 | * This IOTCL used to sets gtxStep |
| 810 | * |
| 811 | * @E.g: iwpriv wlan0 gtxStep <value> |
| 812 | * |
| 813 | * Supported Feature: STA |
| 814 | * |
| 815 | * Usage: Internal/External |
| 816 | * |
| 817 | * </ioctl> |
| 818 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | #define WE_SET_GTX_STEP 67 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 820 | /* |
| 821 | * <ioctl> |
| 822 | * gtxMinTpc - Sets the gtxMinTpc |
| 823 | * |
| 824 | * @INPUT: Atleast one int argument |
| 825 | * |
| 826 | * @OUTPUT: None |
| 827 | * |
| 828 | * This IOTCL sets the tx MinTpc |
| 829 | * |
| 830 | * @E.g: iwpriv wlan0 gtxMinTpc <value> |
| 831 | * |
| 832 | * Supported Feature: STA |
| 833 | * |
| 834 | * Usage: Internal/External |
| 835 | * |
| 836 | * </ioctl> |
| 837 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 838 | #define WE_SET_GTX_MINTPC 68 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 839 | /* |
| 840 | * <ioctl> |
| 841 | * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz) |
| 842 | * |
| 843 | * @INPUT: Mask value |
| 844 | * |
| 845 | * @OUTPUT: None |
| 846 | * |
| 847 | * This IOTCL used to set gtxBWMask |
| 848 | * |
| 849 | * @E.g: iwpriv wlan0 gtxBWMask <value> |
| 850 | * |
| 851 | * Supported Feature: STA |
| 852 | * |
| 853 | * Usage: Internal/External |
| 854 | * |
| 855 | * </ioctl> |
| 856 | */ |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 857 | |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 858 | #define WE_SET_GTX_BWMASK 69 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 859 | /* |
| 860 | * <ioctl> |
| 861 | * setMccLatency - Sets the MCC latency value during STA-P2P concurrency |
| 862 | * |
| 863 | * @INPUT: set_value |
| 864 | * |
| 865 | * @OUTPUT: None |
| 866 | * |
| 867 | * This IOCTL is used to set the MCC latency value in milliseconds |
| 868 | * during STA-P2P concurrency. |
| 869 | * |
| 870 | * If 0ms latency is provided, then FW will set to a default. |
| 871 | * Otherwise, latency must be at least 30ms. |
| 872 | * |
| 873 | * @E.g: iwpriv wlan0 setMccLatency 40 |
| 874 | * |
| 875 | * |
| 876 | * Supported Feature: Concurrency |
| 877 | * |
| 878 | * Usage: Internal/External |
| 879 | * |
| 880 | * </ioctl> |
| 881 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | #define WE_MCC_CONFIG_LATENCY 70 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 883 | |
| 884 | /* |
| 885 | * <ioctl> |
| 886 | * setMccQuota- Set the quota for P2P cases |
| 887 | * |
| 888 | * @INPUT: set_value [0,100] |
| 889 | * |
| 890 | * @OUTPUT: None |
| 891 | * |
| 892 | * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA. |
| 893 | * |
| 894 | * Currently used to set time quota for 2 MCC vdevs/adapters using |
| 895 | * (operating channel, quota) for each mode. |
| 896 | * The info is provided run time using iwpriv command: |
| 897 | * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>. |
| 898 | * Note: the quota provided in command is for the same mode in cmd. |
| 899 | * HDD checks if MCC mode is active, gets the second mode and its |
| 900 | * operating chan. |
| 901 | * Quota for the 2nd role is calculated as 100 - quota of first mode. |
| 902 | * |
| 903 | * @E.g: iwpriv wlan0 setMccQuota 50 |
| 904 | * iwpriv p2p0 setMccQuota 50 |
| 905 | * |
| 906 | * Supported Feature: Concurrency |
| 907 | * |
| 908 | * Usage: Internal/External |
| 909 | * |
| 910 | * </ioctl> |
| 911 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 912 | #define WE_MCC_CONFIG_QUOTA 71 |
| 913 | /* Private IOCTL for debug connection issues */ |
| 914 | #define WE_SET_DEBUG_LOG 72 |
| 915 | #ifdef WE_SET_TX_POWER |
| 916 | #undef WE_SET_TX_POWER |
| 917 | #endif |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 918 | /* |
| 919 | * <ioctl> |
| 920 | * setTxPower - Set the current transmit power |
| 921 | * |
| 922 | * @INPUT: Transmission power in dBm |
| 923 | * |
| 924 | * @OUTPUT: None |
| 925 | * |
| 926 | * This IOCTL sets the current transmit power. |
| 927 | * This setting does not persist over reboots. |
| 928 | * |
| 929 | * @E.g: iwpriv wlan0 setTxPower 10 |
| 930 | * |
| 931 | * Supported Feature: STA |
| 932 | * |
| 933 | * Usage: Internal/External |
| 934 | * |
| 935 | * </ioctl> |
| 936 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 937 | #define WE_SET_TX_POWER 74 |
| 938 | /* Private ioctl for earlyrx power save feature */ |
| 939 | #define WE_SET_EARLY_RX_ADJUST_ENABLE 75 |
| 940 | #define WE_SET_EARLY_RX_TGT_BMISS_NUM 76 |
| 941 | #define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77 |
| 942 | #define WE_SET_EARLY_RX_SLOP_STEP 78 |
| 943 | #define WE_SET_EARLY_RX_INIT_SLOP 79 |
| 944 | #define WE_SET_EARLY_RX_ADJUST_PAUSE 80 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 945 | /* |
| 946 | * <ioctl> |
| 947 | * setMcRate - Set the data rate for multicast data |
| 948 | * |
| 949 | * @INPUT: 1 to 32 |
| 950 | * |
| 951 | * @OUTPUT: None |
| 952 | * |
| 953 | * This IOCTL sets the data rate for multicast data. Note that this command |
| 954 | * is allowed only in STA, IBSS, or QCMobileAP mode |
| 955 | * |
| 956 | * @E.g: iwpriv wlan0 setMcRate <value> |
| 957 | * |
| 958 | * Supported Feature: STA |
| 959 | * |
| 960 | * Usage: Internal/External |
| 961 | * |
| 962 | * </ioctl> |
| 963 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | #define WE_SET_MC_RATE 81 |
| 965 | #define WE_SET_EARLY_RX_DRIFT_SAMPLE 82 |
| 966 | /* Private ioctl for packet power save */ |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 967 | /* |
| 968 | * <ioctl> |
| 969 | * 5g_ebt - Sets the 5g_ebt |
| 970 | * |
| 971 | * @INPUT: <value> |
| 972 | * |
| 973 | * @OUTPUT: None |
| 974 | * |
| 975 | * This IOTCL used to set 5g_ebt |
| 976 | * |
| 977 | * @E.g: iwpriv wlan0 5g_ebt <value> |
| 978 | * |
| 979 | * Supported Feature: STA |
| 980 | * |
| 981 | * Usage: Internal/External |
| 982 | * |
| 983 | * </ioctl> |
| 984 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 985 | #define WE_PPS_5G_EBT 83 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 986 | /* |
| 987 | * <ioctl> |
| 988 | * cts_cbw - Set CTS channel BW for dynamic BW adjustment |
| 989 | * |
| 990 | * @INPUT: 20 t0 160 |
| 991 | * |
| 992 | * @OUTPUT: None |
| 993 | * |
| 994 | * This IOTCL used to set CTS channel BW for dynamic BW adjustment |
| 995 | * |
| 996 | * @E.g: iwpriv wlan0 cts_cbw <value> |
| 997 | * |
| 998 | * Supported Feature: STA |
| 999 | * |
| 1000 | * Usage: Internal/External |
| 1001 | * |
| 1002 | * </ioctl> |
| 1003 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1004 | #define WE_SET_CTS_CBW 84 |
| 1005 | #define WE_DUMP_STATS 85 |
| 1006 | #define WE_CLEAR_STATS 86 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1007 | /* Private sub ioctl for starting/stopping the profiling */ |
| 1008 | #define WE_START_FW_PROFILE 87 |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 1009 | |
Abhishek Singh | 3c50701 | 2016-12-01 11:15:42 +0530 | [diff] [blame] | 1010 | /* |
| 1011 | * <ioctl> |
| 1012 | * setChanChange - Initiate channel change |
| 1013 | * |
| 1014 | * @INPUT: channel number to switch to. |
| 1015 | * |
| 1016 | * @OUTPUT: None |
| 1017 | * |
| 1018 | * This IOCTL is used to initiate a channel change. |
| 1019 | * If called on STA/CLI interface it will send the |
| 1020 | * ECSA action frame to the connected SAP/GO asking to |
| 1021 | * initiate the ECSA, if supported. |
| 1022 | * If called on SAP/GO interface it will initiate |
| 1023 | * ECSA and ask connected peers to move to new channel. |
| 1024 | * |
| 1025 | * @E.g: iwpriv wlan0 setChanChange <channel> |
| 1026 | * iwpriv wlan0 setChanChange 1 |
| 1027 | * |
| 1028 | * Supported Feature: ECSA |
| 1029 | * |
| 1030 | * Usage: Internal/External |
| 1031 | * |
| 1032 | * </ioctl> |
| 1033 | */ |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 1034 | #define WE_SET_CHANNEL 88 |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 1035 | #define WE_SET_CONC_SYSTEM_PREF 89 |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 1036 | #define WE_SET_TXRX_STATS 90 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 1038 | /* |
| 1039 | * <ioctl> |
| 1040 | * set_11ax_rate - set 11ax rates to FW |
| 1041 | * |
| 1042 | * @INPUT: rate code |
| 1043 | * |
| 1044 | * @OUTPUT: None |
| 1045 | * |
| 1046 | * This IOCTL fixes the Tx data rate of 11AX. |
| 1047 | * |
| 1048 | * @E.g: iwpriv wlan0 set_11ax_rate <rate code> |
| 1049 | * |
| 1050 | * Supported Feature: STA/SAP |
| 1051 | * |
| 1052 | * Usage: Internal |
| 1053 | * |
| 1054 | * </ioctl> |
| 1055 | */ |
| 1056 | #define WE_SET_11AX_RATE 91 |
| 1057 | |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1058 | /* |
| 1059 | * <ioctl> |
| 1060 | * enable_dcm - enable Dual Carrier Modulation(DCM) |
| 1061 | * |
| 1062 | * @INPUT: 0/1 |
| 1063 | * |
| 1064 | * @OUTPUT: None |
| 1065 | * |
| 1066 | * This IOCTL enables/disables DCM. |
| 1067 | * |
| 1068 | * @E.g: iwpriv wlan0 enable_dcm <0/1> |
| 1069 | * |
| 1070 | * Supported Feature: STA/SAP |
| 1071 | * |
| 1072 | * Usage: Internal |
| 1073 | * |
| 1074 | * </ioctl> |
| 1075 | */ |
| 1076 | #define WE_SET_DCM 92 |
| 1077 | |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 1078 | /* |
| 1079 | * <ioctl> |
| 1080 | * enable_range_ext - enable Range extension |
| 1081 | * |
| 1082 | * @INPUT: 0/1 |
| 1083 | * |
| 1084 | * @OUTPUT: None |
| 1085 | * |
| 1086 | * This IOCTL enables/disables Range extension. |
| 1087 | * |
| 1088 | * @E.g: iwpriv wlan0 enable_range_ext <0/1> |
| 1089 | * |
| 1090 | * Supported Feature: STA/SAP |
| 1091 | * |
| 1092 | * Usage: Internal |
| 1093 | * |
| 1094 | * </ioctl> |
| 1095 | */ |
| 1096 | #define WE_SET_RANGE_EXT 93 |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1097 | |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 1098 | /* |
| 1099 | * <ioctl> |
| 1100 | * wow_ito - sets the timeout value for inactivity data while |
| 1101 | * in power save mode during wow |
| 1102 | * |
| 1103 | * @INPUT: int |
| 1104 | * |
| 1105 | * @OUTPUT: None |
| 1106 | * |
| 1107 | * This IOCTL set the timeout value for inactivity data in power save mode |
| 1108 | * |
| 1109 | * @E.g: iwpriv wlan0 wow_ito 20 |
| 1110 | * |
| 1111 | * Supported Feature: STA |
| 1112 | * |
| 1113 | * Usage: External |
| 1114 | * |
| 1115 | * </ioctl> |
Jeff Johnson | dcf84ce | 2017-10-05 09:26:24 -0700 | [diff] [blame] | 1116 | */ |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 1117 | #define WE_SET_WOW_DATA_INACTIVITY_TO 94 |
| 1118 | |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 1119 | /* |
| 1120 | * <ioctl> |
| 1121 | * pdev_reset - reset the pdev |
| 1122 | * |
| 1123 | * @INPUT: Reset command to initiate: |
| 1124 | * TX_FLUSH = 1 |
| 1125 | * WARM_RESET = 2 |
| 1126 | * COLD_RESET = 3 |
| 1127 | * WARM_RESET_RESTORE_CAL = 4 |
| 1128 | * COLD_RESET_RESTORE_CAL = 5 |
| 1129 | * |
| 1130 | * @OUTPUT: None |
| 1131 | * |
| 1132 | * This IOCTL is used to reset the pdev. The primary use is |
| 1133 | * for internal testing. It is not expected that this will |
| 1134 | * be used on a production device. |
| 1135 | * |
| 1136 | * @E.g: iwpriv wlan0 pdev_reset <command> |
| 1137 | * iwpriv wlan0 pdev_reset 1 |
| 1138 | * |
| 1139 | * Supported Feature: None |
| 1140 | * |
| 1141 | * Usage: Internal |
| 1142 | * |
| 1143 | * </ioctl> |
| 1144 | */ |
| 1145 | #define WE_SET_PDEV_RESET 95 |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 1146 | |
SaidiReddy Yenuga | a92f8cc | 2017-03-24 15:15:03 +0530 | [diff] [blame] | 1147 | /* |
| 1148 | * setModDTIM - Change Modulated DTIM |
| 1149 | * |
| 1150 | * @INPUT: set_value. |
| 1151 | * |
| 1152 | * @OUTPUT: None |
| 1153 | * |
| 1154 | * This IOCTL is used to change modulated DTIM |
| 1155 | * value without WIFI OFF/ON. |
| 1156 | * |
| 1157 | * @E.g: iwpriv wlan0 setModDTIM <value> |
| 1158 | * iwpriv wlan0 setModDTIM 2 |
| 1159 | * |
| 1160 | * Supported Feature: N/A |
| 1161 | * |
| 1162 | * Usage: Internal/External |
| 1163 | * |
| 1164 | * </ioctl> |
| 1165 | */ |
| 1166 | #define WE_SET_MODULATED_DTIM 96 |
| 1167 | |
| 1168 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1169 | /* Private ioctls and their sub-ioctls */ |
| 1170 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 1171 | #define WE_GET_11D_STATE 1 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1172 | #define WE_SET_SAP_CHANNELS 3 |
| 1173 | #define WE_GET_WLAN_DBG 4 |
| 1174 | #define WE_GET_MAX_ASSOC 6 |
| 1175 | /* 7 is unused */ |
| 1176 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
Nitesh Shah | c87a7a8 | 2016-12-14 11:37:55 +0530 | [diff] [blame] | 1177 | |
| 1178 | /* |
| 1179 | * <ioctl> |
| 1180 | * getconcurrency - Get concurrency mode |
| 1181 | * |
| 1182 | * @INPUT: None |
| 1183 | * |
| 1184 | * @OUTPUT: It shows concurrency value |
| 1185 | * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO |
| 1186 | * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device |
| 1187 | * 8:OCB 9:EPPING 10:QVIT 11:NDI |
| 1188 | * |
| 1189 | * This IOCTL is used to retrieve concurrency mode. |
| 1190 | * |
| 1191 | * @E.g: iwpriv wlan0 getconcurrency |
| 1192 | * wlan0 getconcurrency:5 |
| 1193 | * Above value shows STA+P2P_Client |
| 1194 | * |
| 1195 | * Supported Feature: Concurrency |
| 1196 | * |
| 1197 | * Usage: Internal/External |
| 1198 | * |
| 1199 | * </ioctl> |
| 1200 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | #define WE_GET_CONCURRENCY_MODE 9 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1202 | /* |
| 1203 | * <ioctl> |
| 1204 | * get_nss - Get the number of spatial STBC streams (NSS) |
| 1205 | * |
| 1206 | * @INPUT: None |
| 1207 | * |
| 1208 | * @OUTPUT: NSS |
| 1209 | * wlan0 get_nss:2 |
| 1210 | * |
| 1211 | * This IOTCL used to get the number of spatial STBC streams |
| 1212 | * |
| 1213 | * @E.g: iwpriv wlan0 get_nss |
| 1214 | * |
| 1215 | * Supported Feature: STA |
| 1216 | * |
| 1217 | * Usage: Internal/External |
| 1218 | * |
| 1219 | * </ioctl> |
| 1220 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | #define WE_GET_NSS 11 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1222 | /* |
| 1223 | * <ioctl> |
| 1224 | * get_ldpc - This IOCTL gets the low density parity check (LDPC) |
| 1225 | * |
| 1226 | * @INPUT: None |
| 1227 | * |
| 1228 | * @OUTPUT: ldpc |
| 1229 | * wlan0 get_ldpc:1 |
| 1230 | * |
| 1231 | * This IOTCL used to gets the low density parity check (LDPC) |
| 1232 | * |
| 1233 | * @E.g: iwpriv wlan0 get_ldpc |
| 1234 | * |
| 1235 | * Supported Feature: STA |
| 1236 | * |
| 1237 | * Usage: Internal/External |
| 1238 | * |
| 1239 | * </ioctl> |
| 1240 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | #define WE_GET_LDPC 12 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1242 | /* |
| 1243 | * <ioctl> |
| 1244 | * get_tx_stbc - Get the value of the current Tx space time block code (STBC) |
| 1245 | * |
| 1246 | * @INPUT: None |
| 1247 | * |
| 1248 | * @OUTPUT: TXSTBC |
| 1249 | * wlan0 get_tx_stbc:1 |
| 1250 | * |
| 1251 | * This IOTCL get the value of the current Tx space time block code (STBC) |
| 1252 | * |
| 1253 | * @E.g: iwpriv wlan0 get_tx_stbc |
| 1254 | * |
| 1255 | * Supported Feature: STA |
| 1256 | * |
| 1257 | * Usage: Internal/External |
| 1258 | * |
| 1259 | * </ioctl> |
| 1260 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1261 | #define WE_GET_TX_STBC 13 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1262 | /* |
| 1263 | * <ioctl> |
| 1264 | * get_rx_stbc - Gets the value of the current Rx STBC |
| 1265 | * |
| 1266 | * @INPUT: None |
| 1267 | * |
| 1268 | * @OUTPUT: Rx STBC |
| 1269 | * wlan0 get_rx_stbc:1 |
| 1270 | * |
| 1271 | * This IOTCL used to get the value of the current Rx STBC |
| 1272 | * |
| 1273 | * @E.g: iwpriv wlan0 get_rx_stbc |
| 1274 | * |
| 1275 | * Supported Feature: STA |
| 1276 | * |
| 1277 | * Usage: Internal/External |
| 1278 | * |
| 1279 | * </ioctl> |
| 1280 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1281 | #define WE_GET_RX_STBC 14 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1282 | /* |
| 1283 | * <ioctl> |
| 1284 | * get_shortgi - Get the value of the current short GI setting |
| 1285 | * |
| 1286 | * @INPUT: None |
| 1287 | * |
| 1288 | * @OUTPUT: Enable/disable of shortgi |
| 1289 | * wlan0 get_shortgi:1 |
| 1290 | * |
| 1291 | * This IOCTL gets the value of the current short GI setting |
| 1292 | * |
| 1293 | * @E.g: iwpriv wlan0 get_shortgi |
| 1294 | * |
| 1295 | * Supported Feature: STA |
| 1296 | * |
| 1297 | * Usage: Internal/External |
| 1298 | * |
| 1299 | * </ioctl> |
| 1300 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1301 | #define WE_GET_SHORT_GI 15 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1302 | /* |
| 1303 | * <ioctl> |
| 1304 | * get_rtscts - Get the value of the current RTS/CTS setting. |
| 1305 | * |
| 1306 | * @INPUT: None |
| 1307 | * |
| 1308 | * @OUTPUT: Enable/disable of RTS/CTS |
| 1309 | * wlan0 get_rtscts:33 |
| 1310 | * |
| 1311 | * This IOTCL get the value of the current RTS/CTS setting. |
| 1312 | * |
| 1313 | * @E.g: iwpriv wlan0 get_rtscts |
| 1314 | * |
| 1315 | * Supported Feature: STA |
| 1316 | * |
| 1317 | * Usage: Internal/External |
| 1318 | * |
| 1319 | * </ioctl> |
| 1320 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1321 | #define WE_GET_RTSCTS 16 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1322 | /* |
| 1323 | * <ioctl> |
| 1324 | * get_chwidth - Get the current channel width setting |
| 1325 | * |
| 1326 | * @INPUT: None |
| 1327 | * |
| 1328 | * @OUTPUT: channel width |
| 1329 | * wlan0 get_chwidth:0 |
| 1330 | * |
| 1331 | * This IOTCL get the current channel width setting. |
| 1332 | * |
| 1333 | * @E.g: iwpriv wlan0 get_chwidth |
| 1334 | * |
| 1335 | * Supported Feature: STA |
| 1336 | * |
| 1337 | * Usage: Internal/External |
| 1338 | * |
| 1339 | * </ioctl> |
| 1340 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | #define WE_GET_CHWIDTH 17 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1342 | /* |
| 1343 | * <ioctl> |
| 1344 | * get_anienable - Get the anienable |
| 1345 | * |
| 1346 | * @INPUT: None |
| 1347 | * |
| 1348 | * @OUTPUT: |
| 1349 | * wlan0 get_anienable:0 |
| 1350 | * |
| 1351 | * This IOTCL get the anienable |
| 1352 | * |
| 1353 | * @E.g: iwpriv wlan0 get_anienable |
| 1354 | * |
| 1355 | * Supported Feature: STA |
| 1356 | * |
| 1357 | * Usage: Internal/External |
| 1358 | * |
| 1359 | * </ioctl> |
| 1360 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1361 | #define WE_GET_ANI_EN_DIS 18 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1362 | /* |
| 1363 | * <ioctl> |
| 1364 | * get_aniplen - Get the aniplen |
| 1365 | * |
| 1366 | * @INPUT: None |
| 1367 | * |
| 1368 | * @OUTPUT: |
| 1369 | * wlan0 get_aniplen:0 |
| 1370 | * |
| 1371 | * This IOTCL get the aniplen |
| 1372 | * |
| 1373 | * @E.g: iwpriv wlan0 get_aniplen |
| 1374 | * |
| 1375 | * Supported Feature: STA |
| 1376 | * |
| 1377 | * Usage: Internal/External |
| 1378 | * |
| 1379 | * </ioctl> |
| 1380 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1381 | #define WE_GET_ANI_POLL_PERIOD 19 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1382 | /* |
| 1383 | * <ioctl> |
| 1384 | * get_anilislen- Get the anilislen |
| 1385 | * |
| 1386 | * @INPUT: None |
| 1387 | * |
| 1388 | * @OUTPUT: |
| 1389 | * wlan0 get_anilislen:0 |
| 1390 | * |
| 1391 | * This IOTCL used to get anilislen |
| 1392 | * |
| 1393 | * @E.g: iwpriv wlan0 get_anilislen |
| 1394 | * |
| 1395 | * Supported Feature: STA |
| 1396 | * |
| 1397 | * Usage: Internal/External |
| 1398 | * |
| 1399 | * </ioctl> |
| 1400 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | #define WE_GET_ANI_LISTEN_PERIOD 20 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1402 | /* |
| 1403 | * <ioctl> |
| 1404 | * get_aniofdmlvl - Get the OFDM level |
| 1405 | * |
| 1406 | * @INPUT: None |
| 1407 | * |
| 1408 | * @OUTPUT: OFDM |
| 1409 | * wlan0 get_aniofdmlvl:0 |
| 1410 | * |
| 1411 | * This IOTCL used to get ofdm level |
| 1412 | * |
| 1413 | * @E.g: iwpriv wlan0 get_aniofdmlvl |
| 1414 | * |
| 1415 | * Supported Feature: STA |
| 1416 | * |
| 1417 | * Usage: Internal/External |
| 1418 | * |
| 1419 | * </ioctl> |
| 1420 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1421 | #define WE_GET_ANI_OFDM_LEVEL 21 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1422 | /* |
| 1423 | * <ioctl> |
| 1424 | * get_aniccklvl - Get the cck level |
| 1425 | * |
| 1426 | * @INPUT: None |
| 1427 | * |
| 1428 | * @OUTPUT: |
| 1429 | * wlan0 get_aniccklvl:0 |
| 1430 | * |
| 1431 | * This IOTCL used to get cck level |
| 1432 | * |
| 1433 | * @E.g: iwpriv wlan0 get_aniccklvl |
| 1434 | * |
| 1435 | * Supported Feature: STA |
| 1436 | * |
| 1437 | * Usage: Internal/External |
| 1438 | * |
| 1439 | * </ioctl> |
| 1440 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1441 | #define WE_GET_ANI_CCK_LEVEL 22 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1442 | /* |
| 1443 | * <ioctl> |
| 1444 | * get_cwmenable - Get the value of the dynamic channel bandwidth setting |
| 1445 | * |
| 1446 | * @INPUT: None |
| 1447 | * |
| 1448 | * @OUTPUT: Enable/disable dynamic channel bandwidth |
| 1449 | * wlan0 get_cwmenable:0 |
| 1450 | * |
| 1451 | * This IOTCL get the value of the dynamic channel bandwidth setting |
| 1452 | * |
| 1453 | * @E.g: iwpriv wlan0 get_cwmenable |
| 1454 | * |
| 1455 | * Supported Feature: STA |
| 1456 | * |
| 1457 | * Usage: Internal/External |
| 1458 | * |
| 1459 | * </ioctl> |
| 1460 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1461 | #define WE_GET_DYNAMIC_BW 23 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1462 | /* |
| 1463 | * <ioctl> |
| 1464 | * get_txchainmask - Get the txchainmask that was set |
| 1465 | * |
| 1466 | * @INPUT: None |
| 1467 | * |
| 1468 | * @OUTPUT: txchainmask |
| 1469 | * wlan0 get_txchainmask:1 |
| 1470 | * |
| 1471 | * This IOCTL gets the txchainmask that was set |
| 1472 | * This command is useful if it was previously set |
| 1473 | * |
| 1474 | * @E.g: iwpriv wlan0 get_txchainmask |
| 1475 | * |
| 1476 | * Supported Feature: STA |
| 1477 | * |
| 1478 | * Usage: Internal/External |
| 1479 | * |
| 1480 | * </ioctl> |
| 1481 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1482 | #define WE_GET_TX_CHAINMASK 24 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1483 | /* |
| 1484 | * <ioctl> |
| 1485 | * get_rxchainmask - Get the rxchainmask that was set |
| 1486 | * |
| 1487 | * @INPUT: None |
| 1488 | * |
| 1489 | * @OUTPUT: rxchainmask |
| 1490 | * wlan0 get_rxchainmask:1 |
| 1491 | * |
| 1492 | * This IOCTL gets the rxchainmask that was set |
| 1493 | * This command is useful only if it was previously set. |
| 1494 | * |
| 1495 | * @E.g: iwpriv wlan0 get_rxchainmask |
| 1496 | * |
| 1497 | * Supported Feature: STA |
| 1498 | * |
| 1499 | * Usage: Internal/External |
| 1500 | * |
| 1501 | * </ioctl> |
| 1502 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | #define WE_GET_RX_CHAINMASK 25 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1504 | /* |
| 1505 | * <ioctl> |
| 1506 | * get_11nrate - Get the fixed Tx data rate |
| 1507 | * |
| 1508 | * @INPUT: None |
| 1509 | * |
| 1510 | * @OUTPUT: Using this command does not return the same value as set |
| 1511 | * wlan0 get_11nrate:0 |
| 1512 | * |
| 1513 | * This IOCTL gets the fixed Tx data rate |
| 1514 | * This command is useful only if setting the fixed Tx rate. |
| 1515 | * |
| 1516 | * @E.g: iwpriv wlan0 get_11nrate |
| 1517 | * |
| 1518 | * Supported Feature: STA |
| 1519 | * |
| 1520 | * Usage: Internal/External |
| 1521 | * |
| 1522 | * </ioctl> |
| 1523 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | #define WE_GET_11N_RATE 26 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1525 | /* |
| 1526 | * <ioctl> |
| 1527 | * get_ampdu - Get the maximum subframe of ampdu |
| 1528 | * |
| 1529 | * @INPUT: None |
| 1530 | * |
| 1531 | * @OUTPUT: Maximum subframe of ampdu |
| 1532 | * wlan0 get_ampdu:1 |
| 1533 | * |
| 1534 | * This IOCTL gets the maximum subframe of ampdu |
| 1535 | * This command is useful only if setting ampdu. |
| 1536 | * |
| 1537 | * @E.g: iwpriv wlan0 get_ampdu |
| 1538 | * |
| 1539 | * Supported Feature: STA |
| 1540 | * |
| 1541 | * Usage: Internal/External |
| 1542 | * |
| 1543 | * </ioctl> |
| 1544 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1545 | #define WE_GET_AMPDU 27 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1546 | /* |
| 1547 | * <ioctl> |
| 1548 | * get_amsdu - Get the maximum subframe of amsdu |
| 1549 | * |
| 1550 | * @INPUT: None |
| 1551 | * |
| 1552 | * @OUTPUT: Maximum subframe of amsdu |
| 1553 | * wlan0 get_amsdu:1 |
| 1554 | * |
| 1555 | * This IOCTL gets the maximum subframe of amsdu. |
| 1556 | * This command is useful only if setting amsdu |
| 1557 | * |
| 1558 | * @E.g: iwpriv wlan0 get_amsdu |
| 1559 | * |
| 1560 | * Supported Feature: STA |
| 1561 | * |
| 1562 | * Usage: Internal/External |
| 1563 | * |
| 1564 | * </ioctl> |
| 1565 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1566 | #define WE_GET_AMSDU 28 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1567 | /* |
| 1568 | * <ioctl> |
| 1569 | * get_txpow2g - Get the current 2 GHz Tx power setting |
| 1570 | * |
| 1571 | * @INPUT: None |
| 1572 | * |
| 1573 | * @OUTPUT: Tx Power in dbm |
| 1574 | * wlan0 get_txpow2g:0 |
| 1575 | * |
| 1576 | * This IOCTL gets the current 2 GHz Tx power setting |
| 1577 | * This command is useful if setting Tx power |
| 1578 | * |
| 1579 | * @E.g: iwpriv wlan0 get_txpow2g |
| 1580 | * |
| 1581 | * Supported Feature: STA |
| 1582 | * |
| 1583 | * Usage: Internal/External |
| 1584 | * |
| 1585 | * </ioctl> |
| 1586 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | #define WE_GET_TXPOW_2G 29 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1588 | /* |
| 1589 | * <ioctl> |
| 1590 | * get_txpow5g - Get the current 5 GHz Tx power setting |
| 1591 | * |
| 1592 | * @INPUT: None |
| 1593 | * |
| 1594 | * @OUTPUT: Tx Power in dbm |
| 1595 | * wlan0 get_txpow5g:0 |
| 1596 | * |
| 1597 | * This IOCTL gets the current 5 GHz Tx power setting |
| 1598 | * This command is useful if setting Tx power |
| 1599 | * |
| 1600 | * @E.g: iwpriv wlan0 get_txpow5g |
| 1601 | * |
| 1602 | * Supported Feature: STA |
| 1603 | * |
| 1604 | * Usage: Internal/External |
| 1605 | * |
| 1606 | * </ioctl> |
| 1607 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1608 | #define WE_GET_TXPOW_5G 30 |
Rajeev Kumar | 1bcfd63 | 2015-12-07 11:38:51 -0800 | [diff] [blame] | 1609 | /* 31 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1610 | #define WE_GET_PPS_PAID_MATCH 32 |
| 1611 | #define WE_GET_PPS_GID_MATCH 33 |
| 1612 | #define WE_GET_PPS_EARLY_TIM_CLEAR 34 |
| 1613 | #define WE_GET_PPS_EARLY_DTIM_CLEAR 35 |
| 1614 | #define WE_GET_PPS_EOF_PAD_DELIM 36 |
| 1615 | #define WE_GET_PPS_MACADDR_MISMATCH 37 |
| 1616 | #define WE_GET_PPS_DELIM_CRC_FAIL 38 |
| 1617 | #define WE_GET_PPS_GID_NSTS_ZERO 39 |
| 1618 | #define WE_GET_PPS_RSSI_CHECK 40 |
| 1619 | /* Private ioctl for QPower */ |
| 1620 | #define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41 |
| 1621 | #define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42 |
| 1622 | #define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43 |
| 1623 | #define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1624 | /* |
| 1625 | * <ioctl> |
| 1626 | * get_burst_en - Enables or disables the burst feature |
| 1627 | * |
| 1628 | * @INPUT: None |
| 1629 | * |
| 1630 | * @OUTPUT: Enable/disable of burst feature |
| 1631 | * wlan0 get_burst_en:1 |
| 1632 | * |
| 1633 | * This IOCTL enables or disables the burst feature |
| 1634 | * |
| 1635 | * @E.g: iwpriv wlan0 get_burst_en |
| 1636 | * |
| 1637 | * Supported Feature:STA |
| 1638 | * |
| 1639 | * Usage: Internal/External |
| 1640 | * |
| 1641 | * </ioctl> |
| 1642 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | #define WE_GET_BURST_ENABLE 45 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1644 | /* |
| 1645 | * <ioctl> |
| 1646 | * get_burst_dur - Get the burst duration |
| 1647 | * |
| 1648 | * @INPUT: None |
| 1649 | * |
| 1650 | * @OUTPUT: Duration in microseconds |
| 1651 | * wlan0 get_burst_dur:8160 |
| 1652 | * |
| 1653 | * This IOCTL gets the burst duration |
| 1654 | * This command is useful if setting burst enable |
| 1655 | * |
| 1656 | * @E.g: iwpriv wlan0 get_burst_dur |
| 1657 | * |
| 1658 | * Supported Feature: STA |
| 1659 | * |
| 1660 | * Usage: Internal/External |
| 1661 | * |
| 1662 | * </ioctl> |
| 1663 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1664 | #define WE_GET_BURST_DUR 46 |
| 1665 | /* GTX Commands */ |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1666 | /* |
| 1667 | * <ioctl> |
| 1668 | * get_gtxHTMcs - Get the tx HTM |
| 1669 | * |
| 1670 | * @INPUT: None |
| 1671 | * |
| 1672 | * @OUTPUT: HTM |
| 1673 | * wlan0 get_gtxHTMcs:32896 |
| 1674 | * |
| 1675 | * This IOTCL used to get HTM |
| 1676 | * |
| 1677 | * @E.g: iwpriv wlan0 get_gtxHTMcs |
| 1678 | * |
| 1679 | * Supported Feature: STA |
| 1680 | * |
| 1681 | * Usage: Internal/External |
| 1682 | * |
| 1683 | * </ioctl> |
| 1684 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1685 | #define WE_GET_GTX_HT_MCS 47 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1686 | /* |
| 1687 | * <ioctl> |
| 1688 | * get_gtxVHTMcs - Get the VHTM |
| 1689 | * |
| 1690 | * @INPUT: None |
| 1691 | * |
| 1692 | * @OUTPUT: VHTM |
| 1693 | * wlan0 get_gtxVHTMcs:524800 |
| 1694 | * |
| 1695 | * This IOTCL used to get the VHTM |
| 1696 | * |
| 1697 | * @E.g: iwpriv wlan0 get_gtxVHTMcs |
| 1698 | * |
| 1699 | * Supported Feature: STA |
| 1700 | * |
| 1701 | * Usage: Internal/External |
| 1702 | * |
| 1703 | * </ioctl> |
| 1704 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1705 | #define WE_GET_GTX_VHT_MCS 48 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1706 | /* |
| 1707 | * <ioctl> |
| 1708 | * get_gtxUsrCfg - Get the tx cfg |
| 1709 | * |
| 1710 | * @INPUT: None |
| 1711 | * |
| 1712 | * @OUTPUT: TXCFG |
| 1713 | * wlan0 get_gtxUsrCfg:32 |
| 1714 | * |
| 1715 | * This IOTCL used to get the tx cfg |
| 1716 | * |
| 1717 | * @E.g: iwpriv wlan0 get_gtxUsrCfg |
| 1718 | * |
| 1719 | * Supported Feature: STA |
| 1720 | * |
| 1721 | * Usage: Internal/External |
| 1722 | * |
| 1723 | * </ioctl> |
| 1724 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1725 | #define WE_GET_GTX_USRCFG 49 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1726 | /* |
| 1727 | * <ioctl> |
| 1728 | * get_gtxThre - Get the tx threshold |
| 1729 | * |
| 1730 | * @INPUT: None |
| 1731 | * |
| 1732 | * @OUTPUT: Threshold |
| 1733 | * wlan0 get_gtxThre:3 |
| 1734 | * |
| 1735 | * This IOCTL is used to get tx threshold |
| 1736 | * |
| 1737 | * @E.g: iwpriv wlan0 get_gtxThre |
| 1738 | * |
| 1739 | * Supported Feature: STA |
| 1740 | * |
| 1741 | * Usage: Internal/External |
| 1742 | * |
| 1743 | * </ioctl> |
| 1744 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1745 | #define WE_GET_GTX_THRE 50 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1746 | /* |
| 1747 | * <ioctl> |
| 1748 | * get_gtxMargin - Get the tx margin |
| 1749 | * |
| 1750 | * @INPUT: None |
| 1751 | * |
| 1752 | * @OUTPUT: GTXMARGIN |
| 1753 | * wlan0 get_gtxMargin:2 |
| 1754 | * |
| 1755 | * This IOCTL is used to set tx margin |
| 1756 | * |
| 1757 | * @E.g: iwpriv wlan0 get_gtxMargin |
| 1758 | * |
| 1759 | * Supported Feature: STA |
| 1760 | * |
| 1761 | * Usage: Internal/External |
| 1762 | * |
| 1763 | * </ioctl> |
| 1764 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | #define WE_GET_GTX_MARGIN 51 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1766 | /* |
| 1767 | * <ioctl> |
| 1768 | * get_gtxStep - Get the tx step |
| 1769 | * |
| 1770 | * @INPUT: None |
| 1771 | * |
| 1772 | * @OUTPUT: GTXSTEP |
| 1773 | * wlan0 get_gtxStep:0 |
| 1774 | * |
| 1775 | * This IOCTL is used to get the gtx step |
| 1776 | * |
| 1777 | * @E.g: iwpriv wlan0 get_gtxStep |
| 1778 | * |
| 1779 | * Supported Feature: STA |
| 1780 | * |
| 1781 | * Usage: Internal/External |
| 1782 | * |
| 1783 | * </ioctl> |
| 1784 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1785 | #define WE_GET_GTX_STEP 52 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1786 | /* |
| 1787 | * <ioctl> |
| 1788 | * get_gtxMinTpc - Get the tx miminum tpc |
| 1789 | * |
| 1790 | * @INPUT: None |
| 1791 | * |
| 1792 | * @OUTPUT: TPC |
| 1793 | * wlan0 get_gtxMinTpc:0 |
| 1794 | * |
| 1795 | * This IOCTL is used to get tx miminum tpc |
| 1796 | * |
| 1797 | * @E.g: iwpriv wlan0 get_gtxMinTpc |
| 1798 | * |
| 1799 | * Supported Feature: STA |
| 1800 | * |
| 1801 | * Usage: Internal/External |
| 1802 | * |
| 1803 | * </ioctl> |
| 1804 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | #define WE_GET_GTX_MINTPC 53 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1806 | /* |
| 1807 | * <ioctl> |
| 1808 | * get_gtxBWMask - Get the tx BW MASK |
| 1809 | * |
| 1810 | * @INPUT: None |
| 1811 | * |
| 1812 | * @OUTPUT: MASK |
| 1813 | * wlan0 get_gtxBWMask:15 |
| 1814 | * |
| 1815 | * This IOCTL is used get gtx bw mask |
| 1816 | * |
| 1817 | * @E.g: iwpriv wlan0 get_gtxBWMask |
| 1818 | * |
| 1819 | * Supported Feature: STA |
| 1820 | * |
| 1821 | * Usage: Internal/External |
| 1822 | * |
| 1823 | * </ioctl> |
| 1824 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1825 | #define WE_GET_GTX_BWMASK 54 |
| 1826 | #define WE_GET_TEMPERATURE 56 |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 1827 | #define WE_CAP_TSF 58 |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 1828 | #define WE_GET_ROAM_SYNCH_DELAY 59 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1830 | /* |
| 1831 | * <ioctl> |
| 1832 | * get_dcm - Get dcm enablement value |
| 1833 | * |
| 1834 | * @INPUT: None |
| 1835 | * |
| 1836 | * @OUTPUT: 0/1 |
| 1837 | * wlan0 get_dcm |
| 1838 | * |
| 1839 | * This IOCTL is used get dcm value |
| 1840 | * |
| 1841 | * Supported Feature: STA/SAP |
| 1842 | * |
| 1843 | * Usage: Internal |
| 1844 | * |
| 1845 | * </ioctl> |
| 1846 | */ |
| 1847 | #define WE_GET_DCM 60 |
| 1848 | |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 1849 | /* |
| 1850 | * <ioctl> |
| 1851 | * get_dcm - Get range extension enablement value |
| 1852 | * |
| 1853 | * @INPUT: None |
| 1854 | * |
| 1855 | * @OUTPUT: 0/1 |
| 1856 | * wlan0 get_range_ext |
| 1857 | * |
| 1858 | * This IOCTL is used get range_extension value |
| 1859 | * |
| 1860 | * Supported Feature: STA/SAP |
| 1861 | * |
| 1862 | * Usage: Internal |
| 1863 | * |
| 1864 | * </ioctl> |
| 1865 | */ |
| 1866 | #define WE_GET_RANGE_EXT 61 |
| 1867 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | /* Private ioctls and their sub-ioctls */ |
| 1869 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 1870 | |
| 1871 | /* Private ioctls and their sub-ioctls */ |
| 1872 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 1873 | #define WE_WOWL_ADD_PTRN 1 |
| 1874 | #define WE_WOWL_DEL_PTRN 2 |
Sreelakshmi Konamki | ded64d7 | 2017-02-23 10:39:26 +0530 | [diff] [blame] | 1875 | /* |
| 1876 | * <ioctl> |
| 1877 | * neighbor - Send neighbor report request |
| 1878 | * |
| 1879 | * @INPUT: string |
| 1880 | * |
| 1881 | * @OUTPUT: None |
| 1882 | * |
| 1883 | * This IOCTL create a Neighbor report request and send it to peer |
| 1884 | * |
| 1885 | * @E.g: iwpriv wlan0 neighbor "SSID" |
| 1886 | * |
| 1887 | * Supported Feature: 11k |
| 1888 | * |
| 1889 | * Usage: Internal/External |
| 1890 | * |
| 1891 | * </ioctl> |
| 1892 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1893 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1894 | /* |
| 1895 | * <ioctl> |
| 1896 | * set_ap_wps_ie - Set the P2P IE of the probe response |
| 1897 | * |
| 1898 | * @INPUT: string |
| 1899 | * |
| 1900 | * @OUTPUT: None |
| 1901 | * |
| 1902 | * This IOCTL sets the P2P IE of the probe response |
| 1903 | * |
| 1904 | * @E.g: iwpriv wlan0 set_ap_wps_ie abcd |
| 1905 | * |
| 1906 | * Supported Feature: STA |
| 1907 | * |
| 1908 | * Usage: Internal/External |
| 1909 | * |
| 1910 | * </ioctl> |
| 1911 | */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 1912 | #define WE_SET_AP_WPS_IE 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | #define WE_SET_CONFIG 5 |
| 1914 | |
| 1915 | /* Private ioctls and their sub-ioctls */ |
| 1916 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 1917 | #define WE_SET_WLAN_DBG 1 |
| 1918 | #define WE_SET_DP_TRACE 2 |
| 1919 | #define WE_SET_SAP_CHANNELS 3 |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 1920 | #define WE_SET_FW_TEST 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1921 | |
| 1922 | /* Private ioctls and their sub-ioctls */ |
| 1923 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 1924 | #define WE_WLAN_VERSION 1 |
| 1925 | #define WE_GET_STATS 2 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1926 | /* |
| 1927 | * <ioctl> |
| 1928 | * getConfig - gets the values of all configurations listed in WCNSS |
| 1929 | * |
| 1930 | * @INPUT: None |
| 1931 | * |
| 1932 | * @OUTPUT: Current configuration to the sys log |
| 1933 | * wlan0 getConfig: WLAN configuration written to system log |
| 1934 | * |
| 1935 | * This IOCTL gets the values of all configurations listed in WCNSS |
| 1936 | * |
| 1937 | * @E.g: iwpriv wlan0 getConfig |
| 1938 | * |
| 1939 | * Supported Feature: STA |
| 1940 | * |
| 1941 | * Usage: Internal/External |
| 1942 | * |
| 1943 | * </ioctl> |
| 1944 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | #define WE_GET_CFG 3 |
| 1946 | #define WE_GET_WMM_STATUS 4 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1947 | /* |
| 1948 | * <ioctl> |
| 1949 | * getChannelList - Get the available channel list while in QCMobileAP |
| 1950 | * |
| 1951 | * @INPUT: None |
| 1952 | * |
| 1953 | * @OUTPUT: Channel list |
| 1954 | * wlan0 getChannelList:36 US 1..165 |
| 1955 | * |
| 1956 | * This IOCTL gets the available channel list while in QCMobileAP |
| 1957 | * |
| 1958 | * @E.g: iwpriv wlan0 getChannelList |
| 1959 | * |
| 1960 | * Supported Feature: STA |
| 1961 | * |
| 1962 | * Usage: Internal/External |
| 1963 | * |
| 1964 | * </ioctl> |
| 1965 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | #define WE_GET_CHANNEL_LIST 5 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 1967 | /* |
| 1968 | * <ioctl> |
| 1969 | * getRSSI - Get the Received Signal Strength Indicator |
| 1970 | * |
| 1971 | * @INPUT: None |
| 1972 | * |
| 1973 | * @OUTPUT: RSSI |
| 1974 | * wlan0 getRSSI:rsssi=-32 |
| 1975 | * |
| 1976 | * This IOCTL gets the Received Signal Strength Indicator (RSSI) |
| 1977 | * |
| 1978 | * @E.g: iwpriv wlan0 getRSSI |
| 1979 | * |
| 1980 | * Supported Feature: STA |
| 1981 | * |
| 1982 | * Usage: Internal/External |
| 1983 | * |
| 1984 | * </ioctl> |
| 1985 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1986 | #define WE_GET_RSSI 6 |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 1987 | |
| 1988 | /* |
| 1989 | * <ioctl> |
| 1990 | * getSuspendStats - Get suspend/resume stats |
| 1991 | * |
| 1992 | * @INPUT: None |
| 1993 | * |
| 1994 | * @OUTPUT: character string containing formatted suspend/resume stats |
| 1995 | * |
| 1996 | * This ioctl is used to get suspend/resume stats formatted for display. |
| 1997 | * Currently it includes suspend/resume counts, wow wake up reasons, and |
| 1998 | * suspend fail reasons. |
| 1999 | * |
| 2000 | * @E.g: iwpriv wlan0 getSuspendStats |
| 2001 | * iwpriv wlan0 getSuspendStats |
| 2002 | * |
| 2003 | * Supported Feature: suspend/resume |
| 2004 | * |
| 2005 | * Usage: Internal |
| 2006 | * |
| 2007 | * </ioctl> |
| 2008 | */ |
| 2009 | #define WE_GET_SUSPEND_RESUME_STATS 7 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | #ifdef FEATURE_WLAN_TDLS |
Nitesh Shah | 5dfb99e | 2016-12-10 14:19:46 +0530 | [diff] [blame] | 2011 | /* |
| 2012 | * <ioctl> |
| 2013 | * getTdlsPeers - Get all TDLS peers. |
| 2014 | * |
| 2015 | * @INPUT: None |
| 2016 | * |
| 2017 | * @OUTPUT: Returns the MAC address of all the TDLS peers |
| 2018 | * wlan0 getTdlsPeers: |
| 2019 | * MAC Id cap up RSSI |
| 2020 | * --------------------------------- |
| 2021 | * 00:0a:f5:0e:bd:18 2 Y Y -44 |
| 2022 | * 00:0a:f5:bf:0e:12 0 N N 0 |
| 2023 | * |
| 2024 | * This IOCTL is used to get all TDLS peers. |
| 2025 | * |
| 2026 | * @E.g: iwpriv wlan0 getTdlsPeers |
| 2027 | * |
| 2028 | * Supported Feature: TDLS |
| 2029 | * |
| 2030 | * Usage: Internal/External |
| 2031 | * |
| 2032 | * </ioctl> |
| 2033 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2034 | #define WE_GET_TDLS_PEERS 8 |
| 2035 | #endif |
| 2036 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 2f81049 | 2016-12-01 11:39:39 +0530 | [diff] [blame] | 2037 | /* |
| 2038 | * <ioctl> |
| 2039 | * getPMFInfo - get the PMF info of the connected session |
| 2040 | * |
| 2041 | * @INPUT: None |
| 2042 | * |
| 2043 | * @OUTPUT: |
| 2044 | * wlan0 getPMFInfo: |
| 2045 | * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0 |
| 2046 | * Number of Unprotected Disassocs 0 |
| 2047 | * Number of Unprotected Deauths 0 |
| 2048 | * |
| 2049 | * This IOCTL is used to get the PMF stats/status of the current |
| 2050 | * connection. |
| 2051 | * |
| 2052 | * @e.g:iwpriv wlan0 getPMFInfo |
| 2053 | * |
| 2054 | * Supported Feature: PMF |
| 2055 | * |
| 2056 | * Usage: Internal/External |
| 2057 | * |
| 2058 | * </ioctl> |
| 2059 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | #define WE_GET_11W_INFO 9 |
| 2061 | #endif |
| 2062 | #define WE_GET_STATES 10 |
Abhishek Singh | 49b654e | 2016-12-01 16:11:17 +0530 | [diff] [blame] | 2063 | /* |
| 2064 | * <ioctl> |
| 2065 | * getIbssSTAs - get ibss sta info |
| 2066 | * |
| 2067 | * @INPUT: None |
| 2068 | * |
| 2069 | * @OUTPUT: Give the MAC of the IBSS STA |
| 2070 | * wlan0 getIbssSTAs: |
| 2071 | * 1 .8c:fd:f0:01:9c:bf |
| 2072 | * |
| 2073 | * This IOCTL is used to get ibss sta info |
| 2074 | * |
| 2075 | * @E.g: iwpriv wlan0 getIbssSTAs |
| 2076 | * |
| 2077 | * Supported Feature: IBSS |
| 2078 | * |
| 2079 | * Usage: Internal/External |
| 2080 | * |
| 2081 | * </ioctl> |
| 2082 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2083 | #define WE_GET_IBSS_STA_INFO 11 |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 2084 | /* |
| 2085 | * <ioctl> |
| 2086 | * getphymode - Get the current phymode. |
| 2087 | * |
| 2088 | * @INPUT: None |
| 2089 | * |
| 2090 | * @OUTPUT: In phymode |
| 2091 | * wlan0 getphymode:AUTO MODE |
| 2092 | * |
| 2093 | * This IOCTL used to gets the current phymode. |
| 2094 | * |
| 2095 | * @E.g: iwpriv wlan0 getphymode |
| 2096 | * |
| 2097 | * Supported Feature: STA |
| 2098 | * |
| 2099 | * Usage: Internal/External |
| 2100 | * |
| 2101 | * </ioctl> |
| 2102 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | #define WE_GET_PHYMODE 12 |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 2104 | |
| 2105 | /* |
| 2106 | * <ioctl> |
| 2107 | * getOemDataCap - Get the oem data caps. |
| 2108 | * |
| 2109 | * @INPUT: None |
| 2110 | * |
| 2111 | * @OUTPUT: oem data capability |
| 2112 | * |
| 2113 | * This IOCTL used to gets the current oem data cap. |
| 2114 | * |
| 2115 | * @E.g: iwpriv wlan0 getOemDataCap |
| 2116 | * |
| 2117 | * Usage: Internal/External |
| 2118 | * |
| 2119 | * </ioctl> |
| 2120 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | #define WE_GET_OEM_DATA_CAP 13 |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 2122 | |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 2123 | /* |
| 2124 | * <ioctl> |
| 2125 | * getSNR - Enable SNR Monitoring |
| 2126 | * |
| 2127 | * @INPUT: None |
| 2128 | * |
| 2129 | * @OUTPUT: Signal strength/ratio |
| 2130 | * wlan0 getSNR:1 |
| 2131 | * |
| 2132 | * This IOCTL is used to get ibss sta info |
| 2133 | * |
| 2134 | * @E.g: iwpriv wlan0 getSNR |
| 2135 | * |
| 2136 | * Supported Feature: STA |
| 2137 | * |
| 2138 | * Usage: Internal/External |
| 2139 | * |
| 2140 | * </ioctl> |
| 2141 | */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 2142 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2143 | #define WE_GET_SNR 14 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 2144 | #define WE_LIST_FW_PROFILE 15 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2145 | |
| 2146 | /* Private ioctls and their sub-ioctls */ |
| 2147 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
Selvaraj, Sridhar | f793983 | 2017-03-25 16:59:50 +0530 | [diff] [blame] | 2148 | |
| 2149 | /* |
| 2150 | * <ioctl> |
| 2151 | * reassoc - Trigger STA re-association to the connected AP |
| 2152 | * |
| 2153 | * @INPUT: None |
| 2154 | * |
| 2155 | * @OUTPUT: None |
| 2156 | * |
| 2157 | * This IOCTL is used to trigger STA reassociation to the connected AP. |
| 2158 | * |
| 2159 | * @E.g: iwpriv wlan0 reassoc |
| 2160 | * |
| 2161 | * Supported Feature: Roaming |
| 2162 | * |
| 2163 | * Usage: Internal |
| 2164 | * |
| 2165 | * </ioctl> |
| 2166 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2167 | #define WE_SET_REASSOC_TRIGGER 8 |
Abhishek Singh | 49b654e | 2016-12-01 16:11:17 +0530 | [diff] [blame] | 2168 | /* |
| 2169 | * <ioctl> |
| 2170 | * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI |
| 2171 | * |
| 2172 | * @INPUT: None |
| 2173 | * |
| 2174 | * @OUTPUT: print ibss peer in info logs |
| 2175 | * pPeerInfo->numIBSSPeers = 1 |
| 2176 | * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35 |
| 2177 | * |
| 2178 | * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI |
| 2179 | * in info logs |
| 2180 | * |
| 2181 | * @E.g: iwpriv wlan0 ibssPeerInfoAll |
| 2182 | * |
| 2183 | * Supported Feature: IBSS |
| 2184 | * |
| 2185 | * Usage: Internal/External |
| 2186 | * |
| 2187 | * </ioctl> |
| 2188 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2189 | #define WE_IBSS_GET_PEER_INFO_ALL 10 |
Rajeev Kumar | f4390fa | 2016-12-22 13:17:33 -0800 | [diff] [blame] | 2190 | /* Sub ioctls 11 to 16 are not used */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2191 | #define WE_GET_RECOVERY_STAT 17 |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 2192 | #define WE_GET_FW_PROFILE_DATA 18 |
yeshwanth sriram guntuka | bdfe435 | 2017-02-16 14:44:31 +0530 | [diff] [blame] | 2193 | /* |
| 2194 | * <ioctl> |
| 2195 | * stop_obss_scan - Stop obss scan |
| 2196 | * |
| 2197 | * @INPUT: None |
| 2198 | * |
| 2199 | * @OUTPUT: None |
| 2200 | * |
| 2201 | * This IOCTL is used to stop obss scan |
| 2202 | * |
| 2203 | * @E.g: iwpriv wlan0 stop_obss_scan |
| 2204 | * |
| 2205 | * Supported Feature: Scan |
| 2206 | * |
| 2207 | * Usage: Internal/External |
| 2208 | * |
| 2209 | * </ioctl> |
| 2210 | */ |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 2211 | #define WE_STOP_OBSS_SCAN 19 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2212 | |
| 2213 | /* Private ioctls and their sub-ioctls */ |
| 2214 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 2215 | |
| 2216 | #define WE_P2P_NOA_CMD 2 |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 2217 | /* subcommands 3 is unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2218 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 2219 | #define WE_MAC_PWR_DEBUG_CMD 4 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2220 | |
| 2221 | #ifdef FEATURE_WLAN_TDLS |
Nitesh Shah | 5dfb99e | 2016-12-10 14:19:46 +0530 | [diff] [blame] | 2222 | /* |
| 2223 | * <ioctl> |
| 2224 | * setTdlsConfig - Set TDLS configuration parameters. |
| 2225 | * |
| 2226 | * @INPUT: 11 TDLS configuration parameters |
| 2227 | * @args[0]: tdls: [0..2] |
| 2228 | * @args[1]: tx_period_t: [1000..4294967295UL] |
| 2229 | * @args[2]: tx_packet_n: [0..4294967295UL] |
| 2230 | * @args[3]: [discovery_period is not used anymore] |
| 2231 | * @args[4]: discovery_tries_n: [1..100] |
| 2232 | * @args[5]: [idle_timeout is not used anymore] |
| 2233 | * @args[6]: idle_packet_n: [0..40000] |
| 2234 | * @args[7]: [rssi_hysteresis is not used anymore] |
| 2235 | * @args[8]: rssi_trigger_threshold: [-120..0] |
| 2236 | * @args[9]: rssi_teardown_threshold: [-120..0] |
| 2237 | * @args[10]: rssi_delta: [-30..0] |
| 2238 | * |
| 2239 | * @OUTPUT: None |
| 2240 | * |
| 2241 | * This IOCTL is used to set the TDLS configuration parameters. |
| 2242 | * |
| 2243 | * @E.g: iwpriv wlan0 setTdlsConfig tdls tx_period_t tx_packet_n |
| 2244 | * discovery_period discovery_tries_n idle_timeout |
| 2245 | * idle_packet_n rssi_hysteresis rssi_trigger_threshold |
| 2246 | * rssi_teardown_threshold rssi_delta |
| 2247 | * iwpriv wlan0 setTdlsConfig 1 1500 40 1 5 1 5 0 -70 -70 -10 |
| 2248 | * |
| 2249 | * Supported Feature: TDLS |
| 2250 | * |
| 2251 | * Usage: Internal/External |
| 2252 | * |
| 2253 | * </ioctl> |
| 2254 | */ |
| 2255 | |
| 2256 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2257 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 2258 | #endif |
Abhishek Singh | 49b654e | 2016-12-01 16:11:17 +0530 | [diff] [blame] | 2259 | /* |
| 2260 | * <ioctl> |
| 2261 | * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI |
| 2262 | * |
| 2263 | * @INPUT: staid |
| 2264 | * |
| 2265 | * @OUTPUT: print ibss peer corresponding to staid in info logs |
| 2266 | * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35 |
| 2267 | * |
| 2268 | * This IOCTL is used to print the specific ibss peers's MAC, |
| 2269 | * rate and RSSI in info logs |
| 2270 | * |
| 2271 | * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id> |
| 2272 | * iwpriv wlan0 ibssPeerInfo 0 |
| 2273 | * |
| 2274 | * Supported Feature: IBSS |
| 2275 | * |
| 2276 | * Usage: Internal/External |
| 2277 | * |
| 2278 | * </ioctl> |
| 2279 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2280 | #define WE_IBSS_GET_PEER_INFO 6 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2281 | #define WE_UNIT_TEST_CMD 7 |
| 2282 | |
| 2283 | #define WE_MTRACE_DUMP_CMD 8 |
| 2284 | #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 |
| 2285 | |
| 2286 | |
| 2287 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 2288 | #define WE_LED_FLASHING_PARAM 10 |
| 2289 | #endif |
| 2290 | |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2291 | /* |
| 2292 | * <ioctl> |
| 2293 | * pm_clist - Increments the index value of the concurrent connection list |
| 2294 | * and update with the input parameters provided. |
| 2295 | * |
| 2296 | * @INPUT: Following 8 arguments: |
| 2297 | * @vdev_id: vdev id |
| 2298 | * @tx_streams: TX streams |
| 2299 | * @rx_streams: RX streams |
| 2300 | * @chain_mask: Chain mask |
| 2301 | * @type: vdev_type |
| 2302 | * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7 |
| 2303 | * @sub_type: vdev_subtype |
| 2304 | * P2P_Device:1 P2P_Client:2 P2P_GO:3 |
| 2305 | * Proxy_STA:4 Mesh:5 Mesh_11s:6 |
| 2306 | * @channel: Channel |
| 2307 | * @mac: Mac id |
| 2308 | * |
| 2309 | * @OUTPUT: None |
| 2310 | * |
| 2311 | * This IOCTL is used to increments the index value of the concurrent connection |
| 2312 | * list and update with the input parameters provided. |
| 2313 | * |
| 2314 | * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type |
| 2315 | * sub_type channel mac |
| 2316 | * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1 |
| 2317 | * |
| 2318 | * Supported Feature: DBS |
| 2319 | * |
| 2320 | * Usage: Internal/External |
| 2321 | * |
| 2322 | * </ioctl> |
| 2323 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2324 | #define WE_POLICY_MANAGER_CLIST_CMD 11 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2325 | |
| 2326 | /* |
| 2327 | * <ioctl> |
| 2328 | * pm_dlist - Delete the index from the concurrent connection list that is |
| 2329 | * present in the given vdev_id. |
| 2330 | * |
| 2331 | * @INPUT: delete_all, vdev_id |
| 2332 | * @delete_all: delete all indices |
| 2333 | * @vdev_id: vdev id |
| 2334 | * |
| 2335 | * @OUTPUT: None |
| 2336 | * |
| 2337 | * This IOCTL is used to delete the index from the concurrent connection list |
| 2338 | * that is present in the given vdev_id. |
| 2339 | * |
| 2340 | * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id |
| 2341 | * iwpriv wlan0 pm_dlist 0 1 |
| 2342 | * |
| 2343 | * Supported Feature: DBS |
| 2344 | * |
| 2345 | * Usage: Internal/External |
| 2346 | * |
| 2347 | * </ioctl> |
| 2348 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2349 | #define WE_POLICY_MANAGER_DLIST_CMD 12 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2350 | |
| 2351 | /* |
| 2352 | * <ioctl> |
| 2353 | * pm_dbs - Set dbs capability and system preference |
| 2354 | * |
| 2355 | * @INPUT: dbs, system_pref |
| 2356 | * @dbs: Value of DBS capability to be set |
| 2357 | * @system_pref: System preference |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 2358 | * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2359 | * |
| 2360 | * @OUTPUT: None |
| 2361 | * |
| 2362 | * This IOCTL is used to set dbs capability and system preference. |
| 2363 | * |
| 2364 | * @E.g: iwpriv wlan0 pm_dbs dbs system_pref |
| 2365 | * iwpriv wlan0 pm_dbs 1 0 |
| 2366 | * |
| 2367 | * Supported Feature: DBS |
| 2368 | * |
| 2369 | * Usage: Internal/External |
| 2370 | * |
| 2371 | * </ioctl> |
| 2372 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2373 | #define WE_POLICY_MANAGER_DBS_CMD 13 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2374 | |
| 2375 | /* |
| 2376 | * <ioctl> |
| 2377 | * pm_pcl - Set pcl for concurrency mode. |
| 2378 | * |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 2379 | * @INPUT: policy_mgr_con_mode |
| 2380 | * @policy_mgr_con_mode: concurrency mode for PCL table |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2381 | * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS |
| 2382 | * |
| 2383 | * @OUTPUT: None |
| 2384 | * |
| 2385 | * This IOCTL is used to set pcl for concurrency mode. |
| 2386 | * |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 2387 | * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2388 | * iwpriv wlan0 pm_pcl 0 |
| 2389 | * |
| 2390 | * Supported Feature: DBS |
| 2391 | * |
| 2392 | * Usage: Internal/External |
| 2393 | * |
| 2394 | * </ioctl> |
| 2395 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2396 | #define WE_POLICY_MANAGER_PCL_CMD 14 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2397 | |
| 2398 | /* |
| 2399 | * <ioctl> |
| 2400 | * pm_cinfo - Shows the concurrent connection list. |
| 2401 | * |
| 2402 | * @INPUT: None |
| 2403 | * |
| 2404 | * @OUTPUT: None |
| 2405 | * |
| 2406 | * This IOCTL is used to show the concurrent connection list. |
| 2407 | * |
| 2408 | * @E.g: iwpriv wlan0 pm_cinfo |
| 2409 | * |
| 2410 | * Supported Feature: DBS |
| 2411 | * |
| 2412 | * Usage: Internal/External |
| 2413 | * |
| 2414 | * </ioctl> |
| 2415 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | #define WE_POLICY_MANAGER_CINFO_CMD 15 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2417 | |
| 2418 | /* |
| 2419 | * <ioctl> |
| 2420 | * pm_ulist - Updates the index value of the concurrent connection list |
| 2421 | * with the input parameters provided. |
| 2422 | * |
| 2423 | * @INPUT: Following 8 arguments: |
| 2424 | * @vdev_id: vdev id |
| 2425 | * @tx_streams: TX streams |
| 2426 | * @rx_streams: RX streams |
| 2427 | * @chain_mask: Chain mask |
| 2428 | * @type: vdev_type |
| 2429 | * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7 |
| 2430 | * @sub_type: vdev_subtype |
| 2431 | * P2P_Device:1 P2P_Client:2 P2P_GO:3 |
| 2432 | * Proxy_STA:4 Mesh:5 Mesh_11s:6 |
| 2433 | * @channel: Channel |
| 2434 | * @mac: Mac id |
| 2435 | * |
| 2436 | * @OUTPUT: None |
| 2437 | * |
| 2438 | * This IOCTL is used to updates the index value of the concurrent |
| 2439 | * connection list with the input parameters provided. |
| 2440 | * |
| 2441 | * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type |
| 2442 | * sub_type channel mac |
| 2443 | * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1 |
| 2444 | * |
| 2445 | * Supported Feature: DBS |
| 2446 | * |
| 2447 | * Usage: Internal/External |
| 2448 | * |
| 2449 | * </ioctl> |
| 2450 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | #define WE_POLICY_MANAGER_ULIST_CMD 16 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2452 | |
| 2453 | /* |
| 2454 | * <ioctl> |
| 2455 | * pm_query_action - Initiate actions needed on current connections as |
| 2456 | * per the channel provided. |
| 2457 | * |
| 2458 | * @INPUT: channel |
| 2459 | * @channel: Channel on which new connection will be. |
| 2460 | * |
| 2461 | * @OUTPUT: None |
| 2462 | * |
| 2463 | * This IOCTL is used to initiate actions needed on current connections |
| 2464 | * as per the channel provided. |
| 2465 | * |
| 2466 | * @E.g: iwpriv wlan0 pm_query_action channel |
| 2467 | * iwpriv wlan0 pm_query_action 6 |
| 2468 | * |
| 2469 | * Supported Feature: DBS |
| 2470 | * |
| 2471 | * Usage: Internal/External |
| 2472 | * |
| 2473 | * </ioctl> |
| 2474 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | #define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2476 | |
| 2477 | /* |
| 2478 | * <ioctl> |
| 2479 | * pm_query_allow - Checks for allowed concurrency combination |
| 2480 | * |
| 2481 | * @INPUT: mode, channel, bandwidth |
| 2482 | * @mode: new connection mode |
| 2483 | * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS |
| 2484 | * @channel: channel on which new connection is coming up |
| 2485 | * @bandwidth: Bandwidth requested by the connection |
| 2486 | * 0:None 1:5MHz 2:10MHz 3:20MHz |
| 2487 | * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz |
| 2488 | * |
| 2489 | * @OUTPUT: None |
| 2490 | * |
| 2491 | * This IOCTL is used to checks for allowed concurrency combination. |
| 2492 | * |
| 2493 | * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth |
| 2494 | * iwpriv wlan0 pm_query_allow 0 6 4 |
| 2495 | * |
| 2496 | * Supported Feature: DBS |
| 2497 | * |
| 2498 | * Usage: Internal/External |
| 2499 | * |
| 2500 | * </ioctl> |
| 2501 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2502 | #define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2503 | |
| 2504 | /* |
| 2505 | * <ioctl> |
| 2506 | * pm_run_scenario - Create scenario with number of connections provided. |
| 2507 | * |
| 2508 | * @INPUT: num_of_conn |
| 2509 | * @num_of_conn: the number of connections (values: 1~3) |
| 2510 | * |
| 2511 | * @OUTPUT: None |
| 2512 | * |
| 2513 | * This IOCTL is used to create scenario with the number of connections |
| 2514 | * provided. |
| 2515 | * |
| 2516 | * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn |
| 2517 | * iwpriv wlan0 pm_run_scenario 1 |
| 2518 | * |
| 2519 | * Supported Feature: DBS |
| 2520 | * |
| 2521 | * Usage: Internal/External |
| 2522 | * |
| 2523 | * </ioctl> |
| 2524 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2525 | #define WE_POLICY_MANAGER_SCENARIO_CMD 19 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2526 | |
| 2527 | /* |
| 2528 | * <ioctl> |
| 2529 | * pm_set_hw_mode - Set hardware for single/dual mac. |
| 2530 | * |
| 2531 | * @INPUT: hw_mode |
| 2532 | * 0:single mac 1:dual mac |
| 2533 | * |
| 2534 | * @OUTPUT: None |
| 2535 | * |
| 2536 | * This IOCTL is used to set hardware for single/dual mac. |
| 2537 | * |
| 2538 | * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode |
| 2539 | * iwpriv wlan0 pm_set_hw_mode 1 |
| 2540 | * |
| 2541 | * Supported Feature: DBS |
| 2542 | * |
| 2543 | * Usage: Internal/External |
| 2544 | * |
| 2545 | * </ioctl> |
| 2546 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2547 | #define WE_POLICY_SET_HW_MODE_CMD 20 |
| 2548 | |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2549 | /* |
| 2550 | * <ioctl> |
| 2551 | * set_scan_cfg - Set dual MAC scan config parameters. |
| 2552 | * |
| 2553 | * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs |
| 2554 | * @dbs: Value of DBS bit |
| 2555 | * @dbs_plus_agile_scan: Value of DBS plus agile scan bit |
| 2556 | * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS |
| 2557 | * |
| 2558 | * @OUTPUT: None |
| 2559 | * |
| 2560 | * This IOCTL is used to set the dual MAC scan config. |
| 2561 | * |
| 2562 | * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan |
| 2563 | * single_mac_scan_with_dbs |
| 2564 | * iwpriv wlan0 set_scan_cfg 1 0 1 |
| 2565 | * |
| 2566 | * Supported Feature: DBS |
| 2567 | * |
| 2568 | * Usage: Internal/External |
| 2569 | * |
| 2570 | * </ioctl> |
| 2571 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | #define WE_SET_DUAL_MAC_SCAN_CONFIG 21 |
Nitesh Shah | f9503dd | 2016-12-15 20:26:07 +0530 | [diff] [blame] | 2573 | |
| 2574 | /* |
| 2575 | * <ioctl> |
| 2576 | * set_fw_mode_cfg - Sets the dual mac FW mode config |
| 2577 | * |
| 2578 | * @INPUT: dbs, dfs |
| 2579 | * @dbs: DBS bit |
| 2580 | * @dfs: Agile DFS bit |
| 2581 | * |
| 2582 | * @OUTPUT: None |
| 2583 | * |
| 2584 | * This IOCTL is used to set the dual mac FW mode config. |
| 2585 | * |
| 2586 | * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs |
| 2587 | * iwpriv wlan0 set_fw_mode_cfg 1 1 |
| 2588 | * |
| 2589 | * Supported Feature: DBS |
| 2590 | * |
| 2591 | * Usage: Internal/External |
| 2592 | * |
| 2593 | * </ioctl> |
| 2594 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2595 | #define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22 |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 2596 | #define WE_SET_MON_MODE_CHAN 23 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2597 | |
| 2598 | #ifdef FEATURE_WLAN_TDLS |
| 2599 | #undef MAX_VAR_ARGS |
| 2600 | #define MAX_VAR_ARGS 11 |
| 2601 | #else |
| 2602 | #undef MAX_VAR_ARGS |
| 2603 | #define MAX_VAR_ARGS 9 |
| 2604 | #endif |
| 2605 | |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 2606 | /* |
| 2607 | * <ioctl> |
| 2608 | * fips_test - Perform a FIPS test |
| 2609 | * |
| 2610 | * @INPUT: Binary representation of the following packed structure |
| 2611 | * |
| 2612 | * @OUTPUT: Binary representation of the following packed structure |
| 2613 | * |
| 2614 | * This IOCTL is used to perform FIPS certification testing |
| 2615 | * |
| 2616 | * @E.g: iwpriv wlan0 fips_test <test vector> |
| 2617 | * |
| 2618 | * iwpriv wlan0 fips_test <tbd> |
| 2619 | * |
| 2620 | * Supported Feature: FIPS |
| 2621 | * |
| 2622 | * Usage: Internal |
| 2623 | * |
| 2624 | * </ioctl> |
| 2625 | */ |
| 2626 | #define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8) |
| 2627 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2628 | /* Private ioctls (with no sub-ioctls) */ |
| 2629 | /* note that they must be odd so that they have "get" semantics */ |
Sreelakshmi Konamki | 9be8d41 | 2017-03-01 10:29:08 +0530 | [diff] [blame] | 2630 | /* |
| 2631 | * <ioctl> |
| 2632 | * addTspec - Add TSPEC for each AC |
| 2633 | * |
| 2634 | * @INPUT: 19 TSPEC params |
| 2635 | * @[arg0]: handle |
| 2636 | * @[arg1]: tid |
| 2637 | * @[arg2]: dir |
| 2638 | * @[arg3]: psb |
| 2639 | * @[arg4]: up |
| 2640 | * @[arg5]: nomMsduSize |
| 2641 | * @[arg6]: maxMsduSize |
| 2642 | * @[arg7]: minDataRate |
| 2643 | * @[arg8]: meanDataRate |
| 2644 | * @[arg9]: peakDataRate |
| 2645 | * @[arg10]: maxBurstSize |
| 2646 | * @[arg11]: minPhyRate |
| 2647 | * @[arg12]: sba |
| 2648 | * @[arg13]: minServiceIntv |
| 2649 | * @[arg14]: suspendIntv |
| 2650 | * @[arg15]: burstSizeDefn |
| 2651 | * @[arg16]: ackPolicy |
| 2652 | * @[arg17]: inactivityPeriod |
| 2653 | * @[arg18]: maxServiceIntv |
| 2654 | * |
| 2655 | * @OUTPUT: Success/Failure |
| 2656 | * |
| 2657 | * This IOCTL is used to add TSPEC for each AC. |
| 2658 | * |
| 2659 | * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize> |
| 2660 | * <maxMsduSize> <minDataRate> <meanDataRate> |
| 2661 | * <peakDataRate> <maxBurstSize> <minPhyRate> |
| 2662 | * <sba> <minServiceIntv> <suspendIntv> |
| 2663 | * <burstSizeDefn> <ackPolicy> <inactivityPeriod> |
| 2664 | * <maxServiceIntv> |
| 2665 | * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500 |
| 2666 | * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000 |
| 2667 | * wlan0 addTspec:3 |
| 2668 | * |
| 2669 | * Supported Feature: WMM |
| 2670 | * |
| 2671 | * Usage: Internal/External |
| 2672 | * |
| 2673 | * </ioctl> |
| 2674 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
Sreelakshmi Konamki | 9be8d41 | 2017-03-01 10:29:08 +0530 | [diff] [blame] | 2676 | /* |
| 2677 | * <ioctl> |
| 2678 | * delTspec - Delete TSPEC entry for each AC |
| 2679 | * |
| 2680 | * @INPUT: 1 TSPEC param |
| 2681 | * @[arg0]: handle |
| 2682 | * |
| 2683 | * @OUTPUT: Success/Failure |
| 2684 | * |
| 2685 | * This IOCTL is used to delete TSPEC entry for each AC. |
| 2686 | * |
| 2687 | * @E.g: iwpriv wlan0 delTspec <handle> |
| 2688 | * iwpriv wlan0 delTspec 7001 |
| 2689 | * wlan0 delTspec:16 |
| 2690 | * |
| 2691 | * Supported Feature: WMM |
| 2692 | * |
| 2693 | * Usage: Internal/External |
| 2694 | * |
| 2695 | * </ioctl> |
| 2696 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2697 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
Sreelakshmi Konamki | 9be8d41 | 2017-03-01 10:29:08 +0530 | [diff] [blame] | 2698 | /* |
| 2699 | * <ioctl> |
| 2700 | * getTspec - Get TSPEC entry for each AC |
| 2701 | * |
| 2702 | * @INPUT: 1 TSPEC param |
| 2703 | * @[arg0]: handle |
| 2704 | * |
| 2705 | * @OUTPUT: Success/Failure |
| 2706 | * |
| 2707 | * This IOCTL is used to get TSPEC entry for each AC. |
| 2708 | * |
| 2709 | * @E.g: iwpriv wlan0 getTspec <handle> |
| 2710 | * iwpriv wlan0 getTspec 7001 |
| 2711 | * wlan0 delTspec:18 |
| 2712 | * |
| 2713 | * Supported Feature: WMM |
| 2714 | * |
| 2715 | * Usage: Internal/External |
| 2716 | * |
| 2717 | * </ioctl> |
| 2718 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2719 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 2720 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2721 | /* (SIOCIWFIRSTPRIV + 10) is currently unused */ |
| 2722 | /* (SIOCIWFIRSTPRIV + 12) is currently unused */ |
| 2723 | /* (SIOCIWFIRSTPRIV + 14) is currently unused */ |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 2724 | #define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15) |
| 2725 | #define WE_GET_TSF 1 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2726 | /* (SIOCIWFIRSTPRIV + 16) is currently unused */ |
| 2727 | /* (SIOCIWFIRSTPRIV + 17) is currently unused */ |
| 2728 | /* (SIOCIWFIRSTPRIV + 19) is currently unused */ |
| 2729 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2730 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2731 | |
| 2732 | /* Private ioctl for setting the host offload feature */ |
| 2733 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 2734 | |
| 2735 | /* Private ioctl to get the statistics */ |
| 2736 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 2737 | |
| 2738 | /* Private ioctl to set the Keep Alive Params */ |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 2739 | /* |
| 2740 | * <ioctl> |
| 2741 | * setKeepAlive - Set the keep alive feature |
| 2742 | * |
| 2743 | * @INPUT: 28 bytes of information in the order of packet type, time period |
| 2744 | * host IPv4 address, destination IPv4 address, destination MAC address, bssID |
| 2745 | * |
| 2746 | * @OUTPUT: None |
| 2747 | * |
| 2748 | * This IOCTL sets the keep alive feature to send either NULL |
| 2749 | * or unsolicited ARP response packets |
| 2750 | * |
| 2751 | * @E.g: iwpriv wlan0 setKeepAlive |
| 2752 | * |
| 2753 | * Supported Feature: STA |
| 2754 | * |
| 2755 | * Usage: Internal/External |
| 2756 | * |
| 2757 | * </ioctl> |
| 2758 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2759 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 2760 | |
| 2761 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 2762 | /* Private ioctl to set the packet filtering params */ |
| 2763 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 2764 | #endif |
| 2765 | |
| 2766 | |
| 2767 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 2768 | /* Private ioctl to get the statistics */ |
| 2769 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 2770 | #endif |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 2771 | /* |
| 2772 | * <ioctl> |
| 2773 | * SETBAND - Set the operational band |
| 2774 | * |
| 2775 | * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz |
| 2776 | * |
| 2777 | * @OUTPUT: None |
| 2778 | * |
| 2779 | * This IOCTL Set the operational band If the new band is different from the |
| 2780 | * current operational band, it aborts the pending scan requests, flushes |
| 2781 | * the existing scan results, and then change * the band capability |
| 2782 | * |
| 2783 | * @E.g: iwpriv wlan0 SETBAND <value> |
| 2784 | * |
| 2785 | * Supported Feature: STA |
| 2786 | * |
| 2787 | * Usage: Internal/External |
| 2788 | * |
| 2789 | * </ioctl> |
| 2790 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2791 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) |
| 2792 | |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 2793 | #define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26) |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 2794 | /* (SIOCIWFIRSTPRIV + 27) is currently unused */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2795 | |
| 2796 | /* Private ioctls and their sub-ioctls */ |
| 2797 | #define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28) |
| 2798 | #define WE_SET_SMPS_PARAM 1 |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 2799 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | #define WE_SET_FW_CRASH_INJECT 2 |
| 2801 | #endif |
| 2802 | #define WE_DUMP_DP_TRACE_LEVEL 3 |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 2803 | /* Private sub ioctl for enabling and setting histogram interval of profiling */ |
| 2804 | #define WE_ENABLE_FW_PROFILE 4 |
| 2805 | #define WE_SET_FW_PROFILE_HIST_INTVL 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2806 | |
Rajeev Kumar | 9bb2e85 | 2016-09-24 12:29:25 -0700 | [diff] [blame] | 2807 | /* Private sub-ioctl for initiating WoW suspend without Apps suspend */ |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 2808 | #define WE_SET_WLAN_SUSPEND 6 |
| 2809 | #define WE_SET_WLAN_RESUME 7 |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 2810 | |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 2811 | /* |
| 2812 | * <ioctl> |
| 2813 | * log_buffer - prints host/target related communication logs via dmesg |
| 2814 | * |
| 2815 | * @INPUT: Log Id, Count |
| 2816 | * |
| 2817 | * Log Id: |
| 2818 | * 0) HTC_CREDIT_HISTORY_LOG |
| 2819 | * 1) COMMAND_LOG, |
| 2820 | * 2) COMMAND_TX_CMP_LOG, |
| 2821 | * 3) MGMT_COMMAND_LOG, |
| 2822 | * 4) MGMT_COMMAND_TX_CMP_LOG, |
| 2823 | * 5) EVENT_LOG, |
| 2824 | * 6) RX_EVENT_LOG, |
| 2825 | * 7) MGMT_EVENT_LOG |
| 2826 | * |
| 2827 | * @OUTPUT: None |
| 2828 | * |
| 2829 | * @E.g: |
| 2830 | * # print up to 10 of the most recent records from HTC Credit History |
| 2831 | * iwpriv wlan0 log_buffer 0 10 |
| 2832 | * # print up to 3 of the most recent records from Event Log |
| 2833 | * iwpriv wlan0 log_buffer 5 3 |
| 2834 | * |
| 2835 | * Supported Feature: WLAN Trace |
| 2836 | * |
| 2837 | * Usage: Internal/External |
| 2838 | * |
| 2839 | * </ioctl> |
| 2840 | */ |
| 2841 | #define WE_LOG_BUFFER 8 |
| 2842 | |
| 2843 | enum host_target_comm_log { |
| 2844 | HTC_CREDIT_HISTORY_LOG = 0, |
| 2845 | COMMAND_LOG, |
| 2846 | COMMAND_TX_CMP_LOG, |
| 2847 | MGMT_COMMAND_LOG, |
| 2848 | MGMT_COMMAND_TX_CMP_LOG, |
| 2849 | EVENT_LOG, |
| 2850 | RX_EVENT_LOG, |
| 2851 | MGMT_EVENT_LOG |
| 2852 | }; |
| 2853 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2854 | /* (SIOCIWFIRSTPRIV + 29) is currently unused */ |
| 2855 | |
| 2856 | /* 802.11p IOCTL */ |
| 2857 | #define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30) |
| 2858 | |
Sen, Devendra | 9ca8c43 | 2017-02-23 15:10:26 +0530 | [diff] [blame] | 2859 | /* |
| 2860 | * <ioctl> |
| 2861 | * getLinkSpeed - Gets the current link speed in Mbps |
| 2862 | * |
| 2863 | * @INPUT: None |
| 2864 | * |
| 2865 | * @OUTPUT: linkspeed in mbps |
| 2866 | * wlan0 getLinkSpeed:7 |
| 2867 | * |
| 2868 | * This IOCTL is used get the current link speed in Mbps |
| 2869 | * |
| 2870 | * @E.g: iwpriv wlan0 getLinkSpeed |
| 2871 | * |
| 2872 | * Supported Feature: STA |
| 2873 | * |
| 2874 | * Usage: Internal/External |
| 2875 | * |
| 2876 | * </ioctl> |
| 2877 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 2879 | |
| 2880 | #define WLAN_STATS_INVALID 0 |
| 2881 | #define WLAN_STATS_RETRY_CNT 1 |
| 2882 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 2883 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 2884 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 2885 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 2886 | #define WLAN_STATS_FAIL_CNT 6 |
| 2887 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 2888 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 2889 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 2890 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 2891 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 2892 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 2893 | |
| 2894 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 2895 | #define WLAN_STATS_RX_RATE 14 |
| 2896 | #define WLAN_STATS_TX_RATE 15 |
| 2897 | |
| 2898 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 2899 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 2900 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 2901 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 2902 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 2903 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 2904 | |
| 2905 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 2906 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \ |
| 2907 | *__p++ = __type; \ |
| 2908 | *__p++ = __size; \ |
| 2909 | memcpy(__p, __val, __size); \ |
| 2910 | __p += __size; \ |
| 2911 | __tlen += __size + 2; \ |
| 2912 | } else { \ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2913 | hdd_err("FILL_TLV Failed!!!"); \ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | } \ |
| 2915 | } while (0) |
| 2916 | |
| 2917 | #define VERSION_VALUE_MAX_LEN 32 |
| 2918 | |
| 2919 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 2920 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 2921 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 2922 | |
| 2923 | #define WLAN_ADAPTER 0 |
| 2924 | #define P2P_ADAPTER 1 |
| 2925 | |
| 2926 | /** |
| 2927 | * mem_alloc_copy_from_user_helper - copy from user helper |
| 2928 | * @wrqu_data: wireless extensions request data |
| 2929 | * @len: length of @wrqu_data |
| 2930 | * |
| 2931 | * Helper function to allocate buffer and copy user data. |
| 2932 | * |
| 2933 | * Return: On success return a pointer to a kernel buffer containing a |
| 2934 | * copy of the userspace data (with an additional NUL character |
| 2935 | * appended for safety). On failure return %NULL. |
| 2936 | */ |
| 2937 | void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len) |
| 2938 | { |
| 2939 | u8 *ptr = NULL; |
| 2940 | |
| 2941 | /* in order to protect the code, an extra byte is post |
| 2942 | * appended to the buffer and the null termination is added. |
| 2943 | * However, when allocating (len+1) byte of memory, we need to |
| 2944 | * make sure that there is no uint overflow when doing |
| 2945 | * addition. In theory check len < UINT_MAX protects the uint |
| 2946 | * overflow. For wlan private ioctl, the buffer size is much |
| 2947 | * less than UINT_MAX, as a good guess, now, it is assumed |
| 2948 | * that the private command buffer size is no greater than 4K |
| 2949 | * (4096 bytes). So we use 4096 as the upper boundary for now. |
| 2950 | */ |
| 2951 | if (len > MAX_USER_COMMAND_SIZE) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 2952 | hdd_err("Invalid length: %zu max: %u", |
| 2953 | len, MAX_USER_COMMAND_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | return NULL; |
| 2955 | } |
| 2956 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2957 | ptr = qdf_mem_malloc(len + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | if (NULL == ptr) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2959 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | return NULL; |
| 2961 | } |
| 2962 | |
| 2963 | if (copy_from_user(ptr, wrqu_data, len)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 2964 | hdd_err("failed to copy data to user buffer"); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2965 | qdf_mem_free(ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2966 | return NULL; |
| 2967 | } |
| 2968 | ptr[len] = '\0'; |
| 2969 | return ptr; |
| 2970 | } |
| 2971 | |
| 2972 | /** |
| 2973 | * hdd_priv_get_data() - Get pointer to ioctl private data |
| 2974 | * @p_priv_data: pointer to iw_point struct to be filled |
| 2975 | * @wrqu: Pointer to IOCTL Data received from userspace |
| 2976 | * |
| 2977 | * Helper function to get compatible struct iw_point passed to ioctl |
| 2978 | * |
| 2979 | * Return - 0 if p_priv_data successfully filled, error otherwise |
| 2980 | */ |
| 2981 | int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu) |
| 2982 | { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 2983 | if ((NULL == p_priv_data) || (NULL == wrqu)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2984 | return -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 2985 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | #ifdef CONFIG_COMPAT |
| 2987 | if (is_compat_task()) { |
| 2988 | struct compat_iw_point *p_compat_priv_data; |
| 2989 | |
| 2990 | /* Compat task: |
| 2991 | * typecast to compat structure and copy the members. |
| 2992 | */ |
| 2993 | p_compat_priv_data = (struct compat_iw_point *)&wrqu->data; |
| 2994 | |
| 2995 | p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer); |
| 2996 | p_priv_data->length = p_compat_priv_data->length; |
| 2997 | p_priv_data->flags = p_compat_priv_data->flags; |
| 2998 | } else { |
| 2999 | #endif /* #ifdef CONFIG_COMPAT */ |
| 3000 | |
| 3001 | /* Non compat task: directly copy the structure. */ |
| 3002 | memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point)); |
| 3003 | |
| 3004 | #ifdef CONFIG_COMPAT |
| 3005 | } |
| 3006 | #endif /* #ifdef CONFIG_COMPAT */ |
| 3007 | |
| 3008 | return 0; |
| 3009 | } |
| 3010 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 3011 | static int hdd_check_wext_control(enum hdd_wext_control wext_control, |
| 3012 | struct iw_request_info *info) |
| 3013 | { |
| 3014 | switch (wext_control) { |
| 3015 | default: |
| 3016 | case hdd_wext_disabled: |
| 3017 | hdd_err("Rejecting disabled ioctl %x", info->cmd); |
| 3018 | return -ENOTSUPP; |
| 3019 | case hdd_wext_deprecated: |
| 3020 | hdd_warn("Using deprecated ioctl %x", info->cmd); |
| 3021 | return 0; |
| 3022 | case hdd_wext_enabled: |
| 3023 | return 0; |
| 3024 | } |
| 3025 | } |
| 3026 | |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 3027 | int hdd_check_standard_wext_control(struct hdd_context *hdd_ctx, |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 3028 | struct iw_request_info *info) |
| 3029 | { |
| 3030 | return hdd_check_wext_control(hdd_ctx->config->standard_wext_control, |
| 3031 | info); |
| 3032 | } |
| 3033 | |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 3034 | int hdd_check_private_wext_control(struct hdd_context *hdd_ctx, |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 3035 | struct iw_request_info *info) |
| 3036 | { |
| 3037 | return hdd_check_wext_control(hdd_ctx->config->private_wext_control, |
| 3038 | info); |
| 3039 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3040 | |
| 3041 | /** |
| 3042 | * hdd_wlan_get_stats() - Get txrx stats in SAP mode |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3043 | * @adapter: Pointer to the hdd adapter. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3044 | * @length: Size of the data copied |
| 3045 | * @buffer: Pointer to char buffer. |
| 3046 | * @buf_len: Length of the char buffer. |
| 3047 | * |
| 3048 | * This function called when the "iwpriv wlan0 get_stats" command is given. |
| 3049 | * It used to collect the txrx stats when the device is configured in SAP mode. |
| 3050 | * |
| 3051 | * Return - none |
| 3052 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3053 | void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3054 | char *buffer, uint16_t buf_len) |
| 3055 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3056 | struct hdd_tx_rx_stats *pStats = &adapter->hdd_stats.hddTxRxStats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3057 | uint32_t len = 0; |
| 3058 | uint32_t total_rx_pkt = 0, total_rx_dropped = 0; |
| 3059 | uint32_t total_rx_delv = 0, total_rx_refused = 0; |
| 3060 | int i = 0; |
| 3061 | |
| 3062 | for (; i < NUM_CPUS; i++) { |
| 3063 | total_rx_pkt += pStats->rxPackets[i]; |
| 3064 | total_rx_dropped += pStats->rxDropped[i]; |
| 3065 | total_rx_delv += pStats->rxDelivered[i]; |
| 3066 | total_rx_refused += pStats->rxRefused[i]; |
| 3067 | } |
| 3068 | |
| 3069 | len = scnprintf(buffer, buf_len, |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3070 | "\nTransmit[%lu] - " |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 3071 | "called %u, dropped %u orphan %u," |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3072 | "\n[dropped] BK %u, BE %u, VI %u, VO %u" |
| 3073 | "\n[classified] BK %u, BE %u, VI %u, VO %u" |
| 3074 | "\n\nReceive[%lu] - " |
| 3075 | "packets %u, dropped %u, delivered %u, refused %u" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3076 | "\n", |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3077 | qdf_system_ticks(), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3078 | pStats->txXmitCalled, |
| 3079 | pStats->txXmitDropped, |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 3080 | pStats->txXmitOrphaned, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3081 | |
| 3082 | pStats->txXmitDroppedAC[SME_AC_BK], |
| 3083 | pStats->txXmitDroppedAC[SME_AC_BE], |
| 3084 | pStats->txXmitDroppedAC[SME_AC_VI], |
| 3085 | pStats->txXmitDroppedAC[SME_AC_VO], |
| 3086 | |
| 3087 | pStats->txXmitClassifiedAC[SME_AC_BK], |
| 3088 | pStats->txXmitClassifiedAC[SME_AC_BE], |
| 3089 | pStats->txXmitClassifiedAC[SME_AC_VI], |
| 3090 | pStats->txXmitClassifiedAC[SME_AC_VO], |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3091 | qdf_system_ticks(), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused |
| 3093 | ); |
| 3094 | |
| 3095 | for (i = 0; i < NUM_CPUS; i++) { |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3096 | if (pStats->rxPackets[i] == 0) |
| 3097 | continue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3098 | len += scnprintf(buffer + len, buf_len - len, |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3099 | "Rx CPU[%d]:" |
| 3100 | "packets %u, dropped %u, delivered %u, refused %u\n", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | i, pStats->rxPackets[i], pStats->rxDropped[i], |
| 3102 | pStats->rxDelivered[i], pStats->rxRefused[i]); |
| 3103 | } |
| 3104 | |
| 3105 | len += scnprintf(buffer + len, buf_len - len, |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3106 | "\nTX_FLOW" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3107 | "\nCurrent status: %s" |
| 3108 | "\ntx-flow timer start count %u" |
| 3109 | "\npause count %u, unpause count %u", |
| 3110 | (pStats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"), |
| 3111 | pStats->txflow_timer_cnt, |
| 3112 | pStats->txflow_pause_cnt, |
| 3113 | pStats->txflow_unpause_cnt); |
| 3114 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3115 | len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC), |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3116 | adapter->sessionId, &buffer[len], (buf_len - len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3117 | *length = len + 1; |
| 3118 | } |
| 3119 | |
| 3120 | /** |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 3121 | * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer |
| 3122 | * @hdd_ctx: The Hdd context owning the stats to be written |
| 3123 | * @buffer: The char buffer to write to |
| 3124 | * @max_len: The maximum number of chars to write |
| 3125 | * |
| 3126 | * This assumes hdd_ctx has already been validated, and buffer is not NULL. |
| 3127 | * |
| 3128 | * Return - length of written content, negative number on error |
| 3129 | */ |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 3130 | static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx, |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 3131 | char *buffer, uint16_t max_len) |
| 3132 | { |
| 3133 | QDF_STATUS status; |
| 3134 | struct suspend_resume_stats *sr_stats; |
| 3135 | struct sir_wake_lock_stats wow_stats; |
| 3136 | |
| 3137 | sr_stats = &hdd_ctx->suspend_resume_stats; |
| 3138 | |
| 3139 | status = wma_get_wakelock_stats(&wow_stats); |
| 3140 | if (QDF_IS_STATUS_ERROR(status)) { |
| 3141 | hdd_err("Failed to get WoW stats"); |
| 3142 | return qdf_status_to_os_return(status); |
| 3143 | } |
| 3144 | |
| 3145 | return scnprintf(buffer, max_len, |
| 3146 | "\n" |
| 3147 | "Suspends: %u\n" |
| 3148 | "Resumes: %u\n" |
| 3149 | "\n" |
| 3150 | "Suspend Fail Reasons\n" |
| 3151 | "\tIPA: %u\n" |
| 3152 | "\tRadar: %u\n" |
| 3153 | "\tRoam: %u\n" |
| 3154 | "\tScan: %u\n" |
| 3155 | "\tInitial Wakeup: %u\n" |
| 3156 | "\n" |
| 3157 | "WoW Wake Reasons\n" |
| 3158 | "\tunicast: %u\n" |
| 3159 | "\tbroadcast: %u\n" |
| 3160 | "\tIPv4 multicast: %u\n" |
| 3161 | "\tIPv6 multicast: %u\n" |
| 3162 | "\tIPv6 multicast RA: %u\n" |
| 3163 | "\tIPv6 multicast NS: %u\n" |
| 3164 | "\tIPv6 multicast NA: %u\n" |
| 3165 | "\tICMPv4: %u\n" |
| 3166 | "\tICMPv6: %u\n" |
| 3167 | "\tRSSI Breach: %u\n" |
| 3168 | "\tLow RSSI: %u\n" |
| 3169 | "\tG-Scan: %u\n" |
| 3170 | "\tPNO Complete: %u\n" |
| 3171 | "\tPNO Match: %u\n", |
| 3172 | sr_stats->suspends, |
| 3173 | sr_stats->resumes, |
| 3174 | sr_stats->suspend_fail[SUSPEND_FAIL_IPA], |
| 3175 | sr_stats->suspend_fail[SUSPEND_FAIL_RADAR], |
| 3176 | sr_stats->suspend_fail[SUSPEND_FAIL_ROAM], |
| 3177 | sr_stats->suspend_fail[SUSPEND_FAIL_SCAN], |
| 3178 | sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP], |
| 3179 | wow_stats.wow_ucast_wake_up_count, |
| 3180 | wow_stats.wow_bcast_wake_up_count, |
| 3181 | wow_stats.wow_ipv4_mcast_wake_up_count, |
| 3182 | wow_stats.wow_ipv6_mcast_wake_up_count, |
| 3183 | wow_stats.wow_ipv6_mcast_ra_stats, |
| 3184 | wow_stats.wow_ipv6_mcast_ns_stats, |
| 3185 | wow_stats.wow_ipv6_mcast_na_stats, |
| 3186 | wow_stats.wow_icmpv4_count, |
| 3187 | wow_stats.wow_icmpv6_count, |
| 3188 | wow_stats.wow_rssi_breach_wake_up_count, |
| 3189 | wow_stats.wow_low_rssi_wake_up_count, |
| 3190 | wow_stats.wow_gscan_wake_up_count, |
| 3191 | wow_stats.wow_pno_complete_wake_up_count, |
| 3192 | wow_stats.wow_pno_match_wake_up_count); |
| 3193 | } |
| 3194 | |
| 3195 | /** |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 3196 | * hdd_wlan_list_fw_profile() - Get fw profiling points |
| 3197 | * @length: Size of the data copied |
| 3198 | * @buffer: Pointer to char buffer. |
| 3199 | * @buf_len: Length of the char buffer. |
| 3200 | * |
| 3201 | * This function called when the "iwpriv wlan0 listProfile" command is given. |
| 3202 | * It is used to get the supported profiling points in FW. |
| 3203 | * |
| 3204 | * Return - none |
| 3205 | */ |
| 3206 | void hdd_wlan_list_fw_profile(uint16_t *length, |
| 3207 | char *buffer, uint16_t buf_len) |
| 3208 | { |
| 3209 | uint32_t len = 0; |
| 3210 | |
| 3211 | len = scnprintf(buffer, buf_len, |
| 3212 | "PROF_CPU_IDLE: %u\n" |
| 3213 | "PROF_PPDU_PROC: %u\n" |
| 3214 | "PROF_PPDU_POST: %u\n" |
| 3215 | "PROF_HTT_TX_INPUT: %u\n" |
| 3216 | "PROF_MSDU_ENQ: %u\n" |
| 3217 | "PROF_PPDU_POST_HAL: %u\n" |
| 3218 | "PROF_COMPUTE_TX_TIME: %u\n", |
| 3219 | PROF_CPU_IDLE, |
| 3220 | PROF_PPDU_PROC, |
| 3221 | PROF_PPDU_POST, |
| 3222 | PROF_HTT_TX_INPUT, |
| 3223 | PROF_MSDU_ENQ, |
| 3224 | PROF_PPDU_POST_HAL, |
| 3225 | PROF_COMPUTE_TX_TIME); |
| 3226 | |
| 3227 | *length = len + 1; |
| 3228 | } |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3229 | /** |
| 3230 | * hdd_display_stats_help() - print statistics help |
| 3231 | * |
| 3232 | * Return: none |
| 3233 | */ |
| 3234 | void hdd_display_stats_help(void) |
| 3235 | { |
| 3236 | hdd_err("iwpriv wlan0 dumpStats [option] - dump statistics"); |
| 3237 | hdd_err("iwpriv wlan0 clearStats [option] - clear statistics"); |
| 3238 | hdd_err("options:"); |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3239 | hdd_err(" 1 -- TXRX PATH statistics"); |
| 3240 | hdd_err(" 2 -- TXRX HIST statistics"); |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3241 | hdd_err(" 3 -- TSO statistics"); |
| 3242 | hdd_err(" 4 -- Network queue statistics"); |
| 3243 | hdd_err(" 5 -- Flow control statistics"); |
| 3244 | hdd_err(" 6 -- Per Layer statistics"); |
| 3245 | hdd_err(" 7 -- Copy engine interrupt statistics"); |
| 3246 | hdd_err(" 8 -- LRO statistics"); |
| 3247 | hdd_err(" 9 -- NAPI statistics"); |
| 3248 | } |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 3249 | |
| 3250 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3251 | * hdd_wlan_dump_stats() - display dump Stats |
| 3252 | * @adapter: adapter handle |
| 3253 | * @value: value from user |
| 3254 | * |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3255 | * Return: 0 => success, error code on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 3257 | int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3258 | { |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3259 | int ret = 0; |
| 3260 | QDF_STATUS status; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 3261 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3262 | |
| 3263 | switch (value) { |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3264 | case CDP_TXRX_HIST_STATS: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | wlan_hdd_display_tx_rx_histogram(hdd_ctx); |
| 3266 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3267 | case CDP_HDD_NETIF_OPER_HISTORY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | wlan_hdd_display_netif_queue_history(hdd_ctx); |
| 3269 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3270 | case CDP_HIF_STATS: |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 3271 | hdd_display_hif_stats(); |
| 3272 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3273 | case CDP_LRO_STATS: |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 3274 | hdd_lro_display_stats(hdd_ctx); |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 3275 | case CDP_NAPI_STATS: |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3276 | if (hdd_display_napi_stats()) { |
| 3277 | hdd_err("error displaying napi stats"); |
| 3278 | ret = EFAULT; |
| 3279 | } |
Dhanashri Atre | e7d442a | 2016-07-14 18:20:29 -0700 | [diff] [blame] | 3280 | break; |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 3281 | case CDP_DISCONNECT_STATS: |
| 3282 | sme_display_disconnect_stats(WLAN_HDD_GET_HAL_CTX(adapter), |
| 3283 | adapter->sessionId); |
| 3284 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3285 | default: |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3286 | status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 3287 | value); |
| 3288 | if (status == QDF_STATUS_E_INVAL) { |
| 3289 | hdd_display_stats_help(); |
| 3290 | ret = EINVAL; |
| 3291 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3292 | break; |
| 3293 | } |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 3294 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | } |
| 3296 | |
| 3297 | /** |
| 3298 | * hdd_wlan_get_version() - Get driver version information |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3299 | * @hdd_ctx: Global HDD context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3300 | * @wrqu: Pointer to IOCTL REQUEST Data. |
| 3301 | * @extra: Pointer to destination buffer |
| 3302 | * |
| 3303 | * This function is used to get Wlan Driver, Firmware, & Hardware |
| 3304 | * Version information. If @wrqu and @extra are specified, then the |
| 3305 | * version string is returned. Otherwise it is simply printed to the |
| 3306 | * kernel log. |
| 3307 | * |
| 3308 | * Return: none |
| 3309 | */ |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 3310 | void hdd_wlan_get_version(struct hdd_context *hdd_ctx, union iwreq_data *wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | char *extra) |
| 3312 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3313 | tSirVersionString wcnss_sw_version; |
| 3314 | const char *swversion; |
| 3315 | const char *hwversion; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3316 | 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] | 3317 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3318 | if (!hdd_ctx) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3319 | hdd_err("Invalid context, HDD context is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3320 | goto error; |
| 3321 | } |
| 3322 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3323 | snprintf(wcnss_sw_version, sizeof(wcnss_sw_version), "%08x", |
| 3324 | hdd_ctx->target_fw_version); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3326 | swversion = wcnss_sw_version; |
| 3327 | msp_id = (hdd_ctx->target_fw_version & 0xf0000000) >> 28; |
| 3328 | mspid = (hdd_ctx->target_fw_version & 0xf000000) >> 24; |
| 3329 | siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20; |
| 3330 | crmid = hdd_ctx->target_fw_version & 0x7fff; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3331 | sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 3333 | hwversion = hdd_ctx->target_hw_name; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3334 | |
| 3335 | if (wrqu && extra) { |
| 3336 | wrqu->data.length = |
| 3337 | scnprintf(extra, WE_MAX_STR_LEN, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3338 | "Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3340 | msp_id, mspid, siid, crmid, |
| 3341 | sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3342 | } else { |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3343 | 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] | 3344 | QWLAN_VERSIONSTR, |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 3345 | msp_id, mspid, siid, crmid, sub_id, hwversion); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3346 | } |
| 3347 | error: |
| 3348 | return; |
| 3349 | } |
| 3350 | |
| 3351 | /** |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3352 | * hdd_wlan_get_ibss_mac_addr_from_staid() - Get IBSS MAC address |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3353 | * @adapter: Adapter upon which the IBSS client is active |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3354 | * @staIdx: Station index of the IBSS peer |
| 3355 | * |
| 3356 | * Return: a pointer to the MAC address of the IBSS peer if the peer is |
| 3357 | * found, otherwise %NULL. |
| 3358 | */ |
| 3359 | struct qdf_mac_addr * |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3360 | hdd_wlan_get_ibss_mac_addr_from_staid(struct hdd_adapter *adapter, |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3361 | uint8_t staIdx) |
| 3362 | { |
| 3363 | uint8_t idx; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3364 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3365 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3366 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3367 | if (HDD_WLAN_INVALID_STA_ID != |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3368 | sta_ctx->conn_info.staId[idx] && |
| 3369 | staIdx == sta_ctx->conn_info.staId[idx]) { |
| 3370 | return &sta_ctx->conn_info.peerMacAddress[idx]; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3371 | } |
| 3372 | } |
| 3373 | return NULL; |
| 3374 | } |
| 3375 | |
| 3376 | /** |
| 3377 | * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3378 | * @adapter: Adapter upon which the IBSS client is active |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3379 | * @staIdx: Station index of the IBSS peer |
| 3380 | * |
| 3381 | * Return: QDF_STATUS_STATUS if the peer was found and displayed, |
| 3382 | * otherwise an appropriate QDF_STATUS_E_* failure code. |
| 3383 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3384 | static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter, |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 3385 | uint8_t staIdx) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3386 | { |
| 3387 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3388 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 3389 | struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3390 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3391 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3392 | INIT_COMPLETION(adapter->ibss_peer_info_comp); |
| 3393 | status = sme_request_ibss_peer_info(hHal, adapter, |
Prakash Dhavali | 4c2a9fe | 2016-12-02 16:01:08 -0800 | [diff] [blame] | 3394 | hdd_get_ibss_peer_info_cb, |
| 3395 | false, staIdx); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3396 | |
| 3397 | if (QDF_STATUS_SUCCESS == status) { |
| 3398 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 3399 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3400 | rc = wait_for_completion_timeout |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3401 | (&adapter->ibss_peer_info_comp, |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3402 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 3403 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3404 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3405 | return QDF_STATUS_E_FAILURE; |
| 3406 | } |
| 3407 | |
| 3408 | /** Print the peer info */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3409 | hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3410 | { |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3411 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 3412 | uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3413 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3414 | qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0]. |
| 3415 | mac_addr, sizeof(mac_addr)); |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3416 | hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3417 | mac_addr, (int)tx_rate, |
| 3418 | (int)pPeerInfo->peerInfoParams[0].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3419 | } |
| 3420 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3421 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3422 | } |
| 3423 | |
| 3424 | return status; |
| 3425 | } |
| 3426 | |
| 3427 | /** |
| 3428 | * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3429 | * @adapter: Adapter upon which the IBSS clients are active |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3430 | * |
| 3431 | * Return: QDF_STATUS_STATUS if the peer information was retrieved and |
| 3432 | * displayed, otherwise an appropriate QDF_STATUS_E_* failure code. |
| 3433 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3434 | static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3435 | { |
| 3436 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3437 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 3438 | struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3439 | tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3440 | int i; |
| 3441 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3442 | INIT_COMPLETION(adapter->ibss_peer_info_comp); |
| 3443 | status = sme_request_ibss_peer_info(hHal, adapter, |
Prakash Dhavali | 4c2a9fe | 2016-12-02 16:01:08 -0800 | [diff] [blame] | 3444 | hdd_get_ibss_peer_info_cb, |
| 3445 | true, 0xFF); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3446 | |
| 3447 | if (QDF_STATUS_SUCCESS == status) { |
| 3448 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 3449 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3450 | rc = wait_for_completion_timeout |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3451 | (&adapter->ibss_peer_info_comp, |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3452 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 3453 | if (!rc) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3454 | hdd_err("failed wait on ibss_peer_info_comp"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3455 | return QDF_STATUS_E_FAILURE; |
| 3456 | } |
| 3457 | |
| 3458 | /** Print the peer info */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3459 | hdd_debug("pPeerInfo->numIBSSPeers = %d ", |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3460 | (int)pPeerInfo->numPeers); |
| 3461 | for (i = 0; i < pPeerInfo->numPeers; i++) { |
| 3462 | uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; |
| 3463 | uint32_t tx_rate; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3464 | |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3465 | tx_rate = pPeerInfo->peerInfoParams[i].txRate; |
| 3466 | qdf_mem_copy(mac_addr, |
| 3467 | pPeerInfo->peerInfoParams[i].mac_addr, |
| 3468 | sizeof(mac_addr)); |
| 3469 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3470 | hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d", |
Rajeev Kumar | 94c9b45 | 2016-03-24 12:58:47 -0700 | [diff] [blame] | 3471 | mac_addr, (int)tx_rate, |
| 3472 | (int)pPeerInfo->peerInfoParams[i].rssi); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3473 | } |
| 3474 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3475 | hdd_warn("Warning: sme_request_ibss_peer_info Request failed"); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3476 | } |
| 3477 | |
| 3478 | return status; |
| 3479 | } |
| 3480 | |
| 3481 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3482 | * hdd_wlan_get_freq() - Convert channel to frequency |
| 3483 | * @channel: channel to be converted |
| 3484 | * @pfreq: where to store the frequency |
| 3485 | * |
| 3486 | * Return: 1 on success, otherwise a negative errno |
| 3487 | */ |
| 3488 | int hdd_wlan_get_freq(uint32_t channel, uint32_t *pfreq) |
| 3489 | { |
| 3490 | int i; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 3491 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | if (channel > 0) { |
| 3493 | for (i = 0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) { |
| 3494 | if (channel == freq_chan_map[i].chan) { |
| 3495 | *pfreq = freq_chan_map[i].freq; |
| 3496 | return 1; |
| 3497 | } |
| 3498 | } |
| 3499 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3500 | hdd_err("Invalid channel no=%d!!", channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | return -EINVAL; |
| 3502 | } |
| 3503 | |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3504 | struct rssi_priv { |
| 3505 | int8_t rssi; |
| 3506 | }; |
| 3507 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | /** |
| 3509 | * hdd_get_rssi_cb() - "Get RSSI" callback function |
| 3510 | * @rssi: Current RSSI of the station |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3511 | * @sta_id: ID of the station |
| 3512 | * @context: opaque context originally passed to SME. HDD always passes |
| 3513 | * a cookie for the request context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3514 | * |
| 3515 | * Return: None |
| 3516 | */ |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3517 | static void hdd_get_rssi_cb(int8_t rssi, uint32_t sta_id, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3518 | { |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3519 | struct hdd_request *request; |
| 3520 | struct rssi_priv *priv; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3522 | request = hdd_request_get(context); |
| 3523 | if (!request) { |
| 3524 | hdd_err("Obsolete request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3525 | return; |
| 3526 | } |
| 3527 | |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3528 | priv = hdd_request_priv(request); |
| 3529 | priv->rssi = rssi; |
| 3530 | hdd_request_complete(request); |
| 3531 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3532 | } |
| 3533 | |
| 3534 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | * wlan_hdd_get_rssi() - Get the current RSSI |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3536 | * @adapter: adapter upon which the measurement is requested |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3537 | * @rssi_value: pointer to where the RSSI should be returned |
| 3538 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3539 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3540 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3541 | QDF_STATUS wlan_hdd_get_rssi(struct hdd_adapter *adapter, int8_t *rssi_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3542 | { |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 3543 | struct hdd_context *hdd_ctx; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3544 | struct hdd_station_ctx *sta_ctx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3545 | QDF_STATUS hstatus; |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3546 | int ret; |
| 3547 | void *cookie; |
| 3548 | struct hdd_request *request; |
| 3549 | struct rssi_priv *priv; |
| 3550 | static const struct hdd_request_params params = { |
| 3551 | .priv_size = sizeof(*priv), |
| 3552 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3553 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3554 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3555 | if (NULL == adapter) { |
| 3556 | hdd_err("Invalid context, adapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3557 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3558 | } |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 3559 | if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 3560 | hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", |
| 3561 | cds_get_driver_state()); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | /* return a cached value */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3563 | *rssi_value = adapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3564 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | } |
| 3566 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3567 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3568 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3569 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3570 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3571 | hdd_debug("Not associated!, rssi on disconnect %d", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3572 | adapter->rssi_on_disconnect); |
| 3573 | *rssi_value = adapter->rssi_on_disconnect; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3574 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3575 | } |
| 3576 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3577 | if (sta_ctx->hdd_ReassocScenario) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 3578 | hdd_debug("Roaming in progress, return cached RSSI"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3579 | *rssi_value = adapter->rssi; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3580 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3581 | } |
| 3582 | |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3583 | request = hdd_request_alloc(¶ms); |
| 3584 | if (!request) { |
| 3585 | hdd_err("Request allocation failure, return cached RSSI"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3586 | *rssi_value = adapter->rssi; |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3587 | return QDF_STATUS_SUCCESS; |
| 3588 | } |
| 3589 | cookie = hdd_request_cookie(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3590 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 3591 | hstatus = sme_get_rssi(hdd_ctx->hHal, hdd_get_rssi_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3592 | sta_ctx->conn_info.staId[0], |
| 3593 | sta_ctx->conn_info.bssId, adapter->rssi, |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 3594 | cookie); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3595 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3596 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3597 | /* we'll returned a cached value below */ |
| 3598 | } else { |
| 3599 | /* request was sent -- wait for the response */ |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3600 | ret = hdd_request_wait_for_response(request); |
| 3601 | if (ret) { |
| 3602 | hdd_warn("SME timed out while retrieving RSSI"); |
| 3603 | /* we'll returned a cached value below */ |
| 3604 | } else { |
| 3605 | /* update the adapter with the fresh results */ |
| 3606 | priv = hdd_request_priv(request); |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 3607 | /* |
| 3608 | * update rssi only if its valid else return previous |
| 3609 | * valid rssi. |
| 3610 | */ |
| 3611 | if (priv->rssi) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3612 | adapter->rssi = priv->rssi; |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 3613 | |
| 3614 | /* |
| 3615 | * for new connection there might be no valid previous |
| 3616 | * RSSI. |
| 3617 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3618 | if (!adapter->rssi) { |
| 3619 | hdd_get_rssi_snr_by_bssid(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3620 | sta_ctx->conn_info.bssId.bytes, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3621 | &adapter->rssi, NULL); |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 3622 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3623 | } |
| 3624 | } |
| 3625 | |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3626 | /* |
| 3627 | * either we never sent a request, we sent a request and |
| 3628 | * received a response or we sent a request and timed out. |
| 3629 | * regardless we are done with the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | */ |
Jeff Johnson | a544494 | 2017-01-23 13:11:08 -0800 | [diff] [blame] | 3631 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3632 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3633 | *rssi_value = adapter->rssi; |
Rajeev Kumar Sirasanagandla | 5bacf7f | 2017-05-10 15:31:40 +0530 | [diff] [blame] | 3634 | hdd_debug("RSSI = %d", *rssi_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3636 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3637 | } |
| 3638 | |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3639 | struct snr_priv { |
| 3640 | int8_t snr; |
| 3641 | }; |
| 3642 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3643 | /** |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3644 | * hdd_get_snr_cb() - "Get SNR" callback function |
| 3645 | * @snr: Current SNR of the station |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3646 | * @sta_id: ID of the station |
| 3647 | * @context: opaque context originally passed to SME. HDD always passes |
| 3648 | * a cookie for the request context |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3649 | * |
| 3650 | * Return: None |
| 3651 | */ |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3652 | static void hdd_get_snr_cb(int8_t snr, uint32_t sta_id, void *context) |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3653 | { |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3654 | struct hdd_request *request; |
| 3655 | struct snr_priv *priv; |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3656 | |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3657 | request = hdd_request_get(context); |
| 3658 | if (!request) { |
| 3659 | hdd_err("Obsolete request"); |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3660 | return; |
| 3661 | } |
| 3662 | |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3663 | /* propagate response back to requesting thread */ |
| 3664 | priv = hdd_request_priv(request); |
| 3665 | priv->snr = snr; |
| 3666 | hdd_request_complete(request); |
| 3667 | hdd_request_put(request); |
Jeff Johnson | 8eaff30 | 2017-01-23 11:03:31 -0800 | [diff] [blame] | 3668 | } |
| 3669 | |
| 3670 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3671 | * wlan_hdd_get_snr() - Get the current SNR |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3672 | * @adapter: adapter upon which the measurement is requested |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3673 | * @snr: pointer to where the SNR should be returned |
| 3674 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3675 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3676 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3677 | QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | { |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 3679 | struct hdd_context *hdd_ctx; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3680 | struct hdd_station_ctx *sta_ctx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3681 | QDF_STATUS hstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | int valid; |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3683 | int ret; |
| 3684 | void *cookie; |
| 3685 | struct hdd_request *request; |
| 3686 | struct snr_priv *priv; |
| 3687 | static const struct hdd_request_params params = { |
| 3688 | .priv_size = sizeof(*priv), |
| 3689 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3690 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3691 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 3692 | ENTER(); |
| 3693 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3694 | if (NULL == adapter) { |
| 3695 | hdd_err("Invalid context, adapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3696 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3697 | } |
| 3698 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3699 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3700 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 3701 | valid = wlan_hdd_validate_context(hdd_ctx); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 3702 | if (0 != valid) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3703 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3704 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3705 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3706 | |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3707 | request = hdd_request_alloc(¶ms); |
| 3708 | if (!request) { |
| 3709 | hdd_err("Request allocation failure"); |
| 3710 | return QDF_STATUS_E_FAULT; |
| 3711 | } |
| 3712 | cookie = hdd_request_cookie(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 3714 | hstatus = sme_get_snr(hdd_ctx->hHal, hdd_get_snr_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3715 | sta_ctx->conn_info.staId[0], |
| 3716 | sta_ctx->conn_info.bssId, cookie); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3717 | if (QDF_STATUS_SUCCESS != hstatus) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3718 | hdd_err("Unable to retrieve RSSI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3719 | /* we'll returned a cached value below */ |
| 3720 | } else { |
| 3721 | /* request was sent -- wait for the response */ |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3722 | ret = hdd_request_wait_for_response(request); |
| 3723 | if (ret) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3724 | hdd_err("SME timed out while retrieving SNR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3725 | /* we'll now returned a cached value below */ |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3726 | } else { |
| 3727 | /* update the adapter with the fresh results */ |
| 3728 | priv = hdd_request_priv(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3729 | adapter->snr = priv->snr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | } |
| 3731 | } |
| 3732 | |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3733 | /* |
| 3734 | * either we never sent a request, we sent a request and |
| 3735 | * received a response or we sent a request and timed out. |
| 3736 | * regardless we are done with the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3737 | */ |
Jeff Johnson | 002cb97 | 2017-01-23 14:59:07 -0800 | [diff] [blame] | 3738 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3740 | *snr = adapter->snr; |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 3741 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3742 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3743 | } |
| 3744 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3745 | struct linkspeed_priv { |
| 3746 | tSirLinkSpeedInfo linkspeed_info; |
| 3747 | }; |
| 3748 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3749 | static void |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3750 | hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3751 | { |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3752 | struct hdd_request *request; |
| 3753 | struct linkspeed_priv *priv; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3754 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3755 | if (!linkspeed_info) { |
| 3756 | hdd_err("NULL linkspeed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3757 | return; |
| 3758 | } |
| 3759 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3760 | request = hdd_request_get(context); |
| 3761 | if (!request) { |
| 3762 | hdd_err("Obsolete request"); |
| 3763 | return; |
| 3764 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3766 | priv = hdd_request_priv(request); |
| 3767 | priv->linkspeed_info = *linkspeed_info; |
| 3768 | hdd_request_complete(request); |
| 3769 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3770 | } |
| 3771 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 3772 | int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter, |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3773 | struct qdf_mac_addr *mac_address, |
| 3774 | uint32_t *linkspeed) |
| 3775 | { |
| 3776 | int ret; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3777 | QDF_STATUS status; |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3778 | void *cookie; |
| 3779 | tSirLinkSpeedInfo *linkspeed_info; |
| 3780 | struct hdd_request *request; |
| 3781 | struct linkspeed_priv *priv; |
| 3782 | static const struct hdd_request_params params = { |
| 3783 | .priv_size = sizeof(*priv), |
| 3784 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3785 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3786 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3787 | if ((!adapter) || (!linkspeed)) { |
| 3788 | hdd_err("NULL argument"); |
| 3789 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3791 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3792 | request = hdd_request_alloc(¶ms); |
| 3793 | if (!request) { |
| 3794 | hdd_err("Request allocation failure"); |
| 3795 | ret = -ENOMEM; |
| 3796 | goto return_cached_value; |
| 3797 | } |
| 3798 | |
| 3799 | cookie = hdd_request_cookie(request); |
| 3800 | priv = hdd_request_priv(request); |
| 3801 | |
| 3802 | linkspeed_info = &priv->linkspeed_info; |
| 3803 | qdf_copy_macaddr(&linkspeed_info->peer_macaddr, mac_address); |
| 3804 | status = sme_get_link_speed(WLAN_HDD_GET_HAL_CTX(adapter), |
| 3805 | linkspeed_info, |
| 3806 | cookie, hdd_get_link_speed_cb); |
| 3807 | if (QDF_IS_STATUS_ERROR(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3808 | hdd_err("Unable to retrieve statistics for link speed"); |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3809 | ret = qdf_status_to_os_return(status); |
| 3810 | goto cleanup; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3811 | } |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3812 | ret = hdd_request_wait_for_response(request); |
| 3813 | if (ret) { |
| 3814 | hdd_err("SME timed out while retrieving link speed"); |
| 3815 | goto cleanup; |
| 3816 | } |
| 3817 | adapter->estimated_linkspeed = linkspeed_info->estLinkSpeed; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3818 | |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3819 | cleanup: |
| 3820 | /* |
| 3821 | * either we never sent a request, we sent a request and |
| 3822 | * received a response or we sent a request and timed out. |
| 3823 | * regardless we are done with the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | */ |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3825 | hdd_request_put(request); |
| 3826 | |
| 3827 | return_cached_value: |
| 3828 | *linkspeed = adapter->estimated_linkspeed; |
| 3829 | |
| 3830 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3831 | } |
| 3832 | |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3833 | int wlan_hdd_get_link_speed(struct hdd_adapter *adapter, uint32_t *link_speed) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3834 | { |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3835 | struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3836 | struct hdd_station_ctx *hdd_stactx = |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3837 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3838 | int ret; |
| 3839 | |
| 3840 | ret = wlan_hdd_validate_context(hddctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 3841 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3842 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3843 | |
Nitesh Shah | 4e2d5eb | 2016-09-06 19:45:13 +0530 | [diff] [blame] | 3844 | /* Linkspeed is allowed only for P2P mode */ |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3845 | if (adapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Nitesh Shah | 4e2d5eb | 2016-09-06 19:45:13 +0530 | [diff] [blame] | 3846 | hdd_err("Link Speed is not allowed in Device mode %s(%d)", |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3847 | hdd_device_mode_to_string(adapter->device_mode), |
| 3848 | adapter->device_mode); |
Nitesh Shah | 4e2d5eb | 2016-09-06 19:45:13 +0530 | [diff] [blame] | 3849 | return -ENOTSUPP; |
| 3850 | } |
| 3851 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3852 | if (eConnectionState_Associated != hdd_stactx->conn_info.connState) { |
| 3853 | /* we are not connected so we don't have a classAstats */ |
| 3854 | *link_speed = 0; |
| 3855 | } else { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3856 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3857 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3858 | qdf_copy_macaddr(&bssid, &hdd_stactx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3859 | |
Jeff Johnson | 4e63267 | 2017-10-03 11:40:51 -0700 | [diff] [blame] | 3860 | ret = wlan_hdd_get_linkspeed_for_peermac(adapter, &bssid, |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3861 | link_speed); |
| 3862 | if (ret) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 3863 | hdd_err("Unable to retrieve SME linkspeed"); |
Jeff Johnson | e50427c | 2017-01-26 10:54:49 -0800 | [diff] [blame] | 3864 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3865 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3866 | /* linkspeed in units of 500 kbps */ |
| 3867 | *link_speed = (*link_speed) / 500; |
| 3868 | } |
| 3869 | return 0; |
| 3870 | } |
| 3871 | |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 3872 | struct peer_rssi_priv { |
| 3873 | struct sir_peer_sta_info peer_sta_info; |
| 3874 | }; |
| 3875 | |
| 3876 | /** |
| 3877 | * hdd_get_peer_rssi_cb() - get peer station's rssi callback |
| 3878 | * @sta_rssi: pointer of peer information |
| 3879 | * @context: get rssi callback context |
| 3880 | * |
| 3881 | * This function will fill rssi information to rssi priv |
| 3882 | * adapter |
| 3883 | * |
| 3884 | */ |
| 3885 | static void hdd_get_peer_rssi_cb(struct sir_peer_info_resp *sta_rssi, |
| 3886 | void *context) |
| 3887 | { |
| 3888 | struct hdd_request *request; |
| 3889 | struct peer_rssi_priv *priv; |
| 3890 | struct sir_peer_info *rssi_info; |
| 3891 | uint8_t peer_num; |
| 3892 | |
| 3893 | if ((!sta_rssi) || (!context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 3894 | hdd_err("Bad param, sta_rssi [%pK] context [%pK]", |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 3895 | sta_rssi, context); |
| 3896 | return; |
| 3897 | } |
| 3898 | |
| 3899 | request = hdd_request_get(context); |
| 3900 | if (!request) { |
| 3901 | hdd_err("Obsolete request"); |
| 3902 | return; |
| 3903 | } |
| 3904 | |
| 3905 | priv = hdd_request_priv(request); |
| 3906 | |
| 3907 | peer_num = sta_rssi->count; |
| 3908 | rssi_info = sta_rssi->info; |
| 3909 | |
| 3910 | hdd_debug("%d peers", peer_num); |
| 3911 | |
| 3912 | if (peer_num > MAX_PEER_STA) { |
| 3913 | hdd_warn("Exceed max peer sta to handle one time %d", peer_num); |
| 3914 | peer_num = MAX_PEER_STA; |
| 3915 | } |
| 3916 | |
| 3917 | qdf_mem_copy(priv->peer_sta_info.info, rssi_info, |
| 3918 | peer_num * sizeof(*rssi_info)); |
| 3919 | priv->peer_sta_info.sta_num = peer_num; |
| 3920 | |
| 3921 | hdd_request_complete(request); |
| 3922 | hdd_request_put(request); |
| 3923 | } |
| 3924 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 3925 | int wlan_hdd_get_peer_rssi(struct hdd_adapter *adapter, |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 3926 | struct qdf_mac_addr *macaddress, |
| 3927 | struct sir_peer_sta_info *peer_sta_info) |
| 3928 | { |
| 3929 | QDF_STATUS status; |
| 3930 | void *cookie; |
| 3931 | int ret; |
| 3932 | struct sir_peer_info_req rssi_req; |
| 3933 | struct hdd_request *request; |
| 3934 | struct peer_rssi_priv *priv; |
| 3935 | static const struct hdd_request_params params = { |
| 3936 | .priv_size = sizeof(*priv), |
| 3937 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3938 | }; |
| 3939 | |
| 3940 | if (!adapter || !macaddress || !peer_sta_info) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 3941 | hdd_err("adapter [%pK], macaddress [%pK], peer_sta_info[%pK]", |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 3942 | adapter, macaddress, peer_sta_info); |
| 3943 | return -EFAULT; |
| 3944 | } |
| 3945 | |
| 3946 | request = hdd_request_alloc(¶ms); |
| 3947 | if (!request) { |
| 3948 | hdd_err("Request allocation failure"); |
| 3949 | return -ENOMEM; |
| 3950 | } |
| 3951 | |
| 3952 | cookie = hdd_request_cookie(request); |
| 3953 | priv = hdd_request_priv(request); |
| 3954 | |
| 3955 | qdf_mem_copy(&rssi_req.peer_macaddr, macaddress, |
| 3956 | QDF_MAC_ADDR_SIZE); |
| 3957 | rssi_req.sessionid = adapter->sessionId; |
| 3958 | status = sme_get_peer_info(WLAN_HDD_GET_HAL_CTX(adapter), |
| 3959 | rssi_req, |
| 3960 | cookie, |
| 3961 | hdd_get_peer_rssi_cb); |
| 3962 | if (status != QDF_STATUS_SUCCESS) { |
| 3963 | hdd_err("Unable to retrieve statistics for rssi"); |
| 3964 | ret = -EFAULT; |
| 3965 | } else { |
| 3966 | ret = hdd_request_wait_for_response(request); |
| 3967 | if (ret) { |
| 3968 | hdd_err("SME timed out while retrieving rssi"); |
| 3969 | ret = -EFAULT; |
| 3970 | } else { |
| 3971 | *peer_sta_info = priv->peer_sta_info; |
| 3972 | ret = 0; |
| 3973 | } |
| 3974 | } |
| 3975 | |
| 3976 | hdd_request_put(request); |
| 3977 | |
| 3978 | return ret; |
| 3979 | } |
| 3980 | |
| 3981 | struct peer_info_priv { |
| 3982 | struct sir_peer_sta_ext_info peer_sta_ext_info; |
| 3983 | }; |
| 3984 | |
| 3985 | /** |
| 3986 | * wlan_hdd_get_peer_info_cb() - get peer info callback |
| 3987 | * @sta_info: pointer of peer information |
| 3988 | * @context: get peer info callback context |
| 3989 | * |
| 3990 | * This function will fill stats info to peer info priv |
| 3991 | * |
| 3992 | */ |
| 3993 | static void wlan_hdd_get_peer_info_cb(struct sir_peer_info_ext_resp *sta_info, |
| 3994 | void *context) |
| 3995 | { |
| 3996 | struct hdd_request *request; |
| 3997 | struct peer_info_priv *priv; |
| 3998 | uint8_t sta_num; |
| 3999 | |
| 4000 | if ((!sta_info) || (!context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 4001 | hdd_err("Bad param, sta_info [%pK] context [%pK]", |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 4002 | sta_info, context); |
| 4003 | return; |
| 4004 | } |
| 4005 | |
| 4006 | if (!sta_info->count) { |
| 4007 | hdd_err("Fail to get remote peer info"); |
| 4008 | return; |
| 4009 | } |
| 4010 | |
| 4011 | if (sta_info->count > MAX_PEER_STA) { |
| 4012 | hdd_warn("Exceed max peer number %d", sta_info->count); |
| 4013 | sta_num = MAX_PEER_STA; |
| 4014 | } else { |
| 4015 | sta_num = sta_info->count; |
| 4016 | } |
| 4017 | |
| 4018 | request = hdd_request_get(context); |
| 4019 | if (!request) { |
| 4020 | hdd_err("Obsolete request"); |
| 4021 | return; |
| 4022 | } |
| 4023 | |
| 4024 | priv = hdd_request_priv(request); |
| 4025 | |
| 4026 | priv->peer_sta_ext_info.sta_num = sta_num; |
| 4027 | qdf_mem_copy(&priv->peer_sta_ext_info.info, |
| 4028 | sta_info->info, |
| 4029 | sta_num * sizeof(sta_info->info[0])); |
| 4030 | |
| 4031 | hdd_request_complete(request); |
| 4032 | hdd_request_put(request); |
| 4033 | } |
| 4034 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4035 | int wlan_hdd_get_peer_info(struct hdd_adapter *adapter, |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 4036 | struct qdf_mac_addr macaddress, |
| 4037 | struct sir_peer_info_ext *peer_info_ext) |
| 4038 | { |
| 4039 | QDF_STATUS status; |
| 4040 | void *cookie; |
| 4041 | int ret; |
| 4042 | struct sir_peer_info_ext_req peer_info_req; |
| 4043 | struct hdd_request *request; |
| 4044 | struct peer_info_priv *priv; |
| 4045 | static const struct hdd_request_params params = { |
| 4046 | .priv_size = sizeof(*priv), |
| 4047 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 4048 | }; |
| 4049 | |
| 4050 | if (!adapter) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4051 | hdd_err("adapter is NULL"); |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 4052 | return -EFAULT; |
| 4053 | } |
| 4054 | |
| 4055 | request = hdd_request_alloc(¶ms); |
| 4056 | if (!request) { |
| 4057 | hdd_err("Request allocation failure"); |
| 4058 | return -ENOMEM; |
| 4059 | } |
| 4060 | |
| 4061 | cookie = hdd_request_cookie(request); |
| 4062 | priv = hdd_request_priv(request); |
| 4063 | |
| 4064 | qdf_mem_copy(&peer_info_req.peer_macaddr, &macaddress, |
| 4065 | QDF_MAC_ADDR_SIZE); |
| 4066 | peer_info_req.sessionid = adapter->sessionId; |
| 4067 | peer_info_req.reset_after_request = 0; |
| 4068 | status = sme_get_peer_info_ext(WLAN_HDD_GET_HAL_CTX(adapter), |
| 4069 | &peer_info_req, |
| 4070 | cookie, |
| 4071 | wlan_hdd_get_peer_info_cb); |
| 4072 | if (status != QDF_STATUS_SUCCESS) { |
| 4073 | hdd_err("Unable to retrieve statistics for peer info"); |
| 4074 | ret = -EFAULT; |
| 4075 | } else { |
| 4076 | ret = hdd_request_wait_for_response(request); |
| 4077 | if (ret) { |
| 4078 | hdd_err("SME timed out while retrieving peer info"); |
| 4079 | ret = -EFAULT; |
| 4080 | } else { |
| 4081 | /* only support one peer by now */ |
| 4082 | *peer_info_ext = priv->peer_sta_ext_info.info[0]; |
| 4083 | ret = 0; |
| 4084 | } |
| 4085 | } |
| 4086 | |
| 4087 | hdd_request_put(request); |
| 4088 | |
| 4089 | return ret; |
| 4090 | } |
| 4091 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4092 | /** |
| 4093 | * hdd_statistics_cb() - "Get statistics" callback function |
| 4094 | * @pStats: statistics payload |
| 4095 | * @pContext: opaque context originally passed to SME. HDD always passes |
| 4096 | * a pointer to an adapter |
| 4097 | * |
| 4098 | * Return: None |
| 4099 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 4100 | static void hdd_statistics_cb(void *pStats, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4101 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4102 | struct hdd_adapter *adapter = (struct hdd_adapter *) pContext; |
Jeff Johnson | 07f9474 | 2017-08-14 15:55:40 -0700 | [diff] [blame] | 4103 | struct hdd_stats *pStatsCache = NULL; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4104 | struct hdd_wext_state *pWextState; |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 4105 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | |
| 4107 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 4108 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4109 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4110 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4111 | if (adapter != NULL) |
| 4112 | pStatsCache = &adapter->hdd_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4113 | |
| 4114 | pSummaryStats = (tCsrSummaryStatsInfo *) pStats; |
| 4115 | pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1); |
Jeff Johnson | f2dac4f | 2017-03-16 11:41:31 -0700 | [diff] [blame] | 4116 | pClassDStats = (tCsrGlobalClassDStatsInfo *) (pClassAStats + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4117 | |
| 4118 | if (pStatsCache != NULL) { |
| 4119 | /* copy the stats into the cache we keep in the |
| 4120 | * adapter instance structure |
| 4121 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4122 | qdf_mem_copy(&pStatsCache->summary_stat, pSummaryStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4123 | sizeof(pStatsCache->summary_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4124 | qdf_mem_copy(&pStatsCache->ClassA_stat, pClassAStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | sizeof(pStatsCache->ClassA_stat)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4126 | qdf_mem_copy(&pStatsCache->ClassD_stat, pClassDStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4127 | sizeof(pStatsCache->ClassD_stat)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | } |
| 4129 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4130 | if (adapter) { |
| 4131 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4132 | qdf_status = qdf_event_set(&pWextState->hdd_qdf_event); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 4133 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4134 | hdd_err("qdf_event_set failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4135 | return; |
| 4136 | } |
| 4137 | } |
| 4138 | } |
| 4139 | |
| 4140 | /** |
| 4141 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4142 | * @adapter: adapter who's IEs are to be cleared |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4143 | * |
| 4144 | * Return: None |
| 4145 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4146 | void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4147 | { |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 4148 | struct hdd_station_ctx *sta_ctx; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4149 | struct hdd_wext_state *pWextState = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4150 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4151 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 4152 | ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4153 | |
| 4154 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 4155 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 4156 | pWextState->roamProfile.pWPAReqIE = (uint8_t *) NULL; |
| 4157 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 4158 | pWextState->roamProfile.pRSNReqIE = (uint8_t *) NULL; |
| 4159 | |
| 4160 | #ifdef FEATURE_WLAN_WAPI |
| 4161 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 4162 | pWextState->roamProfile.pWAPIReqIE = (uint8_t *) NULL; |
| 4163 | #endif |
| 4164 | |
| 4165 | pWextState->roamProfile.bWPSAssociation = false; |
| 4166 | pWextState->roamProfile.bOSENAssociation = false; |
| 4167 | pWextState->roamProfile.pAddIEScan = (uint8_t *) NULL; |
| 4168 | pWextState->roamProfile.nAddIEScanLength = 0; |
| 4169 | pWextState->roamProfile.pAddIEAssoc = (uint8_t *) NULL; |
| 4170 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 4171 | |
| 4172 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4173 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 4174 | = eCSR_ENCRYPT_TYPE_NONE; |
| 4175 | |
| 4176 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 4177 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 4178 | = eCSR_ENCRYPT_TYPE_NONE; |
| 4179 | |
| 4180 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 4181 | pWextState->roamProfile.AuthType.authType[0] = |
| 4182 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4183 | |
Abhishek Singh | 3c9910e | 2017-01-06 17:56:47 +0530 | [diff] [blame] | 4184 | qdf_mem_zero(pWextState->roamProfile.bssid_hint.bytes, |
| 4185 | QDF_MAC_ADDR_SIZE); |
| 4186 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4187 | #ifdef WLAN_FEATURE_11W |
| 4188 | pWextState->roamProfile.MFPEnabled = false; |
| 4189 | pWextState->roamProfile.MFPRequired = 0; |
| 4190 | pWextState->roamProfile.MFPCapable = 0; |
| 4191 | #endif |
| 4192 | |
| 4193 | pWextState->authKeyMgmt = 0; |
| 4194 | |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 4195 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, CSR_MAX_NUM_KEY); |
| 4196 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4198 | adapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 4199 | adapter->wapi_info.nWapiMode = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4200 | #endif |
| 4201 | |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 4202 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 4203 | qdf_zero_macaddr(&sta_ctx->requested_bssid); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 4204 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4205 | } |
| 4206 | |
| 4207 | /** |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4208 | * hdd_get_ldpc() - Get adapter LDPC |
| 4209 | * @adapter: adapter being queried |
| 4210 | * @value: where to store the value |
| 4211 | * |
| 4212 | * Return: 0 on success, negative errno on failure |
| 4213 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4214 | int hdd_get_ldpc(struct hdd_adapter *adapter, int *value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4215 | { |
| 4216 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4217 | int ret; |
| 4218 | |
| 4219 | ENTER(); |
| 4220 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 4221 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING); |
| 4222 | if (ret < 0) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4223 | hdd_err("Failed to get LDPC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4224 | } else { |
| 4225 | *value = ret; |
| 4226 | ret = 0; |
| 4227 | } |
| 4228 | return ret; |
| 4229 | } |
| 4230 | |
| 4231 | /** |
| 4232 | * hdd_set_ldpc() - Set adapter LDPC |
| 4233 | * @adapter: adapter being modified |
| 4234 | * @value: new LDPC value |
| 4235 | * |
| 4236 | * Return: 0 on success, negative errno on failure |
| 4237 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4238 | int hdd_set_ldpc(struct hdd_adapter *adapter, int value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4239 | { |
| 4240 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4241 | int ret; |
| 4242 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4243 | hdd_debug("%d", value); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4244 | if (value) { |
| 4245 | /* make sure HT capabilities allow this */ |
| 4246 | QDF_STATUS status; |
| 4247 | uint32_t cfg_value; |
| 4248 | union { |
| 4249 | uint16_t cfg_value16; |
| 4250 | tSirMacHTCapabilityInfo ht_cap_info; |
| 4251 | } u; |
| 4252 | |
| 4253 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 4254 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4255 | hdd_err("Failed to get HT capability info"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4256 | return -EIO; |
| 4257 | } |
| 4258 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 4259 | if (!u.ht_cap_info.advCodingCap) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4260 | hdd_err("LDCP not supported"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4261 | return -EINVAL; |
| 4262 | } |
| 4263 | } |
| 4264 | |
| 4265 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 4266 | WNI_CFG_HT_CAP_INFO_ADVANCE_CODING, |
| 4267 | value); |
| 4268 | if (ret) |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4269 | hdd_err("Failed to set LDPC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4270 | |
| 4271 | return ret; |
| 4272 | } |
| 4273 | |
| 4274 | /** |
| 4275 | * hdd_get_tx_stbc() - Get adapter TX STBC |
| 4276 | * @adapter: adapter being queried |
| 4277 | * @value: where to store the value |
| 4278 | * |
| 4279 | * Return: 0 on success, negative errno on failure |
| 4280 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4281 | int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4282 | { |
| 4283 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4284 | int ret; |
| 4285 | |
| 4286 | ENTER(); |
| 4287 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 4288 | WNI_CFG_HT_CAP_INFO_TX_STBC); |
| 4289 | if (ret < 0) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4290 | hdd_err("Failed to get TX STBC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4291 | } else { |
| 4292 | *value = ret; |
| 4293 | ret = 0; |
| 4294 | } |
| 4295 | |
| 4296 | return ret; |
| 4297 | } |
| 4298 | |
| 4299 | /** |
| 4300 | * hdd_set_tx_stbc() - Set adapter TX STBC |
| 4301 | * @adapter: adapter being modified |
| 4302 | * @value: new TX STBC value |
| 4303 | * |
| 4304 | * Return: 0 on success, negative errno on failure |
| 4305 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4306 | int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4307 | { |
| 4308 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4309 | int ret; |
| 4310 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4311 | hdd_debug("%d", value); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4312 | if (value) { |
| 4313 | /* make sure HT capabilities allow this */ |
| 4314 | QDF_STATUS status; |
| 4315 | uint32_t cfg_value; |
| 4316 | union { |
| 4317 | uint16_t cfg_value16; |
| 4318 | tSirMacHTCapabilityInfo ht_cap_info; |
| 4319 | } u; |
| 4320 | |
| 4321 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 4322 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4323 | hdd_err("Failed to get HT capability info"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4324 | return -EIO; |
| 4325 | } |
| 4326 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 4327 | if (!u.ht_cap_info.txSTBC) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4328 | hdd_err("TX STBC not supported"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4329 | return -EINVAL; |
| 4330 | } |
| 4331 | } |
| 4332 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 4333 | WNI_CFG_HT_CAP_INFO_TX_STBC, |
| 4334 | value); |
| 4335 | if (ret) |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4336 | hdd_err("Failed to set TX STBC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4337 | |
| 4338 | return ret; |
| 4339 | } |
| 4340 | |
| 4341 | /** |
| 4342 | * hdd_get_rx_stbc() - Get adapter RX STBC |
| 4343 | * @adapter: adapter being queried |
| 4344 | * @value: where to store the value |
| 4345 | * |
| 4346 | * Return: 0 on success, negative errno on failure |
| 4347 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4348 | int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4349 | { |
| 4350 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4351 | int ret; |
| 4352 | |
| 4353 | ENTER(); |
| 4354 | ret = sme_get_ht_config(hal, adapter->sessionId, |
| 4355 | WNI_CFG_HT_CAP_INFO_RX_STBC); |
| 4356 | if (ret < 0) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4357 | hdd_err("Failed to get RX STBC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4358 | } else { |
| 4359 | *value = ret; |
| 4360 | ret = 0; |
| 4361 | } |
| 4362 | |
| 4363 | return ret; |
| 4364 | } |
| 4365 | |
| 4366 | /** |
| 4367 | * hdd_set_rx_stbc() - Set adapter RX STBC |
| 4368 | * @adapter: adapter being modified |
| 4369 | * @value: new RX STBC value |
| 4370 | * |
| 4371 | * Return: 0 on success, negative errno on failure |
| 4372 | */ |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4373 | int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value) |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4374 | { |
| 4375 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 4376 | int ret; |
| 4377 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4378 | hdd_debug("%d", value); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4379 | if (value) { |
| 4380 | /* make sure HT capabilities allow this */ |
| 4381 | QDF_STATUS status; |
| 4382 | uint32_t cfg_value; |
| 4383 | union { |
| 4384 | uint16_t cfg_value16; |
| 4385 | tSirMacHTCapabilityInfo ht_cap_info; |
| 4386 | } u; |
| 4387 | |
| 4388 | status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); |
| 4389 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4390 | hdd_err("Failed to get HT capability info"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4391 | return -EIO; |
| 4392 | } |
| 4393 | u.cfg_value16 = cfg_value & 0xFFFF; |
| 4394 | if (!u.ht_cap_info.rxSTBC) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4395 | hdd_warn("RX STBC not supported"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4396 | return -EINVAL; |
| 4397 | } |
| 4398 | } |
| 4399 | ret = sme_update_ht_config(hal, adapter->sessionId, |
| 4400 | WNI_CFG_HT_CAP_INFO_RX_STBC, |
| 4401 | value); |
| 4402 | if (ret) |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4403 | hdd_err("Failed to set RX STBC value"); |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4404 | |
| 4405 | return ret; |
| 4406 | } |
| 4407 | |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 4408 | int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate) |
| 4409 | { |
| 4410 | int set_value; |
| 4411 | |
| 4412 | if (sme_is_feature_supported_by_fw(DOT11AX)) |
| 4413 | set_value = WMI_ASSEMBLE_RATECODE_V1(rate, nss, preamble); |
| 4414 | else |
| 4415 | set_value = (preamble << 6) | (nss << 4) | rate; |
| 4416 | |
| 4417 | return set_value; |
| 4418 | } |
| 4419 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4420 | int hdd_set_11ax_rate(struct hdd_adapter *adapter, int set_value, |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 4421 | struct sap_Config *sap_config) |
| 4422 | { |
| 4423 | uint8_t preamble = 0, nss = 0, rix = 0; |
| 4424 | int ret; |
| 4425 | |
| 4426 | if (!sap_config) { |
| 4427 | if (!sme_is_feature_supported_by_fw(DOT11AX)) { |
| 4428 | hdd_err("Target does not support 11ax"); |
| 4429 | return -EIO; |
| 4430 | } |
| 4431 | } else if (sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax && |
| 4432 | sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax_ONLY) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 4433 | hdd_err("Invalid hw mode, SAP hw_mode= 0x%x, ch = %d", |
| 4434 | sap_config->SapHw_mode, sap_config->channel); |
| 4435 | return -EIO; |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 4436 | } |
| 4437 | |
| 4438 | if (set_value != 0xff) { |
| 4439 | rix = RC_2_RATE_IDX_11AX(set_value); |
| 4440 | preamble = WMI_RATE_PREAMBLE_HE; |
| 4441 | nss = HT_RC_2_STREAMS_11AX(set_value); |
| 4442 | |
| 4443 | set_value = hdd_assemble_rate_code(preamble, nss, rix); |
| 4444 | } |
| 4445 | |
| 4446 | hdd_notice("SET_11AX_RATE val %d rix %d preamble %x nss %d", |
| 4447 | set_value, rix, preamble, nss); |
| 4448 | |
| 4449 | ret = wma_cli_set_command(adapter->sessionId, |
| 4450 | WMI_VDEV_PARAM_FIXED_RATE, |
| 4451 | set_value, VDEV_CMD); |
| 4452 | |
| 4453 | return ret; |
| 4454 | } |
| 4455 | |
Manjeet Singh | e80d6d8 | 2016-09-02 19:04:41 +0530 | [diff] [blame] | 4456 | /** |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 4457 | * hdd_get_aid_rc() - Get AID and rate code passed from user |
| 4458 | * @aid: pointer to AID |
| 4459 | * @rc: pointer to rate code |
| 4460 | * @set_value: value passed from user |
| 4461 | * |
| 4462 | * If target is 11ax capable, set_value will have AID left shifted 16 bits |
| 4463 | * and 16 bits for rate code. If the target is not 11ax capable, rate code |
| 4464 | * will only be 8 bits. |
| 4465 | * |
| 4466 | * Return: None |
| 4467 | */ |
| 4468 | static void hdd_get_aid_rc(uint8_t *aid, uint16_t *rc, int set_value) |
| 4469 | { |
| 4470 | uint8_t rc_bits; |
| 4471 | |
| 4472 | if (sme_is_feature_supported_by_fw(DOT11AX)) |
| 4473 | rc_bits = 16; |
| 4474 | else |
| 4475 | rc_bits = 8; |
| 4476 | |
| 4477 | *aid = set_value >> rc_bits; |
| 4478 | *rc = set_value & ((1 << (rc_bits + 1)) - 1); |
| 4479 | } |
| 4480 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4481 | int hdd_set_peer_rate(struct hdd_adapter *adapter, int set_value) |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 4482 | { |
| 4483 | uint8_t aid, *peer_mac; |
| 4484 | uint16_t rc; |
| 4485 | QDF_STATUS status; |
| 4486 | |
| 4487 | if (adapter->device_mode != QDF_SAP_MODE) { |
| 4488 | hdd_err("Invalid devicde mode - %d", adapter->device_mode); |
| 4489 | return -EINVAL; |
| 4490 | } |
| 4491 | |
| 4492 | hdd_get_aid_rc(&aid, &rc, set_value); |
| 4493 | |
| 4494 | if ((adapter->aStaInfo[aid].isUsed) && |
| 4495 | (OL_TXRX_PEER_STATE_CONN == adapter->aStaInfo[aid].tlSTAState)) { |
| 4496 | peer_mac = |
| 4497 | (uint8_t *)&(adapter->aStaInfo[aid].macAddrSTA.bytes[0]); |
| 4498 | hdd_info("Peer AID: %d MAC_ADDR: "MAC_ADDRESS_STR, |
| 4499 | aid, MAC_ADDR_ARRAY(peer_mac)); |
| 4500 | } else { |
| 4501 | hdd_err("No matching peer found for AID: %d", aid); |
| 4502 | return -EINVAL; |
| 4503 | } |
| 4504 | |
| 4505 | status = sme_set_peer_param(peer_mac, WMI_PEER_PARAM_FIXED_RATE, |
| 4506 | rc, adapter->sessionId); |
| 4507 | if (status != QDF_STATUS_SUCCESS) { |
| 4508 | hdd_err("Failed to set peer fixed rate - status: %d", status); |
| 4509 | return -EIO; |
| 4510 | } |
| 4511 | |
| 4512 | return 0; |
| 4513 | } |
| 4514 | |
| 4515 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4516 | * __iw_set_commit() - SIOCSIWCOMMIT ioctl handler |
| 4517 | * @dev: device upon which the ioctl was received |
| 4518 | * @info: ioctl request information |
| 4519 | * @wrqu: ioctl request data |
| 4520 | * @extra: ioctl extra data |
| 4521 | * |
| 4522 | * Return: 0 on success, non-zero on error |
| 4523 | */ |
| 4524 | static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 4525 | union iwreq_data *wrqu, char *extra) |
| 4526 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4527 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4528 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | int ret; |
| 4530 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4531 | ENTER_DEV(dev); |
| 4532 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4533 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4534 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4535 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4536 | if (0 != ret) |
| 4537 | return ret; |
| 4538 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4539 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4540 | if (0 != ret) |
| 4541 | return ret; |
| 4542 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4543 | /* Do nothing for now */ |
| 4544 | return 0; |
| 4545 | } |
| 4546 | |
| 4547 | /** |
| 4548 | * iw_set_commit() - SSR wrapper function for __iw_set_commit |
| 4549 | * @dev: pointer to net_device |
| 4550 | * @info: pointer to iw_request_info |
| 4551 | * @wrqu: pointer to iwreq_data |
| 4552 | * @extra: extra |
| 4553 | * |
| 4554 | * Return: 0 on success, error number otherwise |
| 4555 | */ |
Jeff Johnson | af2a093 | 2016-10-05 14:52:57 -0700 | [diff] [blame] | 4556 | 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] | 4557 | union iwreq_data *wrqu, char *extra) |
| 4558 | { |
| 4559 | int ret; |
| 4560 | |
| 4561 | cds_ssr_protect(__func__); |
| 4562 | ret = __iw_set_commit(dev, info, wrqu, extra); |
| 4563 | cds_ssr_unprotect(__func__); |
| 4564 | |
| 4565 | return ret; |
| 4566 | } |
| 4567 | |
| 4568 | /** |
| 4569 | * __iw_get_name() - SIOCGIWNAME ioctl handler |
| 4570 | * @dev: device upon which the ioctl was received |
| 4571 | * @info: ioctl request information |
| 4572 | * @wrqu: ioctl request data |
| 4573 | * @extra: ioctl extra data |
| 4574 | * |
| 4575 | * Return: 0 on success, non-zero on error |
| 4576 | */ |
| 4577 | static int __iw_get_name(struct net_device *dev, |
| 4578 | struct iw_request_info *info, char *wrqu, char *extra) |
| 4579 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 4580 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4581 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4582 | int ret; |
| 4583 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4584 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4585 | |
| 4586 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4587 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 4588 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4589 | if (0 != ret) |
| 4590 | return ret; |
| 4591 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4592 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4593 | if (0 != ret) |
| 4594 | return ret; |
| 4595 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4596 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 4597 | EXIT(); |
| 4598 | return 0; |
| 4599 | } |
| 4600 | |
| 4601 | /** |
| 4602 | * __iw_get_name() - SSR wrapper for __iw_get_name |
| 4603 | * @dev: pointer to net_device |
| 4604 | * @info: pointer to iw_request_info |
| 4605 | * @wrqu: pointer to iwreq_data |
| 4606 | * @extra: extra |
| 4607 | * |
| 4608 | * Return: 0 on success, error number otherwise |
| 4609 | */ |
| 4610 | static int iw_get_name(struct net_device *dev, |
| 4611 | struct iw_request_info *info, |
| 4612 | char *wrqu, char *extra) |
| 4613 | { |
| 4614 | int ret; |
| 4615 | |
| 4616 | cds_ssr_protect(__func__); |
| 4617 | ret = __iw_get_name(dev, info, wrqu, extra); |
| 4618 | cds_ssr_unprotect(__func__); |
| 4619 | |
| 4620 | return ret; |
| 4621 | } |
| 4622 | |
| 4623 | /** |
| 4624 | * __iw_set_mode() - ioctl handler |
| 4625 | * @dev: device upon which the ioctl was received |
| 4626 | * @info: ioctl request information |
| 4627 | * @wrqu: ioctl request data |
| 4628 | * @extra: ioctl extra data |
| 4629 | * |
| 4630 | * Return: 0 on success, non-zero on error |
| 4631 | */ |
| 4632 | static int __iw_set_mode(struct net_device *dev, |
| 4633 | struct iw_request_info *info, |
| 4634 | union iwreq_data *wrqu, char *extra) |
| 4635 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4636 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4637 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4638 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | tCsrRoamProfile *pRoamProfile; |
| 4640 | eCsrRoamBssType LastBSSType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4641 | struct hdd_config *pConfig; |
| 4642 | struct wireless_dev *wdev; |
| 4643 | int ret; |
| 4644 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4645 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4646 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4647 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4648 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4649 | if (0 != ret) |
| 4650 | return ret; |
| 4651 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4652 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4653 | if (0 != ret) |
| 4654 | return ret; |
| 4655 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4656 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4657 | wdev = dev->ieee80211_ptr; |
| 4658 | pRoamProfile = &pWextState->roamProfile; |
| 4659 | LastBSSType = pRoamProfile->BSSType; |
| 4660 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4661 | hdd_debug("Old Bss type = %d", LastBSSType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4662 | |
| 4663 | switch (wrqu->mode) { |
| 4664 | case IW_MODE_ADHOC: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4665 | hdd_debug("Setting AP Mode as IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4666 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 4667 | /* Set the phymode correctly for IBSS. */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4668 | pConfig = (WLAN_HDD_GET_CTX(adapter))->config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4669 | pWextState->roamProfile.phyMode = |
| 4670 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4671 | adapter->device_mode = QDF_IBSS_MODE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4672 | wdev->iftype = NL80211_IFTYPE_ADHOC; |
| 4673 | break; |
| 4674 | case IW_MODE_INFRA: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4675 | hdd_debug("Setting AP Mode as IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 4677 | wdev->iftype = NL80211_IFTYPE_STATION; |
| 4678 | break; |
| 4679 | case IW_MODE_AUTO: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4680 | hdd_debug("Setting AP Mode as IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY; |
| 4682 | break; |
| 4683 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4684 | hdd_err("Unknown AP Mode value %d", wrqu->mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4685 | return -EOPNOTSUPP; |
| 4686 | } |
| 4687 | |
| 4688 | if (LastBSSType != pRoamProfile->BSSType) { |
| 4689 | /* the BSS mode changed. We need to issue disconnect |
| 4690 | * if connected or in IBSS disconnect state |
| 4691 | */ |
Jeff Johnson | 9eeed0a | 2016-10-03 15:04:57 -0700 | [diff] [blame] | 4692 | if (hdd_conn_is_connected |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4693 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | || (eCSR_BSS_TYPE_START_IBSS == LastBSSType)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4695 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | /* need to issue a disconnect to CSR. */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4697 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4698 | qdf_status = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4699 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter), |
| 4700 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4701 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4702 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4704 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4705 | rc = wait_for_completion_timeout(&adapter-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4706 | disconnect_comp_var, |
| 4707 | msecs_to_jiffies |
| 4708 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 4709 | if (!rc) |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4710 | hdd_err("disconnect_comp_var failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4711 | } |
| 4712 | } |
| 4713 | } |
| 4714 | |
| 4715 | EXIT(); |
| 4716 | return 0; |
| 4717 | } |
| 4718 | |
| 4719 | /** |
| 4720 | * iw_set_mode() - SSR wrapper for __iw_set_mode() |
| 4721 | * @dev: pointer to net_device |
| 4722 | * @info: pointer to iw_request_info |
| 4723 | * @wrqu: pointer to iwreq_data |
| 4724 | * @extra: pointer to extra ioctl payload |
| 4725 | * |
| 4726 | * Return: 0 on success, error number otherwise |
| 4727 | */ |
| 4728 | static int iw_set_mode(struct net_device *dev, struct iw_request_info *info, |
| 4729 | union iwreq_data *wrqu, char *extra) |
| 4730 | { |
| 4731 | int ret; |
| 4732 | |
| 4733 | cds_ssr_protect(__func__); |
| 4734 | ret = __iw_set_mode(dev, info, wrqu, extra); |
| 4735 | cds_ssr_unprotect(__func__); |
| 4736 | |
| 4737 | return ret; |
| 4738 | } |
| 4739 | |
| 4740 | /** |
| 4741 | * __iw_get_mode() - SIOCGIWMODE ioctl handler |
| 4742 | * @dev: device upon which the ioctl was received |
| 4743 | * @info: ioctl request information |
| 4744 | * @wrqu: ioctl request data |
| 4745 | * @extra: ioctl extra data |
| 4746 | * |
| 4747 | * Return: 0 on success, non-zero on error |
| 4748 | */ |
| 4749 | static int |
| 4750 | __iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 4751 | union iwreq_data *wrqu, char *extra) |
| 4752 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4753 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4754 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4755 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4756 | int ret; |
| 4757 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4758 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4760 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4761 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4762 | if (0 != ret) |
| 4763 | return ret; |
| 4764 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4765 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4766 | if (0 != ret) |
| 4767 | return ret; |
| 4768 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4769 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | |
| 4771 | switch (pWextState->roamProfile.BSSType) { |
| 4772 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4773 | hdd_debug("returns IW_MODE_INFRA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4774 | wrqu->mode = IW_MODE_INFRA; |
| 4775 | break; |
| 4776 | case eCSR_BSS_TYPE_IBSS: |
| 4777 | case eCSR_BSS_TYPE_START_IBSS: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4778 | hdd_debug("returns IW_MODE_ADHOC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4779 | wrqu->mode = IW_MODE_ADHOC; |
| 4780 | break; |
| 4781 | case eCSR_BSS_TYPE_ANY: |
| 4782 | default: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4783 | hdd_debug("returns IW_MODE_AUTO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4784 | wrqu->mode = IW_MODE_AUTO; |
| 4785 | break; |
| 4786 | } |
| 4787 | |
| 4788 | EXIT(); |
| 4789 | return 0; |
| 4790 | } |
| 4791 | |
| 4792 | /** |
| 4793 | * iw_get_mode() - SSR wrapper for __iw_get_mode() |
| 4794 | * @dev: pointer to net_device |
| 4795 | * @info: pointer to iw_request_info |
| 4796 | * @wrqu: pointer to iwreq_data |
| 4797 | * @extra: pointer to extra ioctl payload |
| 4798 | * |
| 4799 | * Return: 0 on success, error number otherwise |
| 4800 | */ |
| 4801 | static int iw_get_mode(struct net_device *dev, struct iw_request_info *info, |
| 4802 | union iwreq_data *wrqu, char *extra) |
| 4803 | { |
| 4804 | int ret; |
| 4805 | |
| 4806 | cds_ssr_protect(__func__); |
| 4807 | ret = __iw_get_mode(dev, info, wrqu, extra); |
| 4808 | cds_ssr_unprotect(__func__); |
| 4809 | |
| 4810 | return ret; |
| 4811 | } |
| 4812 | |
| 4813 | /** |
| 4814 | * __iw_set_freq() - SIOCSIWFREQ ioctl handler |
| 4815 | * @dev: device upon which the ioctl was received |
| 4816 | * @info: ioctl request information |
| 4817 | * @wrqu: ioctl request data |
| 4818 | * @extra: ioctl extra data |
| 4819 | * |
| 4820 | * Return: 0 on success, non-zero on error |
| 4821 | */ |
| 4822 | static int __iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 4823 | union iwreq_data *wrqu, char *extra) |
| 4824 | { |
| 4825 | uint32_t numChans = 0; |
| 4826 | uint8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 4827 | uint32_t indx = 0; |
| 4828 | int ret; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4829 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4830 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4831 | struct hdd_context *hdd_ctx; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4832 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4833 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4834 | tCsrRoamProfile *pRoamProfile; |
| 4835 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4836 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4838 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4840 | if (0 != ret) |
| 4841 | return ret; |
| 4842 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4843 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4844 | if (0 != ret) |
| 4845 | return ret; |
| 4846 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4847 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4848 | |
| 4849 | pRoamProfile = &pWextState->roamProfile; |
| 4850 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4851 | /* Link is up then return cant set channel */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4852 | if (eConnectionState_IbssConnected == sta_ctx->conn_info.connState || |
| 4853 | eConnectionState_Associated == sta_ctx->conn_info.connState) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4854 | hdd_debug("IBSS Associated"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | return -EOPNOTSUPP; |
| 4856 | } |
| 4857 | |
| 4858 | /* Settings by Frequency as input */ |
| 4859 | if ((wrqu->freq.e == 1) && (wrqu->freq.m >= (uint32_t) 2.412e8) && |
| 4860 | (wrqu->freq.m <= (uint32_t) 5.825e8)) { |
| 4861 | uint32_t freq = wrqu->freq.m / 100000; |
| 4862 | |
| 4863 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 4864 | && (freq != freq_chan_map[indx].freq)) |
| 4865 | indx++; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4866 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4867 | return -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4868 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4869 | wrqu->freq.e = 0; |
| 4870 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 4871 | |
| 4872 | } |
| 4873 | |
| 4874 | if (wrqu->freq.e == 0) { |
| 4875 | if ((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 4876 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4877 | hdd_debug("Channel %d is not in range[%d to %d]", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4878 | wrqu->freq.m, |
| 4879 | WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 4880 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4881 | return -EINVAL; |
| 4882 | } |
| 4883 | |
| 4884 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 4885 | |
| 4886 | if (sme_cfg_get_str(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 4887 | validChan, &numChans) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4888 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4889 | hdd_err("WNI_CFG_VALID_CHANNEL_LIST failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4890 | return -EIO; |
| 4891 | } |
| 4892 | |
| 4893 | for (indx = 0; indx < numChans; indx++) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4894 | if (wrqu->freq.m == validChan[indx]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4895 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4896 | } |
| 4897 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4898 | return -EINVAL; |
| 4899 | } |
| 4900 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4901 | if (indx >= numChans) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4902 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4903 | |
| 4904 | /* Set the Operational Channel */ |
| 4905 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4906 | sta_ctx->conn_info.operationChannel = wrqu->freq.m; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4907 | pRoamProfile->ChannelInfo.ChannelList = |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4908 | &sta_ctx->conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4909 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 4910 | hdd_debug("pRoamProfile->operationChannel = %d", wrqu->freq.m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4911 | |
| 4912 | EXIT(); |
| 4913 | |
| 4914 | return ret; |
| 4915 | } |
| 4916 | |
| 4917 | /** |
| 4918 | * iw_set_freq() - SSR wrapper for __iw_set_freq() |
| 4919 | * @dev: pointer to net_device |
| 4920 | * @info: pointer to iw_request_info |
| 4921 | * @wrqu: pointer to iwreq_data |
| 4922 | * @extra: pointer to extra ioctl payload |
| 4923 | * |
| 4924 | * Return: 0 on success, error number otherwise |
| 4925 | */ |
| 4926 | static int iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 4927 | union iwreq_data *wrqu, char *extra) |
| 4928 | { |
| 4929 | int ret; |
| 4930 | |
| 4931 | cds_ssr_protect(__func__); |
| 4932 | ret = __iw_set_freq(dev, info, wrqu, extra); |
| 4933 | cds_ssr_unprotect(__func__); |
| 4934 | |
| 4935 | return ret; |
| 4936 | } |
| 4937 | |
| 4938 | /** |
| 4939 | * __iw_get_freq() - SIOCGIWFREQ ioctl handler |
| 4940 | * @dev: device upon which the ioctl was received |
| 4941 | * @info: ioctl request information |
| 4942 | * @wrqu: ioctl request data |
| 4943 | * @extra: ioctl extra data |
| 4944 | * |
| 4945 | * Return: 0 on success, non-zero on error |
| 4946 | */ |
| 4947 | static int __iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 4948 | struct iw_freq *fwrq, char *extra) |
| 4949 | { |
| 4950 | uint32_t status = false, channel = 0, freq = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4951 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4952 | tHalHandle hHal; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4953 | struct hdd_wext_state *pWextState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4954 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4955 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 4956 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4957 | int ret; |
| 4958 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 4959 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4960 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4961 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4962 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 4963 | if (0 != ret) |
| 4964 | return ret; |
| 4965 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 4966 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 4967 | if (0 != ret) |
| 4968 | return ret; |
| 4969 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4970 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 4971 | hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4972 | |
| 4973 | pRoamProfile = &pWextState->roamProfile; |
| 4974 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4975 | if (sta_ctx->conn_info.connState == eConnectionState_Associated) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 4976 | if (sme_get_operation_channel(hHal, &channel, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4977 | adapter->sessionId) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 4978 | hdd_err("failed to get operating channel %u", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 4979 | adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4980 | return -EIO; |
Jeff Johnson | 6875531 | 2017-02-10 11:46:55 -0800 | [diff] [blame] | 4981 | } |
Jeff Johnson | 6875531 | 2017-02-10 11:46:55 -0800 | [diff] [blame] | 4982 | status = hdd_wlan_get_freq(channel, &freq); |
| 4983 | if (true == status) { |
| 4984 | /* Set Exponent parameter as 6 (MHZ) |
| 4985 | * in struct iw_freq iwlist & iwconfig |
| 4986 | * command shows frequency into proper |
| 4987 | * format (2.412 GHz instead of 246.2 |
| 4988 | * MHz) |
| 4989 | */ |
| 4990 | fwrq->m = freq; |
| 4991 | fwrq->e = MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4992 | } |
| 4993 | } else { |
| 4994 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 4995 | * iwlist & iwconfig command shows frequency into proper |
| 4996 | * format (2.412 GHz instead of 246.2 MHz) |
| 4997 | */ |
| 4998 | fwrq->m = 0; |
| 4999 | fwrq->e = MHZ; |
| 5000 | } |
| 5001 | return 0; |
| 5002 | } |
| 5003 | |
| 5004 | /** |
| 5005 | * iw_get_freq() - SSR wrapper for __iw_get_freq() |
| 5006 | * @dev: pointer to net_device |
| 5007 | * @info: pointer to iw_request_info |
| 5008 | * @fwrq: pointer to frequency data |
| 5009 | * @extra: pointer to extra ioctl payload |
| 5010 | * |
| 5011 | * Return: 0 on success, error number otherwise |
| 5012 | */ |
| 5013 | static int iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 5014 | struct iw_freq *fwrq, char *extra) |
| 5015 | { |
| 5016 | int ret; |
| 5017 | |
| 5018 | cds_ssr_protect(__func__); |
| 5019 | ret = __iw_get_freq(dev, info, fwrq, extra); |
| 5020 | cds_ssr_unprotect(__func__); |
| 5021 | |
| 5022 | return ret; |
| 5023 | } |
| 5024 | |
| 5025 | /** |
| 5026 | * __iw_get_tx_power() - SIOCGIWTXPOW ioctl handler |
| 5027 | * @dev: device upon which the ioctl was received |
| 5028 | * @info: ioctl request information |
| 5029 | * @wrqu: ioctl request data |
| 5030 | * @extra: ioctl extra data |
| 5031 | * |
| 5032 | * Return: 0 on success, non-zero on error |
| 5033 | */ |
| 5034 | static int __iw_get_tx_power(struct net_device *dev, |
| 5035 | struct iw_request_info *info, |
| 5036 | union iwreq_data *wrqu, char *extra) |
| 5037 | { |
| 5038 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5039 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5040 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5041 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5042 | int ret; |
| 5043 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5044 | ENTER_DEV(dev); |
| 5045 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5046 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5047 | if (0 != ret) |
| 5048 | return ret; |
| 5049 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5050 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5051 | if (0 != ret) |
| 5052 | return ret; |
| 5053 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5054 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5055 | wrqu->txpower.value = 0; |
| 5056 | return 0; |
| 5057 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5058 | wlan_hdd_get_class_astats(adapter); |
| 5059 | wrqu->txpower.value = adapter->hdd_stats.ClassA_stat.max_pwr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | |
| 5061 | return 0; |
| 5062 | } |
| 5063 | |
| 5064 | /** |
| 5065 | * iw_get_tx_power() - SSR wrapper for __iw_get_tx_power() |
| 5066 | * @dev: pointer to net_device |
| 5067 | * @info: pointer to iw_request_info |
| 5068 | * @wrqu: pointer to iwreq_data |
| 5069 | * @extra: pointer to extra ioctl payload |
| 5070 | * |
| 5071 | * Return: 0 on success, error number otherwise |
| 5072 | */ |
| 5073 | static int iw_get_tx_power(struct net_device *dev, |
| 5074 | struct iw_request_info *info, |
| 5075 | union iwreq_data *wrqu, char *extra) |
| 5076 | { |
| 5077 | int ret; |
| 5078 | |
| 5079 | cds_ssr_protect(__func__); |
| 5080 | ret = __iw_get_tx_power(dev, info, wrqu, extra); |
| 5081 | cds_ssr_unprotect(__func__); |
| 5082 | |
| 5083 | return ret; |
| 5084 | } |
| 5085 | |
| 5086 | /** |
| 5087 | * __iw_set_tx_power() - SIOCSIWTXPOW ioctl handler |
| 5088 | * @dev: device upon which the ioctl was received |
| 5089 | * @info: ioctl request information |
| 5090 | * @wrqu: ioctl request data |
| 5091 | * @extra: ioctl extra data |
| 5092 | * |
| 5093 | * Return: 0 on success, non-zero on error |
| 5094 | */ |
| 5095 | static int __iw_set_tx_power(struct net_device *dev, |
| 5096 | struct iw_request_info *info, |
| 5097 | union iwreq_data *wrqu, char *extra) |
| 5098 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5099 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5100 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5101 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5102 | int ret; |
| 5103 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5104 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5105 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5106 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5107 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5108 | if (0 != ret) |
| 5109 | return ret; |
| 5110 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5111 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5112 | if (0 != ret) |
| 5113 | return ret; |
| 5114 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5115 | if (sme_cfg_set_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5116 | wrqu->txpower.value) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5117 | hdd_err("WNI_CFG_CURRENT_TX_POWER_LEVEL failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5118 | return -EIO; |
| 5119 | } |
| 5120 | |
| 5121 | EXIT(); |
| 5122 | |
| 5123 | return 0; |
| 5124 | } |
| 5125 | |
| 5126 | /** |
| 5127 | * iw_set_tx_power() - SSR wrapper for __iw_set_tx_power() |
| 5128 | * @dev: pointer to net_device |
| 5129 | * @info: pointer to iw_request_info |
| 5130 | * @wrqu: pointer to iwreq_data |
| 5131 | * @extra: pointer to extra ioctl payload |
| 5132 | * |
| 5133 | * Return: 0 on success, error number otherwise |
| 5134 | */ |
| 5135 | static int iw_set_tx_power(struct net_device *dev, |
| 5136 | struct iw_request_info *info, |
| 5137 | union iwreq_data *wrqu, char *extra) |
| 5138 | { |
| 5139 | int ret; |
| 5140 | |
| 5141 | cds_ssr_protect(__func__); |
| 5142 | ret = __iw_set_tx_power(dev, info, wrqu, extra); |
| 5143 | cds_ssr_unprotect(__func__); |
| 5144 | |
| 5145 | return ret; |
| 5146 | } |
| 5147 | |
| 5148 | /** |
| 5149 | * __iw_get_bitrate() - SIOCGIWRATE ioctl handler |
| 5150 | * @dev: device upon which the ioctl was received |
| 5151 | * @info: ioctl request information |
| 5152 | * @wrqu: ioctl request data |
| 5153 | * @extra: ioctl extra data |
| 5154 | * |
| 5155 | * Return: 0 on success, non-zero on error |
| 5156 | */ |
| 5157 | static int __iw_get_bitrate(struct net_device *dev, |
| 5158 | struct iw_request_info *info, |
| 5159 | union iwreq_data *wrqu, char *extra) |
| 5160 | { |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5161 | QDF_STATUS status; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5162 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5163 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5164 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5165 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5166 | int ret; |
| 5167 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5168 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5169 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5170 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5171 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5172 | if (0 != ret) |
| 5173 | return ret; |
| 5174 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5175 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5176 | if (0 != ret) |
| 5177 | return ret; |
| 5178 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5179 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5180 | wrqu->bitrate.value = 0; |
| 5181 | } else { |
| 5182 | status = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5183 | sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5184 | eCSR_HDD, |
| 5185 | SME_SUMMARY_STATS | |
| 5186 | SME_GLOBAL_CLASSA_STATS | |
Jeff Johnson | dfe8951 | 2017-03-10 15:50:00 -0800 | [diff] [blame] | 5187 | SME_GLOBAL_CLASSD_STATS, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 5188 | hdd_statistics_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5189 | sta_ctx->conn_info.staId[0], |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5190 | adapter, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5191 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5192 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5193 | hdd_err("Unable to retrieve statistics"); |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5194 | return qdf_status_to_os_return(status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5195 | } |
| 5196 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5197 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5198 | |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5199 | status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5200 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5201 | WLAN_WAIT_TIME_STATS); |
| 5202 | |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5203 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5204 | hdd_err("SME timeout while retrieving statistics"); |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5205 | return qdf_status_to_os_return(status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5206 | } |
| 5207 | |
| 5208 | wrqu->bitrate.value = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5209 | adapter->hdd_stats.ClassA_stat.tx_rate * 500 * 1000; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | EXIT(); |
| 5213 | |
Jeff Johnson | f25ac10 | 2017-02-07 09:16:02 -0800 | [diff] [blame] | 5214 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5215 | } |
| 5216 | |
| 5217 | /** |
| 5218 | * iw_get_bitrate() - SSR wrapper for __iw_get_bitrate() |
| 5219 | * @dev: pointer to net_device |
| 5220 | * @info: pointer to iw_request_info |
| 5221 | * @wrqu: pointer to iwreq_data |
| 5222 | * @extra: pointer to extra ioctl payload |
| 5223 | * |
| 5224 | * Return: 0 on success, error number otherwise |
| 5225 | */ |
| 5226 | static int iw_get_bitrate(struct net_device *dev, |
| 5227 | struct iw_request_info *info, |
| 5228 | union iwreq_data *wrqu, char *extra) |
| 5229 | { |
| 5230 | int ret; |
| 5231 | |
| 5232 | cds_ssr_protect(__func__); |
| 5233 | ret = __iw_get_bitrate(dev, info, wrqu, extra); |
| 5234 | cds_ssr_unprotect(__func__); |
| 5235 | |
| 5236 | return ret; |
| 5237 | } |
| 5238 | |
| 5239 | /** |
| 5240 | * __iw_set_bitrate() - SIOCSIWRATE ioctl handler |
| 5241 | * @dev: device upon which the ioctl was received |
| 5242 | * @info: ioctl request information |
| 5243 | * @wrqu: ioctl request data |
| 5244 | * @extra: ioctl extra data |
| 5245 | * |
| 5246 | * Return: 0 on success, non-zero on error |
| 5247 | */ |
| 5248 | static int __iw_set_bitrate(struct net_device *dev, |
| 5249 | struct iw_request_info *info, |
| 5250 | union iwreq_data *wrqu, char *extra) |
| 5251 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5252 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5253 | struct hdd_wext_state *pWextState; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5254 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5255 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 5256 | uint32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 5257 | uint32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 5258 | uint32_t i, rate; |
| 5259 | uint32_t valid_rate = false, active_phy_mode = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5260 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5261 | int ret; |
| 5262 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5263 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5264 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5265 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5266 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5267 | if (0 != ret) |
| 5268 | return ret; |
| 5269 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5270 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5271 | if (0 != ret) |
| 5272 | return ret; |
| 5273 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5274 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5276 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5277 | return -ENXIO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5278 | |
| 5279 | rate = wrqu->bitrate.value; |
| 5280 | |
| 5281 | if (rate == -1) { |
| 5282 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 5283 | valid_rate = true; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5284 | } else if (sme_cfg_get_int(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5285 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5286 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5287 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 5288 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 5289 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5290 | if ((sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5291 | WNI_CFG_SUPPORTED_RATES_11A, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5292 | &a_len) == QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | && |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5294 | (sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5295 | WNI_CFG_SUPPORTED_RATES_11B, supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5296 | &b_len) == QDF_STATUS_SUCCESS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5297 | for (i = 0; i < (b_len + a_len); ++i) { |
| 5298 | /* supported rates returned is double |
| 5299 | * the actual rate so we divide it by 2 |
| 5300 | */ |
| 5301 | if ((supp_rates[i] & 0x7F) / 2 == |
| 5302 | rate) { |
| 5303 | valid_rate = true; |
| 5304 | rate = i + |
| 5305 | WNI_CFG_FIXED_RATE_1MBPS; |
| 5306 | break; |
| 5307 | } |
| 5308 | } |
| 5309 | } |
| 5310 | } |
| 5311 | } |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5312 | if (valid_rate != true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5313 | return -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5314 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5315 | if (sme_cfg_set_int(WLAN_HDD_GET_HAL_CTX(adapter), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5316 | WNI_CFG_FIXED_RATE, rate) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5317 | hdd_err("failed to set ini parameter, WNI_CFG_FIXED_RATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5318 | return -EIO; |
| 5319 | } |
| 5320 | return 0; |
| 5321 | } |
| 5322 | |
| 5323 | /** |
| 5324 | * iw_set_bitrate() - SSR wrapper for __iw_set_bitrate() |
| 5325 | * @dev: pointer to net_device |
| 5326 | * @info: pointer to iw_request_info |
| 5327 | * @wrqu: pointer to iwreq_data |
| 5328 | * @extra: pointer to extra ioctl payload |
| 5329 | * |
| 5330 | * Return: 0 on success, error number otherwise |
| 5331 | */ |
| 5332 | static int iw_set_bitrate(struct net_device *dev, |
| 5333 | struct iw_request_info *info, |
| 5334 | union iwreq_data *wrqu, char *extra) |
| 5335 | { |
| 5336 | int ret; |
| 5337 | |
| 5338 | cds_ssr_protect(__func__); |
| 5339 | ret = __iw_set_bitrate(dev, info, wrqu, extra); |
| 5340 | cds_ssr_unprotect(__func__); |
| 5341 | |
| 5342 | return ret; |
| 5343 | } |
| 5344 | |
| 5345 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5346 | * __iw_get_rts_threshold() - SIOCGIWRTS ioctl handler |
| 5347 | * @dev: device upon which the ioctl was received |
| 5348 | * @info: ioctl request information |
| 5349 | * @wrqu: ioctl request data |
| 5350 | * @extra: ioctl extra data |
| 5351 | * |
| 5352 | * Return: 0 on success, non-zero on error |
| 5353 | */ |
| 5354 | static int __iw_get_rts_threshold(struct net_device *dev, |
| 5355 | struct iw_request_info *info, |
| 5356 | union iwreq_data *wrqu, char *extra) |
| 5357 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 5358 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5359 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 5360 | uint32_t threshold = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5361 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5362 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5363 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5364 | ENTER_DEV(dev); |
| 5365 | |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5366 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5367 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5368 | if (0 != ret) |
| 5369 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5370 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5371 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5372 | if (0 != ret) |
| 5373 | return ret; |
| 5374 | |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5375 | if (QDF_STATUS_SUCCESS != |
| 5376 | sme_cfg_get_int(hal, WNI_CFG_RTS_THRESHOLD, &threshold)) { |
| 5377 | hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD"); |
| 5378 | return -EIO; |
| 5379 | } |
| 5380 | wrqu->rts.value = threshold; |
| 5381 | |
| 5382 | hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value); |
| 5383 | |
| 5384 | EXIT(); |
| 5385 | |
| 5386 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5387 | } |
| 5388 | |
| 5389 | /** |
| 5390 | * __iw_set_rts_threshold() - SIOCSIWRTS ioctl handler |
| 5391 | * @dev: device upon which the ioctl was received |
| 5392 | * @info: ioctl request information |
| 5393 | * @wrqu: ioctl request data |
| 5394 | * @extra: ioctl extra data |
| 5395 | * |
| 5396 | * Return: 0 on success, non-zero on error |
| 5397 | */ |
| 5398 | static int __iw_set_rts_threshold(struct net_device *dev, |
| 5399 | struct iw_request_info *info, |
| 5400 | union iwreq_data *wrqu, char *extra) |
| 5401 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5402 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5403 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5404 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5405 | int ret; |
| 5406 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5407 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5408 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5409 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5410 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5411 | if (0 != ret) |
| 5412 | return ret; |
| 5413 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5414 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5415 | if (0 != ret) |
| 5416 | return ret; |
| 5417 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5418 | if (wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN |
| 5419 | || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX) { |
| 5420 | return -EINVAL; |
| 5421 | } |
| 5422 | |
| 5423 | 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] | 5424 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5425 | hdd_err("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5426 | return -EIO; |
| 5427 | } |
| 5428 | |
| 5429 | EXIT(); |
| 5430 | |
| 5431 | return 0; |
| 5432 | } |
| 5433 | |
| 5434 | /** |
| 5435 | * iw_get_rts_threshold() - SSR wrapper for __iw_get_rts_threshold() |
| 5436 | * @dev: pointer to net_device |
| 5437 | * @info: pointer to iw_request_info |
| 5438 | * @wrqu: pointer to iwreq_data |
| 5439 | * @extra: pointer to extra ioctl payload |
| 5440 | * |
| 5441 | * Return: 0 on success, error number otherwise |
| 5442 | */ |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5443 | int iw_get_rts_threshold(struct net_device *dev, |
| 5444 | struct iw_request_info *info, |
| 5445 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5446 | { |
| 5447 | int ret; |
| 5448 | |
| 5449 | cds_ssr_protect(__func__); |
| 5450 | ret = __iw_get_rts_threshold(dev, info, wrqu, extra); |
| 5451 | cds_ssr_unprotect(__func__); |
| 5452 | |
| 5453 | return ret; |
| 5454 | } |
| 5455 | |
| 5456 | /** |
| 5457 | * iw_set_rts_threshold() - SSR wrapper for __iw_set_rts_threshold() |
| 5458 | * @dev: pointer to net_device |
| 5459 | * @info: pointer to iw_request_info |
| 5460 | * @wrqu: pointer to iwreq_data |
| 5461 | * @extra: pointer to extra ioctl payload |
| 5462 | * |
| 5463 | * Return: 0 on success, error number otherwise |
| 5464 | */ |
| 5465 | static int iw_set_rts_threshold(struct net_device *dev, |
| 5466 | struct iw_request_info *info, |
| 5467 | union iwreq_data *wrqu, char *extra) |
| 5468 | { |
| 5469 | int ret; |
| 5470 | |
| 5471 | cds_ssr_protect(__func__); |
| 5472 | ret = __iw_set_rts_threshold(dev, info, wrqu, extra); |
| 5473 | cds_ssr_unprotect(__func__); |
| 5474 | |
| 5475 | return ret; |
| 5476 | } |
| 5477 | |
| 5478 | /** |
| 5479 | * __iw_get_frag_threshold() - SIOCGIWFRAG ioctl handler |
| 5480 | * @dev: device upon which the ioctl was received |
| 5481 | * @info: ioctl request information |
| 5482 | * @wrqu: ioctl request data |
| 5483 | * @extra: ioctl extra data |
| 5484 | * |
| 5485 | * Return: 0 on success, non-zero on error |
| 5486 | */ |
| 5487 | static int __iw_get_frag_threshold(struct net_device *dev, |
| 5488 | struct iw_request_info *info, |
| 5489 | union iwreq_data *wrqu, char *extra) |
| 5490 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 5491 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5492 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 5493 | uint32_t threshold = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5494 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5495 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5496 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5497 | ENTER_DEV(dev); |
| 5498 | |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5499 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5500 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5501 | if (0 != ret) |
| 5502 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5503 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5504 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5505 | if (0 != ret) |
| 5506 | return ret; |
| 5507 | |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5508 | if (sme_cfg_get_int(hal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
| 5509 | != QDF_STATUS_SUCCESS) { |
| 5510 | hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"); |
| 5511 | return -EIO; |
| 5512 | } |
| 5513 | wrqu->frag.value = threshold; |
| 5514 | |
| 5515 | hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value); |
| 5516 | |
| 5517 | EXIT(); |
| 5518 | |
| 5519 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5520 | } |
| 5521 | |
| 5522 | /** |
| 5523 | * iw_get_frag_threshold() - SSR wrapper for __iw_get_frag_threshold() |
| 5524 | * @dev: pointer to net_device |
| 5525 | * @info: pointer to iw_request_info |
| 5526 | * @wrqu: pointer to iwreq_data |
| 5527 | * @extra: pointer to extra ioctl payload |
| 5528 | * |
| 5529 | * Return: 0 on success, error number otherwise |
| 5530 | */ |
Jeff Johnson | 5b90762 | 2017-02-07 10:00:37 -0800 | [diff] [blame] | 5531 | int iw_get_frag_threshold(struct net_device *dev, |
| 5532 | struct iw_request_info *info, |
| 5533 | union iwreq_data *wrqu, char *extra) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5534 | { |
| 5535 | int ret; |
| 5536 | |
| 5537 | cds_ssr_protect(__func__); |
| 5538 | ret = __iw_get_frag_threshold(dev, info, wrqu, extra); |
| 5539 | cds_ssr_unprotect(__func__); |
| 5540 | |
| 5541 | return ret; |
| 5542 | } |
| 5543 | |
| 5544 | /** |
| 5545 | * __iw_set_frag_threshold() - SIOCSIWFRAG ioctl handler |
| 5546 | * @dev: device upon which the ioctl was received |
| 5547 | * @info: ioctl request information |
| 5548 | * @wrqu: ioctl request data |
| 5549 | * @extra: ioctl extra data |
| 5550 | * |
| 5551 | * Return: 0 on success, non-zero on error |
| 5552 | */ |
| 5553 | static int __iw_set_frag_threshold(struct net_device *dev, |
| 5554 | struct iw_request_info *info, |
| 5555 | union iwreq_data *wrqu, char *extra) |
| 5556 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5557 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5558 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5559 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5560 | int ret; |
| 5561 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5562 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5563 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5564 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5565 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5566 | if (0 != ret) |
| 5567 | return ret; |
| 5568 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5569 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5570 | if (0 != ret) |
| 5571 | return ret; |
| 5572 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5573 | if (wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN |
| 5574 | || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX) { |
| 5575 | return -EINVAL; |
| 5576 | } |
| 5577 | |
| 5578 | if (sme_cfg_set_int |
| 5579 | (hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5580 | != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5581 | hdd_err("WNI_CFG_FRAGMENTATION_THRESHOLD failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5582 | return -EIO; |
| 5583 | } |
| 5584 | |
| 5585 | EXIT(); |
| 5586 | |
| 5587 | return 0; |
| 5588 | } |
| 5589 | |
| 5590 | /** |
| 5591 | * iw_set_frag_threshold() - SSR wrapper for __iw_set_frag_threshold() |
| 5592 | * @dev: pointer to net_device |
| 5593 | * @info: pointer to iw_request_info |
| 5594 | * @wrqu: pointer to iwreq_data |
| 5595 | * @extra: pointer to extra ioctl payload |
| 5596 | * |
| 5597 | * Return: 0 on success, error number otherwise |
| 5598 | */ |
| 5599 | static int iw_set_frag_threshold(struct net_device *dev, |
| 5600 | struct iw_request_info *info, |
| 5601 | union iwreq_data *wrqu, char *extra) |
| 5602 | { |
| 5603 | int ret; |
| 5604 | |
| 5605 | cds_ssr_protect(__func__); |
| 5606 | ret = __iw_set_frag_threshold(dev, info, wrqu, extra); |
| 5607 | cds_ssr_unprotect(__func__); |
| 5608 | |
| 5609 | return ret; |
| 5610 | } |
| 5611 | |
| 5612 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5613 | * __iw_get_range() - SIOCGIWRANGE ioctl handler |
| 5614 | * @dev: device upon which the ioctl was received |
| 5615 | * @info: ioctl request information |
| 5616 | * @wrqu: ioctl request data |
| 5617 | * @extra: ioctl extra data |
| 5618 | * |
| 5619 | * Return: 0 on success, non-zero on error |
| 5620 | */ |
| 5621 | static int __iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 5622 | union iwreq_data *wrqu, char *extra) |
| 5623 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5624 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5625 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5626 | struct iw_range *range = (struct iw_range *)extra; |
| 5627 | |
| 5628 | uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5629 | |
| 5630 | uint32_t num_channels = sizeof(channels); |
| 5631 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 5632 | uint32_t a_len; |
| 5633 | uint32_t b_len; |
| 5634 | uint32_t active_phy_mode = 0; |
| 5635 | uint8_t index = 0, i; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5636 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5637 | int ret; |
| 5638 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5639 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5640 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5641 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5642 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5643 | if (0 != ret) |
| 5644 | return ret; |
| 5645 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5646 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5647 | if (0 != ret) |
| 5648 | return ret; |
| 5649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5650 | wrqu->data.length = sizeof(struct iw_range); |
| 5651 | memset(range, 0, sizeof(struct iw_range)); |
| 5652 | |
| 5653 | |
| 5654 | /*Get the phy mode */ |
| 5655 | if (sme_cfg_get_int(hHal, |
| 5656 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5657 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5658 | hdd_debug("active_phy_mode = %d", active_phy_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5659 | |
| 5660 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 5661 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G) { |
| 5662 | /*Get the supported rates for 11G band */ |
| 5663 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 5664 | if (sme_cfg_get_str(hHal, |
| 5665 | WNI_CFG_SUPPORTED_RATES_11A, |
| 5666 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5667 | &a_len) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5668 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5669 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5670 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5671 | for (i = 0; i < a_len; i++) { |
| 5672 | range->bitrate[i] = |
| 5673 | ((supp_rates[i] & 0x7F) / 2) * |
| 5674 | 1000000; |
| 5675 | } |
| 5676 | range->num_bitrates = a_len; |
| 5677 | } else { |
| 5678 | return -EIO; |
| 5679 | } |
| 5680 | } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 5681 | /*Get the supported rates for 11B band */ |
| 5682 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 5683 | if (sme_cfg_get_str(hHal, |
| 5684 | WNI_CFG_SUPPORTED_RATES_11B, |
| 5685 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5686 | &b_len) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5687 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5688 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5689 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5690 | for (i = 0; i < b_len; i++) { |
| 5691 | range->bitrate[i] = |
| 5692 | ((supp_rates[i] & 0x7F) / 2) * |
| 5693 | 1000000; |
| 5694 | } |
| 5695 | range->num_bitrates = b_len; |
| 5696 | } else { |
| 5697 | return -EIO; |
| 5698 | } |
| 5699 | } |
| 5700 | } |
| 5701 | |
| 5702 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 5703 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 5704 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 5705 | |
| 5706 | range->encoding_size[0] = 5; |
| 5707 | range->encoding_size[1] = 13; |
| 5708 | range->num_encoding_sizes = 2; |
| 5709 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 5710 | |
| 5711 | /* we support through Wireless Extensions 22 */ |
| 5712 | range->we_version_compiled = WIRELESS_EXT; |
| 5713 | range->we_version_source = 22; |
| 5714 | |
| 5715 | /*Supported Channels and Frequencies */ |
| 5716 | if (sme_cfg_get_str |
| 5717 | ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5718 | &num_channels) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5719 | hdd_err("Failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5720 | return -EIO; |
| 5721 | } |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5722 | if (num_channels > IW_MAX_FREQUENCIES) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5723 | num_channels = IW_MAX_FREQUENCIES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5724 | |
| 5725 | range->num_channels = num_channels; |
| 5726 | range->num_frequency = num_channels; |
| 5727 | |
| 5728 | for (index = 0; index < num_channels; index++) { |
| 5729 | uint32_t frq_indx = 0; |
| 5730 | |
| 5731 | range->freq[index].i = channels[index]; |
| 5732 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) { |
| 5733 | if (channels[index] == freq_chan_map[frq_indx].chan) { |
| 5734 | range->freq[index].m = |
| 5735 | freq_chan_map[frq_indx].freq * 100000; |
| 5736 | range->freq[index].e = 1; |
| 5737 | break; |
| 5738 | } |
| 5739 | frq_indx++; |
| 5740 | } |
| 5741 | } |
| 5742 | |
| 5743 | /* Event capability (kernel + driver) */ |
| 5744 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 5745 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 5746 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 5747 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 5748 | |
| 5749 | /*Encryption capability */ |
| 5750 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 5751 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 5752 | |
| 5753 | /* Txpower capability */ |
| 5754 | range->txpower_capa = IW_TXPOW_MWATT; |
| 5755 | |
| 5756 | /*Scanning capability */ |
| 5757 | #if WIRELESS_EXT >= 22 |
| 5758 | range->scan_capa = |
| 5759 | IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 5760 | #endif |
| 5761 | |
| 5762 | EXIT(); |
| 5763 | return 0; |
| 5764 | } |
| 5765 | |
| 5766 | /** |
| 5767 | * iw_get_range() - SSR wrapper for __iw_get_range() |
| 5768 | * @dev: pointer to net_device |
| 5769 | * @info: pointer to iw_request_info |
| 5770 | * @wrqu: pointer to iwreq_data |
| 5771 | * @extra: pointer to extra ioctl payload |
| 5772 | * |
| 5773 | * Return: 0 on success, error number otherwise |
| 5774 | */ |
| 5775 | static int iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 5776 | union iwreq_data *wrqu, char *extra) |
| 5777 | { |
| 5778 | int ret; |
| 5779 | |
| 5780 | cds_ssr_protect(__func__); |
| 5781 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 5782 | cds_ssr_unprotect(__func__); |
| 5783 | |
| 5784 | return ret; |
| 5785 | } |
| 5786 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5787 | struct class_a_stats { |
| 5788 | tCsrGlobalClassAStatsInfo class_a_stats; |
| 5789 | }; |
| 5790 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5791 | /** |
| 5792 | * hdd_get_class_a_statistics_cb() - Get Class A stats callback function |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5793 | * @stats: pointer to Class A stats |
| 5794 | * @context: user context originally registered with SME (always the |
| 5795 | * cookie from the request context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5796 | * |
| 5797 | * Return: None |
| 5798 | */ |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5799 | static void hdd_get_class_a_statistics_cb(void *stats, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5800 | { |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5801 | struct hdd_request *request; |
| 5802 | struct class_a_stats *priv; |
| 5803 | tCsrGlobalClassAStatsInfo *returned_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5804 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5805 | ENTER(); |
| 5806 | if ((NULL == stats) || (NULL == context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 5807 | hdd_err("Bad param, stats [%pK] context [%pK]", |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5808 | stats, context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5809 | return; |
| 5810 | } |
| 5811 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5812 | request = hdd_request_get(context); |
| 5813 | if (!request) { |
| 5814 | hdd_err("Obsolete request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5815 | return; |
| 5816 | } |
| 5817 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5818 | returned_stats = stats; |
| 5819 | priv = hdd_request_priv(request); |
| 5820 | priv->class_a_stats = *returned_stats; |
| 5821 | hdd_request_complete(request); |
| 5822 | hdd_request_put(request); |
| 5823 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5824 | } |
| 5825 | |
| 5826 | /** |
| 5827 | * wlan_hdd_get_class_astats() - Get Class A statistics |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5828 | * @adapter: adapter for which statistics are desired |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5829 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5830 | * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5831 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5832 | QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5833 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5834 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5835 | QDF_STATUS hstatus; |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5836 | int ret; |
| 5837 | void *cookie; |
| 5838 | struct hdd_request *request; |
| 5839 | struct class_a_stats *priv; |
| 5840 | static const struct hdd_request_params params = { |
| 5841 | .priv_size = sizeof(*priv), |
| 5842 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 5843 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5844 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5845 | if (NULL == adapter) { |
| 5846 | hdd_err("adapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5847 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5848 | } |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 5849 | if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5850 | hdd_debug("Recovery in Progress. State: 0x%x Ignore!!!", |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 5851 | cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5852 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5853 | } |
| 5854 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5855 | request = hdd_request_alloc(¶ms); |
| 5856 | if (!request) { |
| 5857 | hdd_err("Request allocation failure"); |
| 5858 | return QDF_STATUS_E_NOMEM; |
| 5859 | } |
| 5860 | cookie = hdd_request_cookie(request); |
| 5861 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5862 | /* query only for Class A statistics (which include link speed) */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5863 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5864 | eCSR_HDD, SME_GLOBAL_CLASSA_STATS, |
| 5865 | hdd_get_class_a_statistics_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5866 | sta_ctx->conn_info.staId[0], |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5867 | cookie, adapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5868 | if (QDF_STATUS_SUCCESS != hstatus) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 5869 | hdd_warn("Unable to retrieve Class A statistics"); |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5870 | goto return_cached_results; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5871 | } |
| 5872 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5873 | /* request was sent -- wait for the response */ |
| 5874 | ret = hdd_request_wait_for_response(request); |
| 5875 | if (ret) { |
| 5876 | hdd_warn("SME timed out while retrieving Class A statistics"); |
| 5877 | goto return_cached_results; |
| 5878 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5879 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5880 | /* update the adapter with the fresh results */ |
| 5881 | priv = hdd_request_priv(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5882 | adapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5883 | |
| 5884 | return_cached_results: |
| 5885 | /* |
| 5886 | * either we never sent a request, we sent a request and |
| 5887 | * received a response or we sent a request and timed out. |
| 5888 | * regardless we are done with the request. |
| 5889 | */ |
| 5890 | hdd_request_put(request); |
| 5891 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5892 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5893 | } |
| 5894 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5895 | struct station_stats { |
| 5896 | tCsrSummaryStatsInfo summary_stats; |
| 5897 | tCsrGlobalClassAStatsInfo class_a_stats; |
| 5898 | struct csr_per_chain_rssi_stats_info per_chain_rssi_stats; |
| 5899 | }; |
| 5900 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5901 | /** |
| 5902 | * hdd_get_station_statistics_cb() - Get stats callback function |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5903 | * @stats: pointer to combined station stats |
| 5904 | * @context: user context originally registered with SME (always the |
| 5905 | * cookie from the request context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5906 | * |
| 5907 | * Return: None |
| 5908 | */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5909 | static void hdd_get_station_statistics_cb(void *stats, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5910 | { |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5911 | struct hdd_request *request; |
| 5912 | struct station_stats *priv; |
| 5913 | tCsrSummaryStatsInfo *summary_stats; |
| 5914 | tCsrGlobalClassAStatsInfo *class_a_stats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 5915 | struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5916 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5917 | if ((NULL == stats) || (NULL == context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 5918 | hdd_err("Bad param, pStats [%pK] pContext [%pK]", |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5919 | stats, context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5920 | return; |
| 5921 | } |
| 5922 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5923 | request = hdd_request_get(context); |
| 5924 | if (!request) { |
| 5925 | hdd_err("Obsolete request"); |
| 5926 | return; |
| 5927 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5928 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5929 | summary_stats = (tCsrSummaryStatsInfo *) stats; |
| 5930 | class_a_stats = (tCsrGlobalClassAStatsInfo *) (summary_stats + 1); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 5931 | per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *) |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5932 | (class_a_stats + 1); |
| 5933 | priv = hdd_request_priv(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5934 | |
| 5935 | /* copy over the stats. do so as a struct copy */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5936 | priv->summary_stats = *summary_stats; |
| 5937 | priv->class_a_stats = *class_a_stats; |
| 5938 | priv->per_chain_rssi_stats = *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5939 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5940 | hdd_request_complete(request); |
| 5941 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | } |
| 5943 | |
| 5944 | /** |
| 5945 | * wlan_hdd_get_station_stats() - Get station statistics |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5946 | * @adapter: adapter for which statistics are desired |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5947 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5948 | * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5949 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5950 | QDF_STATUS wlan_hdd_get_station_stats(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5952 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5953 | QDF_STATUS status; |
| 5954 | int errno; |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5955 | void *cookie; |
| 5956 | struct hdd_request *request; |
| 5957 | struct station_stats *priv; |
| 5958 | static const struct hdd_request_params params = { |
| 5959 | .priv_size = sizeof(*priv), |
| 5960 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 5961 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5962 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5963 | if (NULL == adapter) { |
| 5964 | hdd_err("adapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5965 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5966 | } |
| 5967 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5968 | request = hdd_request_alloc(¶ms); |
| 5969 | if (!request) { |
| 5970 | hdd_err("Request allocation failure"); |
| 5971 | return QDF_STATUS_E_NOMEM; |
| 5972 | } |
| 5973 | cookie = hdd_request_cookie(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5974 | |
| 5975 | /* query only for Summary & Class A statistics */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5976 | status = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter), |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5977 | eCSR_HDD, |
| 5978 | SME_SUMMARY_STATS | |
| 5979 | SME_GLOBAL_CLASSA_STATS | |
| 5980 | SME_PER_CHAIN_RSSI_STATS, |
| 5981 | hdd_get_station_statistics_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5982 | sta_ctx->conn_info.staId[0], |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5983 | cookie, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5984 | adapter->sessionId); |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5985 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5986 | hdd_err("Failed to retrieve statistics, status %d", status); |
| 5987 | goto put_request; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5988 | } |
| 5989 | |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5990 | /* request was sent -- wait for the response */ |
| 5991 | errno = hdd_request_wait_for_response(request); |
| 5992 | if (errno) { |
| 5993 | hdd_err("Failed to wait for statistics, errno %d", errno); |
| 5994 | goto put_request; |
| 5995 | } |
| 5996 | |
| 5997 | /* update the adapter with the fresh results */ |
| 5998 | priv = hdd_request_priv(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5999 | adapter->hdd_stats.summary_stat = priv->summary_stats; |
| 6000 | adapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
| 6001 | adapter->hdd_stats.per_chain_rssi_stats = priv->per_chain_rssi_stats; |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 6002 | |
| 6003 | put_request: |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 6004 | /* |
| 6005 | * either we never sent a request, we sent a request and |
| 6006 | * received a response or we sent a request and timed out. |
| 6007 | * regardless we are done with the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6008 | */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 6009 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6010 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6011 | /* either callback updated adapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6012 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6013 | } |
| 6014 | |
| 6015 | /** |
| 6016 | * iw_get_linkspeed() - Get current link speed ioctl |
| 6017 | * @dev: device upon which the ioctl was received |
| 6018 | * @info: ioctl request information |
| 6019 | * @wrqu: ioctl request data |
| 6020 | * @extra: extra ioctl buffer |
| 6021 | * |
| 6022 | * Return: 0 on success, non-zero on error |
| 6023 | */ |
| 6024 | static int __iw_get_linkspeed(struct net_device *dev, |
| 6025 | struct iw_request_info *info, |
| 6026 | union iwreq_data *wrqu, char *extra) |
| 6027 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6028 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6029 | char *pLinkSpeed = (char *)extra; |
| 6030 | int len = sizeof(uint32_t) + 1; |
| 6031 | uint32_t link_speed = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6032 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6033 | int ret; |
| 6034 | int rc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6035 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 6036 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6037 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6038 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6039 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6040 | if (0 != ret) |
| 6041 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6042 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6043 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 6044 | if (0 != ret) |
| 6045 | return ret; |
| 6046 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6047 | ret = wlan_hdd_get_link_speed(adapter, &link_speed); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6048 | if (0 != ret) |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6049 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6050 | |
| 6051 | wrqu->data.length = len; |
| 6052 | /* return the linkspeed as a string */ |
| 6053 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
| 6054 | if ((rc < 0) || (rc >= len)) { |
| 6055 | /* encoding or length error? */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6056 | hdd_err("Unable to encode link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6057 | return -EIO; |
| 6058 | } |
| 6059 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6060 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6061 | /* a value is being successfully returned */ |
| 6062 | return 0; |
| 6063 | } |
| 6064 | |
| 6065 | static int iw_get_linkspeed(struct net_device *dev, |
| 6066 | struct iw_request_info *info, |
| 6067 | union iwreq_data *wrqu, char *extra) |
| 6068 | { |
| 6069 | int ret; |
| 6070 | |
| 6071 | cds_ssr_protect(__func__); |
| 6072 | ret = __iw_get_linkspeed(dev, info, wrqu, extra); |
| 6073 | cds_ssr_unprotect(__func__); |
| 6074 | |
| 6075 | return ret; |
| 6076 | } |
| 6077 | |
| 6078 | /** |
| 6079 | * wlan_hdd_change_country_code_callback() - Change country code callback |
| 6080 | * @context: opaque context originally passed to SME. All functions |
| 6081 | * which use this callback pass the adapter upon which the country |
| 6082 | * code change is active |
| 6083 | * |
| 6084 | * This function is registered as the callback function when |
| 6085 | * sme_change_country_code() is invoked. Callers of |
| 6086 | * sme_change_country_code() subsequently wait for the adapter's |
| 6087 | * @change_country_code completion variable, so all this function |
| 6088 | * needs to do is set that completion variable so that execution can |
| 6089 | * continue. |
| 6090 | * |
| 6091 | * Return: none |
| 6092 | */ |
| 6093 | void wlan_hdd_change_country_code_callback(void *context) |
| 6094 | { |
| 6095 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 6096 | struct hdd_adapter *adapter = context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6097 | |
| 6098 | if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) |
| 6099 | complete(&adapter->change_country_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6100 | } |
| 6101 | |
| 6102 | /** |
| 6103 | * __iw_set_nick() - SIOCSIWNICKN ioctl handler |
| 6104 | * @dev: device upon which the ioctl was received |
| 6105 | * @info: ioctl request information |
| 6106 | * @wrqu: ioctl request data |
| 6107 | * @extra: ioctl extra data |
| 6108 | * |
| 6109 | * Return: 0 on success, non-zero on error |
| 6110 | */ |
| 6111 | static int __iw_set_nick(struct net_device *dev, |
| 6112 | struct iw_request_info *info, |
| 6113 | union iwreq_data *wrqu, char *extra) |
| 6114 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 6115 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6116 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6117 | int ret; |
| 6118 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6119 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6120 | |
| 6121 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6122 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6123 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6124 | if (0 != ret) |
| 6125 | return ret; |
| 6126 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6127 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6128 | if (0 != ret) |
| 6129 | return ret; |
| 6130 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | return 0; |
| 6132 | } |
| 6133 | |
| 6134 | /** |
| 6135 | * iw_set_nick() - SSR wrapper for __iw_set_nick |
| 6136 | * @dev: pointer to net_device |
| 6137 | * @info: pointer to iw_request_info |
| 6138 | * @wrqu: pointer to iwreq_data |
| 6139 | * @extra: extra |
| 6140 | * |
| 6141 | * Return: 0 on success, error number otherwise |
| 6142 | */ |
| 6143 | static int iw_set_nick(struct net_device *dev, |
| 6144 | struct iw_request_info *info, |
| 6145 | union iwreq_data *wrqu, char *extra) |
| 6146 | { |
| 6147 | int ret; |
| 6148 | |
| 6149 | cds_ssr_protect(__func__); |
| 6150 | ret = __iw_set_nick(dev, info, wrqu, extra); |
| 6151 | cds_ssr_unprotect(__func__); |
| 6152 | |
| 6153 | return ret; |
| 6154 | } |
| 6155 | |
| 6156 | /** |
| 6157 | * __iw_get_nick() - SIOCGIWNICKN ioctl handler |
| 6158 | * @dev: device upon which the ioctl was received |
| 6159 | * @info: ioctl request information |
| 6160 | * @wrqu: ioctl request data |
| 6161 | * @extra: ioctl extra data |
| 6162 | * |
| 6163 | * Return: 0 on success, non-zero on error |
| 6164 | */ |
| 6165 | static int __iw_get_nick(struct net_device *dev, |
| 6166 | struct iw_request_info *info, |
| 6167 | union iwreq_data *wrqu, char *extra) |
| 6168 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 6169 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6170 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6171 | int ret; |
| 6172 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6173 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6174 | |
| 6175 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6176 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6177 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6178 | if (0 != ret) |
| 6179 | return ret; |
| 6180 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6181 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6182 | if (0 != ret) |
| 6183 | return ret; |
| 6184 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6185 | return 0; |
| 6186 | } |
| 6187 | |
| 6188 | /** |
| 6189 | * iw_get_nick() - SSR wrapper for __iw_get_nick |
| 6190 | * @dev: pointer to net_device |
| 6191 | * @info: pointer to iw_request_info |
| 6192 | * @wrqu: pointer to iwreq_data |
| 6193 | * @extra: extra |
| 6194 | * |
| 6195 | * Return: 0 on success, error number otherwise |
| 6196 | */ |
| 6197 | static int iw_get_nick(struct net_device *dev, |
| 6198 | struct iw_request_info *info, |
| 6199 | union iwreq_data *wrqu, char *extra) |
| 6200 | { |
| 6201 | int ret; |
| 6202 | |
| 6203 | cds_ssr_protect(__func__); |
| 6204 | ret = __iw_get_nick(dev, info, wrqu, extra); |
| 6205 | cds_ssr_unprotect(__func__); |
| 6206 | |
| 6207 | return ret; |
| 6208 | } |
| 6209 | |
| 6210 | /** |
| 6211 | * __iw_set_encode() - SIOCSIWENCODE ioctl handler |
| 6212 | * @dev: device upon which the ioctl was received |
| 6213 | * @info: ioctl request information |
| 6214 | * @wrqu: ioctl request data |
| 6215 | * @extra: ioctl extra data |
| 6216 | * |
| 6217 | * Return: 0 on success, non-zero on error |
| 6218 | */ |
| 6219 | static int __iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 6220 | union iwreq_data *wrqu, char *extra) |
| 6221 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6222 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6223 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6224 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 6225 | struct hdd_wext_state *pWextState = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6226 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6227 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6228 | struct iw_point *encoderq = &(wrqu->encoding); |
| 6229 | uint32_t keyId; |
| 6230 | uint8_t key_length; |
| 6231 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6232 | bool fKeyPresent = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6233 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6234 | int ret; |
| 6235 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6236 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6237 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6238 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6239 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6240 | if (0 != ret) |
| 6241 | return ret; |
| 6242 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6243 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6244 | if (0 != ret) |
| 6245 | return ret; |
| 6246 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6247 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 6248 | |
| 6249 | if (keyId) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6250 | if (keyId > MAX_WEP_KEYS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6251 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6252 | |
| 6253 | fKeyPresent = 1; |
| 6254 | keyId--; |
| 6255 | } else { |
| 6256 | fKeyPresent = 0; |
| 6257 | } |
| 6258 | |
| 6259 | if (wrqu->data.flags & IW_ENCODE_DISABLED) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6260 | hdd_debug("****iwconfig wlan0 key off*****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6261 | if (!fKeyPresent) { |
Yingying Tang | 3cc6b79 | 2016-10-20 17:00:37 +0800 | [diff] [blame] | 6262 | qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, |
| 6263 | CSR_MAX_NUM_KEY); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6264 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6265 | sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 6266 | sta_ctx->wpa_versions = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6267 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 6268 | eCSR_ENCRYPT_TYPE_NONE; |
| 6269 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 6270 | eCSR_ENCRYPT_TYPE_NONE; |
| 6271 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6272 | sta_ctx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6273 | sta_ctx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6274 | |
| 6275 | if (eConnectionState_Associated == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6276 | sta_ctx->conn_info.connState) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6277 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6278 | status = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6279 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter), |
| 6280 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6281 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6282 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6283 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6284 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6285 | rc = wait_for_completion_timeout(&adapter-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6286 | disconnect_comp_var, |
| 6287 | msecs_to_jiffies |
| 6288 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 6289 | if (!rc) |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6290 | hdd_err("disconnect_comp_var failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6291 | } |
| 6292 | } |
| 6293 | |
| 6294 | return status; |
| 6295 | |
| 6296 | } |
| 6297 | |
| 6298 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6299 | hdd_debug("iwconfig wlan0 key on"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6300 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6301 | sta_ctx->conn_info.authType = |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6302 | (encoderq->flags & IW_ENCODE_RESTRICTED) ? |
| 6303 | eCSR_AUTH_TYPE_SHARED_KEY : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6304 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6305 | |
| 6306 | } |
| 6307 | |
| 6308 | if (wrqu->data.length > 0) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6309 | hdd_debug("wrqu->data.length : %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6310 | |
| 6311 | key_length = wrqu->data.length; |
| 6312 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6313 | /* IW_ENCODING_TOKEN_MAX is the value that is set |
| 6314 | * for wrqu->data.length by iwconfig.c |
| 6315 | * when 'iwconfig wlan0 key on' is issued. |
| 6316 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6317 | |
| 6318 | if (5 == key_length) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6319 | hdd_debug("Call with WEP40,key_len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6320 | key_length); |
| 6321 | |
| 6322 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 6323 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6324 | sta_ctx->conn_info.authType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6325 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 6326 | } else { |
| 6327 | encryptionType = |
| 6328 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6329 | } |
| 6330 | } else if (13 == key_length) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6331 | hdd_debug("Call with WEP104,key_len:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6332 | key_length); |
| 6333 | |
| 6334 | if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) |
| 6335 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6336 | sta_ctx->conn_info.authType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6337 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 6338 | } else { |
| 6339 | encryptionType = |
| 6340 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6341 | } |
| 6342 | } else { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6343 | hdd_err("Invalid WEP key length :%d", key_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6344 | return -EINVAL; |
| 6345 | } |
| 6346 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6347 | sta_ctx->conn_info.ucEncryptionType = encryptionType; |
| 6348 | sta_ctx->conn_info.mcEncryptionType = encryptionType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6349 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 6350 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 6351 | encryptionType; |
| 6352 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 6353 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 6354 | encryptionType; |
| 6355 | |
| 6356 | if ((eConnectionState_NotConnected == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6357 | sta_ctx->conn_info.connState) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6358 | && |
| 6359 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6360 | sta_ctx->conn_info.authType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6361 | || (eCSR_AUTH_TYPE_SHARED_KEY == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6362 | sta_ctx->conn_info.authType))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6363 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6364 | qdf_mem_copy(&pWextState->roamProfile.Keys. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6365 | KeyMaterial[keyId][0], extra, key_length); |
| 6366 | |
| 6367 | pWextState->roamProfile.Keys.KeyLength[keyId] = |
| 6368 | (uint8_t) key_length; |
| 6369 | pWextState->roamProfile.Keys.defaultIndex = |
| 6370 | (uint8_t) keyId; |
| 6371 | |
| 6372 | return status; |
| 6373 | } |
| 6374 | } |
| 6375 | |
| 6376 | return 0; |
| 6377 | } |
| 6378 | |
| 6379 | /** |
| 6380 | * iw_set_encode() - SSR wrapper for __iw_set_encode() |
| 6381 | * @dev: pointer to net_device |
| 6382 | * @info: pointer to iw_request_info |
| 6383 | * @wrqu: pointer to iwreq_data |
| 6384 | * @extra: pointer to extra ioctl payload |
| 6385 | * |
| 6386 | * Return: 0 on success, error number otherwise |
| 6387 | */ |
| 6388 | static int iw_set_encode(struct net_device *dev, struct iw_request_info *info, |
| 6389 | union iwreq_data *wrqu, char *extra) |
| 6390 | { |
| 6391 | int ret; |
| 6392 | |
| 6393 | cds_ssr_protect(__func__); |
| 6394 | ret = __iw_set_encode(dev, info, wrqu, extra); |
| 6395 | cds_ssr_unprotect(__func__); |
| 6396 | |
| 6397 | return ret; |
| 6398 | } |
| 6399 | |
| 6400 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6401 | * __iw_set_retry() - SIOCSIWRETRY ioctl handler |
| 6402 | * @dev: device upon which the ioctl was received |
| 6403 | * @info: ioctl request information |
| 6404 | * @wrqu: ioctl request data |
| 6405 | * @extra: ioctl extra data |
| 6406 | * |
| 6407 | * Return: 0 on success, non-zero on error |
| 6408 | */ |
| 6409 | static int __iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 6410 | union iwreq_data *wrqu, char *extra) |
| 6411 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6412 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6413 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6414 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6415 | int ret; |
| 6416 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6417 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6418 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6419 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6420 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6421 | if (0 != ret) |
| 6422 | return ret; |
| 6423 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6424 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6425 | if (0 != ret) |
| 6426 | return ret; |
| 6427 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6428 | if (wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 6429 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 6430 | |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6431 | hdd_err("Invalid Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6432 | |
| 6433 | return -EINVAL; |
| 6434 | } |
| 6435 | |
| 6436 | if (wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 6437 | |
| 6438 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 6439 | if (sme_cfg_set_int (hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 6440 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6441 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6442 | hdd_err("WNI_CFG_LONG_RETRY_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6443 | return -EIO; |
| 6444 | } |
| 6445 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 6446 | if (sme_cfg_set_int (hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 6447 | wrqu->retry.value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6448 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6449 | hdd_err("WNI_CFG_SHORT_RETRY_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6450 | return -EIO; |
| 6451 | } |
| 6452 | } |
| 6453 | } else { |
| 6454 | return -EOPNOTSUPP; |
| 6455 | } |
| 6456 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6457 | hdd_debug("Set Retry-Limit=%d!!", wrqu->retry.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6458 | |
| 6459 | EXIT(); |
| 6460 | |
| 6461 | return 0; |
| 6462 | |
| 6463 | } |
| 6464 | |
| 6465 | /** |
| 6466 | * iw_set_retry() - SSR wrapper for __iw_set_retry() |
| 6467 | * @dev: pointer to net_device |
| 6468 | * @info: pointer to iw_request_info |
| 6469 | * @wrqu: pointer to iwreq_data |
| 6470 | * @extra: pointer to extra ioctl payload |
| 6471 | * |
| 6472 | * Return: 0 on success, error number otherwise |
| 6473 | */ |
| 6474 | static int iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 6475 | union iwreq_data *wrqu, char *extra) |
| 6476 | { |
| 6477 | int ret; |
| 6478 | |
| 6479 | cds_ssr_protect(__func__); |
| 6480 | ret = __iw_set_retry(dev, info, wrqu, extra); |
| 6481 | cds_ssr_unprotect(__func__); |
| 6482 | |
| 6483 | return ret; |
| 6484 | } |
| 6485 | |
| 6486 | /** |
| 6487 | * __iw_get_retry() - SIOCGIWRETRY ioctl handler |
| 6488 | * @dev: device upon which the ioctl was received |
| 6489 | * @info: ioctl request information |
| 6490 | * @wrqu: ioctl request data |
| 6491 | * @extra: ioctl extra data |
| 6492 | * |
| 6493 | * Return: 0 on success, non-zero on error |
| 6494 | */ |
| 6495 | static int __iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 6496 | union iwreq_data *wrqu, char *extra) |
| 6497 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6498 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6499 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6500 | uint32_t retry = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6501 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6502 | int ret; |
| 6503 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6504 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6505 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6506 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6507 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6508 | if (0 != ret) |
| 6509 | return ret; |
| 6510 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6511 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6512 | if (0 != ret) |
| 6513 | return ret; |
| 6514 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6515 | if ((wrqu->retry.flags & IW_RETRY_LONG)) { |
| 6516 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 6517 | |
| 6518 | if (sme_cfg_get_int(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6519 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6520 | hdd_err("WNI_CFG_LONG_RETRY_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6521 | return -EIO; |
| 6522 | } |
| 6523 | |
| 6524 | wrqu->retry.value = retry; |
| 6525 | } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) { |
| 6526 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 6527 | |
| 6528 | if (sme_cfg_get_int(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6529 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6530 | hdd_err("WNI_CFG_SHORT_RETRY_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6531 | return -EIO; |
| 6532 | } |
| 6533 | |
| 6534 | wrqu->retry.value = retry; |
| 6535 | } else { |
| 6536 | return -EOPNOTSUPP; |
| 6537 | } |
| 6538 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6539 | hdd_debug("Retry-Limit=%d!!", retry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6540 | |
| 6541 | EXIT(); |
| 6542 | |
| 6543 | return 0; |
| 6544 | } |
| 6545 | |
| 6546 | /** |
| 6547 | * iw_get_retry() - SSR wrapper for __iw_get_retry() |
| 6548 | * @dev: pointer to net_device |
| 6549 | * @info: pointer to iw_request_info |
| 6550 | * @wrqu: pointer to iwreq_data |
| 6551 | * @extra: pointer to extra ioctl payload |
| 6552 | * |
| 6553 | * Return: 0 on success, error number otherwise |
| 6554 | */ |
| 6555 | static int iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 6556 | union iwreq_data *wrqu, char *extra) |
| 6557 | { |
| 6558 | int ret; |
| 6559 | |
| 6560 | cds_ssr_protect(__func__); |
| 6561 | ret = __iw_get_retry(dev, info, wrqu, extra); |
| 6562 | cds_ssr_unprotect(__func__); |
| 6563 | |
| 6564 | return ret; |
| 6565 | } |
| 6566 | |
| 6567 | /** |
| 6568 | * __iw_set_mlme() - SIOCSIWMLME ioctl handler |
| 6569 | * @dev: device upon which the ioctl was received |
| 6570 | * @info: ioctl request information |
| 6571 | * @wrqu: ioctl request data |
| 6572 | * @extra: ioctl extra data |
| 6573 | * |
| 6574 | * Return: 0 on success, non-zero on error |
| 6575 | */ |
| 6576 | static int __iw_set_mlme(struct net_device *dev, |
| 6577 | struct iw_request_info *info, |
| 6578 | union iwreq_data *wrqu, char *extra) |
| 6579 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6580 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6581 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6582 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6583 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6584 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6585 | int ret; |
| 6586 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6587 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6588 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6589 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6590 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6591 | if (0 != ret) |
| 6592 | return ret; |
| 6593 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6594 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6595 | if (0 != ret) |
| 6596 | return ret; |
| 6597 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6598 | /* reason_code is unused. By default it is set to |
| 6599 | * eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 6600 | */ |
| 6601 | switch (mlme->cmd) { |
| 6602 | case IW_MLME_DISASSOC: |
| 6603 | case IW_MLME_DEAUTH: |
| 6604 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6605 | if (sta_ctx->conn_info.connState == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6606 | eConnectionState_Associated) { |
| 6607 | eCsrRoamDisconnectReason reason = |
| 6608 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 6609 | |
| 6610 | if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE) |
| 6611 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 6612 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6613 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6614 | status = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6615 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter), |
| 6616 | adapter->sessionId, reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6617 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6618 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6619 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6620 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6621 | rc = wait_for_completion_timeout(&adapter-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6622 | disconnect_comp_var, |
| 6623 | msecs_to_jiffies |
| 6624 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 6625 | if (!rc) |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6626 | hdd_err("disconnect_comp_var failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6627 | } else |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6628 | hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d", |
| 6629 | (int)mlme->cmd, (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6630 | |
| 6631 | /* Resetting authKeyMgmt */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6632 | (WLAN_HDD_GET_WEXT_STATE_PTR(adapter))->authKeyMgmt = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6633 | 0; |
| 6634 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 6635 | hdd_debug("Disabling queues"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6636 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 6637 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6638 | WLAN_CONTROL_PATH); |
| 6639 | |
| 6640 | } else { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6641 | hdd_warn("%d Command Disassociate/Deauthenticate called but station is not in associated state", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6642 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6643 | } |
| 6644 | break; |
| 6645 | default: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6646 | hdd_err("Unexpected cmd: %d", (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6647 | return -EINVAL; |
| 6648 | } /* end of switch */ |
| 6649 | |
| 6650 | EXIT(); |
| 6651 | |
| 6652 | return status; |
| 6653 | |
| 6654 | } |
| 6655 | |
| 6656 | /** |
| 6657 | * iw_set_mlme() - SSR wrapper for __iw_set_mlme() |
| 6658 | * @dev: pointer to net_device |
| 6659 | * @info: pointer to iw_request_info |
| 6660 | * @wrqu: pointer to iwreq_data |
| 6661 | * @extra: pointer to extra ioctl payload |
| 6662 | * |
| 6663 | * Return: 0 on success, error number otherwise |
| 6664 | */ |
| 6665 | static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info, |
| 6666 | union iwreq_data *wrqu, char *extra) |
| 6667 | { |
| 6668 | int ret; |
| 6669 | |
| 6670 | cds_ssr_protect(__func__); |
| 6671 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 6672 | cds_ssr_unprotect(__func__); |
| 6673 | |
| 6674 | return ret; |
| 6675 | } |
| 6676 | |
| 6677 | /** |
| 6678 | * wlan_hdd_update_phymode() - handle change in PHY mode |
| 6679 | * @net: device upon which PHY mode change was received |
| 6680 | * @hal: umac handle for the driver |
| 6681 | * @new_phymode: new PHY mode for the device |
| 6682 | * @phddctx: pointer to the HDD context |
| 6683 | * |
| 6684 | * This function is called when the device is set to a new PHY mode. |
| 6685 | * It takes a holistic look at the desired PHY mode along with the |
| 6686 | * configured capabilities of the driver and the reported capabilities |
| 6687 | * of the hardware in order to correctly configure all PHY-related |
| 6688 | * parameters. |
| 6689 | * |
| 6690 | * Return: 0 on success, negative errno value on error |
| 6691 | */ |
| 6692 | int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 6693 | int new_phymode, struct hdd_context *phddctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6694 | { |
| 6695 | #ifdef QCA_HT_2040_COEX |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6696 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6697 | QDF_STATUS halStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6698 | #endif |
| 6699 | bool band_24 = false, band_5g = false; |
| 6700 | bool ch_bond24 = false, ch_bond5g = false; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6701 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6702 | uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6703 | uint32_t vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6704 | eCsrPhyMode phymode = -EIO, old_phymode; |
Srinivas Girigowda | 2fb677c | 2017-03-25 15:35:34 -0700 | [diff] [blame] | 6705 | enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6706 | eCsrBand curr_band = eCSR_BAND_ALL; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6707 | int retval = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6708 | |
| 6709 | old_phymode = sme_get_phy_mode(hal); |
| 6710 | |
| 6711 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 6712 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 6713 | nChannelBondingMode24GHz)) |
| 6714 | ch_bond24 = true; |
| 6715 | |
| 6716 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 6717 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 6718 | nChannelBondingMode5GHz)) |
| 6719 | ch_bond5g = true; |
| 6720 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6721 | if (phddctx->config->nBandCapability == eCSR_BAND_ALL) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6722 | band_24 = band_5g = true; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6723 | else if (phddctx->config->nBandCapability == eCSR_BAND_24) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6724 | band_24 = true; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6725 | else if (phddctx->config->nBandCapability == eCSR_BAND_5G) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6726 | band_5g = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6727 | |
| 6728 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6729 | hdd_debug("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] | 6730 | ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth); |
| 6731 | |
| 6732 | switch (new_phymode) { |
| 6733 | case IEEE80211_MODE_AUTO: |
| 6734 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6735 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6736 | phymode = eCSR_DOT11_MODE_AUTO; |
| 6737 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 6738 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6739 | curr_band = eCSR_BAND_ALL; |
| 6740 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 6741 | } else { |
| 6742 | sme_set_phy_mode(hal, old_phymode); |
| 6743 | return -EIO; |
| 6744 | } |
| 6745 | break; |
| 6746 | case IEEE80211_MODE_11A: |
| 6747 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6748 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6749 | phymode = eCSR_DOT11_MODE_11a; |
| 6750 | hdd_dot11mode = eHDD_DOT11_MODE_11a; |
| 6751 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6752 | curr_band = eCSR_BAND_5G; |
| 6753 | } else { |
| 6754 | sme_set_phy_mode(hal, old_phymode); |
| 6755 | return -EIO; |
| 6756 | } |
| 6757 | break; |
| 6758 | case IEEE80211_MODE_11B: |
| 6759 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6760 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6761 | phymode = eCSR_DOT11_MODE_11b; |
| 6762 | hdd_dot11mode = eHDD_DOT11_MODE_11b; |
| 6763 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6764 | curr_band = eCSR_BAND_24; |
| 6765 | } else { |
| 6766 | sme_set_phy_mode(hal, old_phymode); |
| 6767 | return -EIO; |
| 6768 | } |
| 6769 | break; |
| 6770 | case IEEE80211_MODE_11G: |
| 6771 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6772 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6773 | phymode = eCSR_DOT11_MODE_11g; |
| 6774 | hdd_dot11mode = eHDD_DOT11_MODE_11g; |
| 6775 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6776 | curr_band = eCSR_BAND_24; |
| 6777 | } else { |
| 6778 | sme_set_phy_mode(hal, old_phymode); |
| 6779 | return -EIO; |
| 6780 | } |
| 6781 | break; |
| 6782 | /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode |
| 6783 | * so setting phymode as eCSR_DOT11_MODE_11n and updating the band |
| 6784 | * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG |
| 6785 | */ |
| 6786 | case IEEE80211_MODE_11NA_HT20: |
| 6787 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6788 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6789 | phymode = eCSR_DOT11_MODE_11n; |
| 6790 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 6791 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6792 | curr_band = eCSR_BAND_5G; |
| 6793 | } else { |
| 6794 | sme_set_phy_mode(hal, old_phymode); |
| 6795 | return -EIO; |
| 6796 | } |
| 6797 | break; |
| 6798 | case IEEE80211_MODE_11NA_HT40: |
| 6799 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6800 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6801 | phymode = eCSR_DOT11_MODE_11n; |
| 6802 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 6803 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6804 | curr_band = eCSR_BAND_5G; |
| 6805 | } else { |
| 6806 | sme_set_phy_mode(hal, old_phymode); |
| 6807 | return -EIO; |
| 6808 | } |
| 6809 | break; |
| 6810 | case IEEE80211_MODE_11NG_HT20: |
| 6811 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6812 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6813 | phymode = eCSR_DOT11_MODE_11n; |
| 6814 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 6815 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6816 | curr_band = eCSR_BAND_24; |
| 6817 | } else { |
| 6818 | sme_set_phy_mode(hal, old_phymode); |
| 6819 | return -EIO; |
| 6820 | } |
| 6821 | break; |
| 6822 | case IEEE80211_MODE_11NG_HT40: |
| 6823 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6824 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6825 | phymode = eCSR_DOT11_MODE_11n; |
| 6826 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 6827 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6828 | curr_band = eCSR_BAND_24; |
| 6829 | } else { |
| 6830 | sme_set_phy_mode(hal, old_phymode); |
| 6831 | return -EIO; |
| 6832 | } |
| 6833 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6834 | case IEEE80211_MODE_11AC_VHT20: |
| 6835 | case IEEE80211_MODE_11AC_VHT40: |
| 6836 | case IEEE80211_MODE_11AC_VHT80: |
| 6837 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6838 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6839 | phymode = eCSR_DOT11_MODE_11ac; |
| 6840 | hdd_dot11mode = eHDD_DOT11_MODE_11ac; |
| 6841 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6842 | curr_band = eCSR_BAND_5G; |
| 6843 | } else { |
| 6844 | sme_set_phy_mode(hal, old_phymode); |
| 6845 | return -EIO; |
| 6846 | } |
| 6847 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6848 | case IEEE80211_MODE_2G_AUTO: |
| 6849 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6850 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6851 | phymode = eCSR_DOT11_MODE_AUTO; |
| 6852 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 6853 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6854 | curr_band = eCSR_BAND_24; |
| 6855 | } else { |
| 6856 | sme_set_phy_mode(hal, old_phymode); |
| 6857 | return -EIO; |
| 6858 | } |
| 6859 | break; |
| 6860 | case IEEE80211_MODE_5G_AUTO: |
| 6861 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6862 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6863 | phymode = eCSR_DOT11_MODE_AUTO; |
| 6864 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 6865 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6866 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 6867 | curr_band = eCSR_BAND_5G; |
| 6868 | } else { |
| 6869 | sme_set_phy_mode(hal, old_phymode); |
| 6870 | return -EIO; |
| 6871 | } |
| 6872 | break; |
| 6873 | case IEEE80211_MODE_11AGN: |
| 6874 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 6875 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6876 | phymode = eCSR_DOT11_MODE_11n; |
| 6877 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 6878 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 6879 | curr_band = eCSR_BAND_ALL; |
| 6880 | } else { |
| 6881 | sme_set_phy_mode(hal, old_phymode); |
| 6882 | return -EIO; |
| 6883 | } |
| 6884 | break; |
| 6885 | default: |
| 6886 | return -EIO; |
| 6887 | } |
| 6888 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6889 | switch (new_phymode) { |
| 6890 | case IEEE80211_MODE_11AC_VHT20: |
| 6891 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6892 | vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ; |
| 6893 | break; |
| 6894 | case IEEE80211_MODE_11AC_VHT40: |
| 6895 | vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ; |
| 6896 | break; |
| 6897 | case IEEE80211_MODE_11AC_VHT80: |
| 6898 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 6899 | break; |
| 6900 | default: |
| 6901 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
| 6902 | break; |
| 6903 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6904 | |
| 6905 | if (phymode != -EIO) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6906 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 6907 | if (!sme_config) { |
| 6908 | hdd_err("Failed to allocate memory for sme_config"); |
| 6909 | return -ENOMEM; |
| 6910 | } |
| 6911 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 6912 | sme_get_config_param(hal, sme_config); |
| 6913 | sme_config->csrConfig.phyMode = phymode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6914 | #ifdef QCA_HT_2040_COEX |
| 6915 | if (phymode == eCSR_DOT11_MODE_11n && |
| 6916 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6917 | sme_config->csrConfig.obssEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6918 | halStatus = sme_set_ht2040_mode(hal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6919 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6920 | eHT_CHAN_HT20, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6921 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6922 | hdd_err("Failed to disable OBSS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6923 | retval = -EIO; |
| 6924 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6925 | } |
| 6926 | } else if (phymode == eCSR_DOT11_MODE_11n && |
| 6927 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6928 | sme_config->csrConfig.obssEnabled = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6929 | halStatus = sme_set_ht2040_mode(hal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6930 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6931 | eHT_CHAN_HT20, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6932 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6933 | hdd_err("Failed to enable OBSS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6934 | retval = -EIO; |
| 6935 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6936 | } |
| 6937 | } |
| 6938 | #endif |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6939 | sme_config->csrConfig.eBand = curr_band; |
| 6940 | sme_config->csrConfig.bandCapability = curr_band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6941 | if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6942 | sme_config->csrConfig.Is11hSupportEnabled = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6943 | else |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6944 | sme_config->csrConfig.Is11hSupportEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6945 | phddctx->config->Is11hSupportEnabled; |
| 6946 | if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6947 | sme_config->csrConfig.channelBondingMode24GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6948 | else if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6949 | sme_config->csrConfig.channelBondingMode5GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6950 | else { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6951 | sme_config->csrConfig.channelBondingMode24GHz = chwidth; |
| 6952 | sme_config->csrConfig.channelBondingMode5GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6953 | } |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6954 | sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth; |
| 6955 | sme_update_config(hal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6956 | |
| 6957 | phddctx->config->dot11Mode = hdd_dot11mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6958 | phddctx->config->nChannelBondingMode24GHz = |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6959 | sme_config->csrConfig.channelBondingMode24GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6960 | phddctx->config->nChannelBondingMode5GHz = |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6961 | sme_config->csrConfig.channelBondingMode5GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6962 | phddctx->config->vhtChannelWidth = vhtchanwidth; |
Krunal Soni | df0f874 | 2016-09-26 14:56:31 -0700 | [diff] [blame] | 6963 | if (hdd_update_config_cfg(phddctx) == false) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6964 | hdd_err("could not update config_dat"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6965 | retval = -EIO; |
| 6966 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6967 | } |
Rajeev Kumar Sirasanagandla | 4c9b675 | 2017-07-25 20:35:20 +0530 | [diff] [blame] | 6968 | |
| 6969 | if (band_5g) { |
| 6970 | struct ieee80211_supported_band *band; |
| 6971 | |
| 6972 | band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]; |
| 6973 | if (phddctx->config->nChannelBondingMode5GHz) |
| 6974 | band->ht_cap.cap |= |
| 6975 | IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 6976 | else |
| 6977 | band->ht_cap.cap &= |
| 6978 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 6979 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6980 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6981 | hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6982 | phymode, chwidth, curr_band, vhtchanwidth); |
| 6983 | } |
| 6984 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6985 | free: |
| 6986 | if (sme_config) |
| 6987 | qdf_mem_free(sme_config); |
| 6988 | return retval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6989 | } |
| 6990 | |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6991 | struct temperature_priv { |
| 6992 | int temperature; |
| 6993 | }; |
| 6994 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6995 | /** |
| 6996 | * hdd_get_temperature_cb() - "Get Temperature" callback function |
| 6997 | * @temperature: measured temperature |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6998 | * @context: callback context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6999 | * |
| 7000 | * This function is passed to sme_get_temperature() as the callback |
| 7001 | * function to be invoked when the temperature measurement is |
| 7002 | * available. |
| 7003 | * |
| 7004 | * Return: None |
| 7005 | */ |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7006 | static void hdd_get_temperature_cb(int temperature, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7007 | { |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7008 | struct hdd_request *request; |
| 7009 | struct temperature_priv *priv; |
| 7010 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7011 | ENTER(); |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7012 | |
| 7013 | request = hdd_request_get(context); |
| 7014 | if (!request) { |
| 7015 | hdd_err("Obsolete request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7016 | return; |
| 7017 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7018 | |
| 7019 | priv = hdd_request_priv(request); |
| 7020 | priv->temperature = temperature; |
| 7021 | hdd_request_complete(request); |
| 7022 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7023 | EXIT(); |
| 7024 | } |
| 7025 | |
| 7026 | /** |
| 7027 | * wlan_hdd_get_temperature() - get current device temperature |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7028 | * @adapter: device upon which the request was made |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7029 | * @temperature: pointer to where the temperature is to be returned |
| 7030 | * |
| 7031 | * Return: 0 if a temperature value (either current or cached) was |
| 7032 | * returned, otherwise a negative errno is returned. |
| 7033 | * |
| 7034 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7035 | int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7036 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7037 | QDF_STATUS status; |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7038 | int ret; |
| 7039 | void *cookie; |
| 7040 | struct hdd_request *request; |
| 7041 | struct temperature_priv *priv; |
| 7042 | static const struct hdd_request_params params = { |
| 7043 | .priv_size = sizeof(*priv), |
| 7044 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 7045 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7046 | |
| 7047 | ENTER(); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7048 | if (NULL == adapter) { |
| 7049 | hdd_err("adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7050 | return -EPERM; |
| 7051 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7052 | |
| 7053 | request = hdd_request_alloc(¶ms); |
| 7054 | if (!request) { |
| 7055 | hdd_err("Request allocation failure"); |
| 7056 | return -ENOMEM; |
| 7057 | } |
| 7058 | cookie = hdd_request_cookie(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7059 | status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7060 | cookie, hdd_get_temperature_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7061 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7062 | hdd_err("Unable to retrieve temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7063 | } else { |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7064 | ret = hdd_request_wait_for_response(request); |
| 7065 | if (ret) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7066 | hdd_err("SME timed out while retrieving temperature"); |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7067 | } else { |
| 7068 | /* update the adapter with the fresh results */ |
| 7069 | priv = hdd_request_priv(request); |
| 7070 | if (priv->temperature) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7071 | adapter->temperature = priv->temperature; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7072 | } |
| 7073 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 7074 | |
| 7075 | /* |
| 7076 | * either we never sent a request, we sent a request and |
| 7077 | * received a response or we sent a request and timed out. |
| 7078 | * regardless we are done with the request. |
| 7079 | */ |
| 7080 | hdd_request_put(request); |
| 7081 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7082 | *temperature = adapter->temperature; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7083 | EXIT(); |
| 7084 | return 0; |
| 7085 | } |
| 7086 | |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 7087 | static int hdd_validate_pdev_reset(int value) |
| 7088 | { |
| 7089 | if ((value < 1) || (value > 5)) { |
| 7090 | hdd_warn(" Invalid value %d: Use any one of the below values\n" |
| 7091 | " TX_FLUSH = 1\n" |
| 7092 | " WARM_RESET = 2\n" |
| 7093 | " COLD_RESET = 3\n" |
| 7094 | " WARM_RESET_RESTORE_CAL = 4\n" |
| 7095 | " COLD_RESET_RESTORE_CAL = 5", value); |
| 7096 | |
| 7097 | return -EINVAL; |
| 7098 | } |
| 7099 | |
| 7100 | return 0; |
| 7101 | } |
| 7102 | |
| 7103 | static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value) |
| 7104 | { |
| 7105 | int ret; |
| 7106 | |
| 7107 | hdd_debug("%d", value); |
| 7108 | |
| 7109 | ret = hdd_validate_pdev_reset(value); |
| 7110 | if (ret) |
| 7111 | return ret; |
| 7112 | |
| 7113 | ret = wma_cli_set_command(adapter->sessionId, |
| 7114 | WMI_PDEV_PARAM_PDEV_RESET, |
| 7115 | value, PDEV_CMD); |
| 7116 | |
| 7117 | return ret; |
| 7118 | } |
| 7119 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7120 | /** |
| 7121 | * iw_setint_getnone() - Generic "set integer" private ioctl handler |
| 7122 | * @dev: device upon which the ioctl was received |
| 7123 | * @info: ioctl request information |
| 7124 | * @wrqu: ioctl request data |
| 7125 | * @extra: ioctl extra data |
| 7126 | * |
| 7127 | * Return: 0 on success, non-zero on error |
| 7128 | */ |
| 7129 | static int __iw_setint_getnone(struct net_device *dev, |
| 7130 | struct iw_request_info *info, |
| 7131 | union iwreq_data *wrqu, char *extra) |
| 7132 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7133 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7134 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 7135 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 7136 | struct hdd_context *hdd_ctx; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7137 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7138 | int *value = (int *)extra; |
| 7139 | int sub_cmd = value[0]; |
| 7140 | int set_value = value[1]; |
| 7141 | int ret; |
| 7142 | int enable_pbm, enable_mp; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7143 | QDF_STATUS status; |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7144 | void *soc = NULL; |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7145 | struct cdp_pdev *pdev = NULL; |
| 7146 | struct cdp_vdev *vdev = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7147 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7148 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7149 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7150 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7151 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7152 | if (0 != ret) |
| 7153 | return ret; |
| 7154 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 7155 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 7156 | if (0 != ret) |
| 7157 | return ret; |
| 7158 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7159 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 7160 | if (!sme_config) { |
| 7161 | hdd_err("failed to allocate memory for sme_config"); |
| 7162 | return -ENOMEM; |
| 7163 | } |
| 7164 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 7165 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7166 | switch (sub_cmd) { |
| 7167 | case WE_SET_11D_STATE: |
| 7168 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7169 | if (((ENABLE_11D == set_value) |
| 7170 | || (DISABLE_11D == set_value)) && hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7171 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7172 | sme_get_config_param(hHal, sme_config); |
| 7173 | sme_config->csrConfig.Is11dSupportEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7174 | (bool) set_value; |
| 7175 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7176 | hdd_debug("11D state=%d!!", |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7177 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7178 | Is11dSupportEnabled); |
| 7179 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7180 | sme_update_config(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7181 | } else { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7182 | ret = -EINVAL; |
| 7183 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7184 | } |
| 7185 | break; |
| 7186 | } |
| 7187 | |
| 7188 | case WE_WOWL: |
| 7189 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7190 | if (!hHal) |
| 7191 | return -EINVAL; |
| 7192 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7193 | switch (set_value) { |
| 7194 | case 0x00: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7195 | hdd_exit_wowl(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7196 | break; |
| 7197 | case 0x01: |
| 7198 | case 0x02: |
| 7199 | case 0x03: |
| 7200 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 7201 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7202 | hdd_debug("magic packet ? = %s pattern byte matching ? = %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7203 | (enable_mp ? "YES" : "NO"), |
| 7204 | (enable_pbm ? "YES" : "NO")); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7205 | hdd_enter_wowl(adapter, enable_mp, enable_pbm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7206 | break; |
| 7207 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7208 | hdd_err("Invalid arg %d in WE_WOWL IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7209 | set_value); |
| 7210 | ret = -EINVAL; |
| 7211 | break; |
| 7212 | } |
| 7213 | |
| 7214 | break; |
| 7215 | } |
| 7216 | case WE_SET_POWER: |
| 7217 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7218 | if (!hHal) |
| 7219 | return -EINVAL; |
| 7220 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7221 | switch (set_value) { |
| 7222 | case 1: |
| 7223 | /* Enable PowerSave */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7224 | sme_ps_enable_disable(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7225 | SME_PS_ENABLE); |
| 7226 | break; |
| 7227 | case 2: |
| 7228 | /* Disable PowerSave */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7229 | sme_ps_enable_disable(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7230 | SME_PS_DISABLE); |
| 7231 | break; |
| 7232 | case 3: /* Enable UASPD */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7233 | sme_ps_uapsd_enable(hHal, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7234 | break; |
| 7235 | case 4: /* Disable UASPD */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7236 | sme_ps_uapsd_disable(hHal, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7237 | break; |
| 7238 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7239 | hdd_err("Invalid arg %d in WE_SET_POWER IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7240 | set_value); |
| 7241 | ret = -EINVAL; |
| 7242 | break; |
| 7243 | } |
| 7244 | break; |
| 7245 | } |
| 7246 | |
| 7247 | case WE_SET_MAX_ASSOC: |
| 7248 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7249 | if (!hHal) |
| 7250 | return -EINVAL; |
| 7251 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7252 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 7253 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) { |
| 7254 | ret = -EINVAL; |
| 7255 | } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 7256 | set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7257 | != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7258 | hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7259 | ret = -EIO; |
| 7260 | } |
| 7261 | break; |
| 7262 | } |
| 7263 | |
| 7264 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 7265 | if (set_value == 0 || set_value == 1) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7266 | (WLAN_HDD_GET_CTX(adapter))->config->force_sap_acs = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7267 | set_value; |
| 7268 | else |
| 7269 | ret = -EINVAL; |
| 7270 | break; |
| 7271 | |
| 7272 | case WE_SET_DATA_INACTIVITY_TO: |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7273 | if (!hHal) |
| 7274 | return -EINVAL; |
| 7275 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7276 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 7277 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7278 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7279 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7280 | set_value) == QDF_STATUS_E_FAILURE)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7281 | hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7282 | ret = -EINVAL; |
| 7283 | } |
| 7284 | break; |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 7285 | case WE_SET_WOW_DATA_INACTIVITY_TO: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7286 | if (!hHal) { |
| 7287 | ret = -EINVAL; |
| 7288 | goto free; |
| 7289 | } |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 7290 | |
| 7291 | if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 7292 | (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7293 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal, |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 7294 | WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT, |
| 7295 | set_value) == QDF_STATUS_E_FAILURE)) { |
| 7296 | hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail"); |
| 7297 | ret = -EINVAL; |
| 7298 | } |
| 7299 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7300 | case WE_SET_MC_RATE: |
| 7301 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7302 | if (!hHal) |
| 7303 | return -EINVAL; |
| 7304 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7305 | ret = wlan_hdd_set_mc_rate(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7306 | break; |
| 7307 | } |
| 7308 | case WE_SET_TX_POWER: |
| 7309 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7310 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7311 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7312 | if (!hHal) |
| 7313 | return -EINVAL; |
| 7314 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 7315 | qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7316 | if (sme_set_tx_power |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7317 | (hHal, adapter->sessionId, bssid, |
| 7318 | adapter->device_mode, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7319 | set_value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7320 | hdd_err("Setting tx power failed"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7321 | ret = -EIO; |
| 7322 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7323 | } |
| 7324 | break; |
| 7325 | } |
| 7326 | case WE_SET_MAX_TX_POWER: |
| 7327 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7328 | struct qdf_mac_addr bssid; |
| 7329 | struct qdf_mac_addr selfMac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7330 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7331 | if (!hHal) |
| 7332 | return -EINVAL; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7333 | |
| 7334 | hdd_debug("Setting maximum tx power %d dBm", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7335 | set_value); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 7336 | qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId); |
| 7337 | qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7338 | |
| 7339 | if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7340 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7341 | hdd_err("Setting maximum tx power failed"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7342 | ret = -EIO; |
| 7343 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7344 | } |
| 7345 | |
| 7346 | break; |
| 7347 | } |
| 7348 | case WE_SET_MAX_TX_POWER_2_4: |
| 7349 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7350 | hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7351 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7352 | 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] | 7353 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7354 | hdd_err("Setting max tx power failed for 2.4 GHz band"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7355 | ret = -EIO; |
| 7356 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7357 | } |
| 7358 | |
| 7359 | break; |
| 7360 | } |
| 7361 | case WE_SET_MAX_TX_POWER_5_0: |
| 7362 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7363 | hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7364 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7365 | 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] | 7366 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7367 | hdd_err("Setting max tx power failed for 5.0 GHz band"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7368 | ret = -EIO; |
| 7369 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7370 | } |
| 7371 | |
| 7372 | break; |
| 7373 | } |
| 7374 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 7375 | { |
| 7376 | if (!((set_value == false) || (set_value == true))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7377 | hdd_err("Dynamic DTIM Incorrect data:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7378 | set_value); |
| 7379 | ret = -EINVAL; |
| 7380 | } else { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7381 | if (adapter->higherDtimTransition != set_value) { |
| 7382 | adapter->higherDtimTransition = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7383 | set_value; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7384 | hdd_debug("higherDtimTransition set to :%d", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7385 | adapter->higherDtimTransition); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7386 | } |
| 7387 | } |
| 7388 | |
| 7389 | break; |
| 7390 | } |
| 7391 | |
| 7392 | case WE_SET_TM_LEVEL: |
| 7393 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7394 | if (!hHal) |
| 7395 | return -EINVAL; |
| 7396 | |
| 7397 | hdd_notice("Set Thermal Mitigation Level %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7398 | (void)sme_set_thermal_level(hHal, set_value); |
| 7399 | break; |
| 7400 | } |
| 7401 | |
| 7402 | case WE_SET_PHYMODE: |
| 7403 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7404 | struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 7405 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7406 | if (!hHal) |
| 7407 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7408 | |
| 7409 | ret = |
| 7410 | wlan_hdd_update_phymode(dev, hHal, set_value, |
| 7411 | phddctx); |
| 7412 | break; |
| 7413 | } |
| 7414 | |
| 7415 | case WE_SET_NSS: |
| 7416 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7417 | if (!hHal) |
| 7418 | return -EINVAL; |
| 7419 | |
| 7420 | hdd_notice("Set NSS = %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7421 | if ((set_value > 2) || (set_value <= 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7422 | hdd_err("NSS greater than 2 not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7423 | ret = -EINVAL; |
| 7424 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7425 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7426 | hdd_update_nss(WLAN_HDD_GET_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7427 | set_value)) |
| 7428 | ret = -EINVAL; |
| 7429 | } |
| 7430 | break; |
| 7431 | } |
| 7432 | |
| 7433 | case WE_SET_GTX_HT_MCS: |
| 7434 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7435 | hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7436 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7437 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 7438 | set_value, GTX_CMD); |
| 7439 | break; |
| 7440 | } |
| 7441 | |
| 7442 | case WE_SET_GTX_VHT_MCS: |
| 7443 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7444 | hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7445 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7446 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7447 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 7448 | set_value, GTX_CMD); |
| 7449 | break; |
| 7450 | } |
| 7451 | |
| 7452 | case WE_SET_GTX_USRCFG: |
| 7453 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7454 | hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7455 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7456 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7457 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 7458 | set_value, GTX_CMD); |
| 7459 | break; |
| 7460 | } |
| 7461 | |
| 7462 | case WE_SET_GTX_THRE: |
| 7463 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7464 | hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7465 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7466 | WMI_VDEV_PARAM_GTX_THRE, |
| 7467 | set_value, GTX_CMD); |
| 7468 | break; |
| 7469 | } |
| 7470 | |
| 7471 | case WE_SET_GTX_MARGIN: |
| 7472 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7473 | hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7474 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7475 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 7476 | set_value, GTX_CMD); |
| 7477 | break; |
| 7478 | } |
| 7479 | |
| 7480 | case WE_SET_GTX_STEP: |
| 7481 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7482 | hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7483 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7484 | WMI_VDEV_PARAM_GTX_STEP, |
| 7485 | set_value, GTX_CMD); |
| 7486 | break; |
| 7487 | } |
| 7488 | |
| 7489 | case WE_SET_GTX_MINTPC: |
| 7490 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7491 | hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7492 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7493 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 7494 | set_value, GTX_CMD); |
| 7495 | break; |
| 7496 | } |
| 7497 | |
| 7498 | case WE_SET_GTX_BWMASK: |
| 7499 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7500 | hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7501 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7502 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 7503 | set_value, GTX_CMD); |
| 7504 | break; |
| 7505 | } |
| 7506 | |
| 7507 | case WE_SET_LDPC: |
| 7508 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7509 | if (!hHal) |
| 7510 | return -EINVAL; |
| 7511 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7512 | ret = hdd_set_ldpc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7513 | break; |
| 7514 | } |
| 7515 | |
| 7516 | case WE_SET_TX_STBC: |
| 7517 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7518 | if (!hHal) |
| 7519 | return -EINVAL; |
| 7520 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7521 | ret = hdd_set_tx_stbc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7522 | break; |
| 7523 | } |
| 7524 | |
| 7525 | case WE_SET_RX_STBC: |
| 7526 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7527 | if (!hHal) |
| 7528 | return -EINVAL; |
| 7529 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7530 | ret = hdd_set_rx_stbc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7531 | break; |
| 7532 | } |
| 7533 | |
| 7534 | case WE_SET_SHORT_GI: |
| 7535 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7536 | if (!hHal) |
| 7537 | return -EINVAL; |
| 7538 | |
| 7539 | hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7540 | ret = sme_update_ht_config(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7541 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ, |
| 7542 | set_value); |
| 7543 | if (ret) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7544 | hdd_err("Failed to set ShortGI value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7545 | break; |
| 7546 | } |
| 7547 | |
| 7548 | case WE_SET_RTSCTS: |
| 7549 | { |
| 7550 | uint32_t value; |
| 7551 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7552 | if (!hHal) |
| 7553 | return -EINVAL; |
| 7554 | |
| 7555 | hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7556 | set_value); |
| 7557 | |
| 7558 | if ((set_value & HDD_RTSCTS_EN_MASK) == |
| 7559 | HDD_RTSCTS_ENABLE) |
| 7560 | value = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7561 | (WLAN_HDD_GET_CTX(adapter))->config-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7562 | RTSThreshold; |
| 7563 | else if (((set_value & HDD_RTSCTS_EN_MASK) == 0) |
| 7564 | || ((set_value & HDD_RTSCTS_EN_MASK) == |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7565 | HDD_CTS_ENABLE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7566 | value = WNI_CFG_RTS_THRESHOLD_STAMAX; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7567 | } else { |
| 7568 | ret = -EIO; |
| 7569 | goto free; |
| 7570 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7571 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7572 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7573 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 7574 | set_value, VDEV_CMD); |
| 7575 | if (!ret) { |
| 7576 | if (sme_cfg_set_int |
| 7577 | (hHal, WNI_CFG_RTS_THRESHOLD, value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7578 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7579 | hdd_err("FAILED TO SET RTSCTS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7580 | ret = -EIO; |
| 7581 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7582 | } |
| 7583 | } |
| 7584 | |
| 7585 | break; |
| 7586 | } |
| 7587 | |
| 7588 | case WE_SET_CHWIDTH: |
| 7589 | { |
| 7590 | bool chwidth = false; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7591 | struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 7592 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7593 | if (!hHal) |
| 7594 | return -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7595 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7596 | /*updating channel bonding only on 5Ghz */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7597 | hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7598 | set_value); |
| 7599 | if (set_value > eHT_CHANNEL_WIDTH_80MHZ) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7600 | hdd_err("Invalid channel width 0->20 1->40 2->80"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7601 | ret = -EINVAL; |
| 7602 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7603 | } |
| 7604 | |
| 7605 | if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 7606 | csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config-> |
| 7607 | nChannelBondingMode5GHz))) |
| 7608 | chwidth = true; |
| 7609 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7610 | sme_get_config_param(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7611 | switch (set_value) { |
| 7612 | case eHT_CHANNEL_WIDTH_20MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7613 | sme_config->csrConfig.channelBondingMode5GHz = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7614 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 7615 | break; |
| 7616 | case eHT_CHANNEL_WIDTH_40MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7617 | if (chwidth) { |
| 7618 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7619 | channelBondingMode5GHz = |
| 7620 | phddctx->config-> |
| 7621 | nChannelBondingMode5GHz; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7622 | } else { |
| 7623 | ret = -EINVAL; |
| 7624 | goto free; |
| 7625 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7626 | |
| 7627 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7628 | case eHT_CHANNEL_WIDTH_80MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7629 | if (chwidth) { |
| 7630 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7631 | channelBondingMode5GHz = |
| 7632 | phddctx->config-> |
| 7633 | nChannelBondingMode5GHz; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7634 | } else { |
| 7635 | ret = -EINVAL; |
| 7636 | goto free; |
| 7637 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7638 | |
| 7639 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7640 | |
| 7641 | default: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7642 | ret = -EINVAL; |
| 7643 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7644 | } |
| 7645 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7646 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7647 | WMI_VDEV_PARAM_CHWIDTH, |
| 7648 | set_value, VDEV_CMD); |
| 7649 | if (!ret) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7650 | sme_update_config(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7651 | |
| 7652 | break; |
| 7653 | } |
| 7654 | |
| 7655 | case WE_SET_ANI_EN_DIS: |
| 7656 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7657 | hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7658 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7659 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7660 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 7661 | set_value, PDEV_CMD); |
| 7662 | break; |
| 7663 | } |
| 7664 | |
| 7665 | case WE_SET_ANI_POLL_PERIOD: |
| 7666 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7667 | hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7668 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7669 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7670 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 7671 | set_value, PDEV_CMD); |
| 7672 | break; |
| 7673 | } |
| 7674 | |
| 7675 | case WE_SET_ANI_LISTEN_PERIOD: |
| 7676 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7677 | hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7678 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7679 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7680 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 7681 | set_value, PDEV_CMD); |
| 7682 | break; |
| 7683 | } |
| 7684 | |
| 7685 | case WE_SET_ANI_OFDM_LEVEL: |
| 7686 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7687 | hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7688 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7689 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7690 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 7691 | set_value, PDEV_CMD); |
| 7692 | break; |
| 7693 | } |
| 7694 | |
| 7695 | case WE_SET_ANI_CCK_LEVEL: |
| 7696 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7697 | hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7699 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7700 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 7701 | set_value, PDEV_CMD); |
| 7702 | break; |
| 7703 | } |
| 7704 | |
| 7705 | case WE_SET_DYNAMIC_BW: |
| 7706 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7707 | hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7708 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7709 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7710 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 7711 | set_value, PDEV_CMD); |
| 7712 | break; |
| 7713 | } |
| 7714 | |
| 7715 | case WE_SET_CTS_CBW: |
| 7716 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7717 | hdd_debug("WE_SET_CTS_CBW val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7718 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7719 | WMI_PDEV_PARAM_CTS_CBW, |
| 7720 | set_value, PDEV_CMD); |
| 7721 | break; |
| 7722 | } |
| 7723 | |
| 7724 | case WE_SET_11N_RATE: |
| 7725 | { |
| 7726 | uint8_t preamble = 0, nss = 0, rix = 0; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7727 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7728 | hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7729 | set_value); |
| 7730 | |
| 7731 | if (set_value != 0xff) { |
| 7732 | rix = RC_2_RATE_IDX(set_value); |
| 7733 | if (set_value & 0x80) { |
| 7734 | preamble = WMI_RATE_PREAMBLE_HT; |
| 7735 | nss = HT_RC_2_STREAMS(set_value) - 1; |
| 7736 | } else { |
| 7737 | nss = 0; |
| 7738 | rix = RC_2_RATE_IDX(set_value); |
| 7739 | if (set_value & 0x10) { |
| 7740 | preamble = |
| 7741 | WMI_RATE_PREAMBLE_CCK; |
| 7742 | if (rix != 0x3) |
| 7743 | /* Enable Short |
| 7744 | * preamble always for |
| 7745 | * CCK except 1mbps |
| 7746 | */ |
| 7747 | rix |= 0x4; |
| 7748 | } else { |
| 7749 | preamble = |
| 7750 | WMI_RATE_PREAMBLE_OFDM; |
| 7751 | } |
| 7752 | } |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 7753 | set_value = hdd_assemble_rate_code(preamble, nss, rix); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7754 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7755 | hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7756 | set_value, rix, preamble, nss); |
| 7757 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7758 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7759 | WMI_VDEV_PARAM_FIXED_RATE, |
| 7760 | set_value, VDEV_CMD); |
| 7761 | break; |
| 7762 | } |
| 7763 | |
| 7764 | case WE_SET_VHT_RATE: |
| 7765 | { |
| 7766 | uint8_t preamble = 0, nss = 0, rix = 0; |
| 7767 | |
| 7768 | if (set_value != 0xff) { |
| 7769 | rix = RC_2_RATE_IDX_11AC(set_value); |
| 7770 | preamble = WMI_RATE_PREAMBLE_VHT; |
| 7771 | nss = HT_RC_2_STREAMS_11AC(set_value) - 1; |
| 7772 | |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 7773 | set_value = hdd_assemble_rate_code(preamble, nss, rix); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7774 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7775 | hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7776 | set_value, rix, preamble, nss); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7777 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7778 | WMI_VDEV_PARAM_FIXED_RATE, |
| 7779 | set_value, VDEV_CMD); |
| 7780 | break; |
| 7781 | } |
| 7782 | |
| 7783 | case WE_SET_AMPDU: |
| 7784 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7785 | hdd_debug("SET AMPDU val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7786 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7787 | GEN_VDEV_PARAM_AMPDU, |
| 7788 | set_value, GEN_CMD); |
| 7789 | break; |
| 7790 | } |
| 7791 | |
| 7792 | case WE_SET_AMSDU: |
| 7793 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7794 | hdd_debug("SET AMSDU val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7795 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7796 | GEN_VDEV_PARAM_AMSDU, |
| 7797 | set_value, GEN_CMD); |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 7798 | /* Update the stored ini value */ |
| 7799 | if (!ret) |
| 7800 | hdd_ctx->config->max_amsdu_num = set_value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7801 | break; |
| 7802 | } |
| 7803 | |
| 7804 | case WE_SET_BURST_ENABLE: |
| 7805 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7806 | hdd_debug("SET Burst enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7807 | if ((set_value == 0) || (set_value == 1)) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7808 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7809 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 7810 | set_value, PDEV_CMD); |
| 7811 | } else |
| 7812 | ret = -EINVAL; |
| 7813 | break; |
| 7814 | } |
| 7815 | case WE_SET_BURST_DUR: |
| 7816 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7817 | hdd_debug("SET Burst duration val %d", set_value); |
Jeff Johnson | da5ee77 | 2016-08-04 17:18:47 -0700 | [diff] [blame] | 7818 | if ((set_value > 0) && (set_value <= 102400)) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7819 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7820 | WMI_PDEV_PARAM_BURST_DUR, |
| 7821 | set_value, PDEV_CMD); |
| 7822 | else |
| 7823 | ret = -EINVAL; |
| 7824 | break; |
| 7825 | } |
| 7826 | |
| 7827 | case WE_SET_TX_CHAINMASK: |
| 7828 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7829 | hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7830 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7831 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7832 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 7833 | set_value, PDEV_CMD); |
| 7834 | break; |
| 7835 | } |
| 7836 | |
| 7837 | case WE_SET_RX_CHAINMASK: |
| 7838 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7839 | hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7840 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7841 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7842 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 7843 | set_value, PDEV_CMD); |
| 7844 | break; |
| 7845 | } |
| 7846 | |
| 7847 | case WE_SET_TXPOW_2G: |
| 7848 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7849 | hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7850 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7851 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7852 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 7853 | set_value, PDEV_CMD); |
| 7854 | break; |
| 7855 | } |
| 7856 | |
| 7857 | case WE_SET_TXPOW_5G: |
| 7858 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7859 | hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7860 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7861 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7862 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 7863 | set_value, PDEV_CMD); |
| 7864 | break; |
| 7865 | } |
| 7866 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7867 | /* Firmware debug log */ |
| 7868 | case WE_DBGLOG_LOG_LEVEL: |
| 7869 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7870 | hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7871 | hdd_ctx->fw_log_settings.dl_loglevel = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7872 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7873 | WMI_DBGLOG_LOG_LEVEL, |
| 7874 | set_value, DBG_CMD); |
| 7875 | break; |
| 7876 | } |
| 7877 | |
| 7878 | case WE_DBGLOG_VAP_ENABLE: |
| 7879 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7880 | hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7881 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7882 | WMI_DBGLOG_VAP_ENABLE, |
| 7883 | set_value, DBG_CMD); |
| 7884 | break; |
| 7885 | } |
| 7886 | |
| 7887 | case WE_DBGLOG_VAP_DISABLE: |
| 7888 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7889 | hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7890 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7891 | WMI_DBGLOG_VAP_DISABLE, |
| 7892 | set_value, DBG_CMD); |
| 7893 | break; |
| 7894 | } |
| 7895 | |
| 7896 | case WE_DBGLOG_MODULE_ENABLE: |
| 7897 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7898 | hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7899 | set_value); |
| 7900 | hdd_ctx->fw_log_settings.enable = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7901 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7902 | WMI_DBGLOG_MODULE_ENABLE, |
| 7903 | set_value, DBG_CMD); |
| 7904 | break; |
| 7905 | } |
| 7906 | |
| 7907 | case WE_DBGLOG_MODULE_DISABLE: |
| 7908 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7909 | hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7910 | set_value); |
| 7911 | hdd_ctx->fw_log_settings.enable = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7912 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7913 | WMI_DBGLOG_MODULE_DISABLE, |
| 7914 | set_value, DBG_CMD); |
| 7915 | break; |
| 7916 | } |
| 7917 | case WE_DBGLOG_MOD_LOG_LEVEL: |
| 7918 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7919 | hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7920 | set_value); |
| 7921 | |
| 7922 | if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL) |
| 7923 | hdd_ctx->fw_log_settings.index = 0; |
| 7924 | |
| 7925 | hdd_ctx->fw_log_settings. |
| 7926 | dl_mod_loglevel[hdd_ctx->fw_log_settings.index] = |
| 7927 | set_value; |
| 7928 | hdd_ctx->fw_log_settings.index++; |
| 7929 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7930 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7931 | WMI_DBGLOG_MOD_LOG_LEVEL, |
| 7932 | set_value, DBG_CMD); |
| 7933 | break; |
| 7934 | } |
| 7935 | |
| 7936 | case WE_DBGLOG_TYPE: |
| 7937 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7938 | hdd_debug("WE_DBGLOG_TYPE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7939 | hdd_ctx->fw_log_settings.dl_type = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7940 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7941 | WMI_DBGLOG_TYPE, |
| 7942 | set_value, DBG_CMD); |
| 7943 | break; |
| 7944 | } |
| 7945 | case WE_DBGLOG_REPORT_ENABLE: |
| 7946 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7947 | hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7948 | set_value); |
| 7949 | hdd_ctx->fw_log_settings.dl_report = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7950 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7951 | WMI_DBGLOG_REPORT_ENABLE, |
| 7952 | set_value, DBG_CMD); |
| 7953 | break; |
| 7954 | } |
| 7955 | |
| 7956 | case WE_SET_TXRX_FWSTATS: |
| 7957 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7958 | hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7959 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7960 | WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID, |
| 7961 | set_value, VDEV_CMD); |
| 7962 | break; |
| 7963 | } |
| 7964 | |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7965 | case WE_SET_TXRX_STATS: |
| 7966 | { |
| 7967 | hdd_notice("WE_SET_TXRX_STATS val %d", set_value); |
| 7968 | ret = cds_get_datapath_handles(&soc, &pdev, &vdev, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7969 | adapter->sessionId); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7970 | |
Venkata Sharath Chandra Manchala | bcdfdb1 | 2017-03-29 19:25:45 -0700 | [diff] [blame] | 7971 | if (ret != 0) { |
| 7972 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
| 7973 | "Invalid handles"); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7974 | break; |
Venkata Sharath Chandra Manchala | bcdfdb1 | 2017-03-29 19:25:45 -0700 | [diff] [blame] | 7975 | } |
| 7976 | ret = cdp_txrx_stats(soc, vdev, set_value); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7977 | break; |
| 7978 | } |
| 7979 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7980 | case WE_TXRX_FWSTATS_RESET: |
| 7981 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7982 | hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7983 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7984 | WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, |
| 7985 | set_value, VDEV_CMD); |
| 7986 | break; |
| 7987 | } |
| 7988 | |
| 7989 | case WE_DUMP_STATS: |
| 7990 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7991 | hdd_debug("WE_DUMP_STATS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7992 | ret = hdd_wlan_dump_stats(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7993 | break; |
| 7994 | } |
| 7995 | |
| 7996 | case WE_CLEAR_STATS: |
| 7997 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7998 | hdd_debug("WE_CLEAR_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7999 | switch (set_value) { |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 8000 | case CDP_HDD_STATS: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8001 | memset(&adapter->stats, 0, sizeof(adapter->stats)); |
| 8002 | memset(&adapter->hdd_stats, 0, |
| 8003 | sizeof(adapter->hdd_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8004 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 8005 | case CDP_TXRX_HIST_STATS: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8006 | wlan_hdd_clear_tx_rx_histogram(hdd_ctx); |
| 8007 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 8008 | case CDP_HDD_NETIF_OPER_HISTORY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8009 | wlan_hdd_clear_netif_queue_history(hdd_ctx); |
| 8010 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 8011 | case CDP_HIF_STATS: |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 8012 | hdd_clear_hif_stats(); |
| 8013 | break; |
Yun Park | 1027e8c | 2017-10-13 15:17:37 -0700 | [diff] [blame] | 8014 | case CDP_NAPI_STATS: |
| 8015 | hdd_clear_napi_stats(); |
| 8016 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8017 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 8018 | cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 8019 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8020 | } |
| 8021 | break; |
| 8022 | } |
| 8023 | |
| 8024 | case WE_PPS_PAID_MATCH: |
| 8025 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8026 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8027 | ret = -EINVAL; |
| 8028 | goto free; |
| 8029 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8030 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8031 | hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8032 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8033 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8034 | WMI_VDEV_PPS_PAID_MATCH, |
| 8035 | set_value, PPS_CMD); |
| 8036 | break; |
| 8037 | } |
| 8038 | |
| 8039 | case WE_PPS_GID_MATCH: |
| 8040 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8041 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8042 | ret = -EINVAL; |
| 8043 | goto free; |
| 8044 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8045 | hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8046 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8047 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8048 | WMI_VDEV_PPS_GID_MATCH, |
| 8049 | set_value, PPS_CMD); |
| 8050 | break; |
| 8051 | } |
| 8052 | |
| 8053 | case WE_PPS_EARLY_TIM_CLEAR: |
| 8054 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8055 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8056 | ret = -EINVAL; |
| 8057 | goto free; |
| 8058 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8059 | hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8060 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8061 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8062 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 8063 | set_value, PPS_CMD); |
| 8064 | break; |
| 8065 | } |
| 8066 | |
| 8067 | case WE_PPS_EARLY_DTIM_CLEAR: |
| 8068 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8069 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8070 | ret = -EINVAL; |
| 8071 | goto free; |
| 8072 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8073 | hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8074 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8075 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8076 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 8077 | set_value, PPS_CMD); |
| 8078 | break; |
| 8079 | } |
| 8080 | |
| 8081 | case WE_PPS_EOF_PAD_DELIM: |
| 8082 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8083 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8084 | ret = -EINVAL; |
| 8085 | goto free; |
| 8086 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8087 | hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8088 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8089 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8090 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 8091 | set_value, PPS_CMD); |
| 8092 | break; |
| 8093 | } |
| 8094 | |
| 8095 | case WE_PPS_MACADDR_MISMATCH: |
| 8096 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8097 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8098 | ret = -EINVAL; |
| 8099 | goto free; |
| 8100 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8101 | hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8102 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8103 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8104 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 8105 | set_value, PPS_CMD); |
| 8106 | break; |
| 8107 | } |
| 8108 | |
| 8109 | case WE_PPS_DELIM_CRC_FAIL: |
| 8110 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8111 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8112 | ret = -EINVAL; |
| 8113 | goto free; |
| 8114 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8115 | hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8116 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8117 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8118 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 8119 | set_value, PPS_CMD); |
| 8120 | break; |
| 8121 | } |
| 8122 | |
| 8123 | case WE_PPS_GID_NSTS_ZERO: |
| 8124 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8125 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8126 | ret = -EINVAL; |
| 8127 | goto free; |
| 8128 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8129 | hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8130 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8131 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8132 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 8133 | set_value, PPS_CMD); |
| 8134 | break; |
| 8135 | } |
| 8136 | |
| 8137 | case WE_PPS_RSSI_CHECK: |
| 8138 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8139 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8140 | ret = -EINVAL; |
| 8141 | goto free; |
| 8142 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8143 | hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8144 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8145 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8146 | WMI_VDEV_PPS_RSSI_CHECK, |
| 8147 | set_value, PPS_CMD); |
| 8148 | break; |
| 8149 | } |
| 8150 | |
| 8151 | case WE_PPS_5G_EBT: |
| 8152 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8153 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8154 | ret = -EINVAL; |
| 8155 | goto free; |
| 8156 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8157 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8158 | hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8159 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8160 | WMI_VDEV_PPS_5G_EBT, |
| 8161 | set_value, PPS_CMD); |
| 8162 | break; |
| 8163 | } |
| 8164 | |
| 8165 | case WE_SET_HTSMPS: |
| 8166 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8167 | hdd_debug("WE_SET_HTSMPS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8168 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8169 | WMI_STA_SMPS_FORCE_MODE_CMDID, |
| 8170 | set_value, VDEV_CMD); |
| 8171 | break; |
| 8172 | } |
| 8173 | |
| 8174 | case WE_SET_QPOWER_MAX_PSPOLL_COUNT: |
| 8175 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8176 | hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8177 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8178 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8179 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 8180 | set_value, QPOWER_CMD); |
| 8181 | break; |
| 8182 | } |
| 8183 | |
| 8184 | case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 8185 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8186 | hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8187 | set_value); |
| 8188 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8189 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8190 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 8191 | set_value, QPOWER_CMD); |
| 8192 | break; |
| 8193 | } |
| 8194 | |
| 8195 | case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 8196 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8197 | hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8198 | set_value); |
| 8199 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8200 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8201 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 8202 | set_value, QPOWER_CMD); |
| 8203 | break; |
| 8204 | } |
| 8205 | |
| 8206 | case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 8207 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8208 | hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8209 | set_value); |
| 8210 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8211 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8212 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 8213 | set_value, QPOWER_CMD); |
| 8214 | break; |
| 8215 | } |
| 8216 | |
| 8217 | case WE_MCC_CONFIG_LATENCY: |
| 8218 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8219 | wlan_hdd_set_mcc_latency(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8220 | break; |
| 8221 | } |
| 8222 | |
| 8223 | case WE_MCC_CONFIG_QUOTA: |
| 8224 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8225 | hdd_debug("iwpriv cmd to set MCC quota with val %dms", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8226 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8227 | ret = wlan_hdd_set_mcc_p2p_quota(adapter, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 8228 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8229 | break; |
| 8230 | } |
| 8231 | case WE_SET_DEBUG_LOG: |
| 8232 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8233 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 8234 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 8235 | if (!hHal) |
| 8236 | return -EINVAL; |
| 8237 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 8238 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8239 | hdd_ctx->config->gEnableDebugLog = set_value; |
| 8240 | sme_update_connect_debug(hdd_ctx->hHal, set_value); |
| 8241 | break; |
| 8242 | } |
| 8243 | case WE_SET_EARLY_RX_ADJUST_ENABLE: |
| 8244 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8245 | hdd_debug("SET early_rx enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8246 | if ((set_value == 0) || (set_value == 1)) |
| 8247 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8248 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8249 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, |
| 8250 | set_value, VDEV_CMD); |
| 8251 | else |
| 8252 | ret = -EINVAL; |
| 8253 | break; |
| 8254 | } |
| 8255 | case WE_SET_EARLY_RX_TGT_BMISS_NUM: |
| 8256 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8257 | hdd_debug("SET early_rx bmiss val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8258 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8259 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, |
| 8260 | set_value, VDEV_CMD); |
| 8261 | break; |
| 8262 | } |
| 8263 | case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 8264 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8265 | hdd_debug("SET early_rx bmiss sample cycle %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8266 | set_value); |
| 8267 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8268 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8269 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 8270 | set_value, VDEV_CMD); |
| 8271 | break; |
| 8272 | } |
| 8273 | case WE_SET_EARLY_RX_SLOP_STEP: |
| 8274 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8275 | hdd_debug("SET early_rx bmiss slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8276 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8277 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8278 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP, |
| 8279 | set_value, VDEV_CMD); |
| 8280 | break; |
| 8281 | } |
| 8282 | case WE_SET_EARLY_RX_INIT_SLOP: |
| 8283 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8284 | hdd_debug("SET early_rx init slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8285 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8286 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8287 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP, |
| 8288 | set_value, VDEV_CMD); |
| 8289 | break; |
| 8290 | } |
| 8291 | case WE_SET_EARLY_RX_ADJUST_PAUSE: |
| 8292 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8293 | hdd_debug("SET early_rx adjust pause %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8294 | if ((set_value == 0) || (set_value == 1)) |
| 8295 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8296 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8297 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, |
| 8298 | set_value, VDEV_CMD); |
| 8299 | else |
| 8300 | ret = -EINVAL; |
| 8301 | break; |
| 8302 | } |
| 8303 | case WE_SET_EARLY_RX_DRIFT_SAMPLE: |
| 8304 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8305 | hdd_debug("SET early_rx drift sample %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8306 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8307 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE, |
| 8308 | set_value, VDEV_CMD); |
| 8309 | break; |
| 8310 | } |
| 8311 | case WE_SET_SCAN_DISABLE: |
| 8312 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 8313 | if (!hHal) |
| 8314 | return -EINVAL; |
| 8315 | |
| 8316 | hdd_notice("SET SCAN DISABLE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8317 | sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(adapter), set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8318 | break; |
| 8319 | } |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 8320 | case WE_START_FW_PROFILE: |
| 8321 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8322 | hdd_debug("WE_START_FW_PROFILE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8323 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 8324 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 8325 | set_value, DBG_CMD); |
| 8326 | break; |
| 8327 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8328 | case WE_SET_CHANNEL: |
| 8329 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8330 | hdd_debug("Set Channel %d Session ID %d mode %d", set_value, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8331 | adapter->sessionId, adapter->device_mode); |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 8332 | if (!hHal) |
| 8333 | return -EINVAL; |
| 8334 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8335 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8336 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 8337 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8338 | |
| 8339 | status = sme_ext_change_channel(hHal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8340 | set_value, adapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8341 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8342 | hdd_err("Error in change channel status %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8343 | status); |
| 8344 | ret = -EINVAL; |
| 8345 | } |
| 8346 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8347 | hdd_err("change channel not supported for device mode %d", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8348 | adapter->device_mode); |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8349 | ret = -EINVAL; |
| 8350 | } |
| 8351 | break; |
| 8352 | } |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 8353 | case WE_SET_CONC_SYSTEM_PREF: |
| 8354 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8355 | hdd_debug("New preference: %d", set_value); |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 8356 | if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) && |
| 8357 | (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) { |
| 8358 | hdd_err("Invalid system preference %d", set_value); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8359 | ret = -EINVAL; |
| 8360 | goto free; |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 8361 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 8362 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 8363 | /* hdd_ctx, hdd_ctx->config are already checked for null */ |
| 8364 | hdd_ctx->config->conc_system_pref = set_value; |
| 8365 | break; |
| 8366 | } |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 8367 | case WE_SET_11AX_RATE: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8368 | ret = hdd_set_11ax_rate(adapter, set_value, NULL); |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 8369 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 8370 | case WE_SET_DCM: |
| 8371 | hdd_notice("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8372 | ret = wma_cli_set_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 8373 | WMI_VDEV_PARAM_HE_DCM, set_value, |
| 8374 | VDEV_CMD); |
| 8375 | break; |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 8376 | case WE_SET_RANGE_EXT: |
| 8377 | hdd_notice("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8378 | ret = wma_cli_set_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 8379 | WMI_VDEV_PARAM_HE_RANGE_EXT, |
| 8380 | set_value, VDEV_CMD); |
| 8381 | break; |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 8382 | case WE_SET_PDEV_RESET: |
| 8383 | ret = hdd_handle_pdev_reset(adapter, set_value); |
| 8384 | break; |
SaidiReddy Yenuga | a92f8cc | 2017-03-24 15:15:03 +0530 | [diff] [blame] | 8385 | case WE_SET_MODULATED_DTIM: |
| 8386 | { |
| 8387 | if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) || |
| 8388 | (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) { |
| 8389 | hdd_err("Invalid gEnableModuleDTIM value %d", |
| 8390 | set_value); |
| 8391 | return -EINVAL; |
| 8392 | } else { |
| 8393 | hdd_ctx->config->enableModulatedDTIM = set_value; |
| 8394 | } |
| 8395 | break; |
| 8396 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8397 | default: |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 8398 | hdd_err("Invalid sub command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8399 | ret = -EINVAL; |
| 8400 | break; |
| 8401 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8402 | EXIT(); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8403 | free: |
| 8404 | qdf_mem_free(sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8405 | return ret; |
| 8406 | } |
| 8407 | |
| 8408 | static int iw_setint_getnone(struct net_device *dev, |
| 8409 | struct iw_request_info *info, |
| 8410 | union iwreq_data *wrqu, |
| 8411 | char *extra) |
| 8412 | { |
| 8413 | int ret; |
| 8414 | |
| 8415 | cds_ssr_protect(__func__); |
| 8416 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 8417 | cds_ssr_unprotect(__func__); |
| 8418 | |
| 8419 | return ret; |
| 8420 | } |
| 8421 | |
| 8422 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 8423 | * __iw_setnone_get_threeint() - return three value to up layer. |
| 8424 | * |
| 8425 | * @dev: pointer of net_device of this wireless card |
| 8426 | * @info: meta data about Request sent |
| 8427 | * @wrqu: include request info |
| 8428 | * @extra: buf used for in/Output |
| 8429 | * |
| 8430 | * Return: execute result |
| 8431 | */ |
| 8432 | static int __iw_setnone_get_threeint(struct net_device *dev, |
| 8433 | struct iw_request_info *info, |
| 8434 | union iwreq_data *wrqu, char *extra) |
| 8435 | { |
| 8436 | int ret = 0; /* success */ |
| 8437 | uint32_t *value = (int *)extra; |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 8438 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 8439 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 8440 | |
| 8441 | ENTER_DEV(dev); |
| 8442 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8443 | if (0 != ret) |
| 8444 | return ret; |
| 8445 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 8446 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 8447 | if (0 != ret) |
| 8448 | return ret; |
| 8449 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8450 | hdd_debug("param = %d", value[0]); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 8451 | switch (value[0]) { |
| 8452 | case WE_GET_TSF: |
| 8453 | ret = hdd_indicate_tsf(adapter, value, 3); |
| 8454 | break; |
| 8455 | default: |
| 8456 | hdd_err("Invalid IOCTL get_value command %d", value[0]); |
| 8457 | break; |
| 8458 | } |
| 8459 | return ret; |
| 8460 | } |
| 8461 | |
| 8462 | /** |
| 8463 | * iw_setnone_get_threeint() - return three value to up layer. |
| 8464 | * |
| 8465 | * @dev: pointer of net_device of this wireless card |
| 8466 | * @info: meta data about Request sent |
| 8467 | * @wrqu: include request info |
| 8468 | * @extra: buf used for in/Output |
| 8469 | * |
| 8470 | * Return: execute result |
| 8471 | */ |
| 8472 | static int iw_setnone_get_threeint(struct net_device *dev, |
| 8473 | struct iw_request_info *info, |
| 8474 | union iwreq_data *wrqu, char *extra) |
| 8475 | { |
| 8476 | int ret; |
| 8477 | |
| 8478 | cds_ssr_protect(__func__); |
| 8479 | ret = __iw_setnone_get_threeint(dev, info, wrqu, extra); |
| 8480 | cds_ssr_unprotect(__func__); |
| 8481 | |
| 8482 | return ret; |
| 8483 | } |
| 8484 | |
| 8485 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8486 | * iw_setchar_getnone() - Generic "set string" private ioctl handler |
| 8487 | * @dev: device upon which the ioctl was received |
| 8488 | * @info: ioctl request information |
| 8489 | * @wrqu: ioctl request data |
| 8490 | * @extra: ioctl extra data |
| 8491 | * |
| 8492 | * Return: 0 on success, non-zero on error |
| 8493 | */ |
| 8494 | static int __iw_setchar_getnone(struct net_device *dev, |
| 8495 | struct iw_request_info *info, |
| 8496 | union iwreq_data *wrqu, char *extra) |
| 8497 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8498 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8499 | int sub_cmd; |
| 8500 | int ret; |
| 8501 | char *pBuffer = NULL; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8502 | struct hdd_adapter *adapter = (netdev_priv(dev)); |
| 8503 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8504 | struct hdd_config *pConfig = hdd_ctx->config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8505 | struct iw_point s_priv_data; |
| 8506 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8507 | ENTER_DEV(dev); |
| 8508 | |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 8509 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8510 | hdd_err("permission check failed"); |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 8511 | return -EPERM; |
| 8512 | } |
| 8513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8514 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8515 | if (0 != ret) |
| 8516 | return ret; |
| 8517 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 8518 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 8519 | if (0 != ret) |
| 8520 | return ret; |
| 8521 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8522 | /* helper function to get iwreq_data with compat handling. */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8523 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8524 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8525 | |
| 8526 | /* make sure all params are correctly passed to function */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8527 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8528 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8529 | |
| 8530 | sub_cmd = s_priv_data.flags; |
| 8531 | |
| 8532 | /* ODD number is used for set, copy data using copy_from_user */ |
| 8533 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 8534 | s_priv_data.length); |
| 8535 | if (NULL == pBuffer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8536 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8537 | return -ENOMEM; |
| 8538 | } |
| 8539 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8540 | hdd_debug("Received length: %d data: %s", |
| 8541 | s_priv_data.length, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8542 | |
| 8543 | switch (sub_cmd) { |
| 8544 | case WE_WOWL_ADD_PTRN: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8545 | hdd_debug("ADD_PTRN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8546 | hdd_add_wowl_ptrn(adapter, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8547 | break; |
| 8548 | case WE_WOWL_DEL_PTRN: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8549 | hdd_debug("DEL_PTRN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8550 | hdd_del_wowl_ptrn(adapter, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8551 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8552 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 8553 | { |
| 8554 | tRrmNeighborReq neighborReq; |
| 8555 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 8556 | |
| 8557 | if (pConfig->fRrmEnable) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8558 | hdd_debug("Neighbor Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8559 | neighborReq.no_ssid = |
| 8560 | (s_priv_data.length - 1) ? false : true; |
| 8561 | if (!neighborReq.no_ssid) { |
| 8562 | neighborReq.ssid.length = |
| 8563 | (s_priv_data.length - 1) > |
| 8564 | 32 ? 32 : (s_priv_data.length - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8565 | qdf_mem_copy(neighborReq.ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8566 | pBuffer, |
| 8567 | neighborReq.ssid.length); |
| 8568 | } |
| 8569 | |
| 8570 | callbackInfo.neighborRspCallback = NULL; |
| 8571 | callbackInfo.neighborRspCallbackContext = NULL; |
| 8572 | callbackInfo.timeout = 5000; /* 5 seconds */ |
| 8573 | sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8574 | (adapter), |
| 8575 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8576 | &neighborReq, |
| 8577 | &callbackInfo); |
| 8578 | } else { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8579 | hdd_err("Ignoring neighbor request as RRM not enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8580 | ret = -EINVAL; |
| 8581 | } |
| 8582 | } |
| 8583 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8584 | case WE_SET_AP_WPS_IE: |
Wu Gao | 02bd75b | 2017-10-13 18:34:02 +0800 | [diff] [blame] | 8585 | hdd_debug("Received WE_SET_AP_WPS_IE, won't process"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8586 | break; |
| 8587 | case WE_SET_CONFIG: |
| 8588 | vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8589 | if (QDF_STATUS_SUCCESS != vstatus) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8590 | ret = -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8591 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8592 | break; |
| 8593 | default: |
| 8594 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8595 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8596 | sub_cmd); |
| 8597 | ret = -EINVAL; |
| 8598 | break; |
| 8599 | } |
| 8600 | } |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 8601 | qdf_mem_free(pBuffer); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8602 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8603 | return ret; |
| 8604 | } |
| 8605 | |
| 8606 | static int iw_setchar_getnone(struct net_device *dev, |
| 8607 | struct iw_request_info *info, |
| 8608 | union iwreq_data *wrqu, char *extra) |
| 8609 | { |
| 8610 | int ret; |
| 8611 | |
| 8612 | cds_ssr_protect(__func__); |
| 8613 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 8614 | cds_ssr_unprotect(__func__); |
| 8615 | |
| 8616 | return ret; |
| 8617 | } |
| 8618 | |
| 8619 | /** |
| 8620 | * iw_setnone_getint() - Generic "get integer" private ioctl handler |
| 8621 | * @dev: device upon which the ioctl was received |
| 8622 | * @info: ioctl request information |
| 8623 | * @wrqu: ioctl request data |
| 8624 | * @extra: ioctl extra data |
| 8625 | * |
| 8626 | * Return: 0 on success, non-zero on error |
| 8627 | */ |
| 8628 | static int __iw_setnone_getint(struct net_device *dev, |
| 8629 | struct iw_request_info *info, |
| 8630 | union iwreq_data *wrqu, char *extra) |
| 8631 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8632 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8633 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8634 | int *value = (int *)extra; |
| 8635 | int ret; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8636 | tSmeConfigParams *sme_config; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 8637 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8638 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8639 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 8640 | if (!sme_config) { |
| 8641 | hdd_err("failed to allocate memory for sme_config"); |
| 8642 | return -ENOMEM; |
| 8643 | } |
| 8644 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 8645 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8646 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8647 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8648 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8649 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8650 | if (0 != ret) |
| 8651 | return ret; |
| 8652 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 8653 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 8654 | if (0 != ret) |
| 8655 | return ret; |
| 8656 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8657 | switch (value[0]) { |
| 8658 | case WE_GET_11D_STATE: |
| 8659 | { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8660 | sme_get_config_param(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8661 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8662 | *value = sme_config->csrConfig.Is11dSupportEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8663 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8664 | hdd_debug("11D state=%d!!", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8665 | |
| 8666 | break; |
| 8667 | } |
| 8668 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8669 | case WE_GET_WLAN_DBG: |
| 8670 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8671 | qdf_trace_display(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8672 | *value = 0; |
| 8673 | break; |
| 8674 | } |
| 8675 | case WE_GET_MAX_ASSOC: |
| 8676 | { |
| 8677 | if (sme_cfg_get_int |
| 8678 | (hHal, WNI_CFG_ASSOC_STA_LIMIT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8679 | (uint32_t *) value) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8680 | hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8681 | ret = -EIO; |
| 8682 | } |
| 8683 | break; |
| 8684 | } |
| 8685 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 8686 | *value = (WLAN_HDD_GET_CTX( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8687 | adapter))->config->force_sap_acs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8688 | break; |
| 8689 | |
| 8690 | case WE_GET_CONCURRENCY_MODE: |
| 8691 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 8692 | *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8693 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8694 | hdd_debug("concurrency mode=%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8695 | break; |
| 8696 | } |
| 8697 | |
| 8698 | case WE_GET_NSS: |
| 8699 | { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8700 | sme_get_config_param(hHal, sme_config); |
| 8701 | *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2; |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 8702 | if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc)) |
| 8703 | *value = *value - 1; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8704 | hdd_debug("GET_NSS: Current NSS:%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8705 | break; |
| 8706 | } |
| 8707 | |
| 8708 | case WE_GET_GTX_HT_MCS: |
| 8709 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8710 | hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8711 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8712 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 8713 | GTX_CMD); |
| 8714 | break; |
| 8715 | } |
| 8716 | |
| 8717 | case WE_GET_GTX_VHT_MCS: |
| 8718 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8719 | hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8720 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8721 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 8722 | GTX_CMD); |
| 8723 | break; |
| 8724 | } |
| 8725 | |
| 8726 | case WE_GET_GTX_USRCFG: |
| 8727 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8728 | hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8729 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8730 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 8731 | GTX_CMD); |
| 8732 | break; |
| 8733 | } |
| 8734 | |
| 8735 | case WE_GET_GTX_THRE: |
| 8736 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8737 | hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8738 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8739 | WMI_VDEV_PARAM_GTX_THRE, |
| 8740 | GTX_CMD); |
| 8741 | break; |
| 8742 | } |
| 8743 | |
| 8744 | case WE_GET_GTX_MARGIN: |
| 8745 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8746 | hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8747 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8748 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 8749 | GTX_CMD); |
| 8750 | break; |
| 8751 | } |
| 8752 | |
| 8753 | case WE_GET_GTX_STEP: |
| 8754 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8755 | hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8756 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8757 | WMI_VDEV_PARAM_GTX_STEP, |
| 8758 | GTX_CMD); |
| 8759 | break; |
| 8760 | } |
| 8761 | |
| 8762 | case WE_GET_GTX_MINTPC: |
| 8763 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8764 | hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8765 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8766 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 8767 | GTX_CMD); |
| 8768 | break; |
| 8769 | } |
| 8770 | |
| 8771 | case WE_GET_GTX_BWMASK: |
| 8772 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8773 | hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8774 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8775 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 8776 | GTX_CMD); |
| 8777 | break; |
| 8778 | } |
| 8779 | |
| 8780 | case WE_GET_LDPC: |
| 8781 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8782 | ret = hdd_get_ldpc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8783 | break; |
| 8784 | } |
| 8785 | |
| 8786 | case WE_GET_TX_STBC: |
| 8787 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8788 | ret = hdd_get_tx_stbc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8789 | break; |
| 8790 | } |
| 8791 | |
| 8792 | case WE_GET_RX_STBC: |
| 8793 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8794 | ret = hdd_get_rx_stbc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8795 | break; |
| 8796 | } |
| 8797 | |
| 8798 | case WE_GET_SHORT_GI: |
| 8799 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8800 | hdd_debug("GET WMI_VDEV_PARAM_SGI"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8801 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 8802 | WMI_VDEV_PARAM_SGI, |
| 8803 | VDEV_CMD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8804 | break; |
| 8805 | } |
| 8806 | |
| 8807 | case WE_GET_RTSCTS: |
| 8808 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8809 | hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8810 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8811 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 8812 | VDEV_CMD); |
| 8813 | break; |
| 8814 | } |
| 8815 | |
| 8816 | case WE_GET_CHWIDTH: |
| 8817 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8818 | hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8819 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8820 | WMI_VDEV_PARAM_CHWIDTH, |
| 8821 | VDEV_CMD); |
| 8822 | break; |
| 8823 | } |
| 8824 | |
| 8825 | case WE_GET_ANI_EN_DIS: |
| 8826 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8827 | hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8828 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8829 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 8830 | PDEV_CMD); |
| 8831 | break; |
| 8832 | } |
| 8833 | |
| 8834 | case WE_GET_ANI_POLL_PERIOD: |
| 8835 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8836 | hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8837 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8838 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 8839 | PDEV_CMD); |
| 8840 | break; |
| 8841 | } |
| 8842 | |
| 8843 | case WE_GET_ANI_LISTEN_PERIOD: |
| 8844 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8845 | hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8846 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8847 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 8848 | PDEV_CMD); |
| 8849 | break; |
| 8850 | } |
| 8851 | |
| 8852 | case WE_GET_ANI_OFDM_LEVEL: |
| 8853 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8854 | hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8855 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8856 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 8857 | PDEV_CMD); |
| 8858 | break; |
| 8859 | } |
| 8860 | |
| 8861 | case WE_GET_ANI_CCK_LEVEL: |
| 8862 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8863 | hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8864 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8865 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 8866 | PDEV_CMD); |
| 8867 | break; |
| 8868 | } |
| 8869 | |
| 8870 | case WE_GET_DYNAMIC_BW: |
| 8871 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8872 | hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8873 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8874 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 8875 | PDEV_CMD); |
| 8876 | break; |
| 8877 | } |
| 8878 | |
| 8879 | case WE_GET_11N_RATE: |
| 8880 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8881 | hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8882 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8883 | WMI_VDEV_PARAM_FIXED_RATE, |
| 8884 | VDEV_CMD); |
| 8885 | break; |
| 8886 | } |
| 8887 | |
| 8888 | case WE_GET_AMPDU: |
| 8889 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8890 | hdd_debug("GET AMPDU"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8891 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8892 | GEN_VDEV_PARAM_AMPDU, |
| 8893 | GEN_CMD); |
| 8894 | break; |
| 8895 | } |
| 8896 | |
| 8897 | case WE_GET_AMSDU: |
| 8898 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8899 | hdd_debug("GET AMSDU"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8900 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8901 | GEN_VDEV_PARAM_AMSDU, |
| 8902 | GEN_CMD); |
| 8903 | break; |
| 8904 | } |
| 8905 | |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 8906 | case WE_GET_ROAM_SYNCH_DELAY: |
| 8907 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8908 | hdd_debug("GET ROAM SYNCH DELAY"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8909 | *value = wma_cli_get_command(adapter->sessionId, |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 8910 | GEN_VDEV_ROAM_SYNCH_DELAY, |
| 8911 | GEN_CMD); |
| 8912 | break; |
| 8913 | } |
| 8914 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8915 | case WE_GET_BURST_ENABLE: |
| 8916 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8917 | hdd_debug("GET Burst enable value"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8918 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8919 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 8920 | PDEV_CMD); |
| 8921 | break; |
| 8922 | } |
| 8923 | case WE_GET_BURST_DUR: |
| 8924 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8925 | hdd_debug("GET Burst Duration value"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8926 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8927 | WMI_PDEV_PARAM_BURST_DUR, |
| 8928 | PDEV_CMD); |
| 8929 | break; |
| 8930 | } |
| 8931 | |
| 8932 | case WE_GET_TX_CHAINMASK: |
| 8933 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8934 | hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8935 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8936 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 8937 | PDEV_CMD); |
| 8938 | break; |
| 8939 | } |
| 8940 | |
| 8941 | case WE_GET_RX_CHAINMASK: |
| 8942 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8943 | hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8944 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8945 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 8946 | PDEV_CMD); |
| 8947 | break; |
| 8948 | } |
| 8949 | |
| 8950 | case WE_GET_TXPOW_2G: |
| 8951 | { |
| 8952 | uint32_t txpow2g = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8953 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8954 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8955 | hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8956 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8957 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 8958 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8959 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8960 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 8961 | &txpow2g)) { |
| 8962 | return -EIO; |
| 8963 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8964 | hdd_debug("2G tx_power %d", txpow2g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8965 | break; |
| 8966 | } |
| 8967 | |
| 8968 | case WE_GET_TXPOW_5G: |
| 8969 | { |
| 8970 | uint32_t txpow5g = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8971 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8972 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8973 | hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8974 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8975 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 8976 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8977 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8978 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 8979 | &txpow5g)) { |
| 8980 | return -EIO; |
| 8981 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8982 | hdd_debug("5G tx_power %d", txpow5g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8983 | break; |
| 8984 | } |
| 8985 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8986 | case WE_GET_PPS_PAID_MATCH: |
| 8987 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8988 | hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8989 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8990 | WMI_VDEV_PPS_PAID_MATCH, |
| 8991 | PPS_CMD); |
| 8992 | break; |
| 8993 | } |
| 8994 | |
| 8995 | case WE_GET_PPS_GID_MATCH: |
| 8996 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8997 | hdd_debug("GET WMI_VDEV_PPS_GID_MATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8998 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8999 | WMI_VDEV_PPS_GID_MATCH, |
| 9000 | PPS_CMD); |
| 9001 | break; |
| 9002 | } |
| 9003 | |
| 9004 | case WE_GET_PPS_EARLY_TIM_CLEAR: |
| 9005 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9006 | hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9007 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9008 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 9009 | PPS_CMD); |
| 9010 | break; |
| 9011 | } |
| 9012 | |
| 9013 | case WE_GET_PPS_EARLY_DTIM_CLEAR: |
| 9014 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9015 | hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9016 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9017 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 9018 | PPS_CMD); |
| 9019 | break; |
| 9020 | } |
| 9021 | |
| 9022 | case WE_GET_PPS_EOF_PAD_DELIM: |
| 9023 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9024 | hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9025 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9026 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 9027 | PPS_CMD); |
| 9028 | break; |
| 9029 | } |
| 9030 | |
| 9031 | case WE_GET_PPS_MACADDR_MISMATCH: |
| 9032 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9033 | hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9034 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9035 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 9036 | PPS_CMD); |
| 9037 | break; |
| 9038 | } |
| 9039 | |
| 9040 | case WE_GET_PPS_DELIM_CRC_FAIL: |
| 9041 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9042 | hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9043 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9044 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 9045 | PPS_CMD); |
| 9046 | break; |
| 9047 | } |
| 9048 | |
| 9049 | case WE_GET_PPS_GID_NSTS_ZERO: |
| 9050 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9051 | hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9052 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9053 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 9054 | PPS_CMD); |
| 9055 | break; |
| 9056 | } |
| 9057 | |
| 9058 | case WE_GET_PPS_RSSI_CHECK: |
| 9059 | { |
| 9060 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9061 | hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9062 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9063 | WMI_VDEV_PPS_RSSI_CHECK, |
| 9064 | PPS_CMD); |
| 9065 | break; |
| 9066 | } |
| 9067 | |
| 9068 | case WE_GET_QPOWER_MAX_PSPOLL_COUNT: |
| 9069 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9070 | hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9071 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9072 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 9073 | QPOWER_CMD); |
| 9074 | break; |
| 9075 | } |
| 9076 | |
| 9077 | case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 9078 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9079 | hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9080 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9081 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 9082 | QPOWER_CMD); |
| 9083 | break; |
| 9084 | } |
| 9085 | |
| 9086 | case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 9087 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9088 | hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9089 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9090 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 9091 | QPOWER_CMD); |
| 9092 | break; |
| 9093 | } |
| 9094 | |
| 9095 | case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 9096 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9097 | hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9098 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9099 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 9100 | QPOWER_CMD); |
| 9101 | break; |
| 9102 | } |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 9103 | case WE_CAP_TSF: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9104 | ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 9105 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9106 | case WE_GET_TEMPERATURE: |
| 9107 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9108 | hdd_debug("WE_GET_TEMPERATURE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9109 | ret = wlan_hdd_get_temperature(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9110 | break; |
| 9111 | } |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 9112 | case WE_GET_DCM: |
| 9113 | hdd_notice("GET WMI_VDEV_PARAM_HE_DCM"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9114 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 9115 | WMI_VDEV_PARAM_HE_DCM, |
| 9116 | VDEV_CMD); |
| 9117 | break; |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 9118 | case WE_GET_RANGE_EXT: |
| 9119 | hdd_notice("GET WMI_VDEV_PARAM_HE_RANGE_EXT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9120 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 9121 | WMI_VDEV_PARAM_HE_RANGE_EXT, |
| 9122 | VDEV_CMD); |
| 9123 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9124 | default: |
| 9125 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9126 | hdd_err("Invalid IOCTL get_value command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9127 | value[0]); |
| 9128 | break; |
| 9129 | } |
| 9130 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9131 | EXIT(); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 9132 | qdf_mem_free(sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9133 | return ret; |
| 9134 | } |
| 9135 | |
| 9136 | static int iw_setnone_getint(struct net_device *dev, |
| 9137 | struct iw_request_info *info, |
| 9138 | union iwreq_data *wrqu, char *extra) |
| 9139 | { |
| 9140 | int ret; |
| 9141 | |
| 9142 | cds_ssr_protect(__func__); |
| 9143 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 9144 | cds_ssr_unprotect(__func__); |
| 9145 | |
| 9146 | return ret; |
| 9147 | } |
| 9148 | |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 9149 | static int hdd_set_fwtest(int argc, int cmd, int value) |
| 9150 | { |
| 9151 | struct set_fwtest_params *fw_test; |
| 9152 | |
| 9153 | /* check for max number of arguments */ |
| 9154 | if (argc > (WMA_MAX_NUM_ARGS) || |
| 9155 | argc != HDD_FWTEST_PARAMS) { |
| 9156 | hdd_err("Too Many args %d", argc); |
| 9157 | return -EINVAL; |
| 9158 | } |
| 9159 | /* |
| 9160 | * check if number of arguments are 3 then, check |
| 9161 | * then set the default value for sounding interval. |
| 9162 | */ |
| 9163 | if (HDD_FWTEST_PARAMS == argc) { |
| 9164 | if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value) |
| 9165 | value = HDD_FWTEST_SU_DEFAULT_VALUE; |
| 9166 | if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value) |
| 9167 | value = HDD_FWTEST_MU_DEFAULT_VALUE; |
| 9168 | } |
| 9169 | /* check sounding interval value should not exceed to max */ |
| 9170 | if (value > HDD_FWTEST_MAX_VALUE) { |
| 9171 | hdd_err("Invalid arguments value should not exceed max: %d", |
| 9172 | value); |
| 9173 | return -EINVAL; |
| 9174 | } |
| 9175 | fw_test = qdf_mem_malloc(sizeof(*fw_test)); |
| 9176 | if (NULL == fw_test) { |
| 9177 | hdd_err("qdf_mem_malloc failed for fw_test"); |
| 9178 | return -ENOMEM; |
| 9179 | } |
| 9180 | fw_test->arg = cmd; |
| 9181 | fw_test->value = value; |
| 9182 | if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) { |
| 9183 | qdf_mem_free(fw_test); |
| 9184 | hdd_err("Not able to post FW_TEST_CMD message to WMA"); |
| 9185 | return -EINVAL; |
| 9186 | } |
| 9187 | return 0; |
| 9188 | } |
| 9189 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9190 | /** |
| 9191 | * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler |
| 9192 | * @dev: device upon which the ioctl was received |
| 9193 | * @info: ioctl request information |
| 9194 | * @wrqu: ioctl request data |
| 9195 | * @extra: ioctl extra data |
| 9196 | * |
| 9197 | * Return: 0 on success, non-zero on error |
| 9198 | */ |
| 9199 | static int __iw_set_three_ints_getnone(struct net_device *dev, |
| 9200 | struct iw_request_info *info, |
| 9201 | union iwreq_data *wrqu, char *extra) |
| 9202 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9203 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9204 | int *value = (int *)extra; |
| 9205 | int sub_cmd = value[0]; |
| 9206 | int ret; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9207 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9208 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9209 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9210 | |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 9211 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9212 | hdd_err("permission check failed"); |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 9213 | return -EPERM; |
| 9214 | } |
| 9215 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9216 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9217 | if (0 != ret) |
| 9218 | return ret; |
| 9219 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9220 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9221 | if (0 != ret) |
| 9222 | return ret; |
| 9223 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9224 | switch (sub_cmd) { |
| 9225 | |
| 9226 | case WE_SET_WLAN_DBG: |
Dustin Brown | 36e2e5c | 2017-05-16 15:41:37 -0700 | [diff] [blame] | 9227 | qdf_print_set_category_verbose(qdf_get_pidx(), value[1], |
| 9228 | value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9229 | break; |
| 9230 | case WE_SET_DP_TRACE: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9231 | qdf_dp_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9232 | break; |
| 9233 | |
| 9234 | /* value[3] the acs band is not required as start and end channels are |
| 9235 | * enough but this cmd is maintained under set three ints for historic |
| 9236 | * reasons. |
| 9237 | */ |
| 9238 | case WE_SET_SAP_CHANNELS: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9239 | if (wlan_hdd_validate_operation_channel(adapter, value[1]) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9240 | QDF_STATUS_SUCCESS || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9241 | wlan_hdd_validate_operation_channel(adapter, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9242 | value[2]) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9243 | ret = -EINVAL; |
| 9244 | } else { |
| 9245 | hdd_ctx->config->force_sap_acs_st_ch = value[1]; |
| 9246 | hdd_ctx->config->force_sap_acs_end_ch = value[2]; |
| 9247 | } |
| 9248 | break; |
| 9249 | case WE_SET_DUAL_MAC_SCAN_CONFIG: |
| 9250 | hdd_debug("Ioctl to set dual mac scan config"); |
Tushnim Bhattacharyya | 49ed8ab | 2017-05-26 18:20:10 -0700 | [diff] [blame] | 9251 | if (hdd_ctx->config->dual_mac_feature_disable == |
| 9252 | DISABLE_DBS_CXN_AND_SCAN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9253 | hdd_err("Dual mac feature is disabled from INI"); |
| 9254 | return -EPERM; |
| 9255 | } |
| 9256 | hdd_debug("%d %d %d", value[1], value[2], value[3]); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9257 | policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc, |
| 9258 | value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9259 | break; |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 9260 | case WE_SET_FW_TEST: |
| 9261 | { |
| 9262 | ret = hdd_set_fwtest(value[1], value[2], value[3]); |
| 9263 | if (ret) { |
| 9264 | hdd_err("Not able to set fwtest %d", ret); |
| 9265 | return ret; |
| 9266 | } |
| 9267 | } |
| 9268 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9269 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9270 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9271 | break; |
| 9272 | |
| 9273 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9274 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9275 | return ret; |
| 9276 | } |
| 9277 | |
| 9278 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 9279 | struct iw_request_info *info, |
| 9280 | union iwreq_data *wrqu, char *extra) |
| 9281 | { |
| 9282 | int ret; |
| 9283 | |
| 9284 | cds_ssr_protect(__func__); |
| 9285 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 9286 | cds_ssr_unprotect(__func__); |
| 9287 | |
| 9288 | return ret; |
| 9289 | } |
| 9290 | |
| 9291 | /** |
| 9292 | * hdd_connection_state_string() - Get connection state string |
| 9293 | * @connection_state: enum to be converted to a string |
| 9294 | * |
| 9295 | * Return: the string equivalent of @connection_state |
| 9296 | */ |
| 9297 | static const char * |
| 9298 | hdd_connection_state_string(eConnectionState connection_state) |
| 9299 | { |
| 9300 | switch (connection_state) { |
| 9301 | CASE_RETURN_STRING(eConnectionState_NotConnected); |
| 9302 | CASE_RETURN_STRING(eConnectionState_Connecting); |
| 9303 | CASE_RETURN_STRING(eConnectionState_Associated); |
| 9304 | CASE_RETURN_STRING(eConnectionState_IbssDisconnected); |
| 9305 | CASE_RETURN_STRING(eConnectionState_IbssConnected); |
| 9306 | CASE_RETURN_STRING(eConnectionState_Disconnecting); |
| 9307 | default: |
| 9308 | return "UNKNOWN"; |
| 9309 | } |
| 9310 | } |
| 9311 | |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 9312 | #if defined(FEATURE_OEM_DATA_SUPPORT) |
| 9313 | /** |
| 9314 | * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new |
| 9315 | * wifi_pos api to get oem data caps |
| 9316 | * @dev: net device upon which the request was received |
| 9317 | * @info: ioctl request information |
| 9318 | * @wrqu: ioctl request data |
| 9319 | * @extra: ioctl data payload |
| 9320 | * |
| 9321 | * Return: 0 for success, negative errno value on failure |
| 9322 | */ |
| 9323 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 9324 | struct iw_request_info *info, |
| 9325 | union iwreq_data *wrqu, char *extra) |
| 9326 | { |
| 9327 | return iw_get_oem_data_cap(dev, info, wrqu, extra); |
| 9328 | } |
| 9329 | #elif defined(WIFI_POS_CONVERGED) |
| 9330 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 9331 | struct iw_request_info *info, |
| 9332 | union iwreq_data *wrqu, char *extra) |
| 9333 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 9334 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9335 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 9336 | |
| 9337 | return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc, |
| 9338 | (struct wifi_pos_driver_caps *)extra); |
| 9339 | } |
| 9340 | #else |
| 9341 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 9342 | struct iw_request_info *info, |
| 9343 | union iwreq_data *wrqu, char *extra) |
| 9344 | { |
| 9345 | return -ENOTSUPP; |
| 9346 | } |
| 9347 | #endif |
| 9348 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9349 | /** |
| 9350 | * iw_get_char_setnone() - Generic "get string" private ioctl handler |
| 9351 | * @dev: device upon which the ioctl was received |
| 9352 | * @info: ioctl request information |
| 9353 | * @wrqu: ioctl request data |
| 9354 | * @extra: ioctl extra data |
| 9355 | * |
| 9356 | * Return: 0 on success, non-zero on error |
| 9357 | */ |
| 9358 | static int __iw_get_char_setnone(struct net_device *dev, |
| 9359 | struct iw_request_info *info, |
| 9360 | union iwreq_data *wrqu, char *extra) |
| 9361 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9362 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9363 | int sub_cmd = wrqu->data.flags; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9364 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9365 | int ret; |
| 9366 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 9367 | struct hdd_wext_state *pWextState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9368 | #endif |
| 9369 | |
| 9370 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9371 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9372 | #endif |
| 9373 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9374 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9375 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9376 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9377 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9378 | if (0 != ret) |
| 9379 | return ret; |
| 9380 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9381 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9382 | if (0 != ret) |
| 9383 | return ret; |
| 9384 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9385 | switch (sub_cmd) { |
| 9386 | case WE_WLAN_VERSION: |
| 9387 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 9388 | hdd_wlan_get_version(hdd_ctx, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9389 | break; |
| 9390 | } |
| 9391 | |
| 9392 | case WE_GET_STATS: |
| 9393 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9394 | hdd_wlan_get_stats(adapter, &(wrqu->data.length), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9395 | extra, WE_MAX_STR_LEN); |
| 9396 | break; |
| 9397 | } |
| 9398 | |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 9399 | case WE_GET_SUSPEND_RESUME_STATS: |
| 9400 | { |
| 9401 | ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra, |
| 9402 | WE_MAX_STR_LEN); |
| 9403 | if (ret >= 0) { |
| 9404 | wrqu->data.length = ret; |
| 9405 | ret = 0; |
| 9406 | } |
| 9407 | |
| 9408 | break; |
| 9409 | } |
| 9410 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9411 | case WE_LIST_FW_PROFILE: |
| 9412 | hdd_wlan_list_fw_profile(&(wrqu->data.length), |
| 9413 | extra, WE_MAX_STR_LEN); |
| 9414 | break; |
| 9415 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9416 | /* The case prints the current state of the HDD, SME, CSR, PE, |
| 9417 | * TL it can be extended for WDI Global State as well. And |
| 9418 | * currently it only checks P2P_CLIENT adapter. P2P_DEVICE |
| 9419 | * and P2P_GO have not been added as of now. |
| 9420 | */ |
| 9421 | case WE_GET_STATES: |
| 9422 | { |
| 9423 | int buf = 0, len = 0; |
| 9424 | int adapter_num = 0; |
| 9425 | int count = 0, check = 1; |
| 9426 | |
| 9427 | tHalHandle hHal = NULL; |
| 9428 | tpAniSirGlobal pMac = NULL; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9429 | struct hdd_station_ctx *sta_ctx = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9430 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9431 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 9432 | struct hdd_adapter *useAdapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9433 | |
| 9434 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 9435 | * by using the correct adapter |
| 9436 | */ |
| 9437 | while (adapter_num < 2) { |
| 9438 | if (WLAN_ADAPTER == adapter_num) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9439 | useAdapter = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9440 | buf = |
| 9441 | scnprintf(extra + len, |
| 9442 | WE_MAX_STR_LEN - len, |
| 9443 | "\n\n wlan0 States:-"); |
| 9444 | len += buf; |
| 9445 | } else if (P2P_ADAPTER == adapter_num) { |
| 9446 | buf = |
| 9447 | scnprintf(extra + len, |
| 9448 | WE_MAX_STR_LEN - len, |
| 9449 | "\n\n p2p0 States:-"); |
| 9450 | len += buf; |
| 9451 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9452 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9453 | buf = |
| 9454 | scnprintf(extra + len, |
| 9455 | WE_MAX_STR_LEN - |
| 9456 | len, |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9457 | "\n hdd_ctx is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9458 | len += buf; |
| 9459 | break; |
| 9460 | } |
| 9461 | |
| 9462 | /* Printing p2p0 states only in the |
| 9463 | * case when the device is configured |
| 9464 | * as a p2p_client |
| 9465 | */ |
| 9466 | useAdapter = |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9467 | hdd_get_adapter(hdd_ctx, |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 9468 | QDF_P2P_CLIENT_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9469 | if (!useAdapter) { |
| 9470 | buf = |
| 9471 | scnprintf(extra + len, |
| 9472 | WE_MAX_STR_LEN - |
| 9473 | len, |
| 9474 | "\n Device not configured as P2P_CLIENT."); |
| 9475 | len += buf; |
| 9476 | break; |
| 9477 | } |
| 9478 | } |
| 9479 | |
| 9480 | hHal = WLAN_HDD_GET_HAL_CTX(useAdapter); |
| 9481 | if (!hHal) { |
| 9482 | buf = |
| 9483 | scnprintf(extra + len, |
| 9484 | WE_MAX_STR_LEN - len, |
| 9485 | "\n pMac is NULL"); |
| 9486 | len += buf; |
| 9487 | break; |
| 9488 | } |
| 9489 | pMac = PMAC_STRUCT(hHal); |
| 9490 | if (!pMac) { |
| 9491 | buf = |
| 9492 | scnprintf(extra + len, |
| 9493 | WE_MAX_STR_LEN - len, |
| 9494 | "\n pMac is NULL"); |
| 9495 | len += buf; |
| 9496 | break; |
| 9497 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9498 | sta_ctx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9499 | WLAN_HDD_GET_STATION_CTX_PTR(useAdapter); |
| 9500 | |
| 9501 | |
| 9502 | buf = |
| 9503 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 9504 | "\n HDD Conn State - %s " |
| 9505 | "\n \n SME State:" |
| 9506 | "\n Neighbour Roam State - %s" |
| 9507 | "\n CSR State - %s" |
| 9508 | "\n CSR Substate - %s", |
| 9509 | hdd_connection_state_string |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9510 | (sta_ctx->conn_info.connState), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9511 | mac_trace_get_neighbour_roam_state |
| 9512 | (sme_get_neighbor_roam_state |
| 9513 | (hHal, useAdapter->sessionId)), |
| 9514 | mac_trace_getcsr_roam_state |
| 9515 | (sme_get_current_roam_state |
| 9516 | (hHal, useAdapter->sessionId)), |
| 9517 | mac_trace_getcsr_roam_sub_state |
| 9518 | (sme_get_current_roam_sub_state |
| 9519 | (hHal, useAdapter->sessionId)) |
| 9520 | ); |
| 9521 | len += buf; |
| 9522 | adapter_num++; |
| 9523 | } |
| 9524 | |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 9525 | if (hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9526 | /* Printing Lim State starting with global lim states */ |
| 9527 | buf = |
| 9528 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 9529 | "\n \n LIM STATES:-" |
| 9530 | "\n Global Sme State - %s " |
| 9531 | "\n Global mlm State - %s " "\n", |
| 9532 | mac_trace_get_lim_sme_state |
| 9533 | (sme_get_lim_sme_state(hHal)), |
| 9534 | mac_trace_get_lim_mlm_state |
| 9535 | (sme_get_lim_sme_state(hHal)) |
| 9536 | ); |
| 9537 | len += buf; |
| 9538 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9539 | while (check < 3 && count < 255) { |
| 9540 | if (sme_is_lim_session_valid(hHal, count)) { |
| 9541 | buf = |
| 9542 | scnprintf(extra + len, |
| 9543 | WE_MAX_STR_LEN - |
| 9544 | len, |
| 9545 | "\n Lim Valid Session %d:-" |
| 9546 | "\n PE Sme State - %s " |
| 9547 | "\n PE Mlm State - %s " |
| 9548 | "\n", check, |
| 9549 | mac_trace_get_lim_sme_state |
| 9550 | (sme_get_lim_sme_session_state |
| 9551 | (hHal, count)), |
| 9552 | mac_trace_get_lim_mlm_state |
| 9553 | (sme_get_lim_mlm_session_state |
| 9554 | (hHal, count)) |
| 9555 | ); |
| 9556 | |
| 9557 | len += buf; |
| 9558 | check++; |
| 9559 | } |
| 9560 | count++; |
| 9561 | } |
| 9562 | } |
| 9563 | |
| 9564 | wrqu->data.length = strlen(extra) + 1; |
| 9565 | break; |
| 9566 | } |
| 9567 | |
| 9568 | case WE_GET_CFG: |
| 9569 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9570 | hdd_debug("Printing CLD global INI Config"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9571 | hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9572 | extra, |
| 9573 | QCSAP_IOCTL_MAX_STR_LEN); |
| 9574 | wrqu->data.length = strlen(extra) + 1; |
| 9575 | break; |
| 9576 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9577 | case WE_GET_RSSI: |
| 9578 | { |
| 9579 | int8_t s7Rssi = 0; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9580 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9581 | wlan_hdd_get_rssi(adapter, &s7Rssi); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9582 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 9583 | wrqu->data.length = strlen(extra) + 1; |
| 9584 | break; |
| 9585 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9586 | |
| 9587 | case WE_GET_WMM_STATUS: |
| 9588 | { |
| 9589 | snprintf(extra, WE_MAX_STR_LEN, |
| 9590 | "\nDir: 0=up, 1=down, 3=both\n" |
| 9591 | "|------------------------|\n" |
| 9592 | "|AC | ACM |Admitted| Dir |\n" |
| 9593 | "|------------------------|\n" |
| 9594 | "|VO | %d | %3s | %d |\n" |
| 9595 | "|VI | %d | %3s | %d |\n" |
| 9596 | "|BE | %d | %3s | %d |\n" |
| 9597 | "|BK | %d | %3s | %d |\n" |
| 9598 | "|------------------------|\n", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9599 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9600 | wmmAcStatus[SME_AC_VO].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9601 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9602 | wmmAcStatus[SME_AC_VO]. |
| 9603 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9604 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9605 | wmmAcStatus[SME_AC_VO].wmmAcTspecInfo. |
| 9606 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9607 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9608 | wmmAcStatus[SME_AC_VI].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9609 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9610 | wmmAcStatus[SME_AC_VI]. |
| 9611 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9612 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9613 | wmmAcStatus[SME_AC_VI].wmmAcTspecInfo. |
| 9614 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9615 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9616 | wmmAcStatus[SME_AC_BE].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9617 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9618 | wmmAcStatus[SME_AC_BE]. |
| 9619 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9620 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9621 | wmmAcStatus[SME_AC_BE].wmmAcTspecInfo. |
| 9622 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9623 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9624 | wmmAcStatus[SME_AC_BK].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9625 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9626 | wmmAcStatus[SME_AC_BK]. |
| 9627 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9628 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9629 | wmmAcStatus[SME_AC_BK].wmmAcTspecInfo. |
| 9630 | ts_info.direction); |
| 9631 | |
| 9632 | wrqu->data.length = strlen(extra) + 1; |
| 9633 | break; |
| 9634 | } |
| 9635 | case WE_GET_CHANNEL_LIST: |
| 9636 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9637 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9638 | uint8_t i, len; |
| 9639 | char *buf; |
| 9640 | uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN]; |
| 9641 | uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9642 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9643 | |
Srinivas Girigowda | c231df6 | 2017-03-24 18:27:57 -0700 | [diff] [blame] | 9644 | struct channel_list_info channel_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9645 | |
| 9646 | memset(&channel_list, 0, sizeof(channel_list)); |
Agrawal Ashish | 6c9bca7 | 2016-09-04 13:37:59 +0530 | [diff] [blame] | 9647 | status = iw_get_channel_list(dev, info, wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9648 | (char *)&channel_list); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9649 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9650 | hdd_err("GetChannelList Failed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9651 | return -EINVAL; |
| 9652 | } |
| 9653 | buf = extra; |
| 9654 | /* |
| 9655 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. |
| 9656 | * Maximum buffer needed = 5 * number of channels. |
| 9657 | * Check ifsufficient buffer is available and then |
| 9658 | * proceed to fill the buffer. |
| 9659 | */ |
| 9660 | if (WE_MAX_STR_LEN < |
| 9661 | (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9662 | hdd_err("Insufficient Buffer to populate channel list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9663 | return -EINVAL; |
| 9664 | } |
| 9665 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 9666 | channel_list.num_channels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9667 | if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9668 | ubuf, &ubuf_len)) { |
| 9669 | /* Printing Country code in getChannelList */ |
| 9670 | for (i = 0; i < (ubuf_len - 1); i++) |
| 9671 | len += scnprintf(buf + len, |
| 9672 | WE_MAX_STR_LEN - len, |
| 9673 | "%c", ubuf[i]); |
| 9674 | } |
| 9675 | for (i = 0; i < channel_list.num_channels; i++) { |
| 9676 | len += |
| 9677 | scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 9678 | " %u", channel_list.channels[i]); |
| 9679 | } |
| 9680 | wrqu->data.length = strlen(extra) + 1; |
| 9681 | |
| 9682 | break; |
| 9683 | } |
| 9684 | #ifdef FEATURE_WLAN_TDLS |
| 9685 | case WE_GET_TDLS_PEERS: |
| 9686 | { |
| 9687 | wrqu->data.length = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9688 | wlan_hdd_tdls_get_all_peers(adapter, extra, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9689 | WE_MAX_STR_LEN) + 1; |
| 9690 | break; |
| 9691 | } |
| 9692 | #endif |
| 9693 | #ifdef WLAN_FEATURE_11W |
| 9694 | case WE_GET_11W_INFO: |
| 9695 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9696 | hdd_debug("WE_GET_11W_ENABLED = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9697 | pWextState->roamProfile.MFPEnabled); |
| 9698 | |
| 9699 | snprintf(extra, WE_MAX_STR_LEN, |
| 9700 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 9701 | "\n Number of Unprotected Disassocs %d" |
| 9702 | "\n Number of Unprotected Deauths %d", |
| 9703 | pWextState->roamProfile.BSSIDs.bssid->bytes[0], |
| 9704 | pWextState->roamProfile.BSSIDs.bssid->bytes[1], |
| 9705 | pWextState->roamProfile.BSSIDs.bssid->bytes[2], |
| 9706 | pWextState->roamProfile.BSSIDs.bssid->bytes[3], |
| 9707 | pWextState->roamProfile.BSSIDs.bssid->bytes[4], |
| 9708 | pWextState->roamProfile.BSSIDs.bssid->bytes[5], |
| 9709 | pWextState->roamProfile.MFPEnabled, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9710 | adapter->hdd_stats.hddPmfStats. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9711 | numUnprotDisassocRx, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9712 | adapter->hdd_stats.hddPmfStats. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9713 | numUnprotDeauthRx); |
| 9714 | |
| 9715 | wrqu->data.length = strlen(extra) + 1; |
| 9716 | break; |
| 9717 | } |
| 9718 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9719 | case WE_GET_IBSS_STA_INFO: |
| 9720 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9721 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9722 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9723 | int idx = 0; |
| 9724 | int length = 0, buf = 0; |
| 9725 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 9726 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 9727 | if (HDD_WLAN_INVALID_STA_ID != |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9728 | sta_ctx->conn_info.staId[idx]) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9729 | buf = snprintf |
| 9730 | ((extra + length), |
| 9731 | WE_MAX_STR_LEN - length, |
| 9732 | "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9733 | sta_ctx->conn_info.staId[idx], |
| 9734 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9735 | peerMacAddress[idx].bytes[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9736 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9737 | peerMacAddress[idx].bytes[1], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9738 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9739 | peerMacAddress[idx].bytes[2], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9740 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9741 | peerMacAddress[idx].bytes[3], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9742 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9743 | peerMacAddress[idx].bytes[4], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9744 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9745 | peerMacAddress[idx].bytes[5] |
| 9746 | ); |
| 9747 | length += buf; |
| 9748 | } |
| 9749 | } |
| 9750 | wrqu->data.length = strlen(extra) + 1; |
| 9751 | break; |
| 9752 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9753 | case WE_GET_PHYMODE: |
| 9754 | { |
| 9755 | bool ch_bond24 = false, ch_bond5g = false; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9756 | struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter); |
| 9757 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9758 | eCsrPhyMode phymode; |
| 9759 | eCsrBand currBand; |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 9760 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9761 | |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 9762 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 9763 | if (!sme_config) { |
| 9764 | hdd_err("Out of memory"); |
| 9765 | ret = -ENOMEM; |
| 9766 | break; |
| 9767 | } |
| 9768 | |
| 9769 | sme_get_config_param(hal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9770 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 9771 | sme_config->csrConfig.channelBondingMode24GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9772 | ch_bond24 = true; |
| 9773 | |
| 9774 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 9775 | sme_config->csrConfig.channelBondingMode5GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9776 | ch_bond5g = true; |
| 9777 | |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 9778 | qdf_mem_free(sme_config); |
| 9779 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9780 | phymode = sme_get_phy_mode(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9781 | if ((QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9782 | sme_get_freq_band(hal, &currBand))) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9783 | hdd_err("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9784 | return -EIO; |
| 9785 | } |
| 9786 | |
| 9787 | switch (phymode) { |
| 9788 | case eCSR_DOT11_MODE_AUTO: |
| 9789 | snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE"); |
| 9790 | break; |
| 9791 | case eCSR_DOT11_MODE_11n: |
| 9792 | case eCSR_DOT11_MODE_11n_ONLY: |
| 9793 | if (currBand == eCSR_BAND_24) { |
| 9794 | if (ch_bond24) |
| 9795 | snprintf(extra, WE_MAX_STR_LEN, |
| 9796 | "11NGHT40"); |
| 9797 | else |
| 9798 | snprintf(extra, WE_MAX_STR_LEN, |
| 9799 | "11NGHT20"); |
| 9800 | } else if (currBand == eCSR_BAND_5G) { |
| 9801 | if (ch_bond5g) |
| 9802 | snprintf(extra, WE_MAX_STR_LEN, |
| 9803 | "11NAHT40"); |
| 9804 | else |
| 9805 | snprintf(extra, WE_MAX_STR_LEN, |
| 9806 | "11NAHT20"); |
| 9807 | } else { |
| 9808 | snprintf(extra, WE_MAX_STR_LEN, "11N"); |
| 9809 | } |
| 9810 | break; |
| 9811 | case eCSR_DOT11_MODE_abg: |
| 9812 | snprintf(extra, WE_MAX_STR_LEN, "11ABG"); |
| 9813 | break; |
| 9814 | case eCSR_DOT11_MODE_11a: |
| 9815 | snprintf(extra, WE_MAX_STR_LEN, "11A"); |
| 9816 | break; |
| 9817 | case eCSR_DOT11_MODE_11b: |
| 9818 | case eCSR_DOT11_MODE_11b_ONLY: |
| 9819 | snprintf(extra, WE_MAX_STR_LEN, "11B"); |
| 9820 | break; |
| 9821 | case eCSR_DOT11_MODE_11g: |
| 9822 | case eCSR_DOT11_MODE_11g_ONLY: |
| 9823 | snprintf(extra, WE_MAX_STR_LEN, "11G"); |
| 9824 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9825 | case eCSR_DOT11_MODE_11ac: |
| 9826 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 9827 | if (hddctx->config->vhtChannelWidth == |
| 9828 | eHT_CHANNEL_WIDTH_20MHZ) |
| 9829 | snprintf(extra, WE_MAX_STR_LEN, |
| 9830 | "11ACVHT20"); |
| 9831 | else if (hddctx->config->vhtChannelWidth == |
| 9832 | eHT_CHANNEL_WIDTH_40MHZ) |
| 9833 | snprintf(extra, WE_MAX_STR_LEN, |
| 9834 | "11ACVHT40"); |
| 9835 | else if (hddctx->config->vhtChannelWidth == |
| 9836 | eHT_CHANNEL_WIDTH_80MHZ) |
| 9837 | snprintf(extra, WE_MAX_STR_LEN, |
| 9838 | "11ACVHT80"); |
| 9839 | else if (hddctx->config->vhtChannelWidth == |
| 9840 | eHT_CHANNEL_WIDTH_160MHZ) |
| 9841 | snprintf(extra, WE_MAX_STR_LEN, |
| 9842 | "11ACVHT160"); |
| 9843 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 9844 | case eCSR_DOT11_MODE_11ax: |
| 9845 | case eCSR_DOT11_MODE_11ax_ONLY: |
| 9846 | /* currently using vhtChannelWidth */ |
| 9847 | if (hddctx->config->vhtChannelWidth == |
| 9848 | eHT_CHANNEL_WIDTH_20MHZ) |
| 9849 | snprintf(extra, WE_MAX_STR_LEN, |
| 9850 | "11AX_HE_20"); |
| 9851 | else if (hddctx->config->vhtChannelWidth == |
| 9852 | eHT_CHANNEL_WIDTH_40MHZ) |
| 9853 | snprintf(extra, WE_MAX_STR_LEN, |
| 9854 | "11AX_HE_40"); |
| 9855 | else if (hddctx->config->vhtChannelWidth == |
| 9856 | eHT_CHANNEL_WIDTH_80MHZ) |
| 9857 | snprintf(extra, WE_MAX_STR_LEN, |
| 9858 | "11AX_HE_80"); |
| 9859 | else if (hddctx->config->vhtChannelWidth == |
| 9860 | eHT_CHANNEL_WIDTH_160MHZ) |
| 9861 | snprintf(extra, WE_MAX_STR_LEN, |
| 9862 | "11AX_HE_160"); |
| 9863 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9864 | } |
| 9865 | |
| 9866 | wrqu->data.length = strlen(extra) + 1; |
| 9867 | break; |
| 9868 | } |
| 9869 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9870 | case WE_GET_OEM_DATA_CAP: |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 9871 | return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9872 | case WE_GET_SNR: |
| 9873 | { |
| 9874 | int8_t s7snr = 0; |
| 9875 | int status = 0; |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9876 | struct hdd_context *hdd_ctx; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9877 | struct hdd_station_ctx *sta_ctx; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9878 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9879 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9880 | status = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 9881 | if (status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9882 | return status; |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 9883 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9884 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9885 | if (0 == hdd_ctx->config->fEnableSNRMonitoring || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9886 | eConnectionState_Associated != |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9887 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9888 | hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 9889 | hdd_ctx->config->fEnableSNRMonitoring, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9890 | sta_ctx->conn_info.connState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9891 | return -ENONET; |
| 9892 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9893 | wlan_hdd_get_snr(adapter, &s7snr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9894 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr); |
| 9895 | wrqu->data.length = strlen(extra) + 1; |
| 9896 | break; |
| 9897 | } |
| 9898 | default: |
| 9899 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9900 | hdd_err("Invalid IOCTL command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9901 | sub_cmd); |
| 9902 | break; |
| 9903 | } |
| 9904 | } |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 9905 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9906 | EXIT(); |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 9907 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9908 | } |
| 9909 | |
| 9910 | static int iw_get_char_setnone(struct net_device *dev, |
| 9911 | struct iw_request_info *info, |
| 9912 | union iwreq_data *wrqu, char *extra) |
| 9913 | { |
| 9914 | int ret; |
| 9915 | |
| 9916 | cds_ssr_protect(__func__); |
| 9917 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 9918 | cds_ssr_unprotect(__func__); |
| 9919 | |
| 9920 | return ret; |
| 9921 | } |
| 9922 | |
| 9923 | /** |
| 9924 | * iw_setnone_getnone() - Generic "action" private ioctl handler |
| 9925 | * @dev: device upon which the ioctl was received |
| 9926 | * @info: ioctl request information |
| 9927 | * @wrqu: ioctl request data |
| 9928 | * @extra: ioctl extra data |
| 9929 | * |
| 9930 | * Return: 0 on success, non-zero on error |
| 9931 | */ |
| 9932 | static int __iw_setnone_getnone(struct net_device *dev, |
| 9933 | struct iw_request_info *info, |
| 9934 | union iwreq_data *wrqu, char *extra) |
| 9935 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 9936 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9937 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9938 | int ret; |
| 9939 | int sub_cmd; |
| 9940 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9941 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9942 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9943 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9944 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9945 | if (0 != ret) |
| 9946 | return ret; |
| 9947 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9948 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9949 | if (0 != ret) |
| 9950 | return ret; |
| 9951 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9952 | #ifdef CONFIG_COMPAT |
| 9953 | /* this ioctl is a special case where a sub-ioctl is used and both |
| 9954 | * the number of get and set args is 0. in this specific case the |
| 9955 | * logic in iwpriv places the sub_cmd in the data.flags portion of |
| 9956 | * the iwreq. unfortunately the location of this field will be |
| 9957 | * different between 32-bit and 64-bit userspace, and the standard |
| 9958 | * compat support in the kernel does not handle this case. so we |
| 9959 | * need to explicitly handle it here. |
| 9960 | */ |
| 9961 | if (is_compat_task()) { |
| 9962 | struct compat_iw_point *compat_iw_point = |
| 9963 | (struct compat_iw_point *)&wrqu->data; |
| 9964 | sub_cmd = compat_iw_point->flags; |
| 9965 | } else { |
| 9966 | sub_cmd = wrqu->data.flags; |
| 9967 | } |
| 9968 | #else |
| 9969 | sub_cmd = wrqu->data.flags; |
| 9970 | #endif |
| 9971 | |
| 9972 | switch (sub_cmd) { |
| 9973 | case WE_GET_RECOVERY_STAT: |
| 9974 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9975 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9976 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9977 | sme_get_recovery_stats(hal); |
| 9978 | break; |
| 9979 | } |
| 9980 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9981 | case WE_GET_FW_PROFILE_DATA: |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9982 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9983 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 9984 | 0, DBG_CMD); |
| 9985 | break; |
| 9986 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9987 | case WE_IBSS_GET_PEER_INFO_ALL: |
| 9988 | { |
| 9989 | hdd_wlan_get_ibss_peer_info_all(adapter); |
| 9990 | break; |
| 9991 | } |
| 9992 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9993 | case WE_SET_REASSOC_TRIGGER: |
| 9994 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 9995 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9996 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9997 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 9998 | tSirMacAddr bssid; |
Krunal Soni | bfd0549 | 2017-10-03 15:48:37 -0700 | [diff] [blame] | 9999 | uint32_t roamId = INVALID_ROAM_ID; |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 10000 | uint8_t operating_ch = |
| 10001 | adapter->sessionCtx.station.conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10002 | tCsrRoamModifyProfileFields modProfileFields; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10003 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 10004 | sme_get_modify_profile_fields(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10005 | &modProfileFields); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 10006 | if (roaming_offload_enabled(hdd_ctx)) { |
| 10007 | qdf_mem_copy(bssid, |
| 10008 | &adapter->sessionCtx.station.conn_info.bssId, |
| 10009 | sizeof(bssid)); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 10010 | hdd_wma_send_fastreassoc_cmd(adapter, |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 10011 | bssid, operating_ch); |
| 10012 | } else { |
| 10013 | sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, |
| 10014 | NULL, modProfileFields, &roamId, 1); |
| 10015 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10016 | return 0; |
| 10017 | } |
| 10018 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 10019 | case WE_STOP_OBSS_SCAN: |
| 10020 | { |
| 10021 | /* |
| 10022 | * 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 10023 | * 2.OBSS scan is stopped by Firmware during the disassociation |
| 10024 | * 3.OBSS stop comamnd is added for debugging purpose |
| 10025 | */ |
| 10026 | tHalHandle hal; |
| 10027 | |
| 10028 | hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 10029 | if (hal == NULL) { |
| 10030 | hdd_err("hal context is NULL"); |
| 10031 | return -EINVAL; |
| 10032 | } |
| 10033 | sme_ht40_stop_obss_scan(hal, adapter->sessionId); |
| 10034 | } |
| 10035 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10036 | default: |
| 10037 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10038 | hdd_err("unknown ioctl %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10039 | break; |
| 10040 | } |
| 10041 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10042 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10043 | return ret; |
| 10044 | } |
| 10045 | |
| 10046 | static int iw_setnone_getnone(struct net_device *dev, |
| 10047 | struct iw_request_info *info, |
| 10048 | union iwreq_data *wrqu, char *extra) |
| 10049 | { |
| 10050 | int ret; |
| 10051 | |
| 10052 | cds_ssr_protect(__func__); |
| 10053 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 10054 | cds_ssr_unprotect(__func__); |
| 10055 | |
| 10056 | return ret; |
| 10057 | } |
| 10058 | |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10059 | #ifdef MPC_UT_FRAMEWORK |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10060 | static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx, |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 10061 | struct hdd_adapter *adapter, int sub_cmd, int *apps_args) |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10062 | { |
Jeff Johnson | ac8b0de | 2017-02-10 09:22:22 -0800 | [diff] [blame] | 10063 | switch (sub_cmd) { |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10064 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 10065 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10066 | hdd_debug("<iwpriv wlan0 pm_clist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10067 | policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc, |
| 10068 | apps_args[0], apps_args[1], apps_args[2], apps_args[3], |
| 10069 | apps_args[4], apps_args[5], apps_args[6], apps_args[7]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10070 | } |
| 10071 | break; |
| 10072 | |
| 10073 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 10074 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10075 | hdd_debug("<iwpriv wlan0 pm_dlist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10076 | policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc, |
| 10077 | apps_args[0], apps_args[1]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10078 | } |
| 10079 | break; |
| 10080 | |
| 10081 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 10082 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10083 | hdd_debug("<iwpriv wlan0 pm_ulist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10084 | policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc, |
| 10085 | apps_args[0], apps_args[1], apps_args[2], apps_args[3], |
| 10086 | apps_args[4], apps_args[5], apps_args[6], apps_args[7]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10087 | } |
| 10088 | break; |
| 10089 | |
| 10090 | case WE_POLICY_MANAGER_DBS_CMD: |
| 10091 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10092 | hdd_debug("<iwpriv wlan0 pm_dbs> is called"); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10093 | if (apps_args[0] == 0) |
| 10094 | wma_set_dbs_capability_ut(0); |
| 10095 | else |
| 10096 | wma_set_dbs_capability_ut(1); |
| 10097 | |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10098 | if (apps_args[1] >= PM_THROUGHPUT && |
| 10099 | apps_args[1] <= PM_LATENCY) { |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10100 | pr_info("setting system pref to [%d]\n", apps_args[1]); |
| 10101 | hdd_ctx->config->conc_system_pref = apps_args[1]; |
| 10102 | } |
| 10103 | } |
| 10104 | break; |
| 10105 | |
| 10106 | case WE_POLICY_MANAGER_PCL_CMD: |
| 10107 | { |
| 10108 | uint8_t pcl[QDF_MAX_NUM_CHAN] = {0}; |
| 10109 | uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0}; |
| 10110 | uint32_t pcl_len = 0, i = 0; |
| 10111 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 10112 | hdd_debug("<iwpriv wlan0 pm_pcl> is called"); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10113 | |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10114 | policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0], |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10115 | pcl, &pcl_len, |
| 10116 | weight_list, QDF_ARRAY_SIZE(weight_list)); |
| 10117 | pr_info("PCL list for role[%d] is {", apps_args[0]); |
| 10118 | for (i = 0 ; i < pcl_len; i++) |
| 10119 | pr_info(" %d, ", pcl[i]); |
| 10120 | pr_info("}--------->\n"); |
| 10121 | } |
| 10122 | break; |
| 10123 | |
| 10124 | case WE_POLICY_SET_HW_MODE_CMD: |
| 10125 | { |
| 10126 | if (apps_args[0] == 0) { |
| 10127 | hdd_err("set hw mode for single mac"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10128 | policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10129 | adapter->sessionId, |
| 10130 | HW_MODE_SS_2x2, |
| 10131 | HW_MODE_80_MHZ, |
| 10132 | HW_MODE_SS_0x0, HW_MODE_BW_NONE, |
| 10133 | HW_MODE_DBS_NONE, |
| 10134 | HW_MODE_AGILE_DFS_NONE, |
| 10135 | HW_MODE_SBS_NONE, |
| 10136 | SIR_UPDATE_REASON_UT); |
| 10137 | } else if (apps_args[0] == 1) { |
| 10138 | hdd_err("set hw mode for dual mac"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10139 | policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10140 | adapter->sessionId, |
| 10141 | HW_MODE_SS_1x1, |
| 10142 | HW_MODE_80_MHZ, |
| 10143 | HW_MODE_SS_1x1, HW_MODE_40_MHZ, |
| 10144 | HW_MODE_DBS, |
| 10145 | HW_MODE_AGILE_DFS_NONE, |
| 10146 | HW_MODE_SBS_NONE, |
| 10147 | SIR_UPDATE_REASON_UT); |
| 10148 | } |
| 10149 | } |
| 10150 | break; |
| 10151 | |
| 10152 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 10153 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10154 | enum policy_mgr_conc_next_action action; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10155 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 10156 | hdd_debug("<iwpriv wlan0 pm_query_action> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10157 | action = policy_mgr_current_connections_update( |
| 10158 | hdd_ctx->hdd_psoc, |
| 10159 | adapter->sessionId, apps_args[0], |
| 10160 | SIR_UPDATE_REASON_UT); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10161 | pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action); |
| 10162 | } |
| 10163 | break; |
| 10164 | |
| 10165 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 10166 | { |
| 10167 | bool allow; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10168 | |
| 10169 | hdd_notice("<iwpriv wlan0 pm_query_allow> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10170 | allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10171 | apps_args[0], apps_args[1], apps_args[2]); |
| 10172 | pr_info("allow %d {0 = don't allow, 1 = allow}", allow); |
| 10173 | } |
| 10174 | break; |
| 10175 | |
| 10176 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 10177 | { |
| 10178 | clean_report(hdd_ctx); |
| 10179 | if (apps_args[0] == 1) { |
| 10180 | wlan_hdd_one_connection_scenario(hdd_ctx); |
| 10181 | } else if (apps_args[0] == 2) { |
| 10182 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10183 | 6, POLICY_MGR_TWO_TWO); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10184 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10185 | 36, POLICY_MGR_TWO_TWO); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10186 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10187 | 6, POLICY_MGR_ONE_ONE); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10188 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10189 | 36, POLICY_MGR_ONE_ONE); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10190 | } else if (apps_args[0] == 3) { |
| 10191 | /* MCC on same band with 2x2 same mac*/ |
| 10192 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10193 | 6, 11, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10194 | /* MCC on diff band with 2x2 same mac*/ |
| 10195 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10196 | 6, 36, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10197 | /* MCC on diff band with 1x1 diff mac */ |
| 10198 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10199 | 36, 6, POLICY_MGR_ONE_ONE, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10200 | /* MCC on diff band with 1x1 same mac */ |
| 10201 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10202 | 36, 6, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10203 | /* SCC on same band with 2x2 same mac */ |
| 10204 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10205 | 36, 36, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10206 | /* SCC on same band with 1x1 same mac */ |
| 10207 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10208 | 36, 36, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10209 | /* MCC on same band with 2x2 same mac */ |
| 10210 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10211 | 36, 149, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10212 | /* MCC on same band with 1x1 same mac */ |
| 10213 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10214 | 36, 149, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10215 | } |
| 10216 | print_report(hdd_ctx); |
| 10217 | } |
| 10218 | break; |
| 10219 | } |
| 10220 | return 0; |
| 10221 | } |
| 10222 | #else |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10223 | static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx, |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 10224 | struct hdd_adapter *adapter, int sub_cmd, int *apps_args) |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10225 | { |
| 10226 | return 0; |
| 10227 | } |
| 10228 | #endif |
| 10229 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10230 | /** |
| 10231 | * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 10232 | * @dev: device upon which the ioctl was received |
| 10233 | * @info: ioctl request information |
| 10234 | * @wrqu: ioctl request data |
| 10235 | * @extra: ioctl extra data |
| 10236 | * |
| 10237 | * This is an SSR-protected generic handler for private ioctls which |
| 10238 | * take multiple arguments. Note that this implementation is also |
| 10239 | * somewhat unique in that it is shared by both STA-mode and SAP-mode |
| 10240 | * interfaces. |
| 10241 | * |
| 10242 | * Return: 0 on success, non-zero on error |
| 10243 | */ |
| 10244 | static int __iw_set_var_ints_getnone(struct net_device *dev, |
| 10245 | struct iw_request_info *info, |
| 10246 | union iwreq_data *wrqu, char *extra) |
| 10247 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10248 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10249 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10250 | int sub_cmd; |
| 10251 | int *apps_args = (int *) extra; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10252 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10253 | int ret, num_args; |
| 10254 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10255 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10256 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10257 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10258 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10259 | if (0 != ret) |
| 10260 | return ret; |
| 10261 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10262 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10263 | if (0 != ret) |
| 10264 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10265 | |
| 10266 | sub_cmd = wrqu->data.flags; |
| 10267 | num_args = wrqu->data.length; |
| 10268 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10269 | hdd_debug("Received length %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10270 | |
| 10271 | switch (sub_cmd) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 10272 | case WE_IBSS_GET_PEER_INFO: |
| 10273 | { |
| 10274 | pr_info("Station ID = %d\n", apps_args[0]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10275 | hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 10276 | } |
| 10277 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10278 | |
| 10279 | case WE_P2P_NOA_CMD: |
| 10280 | { |
Srinivas Girigowda | 5d5fdc5 | 2017-03-24 22:30:57 -0700 | [diff] [blame] | 10281 | struct p2p_app_set_ps p2pNoA; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10282 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10283 | if (adapter->device_mode != QDF_P2P_GO_MODE) { |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 10284 | hdd_err("Setting NoA is not allowed in Device mode %s(%d)", |
| 10285 | hdd_device_mode_to_string( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10286 | adapter->device_mode), |
| 10287 | adapter->device_mode); |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 10288 | return -EINVAL; |
| 10289 | } |
| 10290 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10291 | p2pNoA.opp_ps = apps_args[0]; |
| 10292 | p2pNoA.ctWindow = apps_args[1]; |
| 10293 | p2pNoA.duration = apps_args[2]; |
| 10294 | p2pNoA.interval = apps_args[3]; |
| 10295 | p2pNoA.count = apps_args[4]; |
| 10296 | p2pNoA.single_noa_duration = apps_args[5]; |
| 10297 | p2pNoA.psSelection = apps_args[6]; |
| 10298 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10299 | hdd_debug("P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10300 | apps_args[0], apps_args[1], apps_args[2], |
| 10301 | apps_args[3], apps_args[4], |
| 10302 | apps_args[5], apps_args[6]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10303 | |
| 10304 | hdd_set_p2p_ps(dev, &p2pNoA); |
| 10305 | |
| 10306 | } |
| 10307 | break; |
| 10308 | |
| 10309 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 10310 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10311 | hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10312 | apps_args[0], apps_args[1]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10313 | qdf_trace_enable(apps_args[0], apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10314 | } |
| 10315 | break; |
| 10316 | |
| 10317 | case WE_MTRACE_DUMP_CMD: |
| 10318 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10319 | hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10320 | apps_args[0], apps_args[1], |
| 10321 | apps_args[2], apps_args[3]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10322 | qdf_trace_dump_all((void *)hHal, apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10323 | apps_args[1], apps_args[2], |
| 10324 | apps_args[3]); |
| 10325 | |
| 10326 | } |
| 10327 | break; |
| 10328 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10329 | case WE_POLICY_MANAGER_CINFO_CMD: |
| 10330 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10331 | struct policy_mgr_conc_connection_info *conn_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10332 | uint32_t i = 0, len = 0; |
| 10333 | |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10334 | hdd_info("<iwpriv wlan0 pm_cinfo> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 10335 | conn_info = policy_mgr_get_conn_info(&len); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10336 | pr_info("+--------------------------+\n"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10337 | for (i = 0; i < len; i++) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 10338 | pr_info("|table_index[%d]\t\t\n", i); |
| 10339 | pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id); |
| 10340 | pr_info("|\t|chan - %-10d|\n", conn_info->chan); |
| 10341 | pr_info("|\t|bw - %-10d|\n", conn_info->bw); |
| 10342 | pr_info("|\t|mode - %-10d|\n", conn_info->mode); |
| 10343 | pr_info("|\t|mac - %-10d|\n", conn_info->mac); |
| 10344 | pr_info("|\t|in_use - %-10d|\n", conn_info->in_use); |
| 10345 | pr_info("+--------------------------+\n"); |
| 10346 | conn_info++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10347 | } |
| 10348 | } |
| 10349 | break; |
| 10350 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10351 | |
| 10352 | #ifdef FEATURE_WLAN_TDLS |
| 10353 | case WE_TDLS_CONFIG_PARAMS: |
| 10354 | { |
Jeff Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 10355 | struct hdd_tdls_config_params tdlsParams; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10356 | |
| 10357 | tdlsParams.tdls = apps_args[0]; |
| 10358 | tdlsParams.tx_period_t = apps_args[1]; |
| 10359 | tdlsParams.tx_packet_n = apps_args[2]; |
| 10360 | /* ignore args[3] as discovery_period is not used anymore */ |
| 10361 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 10362 | /* ignore args[5] as idle_timeout is not used anymore */ |
| 10363 | tdlsParams.idle_packet_n = apps_args[6]; |
| 10364 | /* ignore args[7] as rssi_hysteresis is not used anymore */ |
| 10365 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 10366 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
| 10367 | tdlsParams.rssi_delta = apps_args[10]; |
| 10368 | |
| 10369 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
| 10370 | } |
| 10371 | break; |
| 10372 | #endif |
| 10373 | case WE_UNIT_TEST_CMD: |
| 10374 | { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 10375 | QDF_STATUS status; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10376 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10377 | if ((apps_args[0] < WLAN_MODULE_ID_MIN) || |
| 10378 | (apps_args[0] >= WLAN_MODULE_ID_MAX)) { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 10379 | hdd_err("Invalid MODULE ID %d", apps_args[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10380 | return -EINVAL; |
| 10381 | } |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 10382 | if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) || |
Anurag Chouhan | 7756418 | 2016-09-03 16:38:01 +0530 | [diff] [blame] | 10383 | (apps_args[1] < 0)) { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 10384 | hdd_err("Too Many/Few args %d", apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10385 | return -EINVAL; |
| 10386 | } |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 10387 | status = sme_send_unit_test_cmd(adapter->sessionId, |
| 10388 | apps_args[0], |
| 10389 | apps_args[1], |
| 10390 | &apps_args[2]); |
| 10391 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 21d63bb | 2017-10-07 17:45:33 -0700 | [diff] [blame] | 10392 | hdd_err("sme_send_unit_test_cmd returned %d", status); |
| 10393 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10394 | } |
| 10395 | } |
| 10396 | break; |
| 10397 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 10398 | case WE_LED_FLASHING_PARAM: |
| 10399 | { |
| 10400 | int i; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10401 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10402 | if (num_args != 4) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10403 | hdd_err("gpio_control: 4 parameters are required"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10404 | return -EINVAL; |
| 10405 | } |
| 10406 | for (i = 0; i < num_args; i++) { |
| 10407 | if (apps_args[i] >= 0x7fffffff) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10408 | hdd_err("gpio_control: parameter should be less than 0x7fffffff"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10409 | return -EINVAL; |
| 10410 | } |
| 10411 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10412 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10413 | 0, apps_args[0], apps_args[1]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10414 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10415 | 1, apps_args[2], apps_args[3]); |
| 10416 | } |
| 10417 | break; |
| 10418 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 10419 | case WE_SET_PKTLOG: |
| 10420 | { |
| 10421 | int ret; |
| 10422 | |
| 10423 | if (num_args < 1 || num_args > 2) { |
| 10424 | hdd_err("pktlog: either 1 or 2 parameters are required"); |
| 10425 | return -EINVAL; |
| 10426 | } |
| 10427 | |
| 10428 | ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0], |
| 10429 | apps_args[1]); |
| 10430 | if (ret) |
| 10431 | return ret; |
| 10432 | break; |
| 10433 | } |
| 10434 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 10435 | case WE_MAC_PWR_DEBUG_CMD: |
| 10436 | { |
| 10437 | struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10438 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 10439 | int i, j; |
| 10440 | |
| 10441 | if (num_args < 3) { |
| 10442 | hdd_err("number of arguments can't be null %d", |
| 10443 | num_args); |
| 10444 | return -EINVAL; |
| 10445 | } |
| 10446 | if (num_args - 3 != apps_args[2]) { |
| 10447 | hdd_err("arg list of size %d doesn't match num_args %d", |
| 10448 | num_args-3, apps_args[2]); |
| 10449 | return -EINVAL; |
| 10450 | } |
| 10451 | if ((apps_args[1] < WLAN_MODULE_ID_MIN) || |
| 10452 | (apps_args[1] >= WLAN_MODULE_ID_MAX)) { |
| 10453 | hdd_err("Invalid MODULE ID %d", apps_args[1]); |
| 10454 | return -EINVAL; |
| 10455 | } |
| 10456 | if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) { |
| 10457 | hdd_err("Too Many args %d", apps_args[2]); |
| 10458 | return -EINVAL; |
| 10459 | } |
| 10460 | mac_pwr_dbg_args.pdev_id = apps_args[0]; |
| 10461 | mac_pwr_dbg_args.module_id = apps_args[1]; |
| 10462 | mac_pwr_dbg_args.num_args = apps_args[2]; |
| 10463 | |
| 10464 | for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++) |
| 10465 | mac_pwr_dbg_args.args[i] = apps_args[j]; |
| 10466 | |
| 10467 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10468 | sme_process_mac_pwr_dbg_cmd(hal, adapter->sessionId, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 10469 | &mac_pwr_dbg_args)) { |
| 10470 | return -EINVAL; |
| 10471 | } |
| 10472 | } |
| 10473 | break; |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10474 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 10475 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 10476 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 10477 | case WE_POLICY_MANAGER_DBS_CMD: |
| 10478 | case WE_POLICY_MANAGER_PCL_CMD: |
| 10479 | case WE_POLICY_SET_HW_MODE_CMD: |
| 10480 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 10481 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 10482 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 10483 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10484 | iw_get_policy_manager_ut_ops(hdd_ctx, adapter, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 10485 | sub_cmd, apps_args); |
| 10486 | } |
| 10487 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10488 | default: |
| 10489 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10490 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10491 | } |
| 10492 | break; |
| 10493 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10494 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10495 | return 0; |
| 10496 | } |
| 10497 | |
| 10498 | /** |
| 10499 | * iw_hdd_set_var_ints_getnone() - set var ints getnone callback |
| 10500 | * @dev: pointer to net_device structure |
| 10501 | * @info: pointer to iw_request_info structure |
| 10502 | * @wrqu: pointer to iwreq_data |
| 10503 | * @extra; extra |
| 10504 | * |
| 10505 | * Return: 0 on success, error number otherwise |
| 10506 | * |
| 10507 | */ |
| 10508 | static int iw_hdd_set_var_ints_getnone(struct net_device *dev, |
| 10509 | struct iw_request_info *info, |
| 10510 | union iwreq_data *wrqu, char *extra) |
| 10511 | { |
| 10512 | union iwreq_data u_priv_wrqu; |
| 10513 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 10514 | int ret, num_args; |
| 10515 | |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 10516 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10517 | hdd_err("permission check failed"); |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 10518 | return -EPERM; |
| 10519 | } |
| 10520 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10521 | /* Helper function to get iwreq_data with compat handling. */ |
| 10522 | if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) |
| 10523 | return -EINVAL; |
| 10524 | |
| 10525 | if (NULL == u_priv_wrqu.data.pointer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10526 | hdd_err("NULL data pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10527 | return -EINVAL; |
| 10528 | } |
| 10529 | |
| 10530 | num_args = u_priv_wrqu.data.length; |
| 10531 | if (num_args > MAX_VAR_ARGS) |
| 10532 | num_args = MAX_VAR_ARGS; |
| 10533 | |
| 10534 | if (copy_from_user(apps_args, u_priv_wrqu.data.pointer, |
| 10535 | (sizeof(int)) * num_args)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10536 | hdd_err("failed to copy data from user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10537 | return -EFAULT; |
| 10538 | } |
| 10539 | |
| 10540 | cds_ssr_protect(__func__); |
| 10541 | ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu, |
| 10542 | (char *)&apps_args); |
| 10543 | cds_ssr_unprotect(__func__); |
| 10544 | return ret; |
| 10545 | } |
| 10546 | |
| 10547 | /** |
| 10548 | * iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 10549 | * @dev: device upon which the ioctl was received |
| 10550 | * @info: ioctl request information |
| 10551 | * @wrqu: ioctl request data |
| 10552 | * @extra: ioctl extra data |
| 10553 | * |
| 10554 | * This is a generic handler for private ioctls which take multiple |
| 10555 | * arguments. Note that this implementation is also somewhat unique |
| 10556 | * in that it is shared by both STA-mode and SAP-mode interfaces. |
| 10557 | * |
| 10558 | * Return: 0 on success, non-zero on error |
| 10559 | */ |
| 10560 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 10561 | struct iw_request_info *info, |
| 10562 | union iwreq_data *wrqu, char *extra) |
| 10563 | { |
| 10564 | int ret; |
| 10565 | |
| 10566 | cds_ssr_protect(__func__); |
| 10567 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 10568 | cds_ssr_unprotect(__func__); |
| 10569 | return ret; |
| 10570 | } |
| 10571 | |
| 10572 | /** |
| 10573 | * iw_add_tspec - Add TSpec private ioctl handler |
| 10574 | * @dev: device upon which the ioctl was received |
| 10575 | * @info: ioctl request information |
| 10576 | * @wrqu: ioctl request data |
| 10577 | * @extra: ioctl extra data |
| 10578 | * |
| 10579 | * Return: 0 on success, non-zero on error |
| 10580 | */ |
| 10581 | static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info, |
| 10582 | union iwreq_data *wrqu, char *extra) |
| 10583 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10584 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 10585 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10586 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 10587 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 10588 | struct sme_qos_wmmtspecinfo tSpec; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10589 | uint32_t handle; |
| 10590 | struct iw_point s_priv_data; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10591 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10592 | int ret; |
| 10593 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10594 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10595 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10596 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10597 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10598 | if (0 != ret) |
| 10599 | return ret; |
| 10600 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10601 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10602 | if (0 != ret) |
| 10603 | return ret; |
| 10604 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10605 | /* make sure the application is sufficiently priviledged */ |
| 10606 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 10607 | /* this ioctl wants to return status to user space it must be */ |
| 10608 | /* defined as a "get" ioctl */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10609 | if (!capable(CAP_NET_ADMIN)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10610 | return -EPERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10611 | |
| 10612 | /* we must be associated in order to add a tspec */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 10613 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10614 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10615 | return 0; |
| 10616 | } |
| 10617 | /* since we are defined to be a "get" ioctl, and since the number */ |
| 10618 | /* of params exceeds the number of params that wireless extensions */ |
| 10619 | /* will pass down in the iwreq_data, we must copy the "set" params. */ |
| 10620 | /* We must handle the compat for iwreq_data in 32U/64K environment. */ |
| 10621 | |
| 10622 | /* helper function to get iwreq_data with compat handling. */ |
| 10623 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 10624 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10625 | return 0; |
| 10626 | } |
| 10627 | /* make sure all params are correctly passed to function */ |
| 10628 | if ((NULL == s_priv_data.pointer) || |
| 10629 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) { |
| 10630 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10631 | return 0; |
| 10632 | } |
| 10633 | /* from user space ourselves */ |
| 10634 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) { |
| 10635 | /* hmmm, can't get them */ |
| 10636 | return -EIO; |
| 10637 | } |
| 10638 | /* clear the tspec */ |
| 10639 | memset(&tSpec, 0, sizeof(tSpec)); |
| 10640 | |
| 10641 | /* validate the handle */ |
| 10642 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 10643 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 10644 | /* that one is reserved */ |
| 10645 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10646 | return 0; |
| 10647 | } |
| 10648 | /* validate the TID */ |
| 10649 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) { |
| 10650 | /* out of range */ |
| 10651 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10652 | return 0; |
| 10653 | } |
| 10654 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 10655 | |
| 10656 | /* validate the direction */ |
| 10657 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) { |
| 10658 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 10659 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 10660 | break; |
| 10661 | |
| 10662 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 10663 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 10664 | break; |
| 10665 | |
| 10666 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 10667 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 10668 | break; |
| 10669 | |
| 10670 | default: |
| 10671 | /* unknown */ |
| 10672 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10673 | return 0; |
| 10674 | } |
| 10675 | |
| 10676 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 10677 | |
| 10678 | /* validate the user priority */ |
| 10679 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) { |
| 10680 | /* out of range */ |
| 10681 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10682 | return 0; |
| 10683 | } |
| 10684 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
| 10685 | 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] | 10686 | hdd_err("***ts_info.up out of bounds***"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10687 | return 0; |
| 10688 | } |
| 10689 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10690 | hdd_debug("TS_INFO PSB %d UP %d !!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10691 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 10692 | |
| 10693 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 10694 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 10695 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 10696 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 10697 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 10698 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 10699 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 10700 | tSpec.surplus_bw_allowance = |
| 10701 | params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 10702 | tSpec.min_service_interval = |
| 10703 | params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 10704 | tSpec.max_service_interval = |
| 10705 | params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 10706 | tSpec.suspension_interval = |
| 10707 | params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 10708 | tSpec.inactivity_interval = |
| 10709 | params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 10710 | |
| 10711 | tSpec.ts_info.burst_size_defn = |
| 10712 | params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 10713 | |
| 10714 | /* validate the ts info ack policy */ |
| 10715 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) { |
| 10716 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 10717 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 10718 | break; |
| 10719 | |
| 10720 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 10721 | tSpec.ts_info.ack_policy = |
| 10722 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 10723 | break; |
| 10724 | |
| 10725 | default: |
| 10726 | /* unknown */ |
| 10727 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10728 | return 0; |
| 10729 | } |
| 10730 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10731 | *pStatus = hdd_wmm_addts(adapter, handle, &tSpec); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10732 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10733 | return 0; |
| 10734 | } |
| 10735 | |
| 10736 | static int iw_add_tspec(struct net_device *dev, |
| 10737 | struct iw_request_info *info, |
| 10738 | union iwreq_data *wrqu, char *extra) |
| 10739 | { |
| 10740 | int ret; |
| 10741 | |
| 10742 | cds_ssr_protect(__func__); |
| 10743 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 10744 | cds_ssr_unprotect(__func__); |
| 10745 | |
| 10746 | return ret; |
| 10747 | } |
| 10748 | |
| 10749 | /** |
| 10750 | * iw_del_tspec - Delete TSpec private ioctl handler |
| 10751 | * @dev: device upon which the ioctl was received |
| 10752 | * @info: ioctl request information |
| 10753 | * @wrqu: ioctl request data |
| 10754 | * @extra: ioctl extra data |
| 10755 | * |
| 10756 | * Return: 0 on success, non-zero on error |
| 10757 | */ |
| 10758 | static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info, |
| 10759 | union iwreq_data *wrqu, char *extra) |
| 10760 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10761 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10762 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10763 | int *params = (int *)extra; |
| 10764 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 10765 | uint32_t handle; |
| 10766 | int ret; |
| 10767 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10768 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10769 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10770 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10771 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10772 | if (0 != ret) |
| 10773 | return ret; |
| 10774 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10775 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10776 | if (0 != ret) |
| 10777 | return ret; |
| 10778 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10779 | /* make sure the application is sufficiently priviledged */ |
| 10780 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 10781 | /* this ioctl wants to return status to user space it must be */ |
| 10782 | /* defined as a "get" ioctl */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10783 | if (!capable(CAP_NET_ADMIN)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10784 | return -EPERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10785 | |
| 10786 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 10787 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 10788 | /* is no need to copy the params from user space */ |
| 10789 | |
| 10790 | /* validate the handle */ |
| 10791 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 10792 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 10793 | /* that one is reserved */ |
| 10794 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10795 | return 0; |
| 10796 | } |
| 10797 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10798 | *pStatus = hdd_wmm_delts(adapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10799 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10800 | return 0; |
| 10801 | } |
| 10802 | |
| 10803 | static int iw_del_tspec(struct net_device *dev, |
| 10804 | struct iw_request_info *info, |
| 10805 | union iwreq_data *wrqu, char *extra) |
| 10806 | { |
| 10807 | int ret; |
| 10808 | |
| 10809 | cds_ssr_protect(__func__); |
| 10810 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 10811 | cds_ssr_unprotect(__func__); |
| 10812 | |
| 10813 | return ret; |
| 10814 | } |
| 10815 | |
| 10816 | /** |
| 10817 | * iw_get_tspec - Get TSpec private ioctl handler |
| 10818 | * @dev: device upon which the ioctl was received |
| 10819 | * @info: ioctl request information |
| 10820 | * @wrqu: ioctl request data |
| 10821 | * @extra: ioctl extra data |
| 10822 | * |
| 10823 | * Return: 0 on success, non-zero on error |
| 10824 | */ |
| 10825 | static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info, |
| 10826 | union iwreq_data *wrqu, char *extra) |
| 10827 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10828 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10829 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10830 | int *params = (int *)extra; |
| 10831 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 10832 | uint32_t handle; |
| 10833 | int ret; |
| 10834 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10835 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10836 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10837 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10838 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10839 | if (0 != ret) |
| 10840 | return ret; |
| 10841 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10842 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10843 | if (0 != ret) |
| 10844 | return ret; |
| 10845 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10846 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 10847 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 10848 | /* is no need to copy the params from user space */ |
| 10849 | |
| 10850 | /* validate the handle */ |
| 10851 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 10852 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 10853 | /* that one is reserved */ |
| 10854 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 10855 | return 0; |
| 10856 | } |
| 10857 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10858 | *pStatus = hdd_wmm_checkts(adapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10859 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10860 | return 0; |
| 10861 | } |
| 10862 | |
| 10863 | static int iw_get_tspec(struct net_device *dev, |
| 10864 | struct iw_request_info *info, |
| 10865 | union iwreq_data *wrqu, char *extra) |
| 10866 | { |
| 10867 | int ret; |
| 10868 | |
| 10869 | cds_ssr_protect(__func__); |
| 10870 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 10871 | cds_ssr_unprotect(__func__); |
| 10872 | |
| 10873 | return ret; |
| 10874 | } |
| 10875 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10876 | /** |
| 10877 | * iw_set_fties - Set FT IEs private ioctl handler |
| 10878 | * @dev: device upon which the ioctl was received |
| 10879 | * @info: ioctl request information |
| 10880 | * @wrqu: ioctl request data |
| 10881 | * @extra: ioctl extra data |
| 10882 | * |
| 10883 | * Each time the supplicant has the auth_request or reassoc request |
| 10884 | * IEs ready they are pushed to the driver. The driver will in turn |
| 10885 | * use it to send out the auth req and reassoc req for 11r FT Assoc. |
| 10886 | * |
| 10887 | * Return: 0 on success, non-zero on error |
| 10888 | */ |
| 10889 | static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info, |
| 10890 | union iwreq_data *wrqu, char *extra) |
| 10891 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10892 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 10893 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10894 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10895 | int ret; |
| 10896 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10897 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10898 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10899 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10900 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10901 | if (0 != ret) |
| 10902 | return ret; |
| 10903 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10904 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10905 | if (0 != ret) |
| 10906 | return ret; |
| 10907 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10908 | if (!wrqu->data.length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10909 | hdd_err("called with 0 length IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10910 | return -EINVAL; |
| 10911 | } |
| 10912 | if (wrqu->data.pointer == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10913 | hdd_err("called with NULL IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10914 | return -EINVAL; |
| 10915 | } |
| 10916 | /* Added for debug on reception of Re-assoc Req. */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 10917 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10918 | hdd_debug("Called with Ie of length = %d when not associated", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10919 | wrqu->data.length); |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10920 | hdd_debug("Should be Re-assoc Req IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10921 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10922 | hdd_debug("called with Ie of length = %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10923 | |
| 10924 | /* Pass the received FT IEs to SME */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10925 | sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(adapter), adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10926 | extra, wrqu->data.length); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10927 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10928 | return 0; |
| 10929 | } |
| 10930 | |
| 10931 | static int iw_set_fties(struct net_device *dev, |
| 10932 | struct iw_request_info *info, |
| 10933 | union iwreq_data *wrqu, char *extra) |
| 10934 | { |
| 10935 | int ret; |
| 10936 | |
| 10937 | cds_ssr_protect(__func__); |
| 10938 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 10939 | cds_ssr_unprotect(__func__); |
| 10940 | |
| 10941 | return ret; |
| 10942 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10943 | |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10944 | /** |
| 10945 | * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler |
| 10946 | * @dev: device upon which the ioctl was received |
| 10947 | * @info: ioctl request information |
| 10948 | * @wrqu: ioctl request data |
| 10949 | * @extra: ioctl extra data |
| 10950 | * |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 10951 | * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the |
| 10952 | * time being to provide guidance in migrating to standard APIs. |
| 10953 | * |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10954 | * Return: 0 on success, non-zero on error |
| 10955 | */ |
| 10956 | static int iw_set_dynamic_mcbc_filter(struct net_device *dev, |
| 10957 | struct iw_request_info *info, |
| 10958 | union iwreq_data *wrqu, |
| 10959 | char *extra) |
| 10960 | { |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 10961 | hdd_err("\n" |
| 10962 | "setMCBCFilter is obsolete. Use the following instead:\n" |
| 10963 | "Configure multicast filtering via the ‘ip’ command.\n" |
| 10964 | "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n" |
| 10965 | "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n" |
| 10966 | "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n" |
| 10967 | "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n" |
| 10968 | "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic"); |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 10969 | return -EINVAL; |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10970 | } |
| 10971 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10972 | /** |
| 10973 | * iw_set_host_offload - Set host offload ioctl handler |
| 10974 | * @dev: device upon which the ioctl was received |
| 10975 | * @info: ioctl request information |
| 10976 | * @wrqu: ioctl request data |
| 10977 | * @extra: ioctl extra data |
| 10978 | * |
| 10979 | * Return: 0 on success, non-zero on error |
| 10980 | */ |
| 10981 | static int __iw_set_host_offload(struct net_device *dev, |
| 10982 | struct iw_request_info *info, |
| 10983 | union iwreq_data *wrqu, char *extra) |
| 10984 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10985 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Srinivas Girigowda | 077143e | 2017-03-25 10:47:27 -0700 | [diff] [blame] | 10986 | struct host_offload_req *pRequest = (struct host_offload_req *) extra; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10987 | tSirHostOffloadReq offloadRequest; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10988 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10989 | int ret; |
| 10990 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10991 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10992 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10993 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10994 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10995 | if (0 != ret) |
| 10996 | return ret; |
| 10997 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10998 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10999 | if (0 != ret) |
| 11000 | return ret; |
| 11001 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11002 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11003 | hdd_err("dev is not in CONNECTED state, ignore!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11004 | return -EINVAL; |
| 11005 | } |
| 11006 | |
| 11007 | /* Debug display of request components. */ |
| 11008 | switch (pRequest->offloadType) { |
| 11009 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11010 | hdd_debug("Host offload request: ARP reply"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11011 | switch (pRequest->enableOrDisable) { |
| 11012 | case WLAN_OFFLOAD_DISABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11013 | hdd_debug(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11014 | break; |
| 11015 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11016 | hdd_debug(" BC Filtering enable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11017 | case WLAN_OFFLOAD_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11018 | hdd_debug(" ARP offload enable"); |
| 11019 | hdd_debug(" IP address: %d.%d.%d.%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11020 | pRequest->params.hostIpv4Addr[0], |
| 11021 | pRequest->params.hostIpv4Addr[1], |
| 11022 | pRequest->params.hostIpv4Addr[2], |
| 11023 | pRequest->params.hostIpv4Addr[3]); |
| 11024 | } |
| 11025 | break; |
| 11026 | |
| 11027 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11028 | hdd_debug("Host offload request: neighbor discovery"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11029 | switch (pRequest->enableOrDisable) { |
| 11030 | case WLAN_OFFLOAD_DISABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11031 | hdd_debug(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11032 | break; |
| 11033 | case WLAN_OFFLOAD_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11034 | hdd_debug(" enable"); |
| 11035 | hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11036 | *(uint16_t *) (pRequest->params.hostIpv6Addr), |
| 11037 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11038 | 2), |
| 11039 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11040 | 4), |
| 11041 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11042 | 6), |
| 11043 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11044 | 8), |
| 11045 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11046 | 10), |
| 11047 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11048 | 12), |
| 11049 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 11050 | 14)); |
| 11051 | } |
| 11052 | } |
| 11053 | |
| 11054 | /* Execute offload request. The reason that we can copy the |
| 11055 | * request information from the ioctl structure to the SME |
| 11056 | * structure is that they are laid out exactly the same. |
| 11057 | * Otherwise, each piece of information would have to be |
| 11058 | * copied individually. |
| 11059 | */ |
| 11060 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11061 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11062 | sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(adapter), |
| 11063 | adapter->sessionId, &offloadRequest)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11064 | hdd_err("Failure to execute host offload request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11065 | return -EINVAL; |
| 11066 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 11067 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11068 | return 0; |
| 11069 | } |
| 11070 | |
| 11071 | static int iw_set_host_offload(struct net_device *dev, |
| 11072 | struct iw_request_info *info, |
| 11073 | union iwreq_data *wrqu, char *extra) |
| 11074 | { |
| 11075 | int ret; |
| 11076 | |
| 11077 | cds_ssr_protect(__func__); |
| 11078 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 11079 | cds_ssr_unprotect(__func__); |
| 11080 | |
| 11081 | return ret; |
| 11082 | } |
| 11083 | |
| 11084 | /** |
| 11085 | * iw_set_keepalive_params - Set keepalive params ioctl handler |
| 11086 | * @dev: device upon which the ioctl was received |
| 11087 | * @info: ioctl request information |
| 11088 | * @wrqu: ioctl request data |
| 11089 | * @extra: ioctl extra data |
| 11090 | * |
| 11091 | * Return: 0 on success, non-zero on error |
| 11092 | */ |
| 11093 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 11094 | struct iw_request_info *info, |
| 11095 | union iwreq_data *wrqu, char *extra) |
| 11096 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11097 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11098 | tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 11099 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11100 | int ret; |
| 11101 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11102 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 11103 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11104 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11105 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 11106 | if (0 != ret) |
| 11107 | return ret; |
| 11108 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11109 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11110 | if (0 != ret) |
| 11111 | return ret; |
| 11112 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11113 | if (wrqu->data.length != sizeof(*request)) { |
| 11114 | hdd_err("Invalid length %d", wrqu->data.length); |
| 11115 | return -EINVAL; |
| 11116 | } |
| 11117 | |
| 11118 | if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) { |
| 11119 | hdd_err("Value of timePeriod %d exceed Max limit %d", |
| 11120 | request->timePeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11121 | WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX); |
| 11122 | return -EINVAL; |
| 11123 | } |
| 11124 | |
| 11125 | /* Debug display of request components. */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11126 | hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11127 | request->timePeriod, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11128 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11129 | switch (request->packetType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11130 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11131 | hdd_debug("Keep Alive Request: Tx NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11132 | break; |
| 11133 | |
| 11134 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11135 | hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11136 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11137 | hdd_debug("Host IP address: %d.%d.%d.%d", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11138 | request->hostIpv4Addr[0], request->hostIpv4Addr[1], |
| 11139 | request->hostIpv4Addr[2], request->hostIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11140 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11141 | hdd_debug("Dest IP address: %d.%d.%d.%d", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11142 | request->destIpv4Addr[0], request->destIpv4Addr[1], |
| 11143 | request->destIpv4Addr[2], request->destIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11144 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11145 | hdd_debug("Dest MAC address: "MAC_ADDRESS_STR, |
Srinivas Girigowda | 9c330a9 | 2015-11-24 12:28:25 -0800 | [diff] [blame] | 11146 | MAC_ADDR_ARRAY(request->dest_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11147 | break; |
| 11148 | } |
| 11149 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11150 | hdd_debug("Keep alive period %d", request->timePeriod); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11151 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11152 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11153 | sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(adapter), |
| 11154 | adapter->sessionId, request)) { |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 11155 | hdd_err("Failure to execute Keep Alive"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11156 | return -EINVAL; |
| 11157 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 11158 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11159 | return 0; |
| 11160 | } |
| 11161 | |
| 11162 | static int iw_set_keepalive_params(struct net_device *dev, |
| 11163 | struct iw_request_info *info, |
| 11164 | union iwreq_data *wrqu, |
| 11165 | char *extra) |
| 11166 | { |
| 11167 | int ret; |
| 11168 | |
| 11169 | cds_ssr_protect(__func__); |
| 11170 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 11171 | cds_ssr_unprotect(__func__); |
| 11172 | |
| 11173 | return ret; |
| 11174 | } |
| 11175 | |
| 11176 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 11177 | /** |
| 11178 | * wlan_hdd_set_filter() - Set packet filter |
| 11179 | * @hdd_ctx: Global HDD context |
| 11180 | * @request: Packet filter request struct |
| 11181 | * @sessionId: Target session for the request |
| 11182 | * |
| 11183 | * Return: 0 on success, non-zero on error |
| 11184 | */ |
Hanumanth Reddy Pothula | 3def894 | 2017-10-05 16:19:36 +0530 | [diff] [blame] | 11185 | int wlan_hdd_set_filter(struct hdd_context *hdd_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11186 | struct pkt_filter_cfg *request, |
| 11187 | uint8_t sessionId) |
| 11188 | { |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11189 | struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req = NULL; |
| 11190 | struct pmo_rcv_pkt_fltr_clear_param *pmo_clr_pkt_fltr_param = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11191 | int i = 0; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11192 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11193 | |
| 11194 | if (hdd_ctx->config->disablePacketFilter) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11195 | hdd_warn("Packet filtering disabled in ini"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11196 | return 0; |
| 11197 | } |
| 11198 | |
| 11199 | /* Debug display of request components. */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11200 | hdd_debug("Packet Filter Request : FA %d params %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11201 | request->filter_action, request->num_params); |
| 11202 | |
| 11203 | switch (request->filter_action) { |
| 11204 | case HDD_RCV_FILTER_SET: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11205 | hdd_debug("Set Packet Filter Request for Id: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11206 | request->filter_id); |
| 11207 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11208 | pmo_set_pkt_fltr_req = |
| 11209 | qdf_mem_malloc(sizeof(*pmo_set_pkt_fltr_req)); |
| 11210 | if (!pmo_set_pkt_fltr_req) { |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 11211 | hdd_err("unable to allocate pmo_set_pkt_fltr_req"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11212 | return QDF_STATUS_E_NOMEM; |
| 11213 | } |
| 11214 | |
| 11215 | pmo_set_pkt_fltr_req->filter_id = request->filter_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11216 | if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) { |
| 11217 | hdd_err("Number of Params exceed Max limit %d", |
| 11218 | request->num_params); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11219 | status = QDF_STATUS_E_INVAL; |
| 11220 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11221 | } |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11222 | pmo_set_pkt_fltr_req->num_params = request->num_params; |
| 11223 | pmo_set_pkt_fltr_req->coalesce_time = 0; |
Srinivas Girigowda | bbbecad | 2017-06-28 16:01:48 -0700 | [diff] [blame] | 11224 | pmo_set_pkt_fltr_req->filter_type = PMO_RCV_FILTER_TYPE_FILTER_PKT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11225 | for (i = 0; i < request->num_params; i++) { |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11226 | pmo_set_pkt_fltr_req->params_data[i].protocol_layer = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11227 | request->params_data[i].protocol_layer; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11228 | pmo_set_pkt_fltr_req->params_data[i].compare_flag = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11229 | request->params_data[i].compare_flag; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11230 | pmo_set_pkt_fltr_req->params_data[i].data_offset = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11231 | request->params_data[i].data_offset; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11232 | pmo_set_pkt_fltr_req->params_data[i].data_length = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11233 | request->params_data[i].data_length; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11234 | pmo_set_pkt_fltr_req->params_data[i].reserved = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11235 | |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 11236 | if (request->params_data[i].data_offset > |
| 11237 | SIR_MAX_FILTER_TEST_DATA_OFFSET) { |
| 11238 | hdd_err("Invalid data offset %u for param %d (max = %d)", |
| 11239 | request->params_data[i].data_offset, |
| 11240 | i, |
| 11241 | SIR_MAX_FILTER_TEST_DATA_OFFSET); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11242 | status = QDF_STATUS_E_INVAL; |
| 11243 | goto out; |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 11244 | } |
| 11245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11246 | if (request->params_data[i].data_length > |
| 11247 | SIR_MAX_FILTER_TEST_DATA_LEN) { |
| 11248 | hdd_err("Error invalid data length %d", |
| 11249 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11250 | status = QDF_STATUS_E_INVAL; |
| 11251 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11252 | } |
| 11253 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11254 | hdd_debug("Proto %d Comp Flag %d Filter Type %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11255 | request->params_data[i].protocol_layer, |
| 11256 | request->params_data[i].compare_flag, |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11257 | pmo_set_pkt_fltr_req->filter_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11258 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11259 | hdd_debug("Data Offset %d Data Len %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11260 | request->params_data[i].data_offset, |
| 11261 | request->params_data[i].data_length); |
| 11262 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11263 | if (sizeof( |
| 11264 | pmo_set_pkt_fltr_req->params_data[i].compare_data) |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 11265 | < (request->params_data[i].data_length)) { |
| 11266 | hdd_err("Error invalid data length %d", |
| 11267 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11268 | status = QDF_STATUS_E_INVAL; |
| 11269 | goto out; |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 11270 | } |
| 11271 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11272 | memcpy( |
| 11273 | &pmo_set_pkt_fltr_req->params_data[i].compare_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11274 | request->params_data[i].compare_data, |
| 11275 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11276 | memcpy(&pmo_set_pkt_fltr_req->params_data[i].data_mask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11277 | request->params_data[i].data_mask, |
| 11278 | request->params_data[i].data_length); |
| 11279 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11280 | hdd_debug("CData %d CData %d CData %d CData %d CData %d CData %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11281 | request->params_data[i].compare_data[0], |
| 11282 | request->params_data[i].compare_data[1], |
| 11283 | request->params_data[i].compare_data[2], |
| 11284 | request->params_data[i].compare_data[3], |
| 11285 | request->params_data[i].compare_data[4], |
| 11286 | request->params_data[i].compare_data[5]); |
| 11287 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11288 | hdd_debug("MData %d MData %d MData %d MData %d MData %d MData %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11289 | request->params_data[i].data_mask[0], |
| 11290 | request->params_data[i].data_mask[1], |
| 11291 | request->params_data[i].data_mask[2], |
| 11292 | request->params_data[i].data_mask[3], |
| 11293 | request->params_data[i].data_mask[4], |
| 11294 | request->params_data[i].data_mask[5]); |
| 11295 | } |
| 11296 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11297 | if (QDF_STATUS_SUCCESS != |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11298 | pmo_ucfg_set_pkt_filter(hdd_ctx->hdd_psoc, |
| 11299 | pmo_set_pkt_fltr_req, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11300 | sessionId)) { |
| 11301 | hdd_err("Failure to execute Set Filter"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11302 | status = QDF_STATUS_E_INVAL; |
| 11303 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11304 | } |
| 11305 | |
| 11306 | break; |
| 11307 | |
| 11308 | case HDD_RCV_FILTER_CLEAR: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11309 | hdd_debug("Clear Packet Filter Request for Id: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11310 | request->filter_id); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11311 | |
| 11312 | pmo_clr_pkt_fltr_param = qdf_mem_malloc( |
| 11313 | sizeof(*pmo_clr_pkt_fltr_param)); |
| 11314 | if (!pmo_clr_pkt_fltr_param) { |
| 11315 | hdd_err("unable to allocate pmo_clr_pkt_fltr_param"); |
| 11316 | return QDF_STATUS_E_NOMEM; |
| 11317 | } |
| 11318 | |
| 11319 | pmo_clr_pkt_fltr_param->filter_id = request->filter_id; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11320 | if (QDF_STATUS_SUCCESS != |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11321 | pmo_ucfg_clear_pkt_filter(hdd_ctx->hdd_psoc, |
| 11322 | pmo_clr_pkt_fltr_param, |
| 11323 | sessionId)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11324 | hdd_err("Failure to execute Clear Filter"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11325 | status = QDF_STATUS_E_INVAL; |
| 11326 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11327 | } |
| 11328 | break; |
| 11329 | |
| 11330 | default: |
| 11331 | hdd_err("Packet Filter Request: Invalid %d", |
| 11332 | request->filter_action); |
| 11333 | return -EINVAL; |
| 11334 | } |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 11335 | |
| 11336 | out: |
| 11337 | if (pmo_set_pkt_fltr_req) |
| 11338 | qdf_mem_free(pmo_set_pkt_fltr_req); |
| 11339 | if (pmo_clr_pkt_fltr_param) |
| 11340 | qdf_mem_free(pmo_clr_pkt_fltr_param); |
| 11341 | |
| 11342 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11343 | } |
| 11344 | |
| 11345 | /** |
| 11346 | * __iw_set_packet_filter_params() - set packet filter parameters in target |
| 11347 | * @dev: Pointer to netdev |
| 11348 | * @info: Pointer to iw request info |
| 11349 | * @wrqu: Pointer to data |
| 11350 | * @extra: Pointer to extra data |
| 11351 | * |
| 11352 | * Return: 0 on success, non-zero on error |
| 11353 | */ |
| 11354 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 11355 | struct iw_request_info *info, |
| 11356 | union iwreq_data *wrqu, char *extra) |
| 11357 | { |
| 11358 | int ret; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 11359 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11360 | struct iw_point priv_data; |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 11361 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11362 | struct pkt_filter_cfg *request = NULL; |
| 11363 | |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 11364 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11365 | hdd_err("permission check failed"); |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 11366 | return -EPERM; |
| 11367 | } |
| 11368 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11369 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 11370 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11371 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 11372 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 11373 | if (0 != ret) |
| 11374 | return ret; |
| 11375 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11376 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11377 | if (0 != ret) |
| 11378 | return ret; |
| 11379 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11380 | if (hdd_priv_get_data(&priv_data, wrqu)) { |
| 11381 | hdd_err("failed to get priv data"); |
| 11382 | return -EINVAL; |
| 11383 | } |
| 11384 | |
| 11385 | if ((NULL == priv_data.pointer) || (0 == priv_data.length)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 11386 | hdd_err("invalid priv data %pK or invalid priv data length %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11387 | priv_data.pointer, priv_data.length); |
| 11388 | return -EINVAL; |
| 11389 | } |
| 11390 | |
Arun Khandavalli | 75d246b | 2017-08-07 19:46:06 +0530 | [diff] [blame] | 11391 | if (adapter->device_mode != QDF_STA_MODE) { |
| 11392 | hdd_err("Packet filter not supported for this mode :%d", |
| 11393 | adapter->device_mode); |
| 11394 | return -ENOTSUPP; |
| 11395 | } |
| 11396 | |
Mukul Sharma | be846bb | 2017-05-09 17:41:52 +0530 | [diff] [blame] | 11397 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) { |
| 11398 | hdd_err("Packet filter not supported in disconnected state"); |
| 11399 | return -ENOTSUPP; |
| 11400 | } |
| 11401 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11402 | /* copy data using copy_from_user */ |
| 11403 | request = mem_alloc_copy_from_user_helper(priv_data.pointer, |
| 11404 | priv_data.length); |
| 11405 | if (NULL == request) { |
| 11406 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
| 11407 | return -ENOMEM; |
| 11408 | } |
| 11409 | |
Hanumanth Reddy Pothula | 3def894 | 2017-10-05 16:19:36 +0530 | [diff] [blame] | 11410 | if (request->filter_action == HDD_RCV_FILTER_SET) |
| 11411 | hdd_ctx->user_configured_pkt_filter_rules |= |
| 11412 | 1 << request->filter_id; |
| 11413 | else if (request->filter_action == HDD_RCV_FILTER_CLEAR) |
| 11414 | hdd_ctx->user_configured_pkt_filter_rules &= |
| 11415 | ~(1 << request->filter_id); |
| 11416 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11417 | ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId); |
| 11418 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 11419 | qdf_mem_free(request); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 11420 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11421 | return ret; |
| 11422 | } |
| 11423 | |
| 11424 | /** |
| 11425 | * iw_set_packet_filter_params() - set packet filter parameters in target |
| 11426 | * @dev: Pointer to netdev |
| 11427 | * @info: Pointer to iw request info |
| 11428 | * @wrqu: Pointer to data |
| 11429 | * @extra: Pointer to extra data |
| 11430 | * |
| 11431 | * Return: 0 on success, non-zero on error |
| 11432 | */ |
| 11433 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 11434 | struct iw_request_info *info, |
| 11435 | union iwreq_data *wrqu, char *extra) |
| 11436 | { |
| 11437 | int ret; |
| 11438 | |
| 11439 | cds_ssr_protect(__func__); |
| 11440 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 11441 | cds_ssr_unprotect(__func__); |
| 11442 | |
| 11443 | return ret; |
| 11444 | } |
| 11445 | #endif |
| 11446 | |
| 11447 | |
| 11448 | static int __iw_get_statistics(struct net_device *dev, |
| 11449 | struct iw_request_info *info, |
| 11450 | union iwreq_data *wrqu, char *extra) |
| 11451 | { |
| 11452 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11453 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11454 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 11455 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11456 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11457 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11458 | char *p = extra; |
| 11459 | int tlen = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11460 | tCsrSummaryStatsInfo *pStats = &(adapter->hdd_stats.summary_stat); |
| 11461 | tCsrGlobalClassAStatsInfo *aStats = &(adapter->hdd_stats.ClassA_stat); |
| 11462 | tCsrGlobalClassDStatsInfo *dStats = &(adapter->hdd_stats.ClassD_stat); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11463 | int ret; |
| 11464 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11465 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11466 | |
| 11467 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 11468 | if (0 != ret) |
| 11469 | return ret; |
| 11470 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11471 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11472 | if (0 != ret) |
| 11473 | return ret; |
| 11474 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11475 | if (eConnectionState_Associated != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11476 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter))->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11477 | |
| 11478 | wrqu->txpower.value = 0; |
| 11479 | } else { |
| 11480 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 11481 | SME_SUMMARY_STATS | |
| 11482 | SME_GLOBAL_CLASSA_STATS | |
Jeff Johnson | dfe8951 | 2017-03-10 15:50:00 -0800 | [diff] [blame] | 11483 | SME_GLOBAL_CLASSD_STATS, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 11484 | hdd_statistics_cb, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11485 | (WLAN_HDD_GET_STATION_CTX_PTR |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11486 | (adapter))->conn_info.staId[0], |
| 11487 | adapter, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11488 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11489 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11490 | hdd_err("Unable to retrieve SME statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11491 | return -EINVAL; |
| 11492 | } |
| 11493 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11494 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11495 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11496 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 11497 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11498 | WLAN_WAIT_TIME_STATS); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 11499 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11500 | hdd_err("SME timeout while retrieving statistics"); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 11501 | /* Remove the SME statistics list by |
| 11502 | * passing NULL in callback argument |
| 11503 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11504 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 11505 | SME_SUMMARY_STATS | |
| 11506 | SME_GLOBAL_CLASSA_STATS | |
Jeff Johnson | dfe8951 | 2017-03-10 15:50:00 -0800 | [diff] [blame] | 11507 | SME_GLOBAL_CLASSD_STATS, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 11508 | NULL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11509 | (WLAN_HDD_GET_STATION_CTX_PTR |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11510 | (adapter))->conn_info. |
| 11511 | staId[0], adapter, |
| 11512 | adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11513 | |
| 11514 | return -EINVAL; |
| 11515 | } |
| 11516 | FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT, |
| 11517 | (uint8_t) sizeof(pStats->retry_cnt), |
| 11518 | (char *)&(pStats->retry_cnt[0]), tlen); |
| 11519 | |
| 11520 | FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT, |
| 11521 | (uint8_t) sizeof(pStats->multiple_retry_cnt), |
| 11522 | (char *)&(pStats->multiple_retry_cnt[0]), tlen); |
| 11523 | |
| 11524 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT, |
| 11525 | (uint8_t) sizeof(pStats->tx_frm_cnt), |
| 11526 | (char *)&(pStats->tx_frm_cnt[0]), tlen); |
| 11527 | |
| 11528 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT, |
| 11529 | (uint8_t) sizeof(pStats->rx_frm_cnt), |
| 11530 | (char *)&(pStats->rx_frm_cnt), tlen); |
| 11531 | |
| 11532 | FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT, |
| 11533 | (uint8_t) sizeof(pStats->frm_dup_cnt), |
| 11534 | (char *)&(pStats->frm_dup_cnt), tlen); |
| 11535 | |
| 11536 | FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT, |
| 11537 | (uint8_t) sizeof(pStats->fail_cnt), |
| 11538 | (char *)&(pStats->fail_cnt[0]), tlen); |
| 11539 | |
| 11540 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT, |
| 11541 | (uint8_t) sizeof(pStats->rts_fail_cnt), |
| 11542 | (char *)&(pStats->rts_fail_cnt), tlen); |
| 11543 | |
| 11544 | FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT, |
| 11545 | (uint8_t) sizeof(pStats->ack_fail_cnt), |
| 11546 | (char *)&(pStats->ack_fail_cnt), tlen); |
| 11547 | |
| 11548 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT, |
| 11549 | (uint8_t) sizeof(pStats->rts_succ_cnt), |
| 11550 | (char *)&(pStats->rts_succ_cnt), tlen); |
| 11551 | |
| 11552 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT, |
| 11553 | (uint8_t) sizeof(pStats->rx_discard_cnt), |
| 11554 | (char *)&(pStats->rx_discard_cnt), tlen); |
| 11555 | |
| 11556 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT, |
| 11557 | (uint8_t) sizeof(pStats->rx_error_cnt), |
| 11558 | (char *)&(pStats->rx_error_cnt), tlen); |
| 11559 | |
| 11560 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT, |
| 11561 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 11562 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 11563 | |
| 11564 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT, |
| 11565 | (uint8_t) sizeof(dStats->rx_byte_cnt), |
| 11566 | (char *)&(dStats->rx_byte_cnt), tlen); |
| 11567 | |
| 11568 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE, |
| 11569 | (uint8_t) sizeof(dStats->rx_rate), |
| 11570 | (char *)&(dStats->rx_rate), tlen); |
| 11571 | |
| 11572 | /* Transmit rate, in units of 500 kbit/sec */ |
| 11573 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE, |
| 11574 | (uint8_t) sizeof(aStats->tx_rate), |
| 11575 | (char *)&(aStats->tx_rate), tlen); |
| 11576 | |
| 11577 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT, |
| 11578 | (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]), |
| 11579 | (char *)&(dStats->rx_uc_byte_cnt[0]), tlen); |
| 11580 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT, |
| 11581 | (uint8_t) sizeof(dStats->rx_mc_byte_cnt), |
| 11582 | (char *)&(dStats->rx_mc_byte_cnt), tlen); |
| 11583 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT, |
| 11584 | (uint8_t) sizeof(dStats->rx_bc_byte_cnt), |
| 11585 | (char *)&(dStats->rx_bc_byte_cnt), tlen); |
| 11586 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT, |
| 11587 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 11588 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 11589 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT, |
| 11590 | (uint8_t) sizeof(dStats->tx_mc_byte_cnt), |
| 11591 | (char *)&(dStats->tx_mc_byte_cnt), tlen); |
| 11592 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT, |
| 11593 | (uint8_t) sizeof(dStats->tx_bc_byte_cnt), |
| 11594 | (char *)&(dStats->tx_bc_byte_cnt), tlen); |
| 11595 | |
| 11596 | wrqu->data.length = tlen; |
| 11597 | |
| 11598 | } |
| 11599 | |
| 11600 | EXIT(); |
| 11601 | |
| 11602 | return 0; |
| 11603 | } |
| 11604 | |
| 11605 | static int iw_get_statistics(struct net_device *dev, |
| 11606 | struct iw_request_info *info, |
| 11607 | union iwreq_data *wrqu, char *extra) |
| 11608 | { |
| 11609 | int ret; |
| 11610 | |
| 11611 | cds_ssr_protect(__func__); |
| 11612 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 11613 | cds_ssr_unprotect(__func__); |
| 11614 | |
| 11615 | return ret; |
| 11616 | } |
| 11617 | |
| 11618 | #ifdef FEATURE_WLAN_SCAN_PNO |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11619 | /*Max Len for PNO notification*/ |
| 11620 | #define MAX_PNO_NOTIFY_LEN 100 |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11621 | static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev, |
| 11622 | struct scan_event *event, void *args) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11623 | { |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11624 | struct vdev_osif_priv *osif_priv; |
| 11625 | struct wireless_dev *wdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11626 | union iwreq_data wrqu; |
| 11627 | char buf[MAX_PNO_NOTIFY_LEN + 1]; |
| 11628 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11629 | wlan_vdev_obj_lock(vdev); |
| 11630 | osif_priv = wlan_vdev_get_ospriv(vdev); |
| 11631 | wlan_vdev_obj_unlock(vdev); |
| 11632 | if (!osif_priv) { |
| 11633 | hdd_err("osif_priv is null"); |
| 11634 | return; |
| 11635 | } |
| 11636 | |
| 11637 | wdev = osif_priv->wdev; |
| 11638 | if (!wdev) { |
| 11639 | hdd_err("wdev is null"); |
| 11640 | return; |
| 11641 | } |
| 11642 | |
| 11643 | hdd_debug("A preferred network was found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11644 | |
| 11645 | /* create the event */ |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11646 | qdf_mem_zero(&wrqu, sizeof(wrqu)); |
| 11647 | qdf_mem_zero(buf, sizeof(buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11648 | |
| 11649 | snprintf(buf, MAX_PNO_NOTIFY_LEN, |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11650 | "QCOM: Found preferred network:"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11651 | |
| 11652 | wrqu.data.pointer = buf; |
| 11653 | wrqu.data.length = strlen(buf); |
| 11654 | |
| 11655 | /* send the event */ |
| 11656 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11657 | wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11658 | } |
| 11659 | |
| 11660 | /** |
| 11661 | * __iw_set_pno() - Preferred Network Offload ioctl handler |
| 11662 | * @dev: device upon which the ioctl was received |
| 11663 | * @info: ioctl request information |
| 11664 | * @wrqu: ioctl request data |
| 11665 | * @extra: ioctl extra data |
| 11666 | * |
| 11667 | * This function parses a Preferred Network Offload command |
| 11668 | * Input is string based and expected to be of the form: |
| 11669 | * |
| 11670 | * <enable(1) | disable(0)> |
| 11671 | * when enabling: |
| 11672 | * <number of networks> |
| 11673 | * for each network: |
| 11674 | * <ssid_len> <ssid> <authentication> <encryption> |
| 11675 | * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11676 | * <scan_time (seconds)> |
| 11677 | * <scan_repeat_count (0 means indefinite)> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11678 | * <suspend mode> |
| 11679 | * |
| 11680 | * e.g: |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11681 | * 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] | 11682 | * |
| 11683 | * this translates into: |
| 11684 | * ----------------------------- |
| 11685 | * enable PNO |
| 11686 | * 2 networks |
| 11687 | * Network 1: |
| 11688 | * test - with authentication type 0 and encryption type 0, |
| 11689 | * search on 3 channels: 1 6 and 11, |
| 11690 | * SSID bcast type is unknown (directed probe will be sent if |
| 11691 | * AP not found) and must meet -40dBm RSSI |
| 11692 | * Network 2: |
| 11693 | * test2 - with authentication type 4 and encryption type 4, |
| 11694 | * search on 6 channels 1, 2, 3, 4, 5 and 6 |
| 11695 | * bcast type is non-bcast (directed probe will be sent) |
| 11696 | * and must not meet any RSSI threshold |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11697 | * scan every 5 seconds 2 times |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11698 | * enable on suspend |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11699 | */ |
| 11700 | static int __iw_set_pno(struct net_device *dev, |
| 11701 | struct iw_request_info *info, |
| 11702 | union iwreq_data *wrqu, char *extra) |
| 11703 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 11704 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 11705 | struct hdd_context *hdd_ctx; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11706 | uint8_t value; |
| 11707 | struct wlan_objmgr_vdev *vdev; |
| 11708 | struct wlan_objmgr_psoc *psoc; |
| 11709 | int ret = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11710 | int offset; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11711 | char *ptr, *data; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11712 | uint8_t i, j, params; |
| 11713 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11714 | size_t len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11715 | |
| 11716 | /* request is a large struct, so we make it static to avoid |
| 11717 | * stack overflow. This API is only invoked via ioctl, so it |
| 11718 | * is serialized by the kernel rtnl_lock and hence does not |
| 11719 | * need to be reentrant |
| 11720 | */ |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11721 | static struct pno_scan_req_params req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11722 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11723 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11724 | |
| 11725 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 11726 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 11727 | if (ret) |
| 11728 | return ret; |
| 11729 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11730 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11731 | if (0 != ret) |
| 11732 | return ret; |
| 11733 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11734 | vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev, |
| 11735 | dev->dev_addr, WLAN_LEGACY_MAC_ID); |
| 11736 | if (!vdev) { |
| 11737 | hdd_err("vdev object is NULL"); |
| 11738 | return -EIO; |
| 11739 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11740 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11741 | hdd_debug("PNO data len %d data %s", wrqu->data.length, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11742 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11743 | /* making sure argument string ends with '\0' */ |
| 11744 | len = (wrqu->data.length + 1); |
| 11745 | data = qdf_mem_malloc(len); |
| 11746 | if (!data) { |
| 11747 | hdd_err("fail to allocate memory %zu", len); |
| 11748 | return -EINVAL; |
| 11749 | } |
| 11750 | qdf_mem_copy(data, extra, (len-1)); |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11751 | ptr = data; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11752 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11753 | if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11754 | hdd_err("PNO enable input is not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11755 | ret = -EINVAL; |
| 11756 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11757 | } |
| 11758 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11759 | if (!value) { |
| 11760 | status = ucfg_scan_pno_stop(vdev); |
| 11761 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11762 | hdd_err("Failed to disabled PNO"); |
| 11763 | ret = -EINVAL; |
| 11764 | } else { |
| 11765 | hdd_debug("PNO scan disabled"); |
| 11766 | } |
| 11767 | goto exit; |
| 11768 | } |
| 11769 | |
| 11770 | if (ucfg_scan_get_pno_in_progress(vdev)) { |
| 11771 | hdd_debug("pno is already in progress"); |
| 11772 | ret = -EBUSY; |
| 11773 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11774 | } |
| 11775 | |
| 11776 | ptr += offset; |
| 11777 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11778 | if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11779 | hdd_err("PNO count input not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11780 | ret = -EINVAL; |
| 11781 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11782 | } |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11783 | req.networks_cnt = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11784 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11785 | hdd_debug("PNO enable networks count %d offset %d", |
| 11786 | req.networks_cnt, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11787 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11788 | if ((0 == req.networks_cnt) || |
| 11789 | (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11790 | hdd_err("Network count %d invalid", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11791 | req.networks_cnt); |
| 11792 | ret = -EINVAL; |
| 11793 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11794 | } |
| 11795 | |
| 11796 | ptr += offset; |
| 11797 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11798 | for (i = 0; i < req.networks_cnt; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11799 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11800 | req.networks_list[i].ssid.length = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11801 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11802 | params = sscanf(ptr, " %hhu %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11803 | &(req.networks_list[i].ssid.length), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11804 | &offset); |
| 11805 | |
| 11806 | if (1 != params) { |
| 11807 | hdd_err("PNO ssid length input is not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11808 | ret = -EINVAL; |
| 11809 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11810 | } |
| 11811 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11812 | if ((0 == req.networks_list[i].ssid.length) || |
| 11813 | (req.networks_list[i].ssid.length > 32)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11814 | hdd_err("SSID Len %d is not correct for network %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11815 | req.networks_list[i].ssid.length, i); |
| 11816 | ret = -EINVAL; |
| 11817 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11818 | } |
| 11819 | |
| 11820 | /* Advance to SSID */ |
| 11821 | ptr += offset; |
| 11822 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11823 | memcpy(req.networks_list[i].ssid.ssid, ptr, |
| 11824 | req.networks_list[i].ssid.length); |
| 11825 | ptr += req.networks_list[i].ssid.length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11826 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11827 | params = sscanf(ptr, " %u %u %hhu %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11828 | &(req.networks_list[i].authentication), |
| 11829 | &(req.networks_list[i].encryption), |
| 11830 | &(req.networks_list[i].channel_cnt), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11831 | &offset); |
| 11832 | |
| 11833 | if (3 != params) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11834 | hdd_err("Incorrect cmd %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11835 | ret = -EINVAL; |
| 11836 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11837 | } |
| 11838 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11839 | hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11840 | req.networks_list[i].ssid.length, |
| 11841 | req.networks_list[i].ssid.length, |
| 11842 | req.networks_list[i].ssid.ssid, |
| 11843 | req.networks_list[i].authentication, |
| 11844 | req.networks_list[i].encryption, |
| 11845 | req.networks_list[i].channel_cnt, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11846 | |
| 11847 | /* Advance to channel list */ |
| 11848 | ptr += offset; |
| 11849 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11850 | if (SCAN_PNO_MAX_NETW_CHANNELS_EX < |
| 11851 | req.networks_list[i].channel_cnt) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11852 | hdd_err("Incorrect number of channels"); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11853 | ret = -EINVAL; |
| 11854 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11855 | } |
| 11856 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11857 | if (0 != req.networks_list[i].channel_cnt) { |
| 11858 | for (j = 0; j < req.networks_list[i].channel_cnt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11859 | j++) { |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11860 | if (1 != sscanf(ptr, " %hhu %n", &value, |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11861 | &offset)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 11862 | hdd_err("PNO network channel is not valid %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11863 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11864 | ret = -EINVAL; |
| 11865 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11866 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11867 | if (!IS_CHANNEL_VALID(value)) { |
| 11868 | hdd_err("invalid channel: %hhu", value); |
| 11869 | ret = -EINVAL; |
| 11870 | goto exit; |
| 11871 | } |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11872 | req.networks_list[i].channels[j] = |
| 11873 | cds_chan_to_freq(value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11874 | /* Advance to next channel number */ |
| 11875 | ptr += offset; |
| 11876 | } |
| 11877 | } |
| 11878 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11879 | if (1 != sscanf(ptr, " %u %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11880 | &(req.networks_list[i].bc_new_type), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11881 | &offset)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 11882 | hdd_err("PNO broadcast network type is not valid %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11883 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11884 | ret = -EINVAL; |
| 11885 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11886 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11887 | if (req.networks_list[i].bc_new_type > 2) { |
| 11888 | hdd_err("invalid bcast nw type: %u", |
| 11889 | req.networks_list[i].bc_new_type); |
| 11890 | ret = -EINVAL; |
| 11891 | goto exit; |
| 11892 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11893 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11894 | hdd_debug("PNO bcastNetwType %d offset %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11895 | req.networks_list[i].bc_new_type, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11896 | |
| 11897 | /* Advance to rssi Threshold */ |
| 11898 | ptr += offset; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11899 | if (1 != sscanf(ptr, " %d %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11900 | &(req.networks_list[i].rssi_thresh), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11901 | &offset)) { |
| 11902 | hdd_err("PNO rssi threshold input is not valid %s", |
| 11903 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11904 | ret = -EINVAL; |
| 11905 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11906 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11907 | hdd_debug("PNO rssi %d offset %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11908 | req.networks_list[i].rssi_thresh, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11909 | /* Advance to next network */ |
| 11910 | ptr += offset; |
| 11911 | } /* For ucNetworkCount */ |
| 11912 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11913 | req.fast_scan_period = 0; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11914 | if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) { |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11915 | req.fast_scan_period *= MSEC_PER_SEC; |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11916 | ptr += offset; |
| 11917 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11918 | if (req.fast_scan_period == 0) { |
| 11919 | hdd_err("invalid fast scan period %u", |
| 11920 | req.fast_scan_period); |
| 11921 | ret = -EINVAL; |
| 11922 | goto exit; |
| 11923 | } |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11924 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11925 | req.fast_scan_max_cycles = 0; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11926 | if (sscanf(ptr, " %hhu %n", &value, |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11927 | &offset) > 0) |
| 11928 | ptr += offset; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11929 | req.fast_scan_max_cycles = value; |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 11930 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11931 | wlan_pdev_obj_lock(hdd_ctx->hdd_pdev); |
| 11932 | psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev); |
| 11933 | wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev); |
| 11934 | ucfg_scan_register_pno_cb(psoc, |
| 11935 | found_pref_network_cb, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11936 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11937 | ucfg_scan_get_pno_def_params(vdev, &req); |
| 11938 | status = ucfg_scan_pno_start(vdev, &req); |
| 11939 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11940 | hdd_err("Failed to enable PNO"); |
| 11941 | ret = -EINVAL; |
| 11942 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11943 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11944 | exit: |
| 11945 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11946 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11947 | qdf_mem_free(data); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11948 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11949 | } |
| 11950 | |
| 11951 | static int iw_set_pno(struct net_device *dev, |
| 11952 | struct iw_request_info *info, |
| 11953 | union iwreq_data *wrqu, char *extra) |
| 11954 | { |
| 11955 | int ret; |
| 11956 | |
| 11957 | cds_ssr_protect(__func__); |
| 11958 | ret = __iw_set_pno(dev, info, wrqu, extra); |
| 11959 | cds_ssr_unprotect(__func__); |
| 11960 | |
| 11961 | return ret; |
| 11962 | } |
| 11963 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 11964 | |
| 11965 | /* Common function to SetBand */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11966 | int hdd_reg_set_band(struct net_device *dev, u8 ui_band) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11967 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11968 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11969 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11970 | enum band_info band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11971 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11972 | QDF_STATUS status; |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11973 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11974 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11975 | enum band_info currBand; |
| 11976 | enum band_info connectedBand; |
| 11977 | long lrc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11978 | |
| 11979 | pAdapterNode = NULL; |
| 11980 | pNext = NULL; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11981 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11982 | |
| 11983 | switch (ui_band) { |
| 11984 | case WLAN_HDD_UI_BAND_AUTO: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11985 | band = BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11986 | break; |
| 11987 | case WLAN_HDD_UI_BAND_5_GHZ: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11988 | band = BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11989 | break; |
| 11990 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11991 | band = BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11992 | break; |
| 11993 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11994 | hdd_err("Invalid band value %u", ui_band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11995 | return -EINVAL; |
| 11996 | } |
| 11997 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11998 | hdd_debug("change band to %u", band); |
| 11999 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12000 | if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) || |
Rajeev Kumar Sirasanagandla | 4c9b675 | 2017-07-25 20:35:20 +0530 | [diff] [blame] | 12001 | (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) || |
| 12002 | (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12003 | hdd_err("band value %u violate INI settings %u", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12004 | band, hdd_ctx->config->nBandCapability); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12005 | return -EIO; |
| 12006 | } |
| 12007 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12008 | if (band == BAND_ALL) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12009 | hdd_debug("Auto band received. Setting band same as ini value %d", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12010 | hdd_ctx->config->nBandCapability); |
| 12011 | band = hdd_ctx->config->nBandCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12012 | } |
| 12013 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12014 | if (QDF_STATUS_SUCCESS != ucfg_reg_get_curr_band(hdd_ctx->hdd_pdev, |
Amar Singhal | 58b45ef | 2017-08-01 13:43:54 -0700 | [diff] [blame] | 12015 | &currBand)) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12016 | hdd_debug("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12017 | return -EIO; |
| 12018 | } |
| 12019 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12020 | if (currBand == band) |
| 12021 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12022 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12023 | hdd_ctx->curr_band = band; |
Amar Singhal | 58b45ef | 2017-08-01 13:43:54 -0700 | [diff] [blame] | 12024 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12025 | /* Change band request received. |
| 12026 | * Abort pending scan requests, flush the existing scan results, |
| 12027 | * and change the band capability |
| 12028 | */ |
| 12029 | hdd_debug("Current band value = %u, new setting %u ", |
| 12030 | currBand, band); |
| 12031 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12032 | status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12033 | while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12034 | adapter = pAdapterNode->adapter; |
| 12035 | hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12036 | wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12037 | adapter->sessionId, INVALID_SCAN_ID, false); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12038 | connectedBand = hdd_conn_get_connected_band( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12039 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12040 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12041 | /* Handling is done only for STA and P2P */ |
| 12042 | if (band != BAND_ALL && |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12043 | ((adapter->device_mode == QDF_STA_MODE) || |
| 12044 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) && |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12045 | (hdd_conn_is_connected( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12046 | WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12047 | && (connectedBand != band)) { |
| 12048 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12049 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12050 | /* STA already connected on current |
| 12051 | * band, So issue disconnect first, |
| 12052 | * then change the band |
| 12053 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12054 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12055 | hdd_debug("STA (Device mode %s(%d)) connected in band %u, Changing band to %u, Issuing Disconnect", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12056 | hdd_device_mode_to_string(adapter->device_mode), |
| 12057 | adapter->device_mode, currBand, band); |
| 12058 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12059 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12060 | status = sme_roam_disconnect( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12061 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 12062 | adapter->sessionId, |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12063 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12064 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12065 | if (QDF_STATUS_SUCCESS != status) { |
| 12066 | hdd_err("sme_roam_disconnect failure, status: %d", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12067 | (int)status); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12068 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12069 | } |
| 12070 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12071 | lrc = wait_for_completion_timeout( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12072 | &adapter->disconnect_comp_var, |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12073 | msecs_to_jiffies( |
| 12074 | WLAN_WAIT_TIME_DISCONNECT)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12075 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12076 | if (lrc == 0) { |
| 12077 | hdd_err("Timeout while waiting for csr_roam_disconnect"); |
| 12078 | return -ETIMEDOUT; |
| 12079 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12080 | } |
| 12081 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12082 | sme_scan_flush_result(hHal); |
| 12083 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12084 | status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12085 | pAdapterNode = pNext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12086 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12087 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12088 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 12089 | ucfg_reg_set_band(hdd_ctx->hdd_pdev, band)) { |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12090 | hdd_err("Failed to set the band value to %u", |
| 12091 | band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12092 | return -EINVAL; |
| 12093 | } |
| 12094 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12095 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12096 | } |
| 12097 | |
| 12098 | static int __iw_set_band_config(struct net_device *dev, |
| 12099 | struct iw_request_info *info, |
| 12100 | union iwreq_data *wrqu, char *extra) |
| 12101 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 12102 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 12103 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 12104 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12105 | int *value = (int *)extra; |
| 12106 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 12107 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12108 | |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 12109 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12110 | hdd_err("permission check failed"); |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 12111 | return -EPERM; |
| 12112 | } |
| 12113 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 12114 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 12115 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 12116 | if (0 != ret) |
| 12117 | return ret; |
| 12118 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 12119 | return hdd_reg_set_band(dev, value[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12120 | } |
| 12121 | |
| 12122 | static int iw_set_band_config(struct net_device *dev, |
| 12123 | struct iw_request_info *info, |
| 12124 | union iwreq_data *wrqu, char *extra) |
| 12125 | { |
| 12126 | int ret; |
| 12127 | |
| 12128 | cds_ssr_protect(__func__); |
| 12129 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 12130 | cds_ssr_unprotect(__func__); |
| 12131 | |
| 12132 | return ret; |
| 12133 | } |
| 12134 | |
Arunk Khandavalli | 062fb03 | 2017-10-04 12:18:15 +0530 | [diff] [blame] | 12135 | int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12136 | uint32_t bandwidth) |
| 12137 | { |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 12138 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 12139 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12140 | struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info; |
| 12141 | QDF_STATUS status; |
| 12142 | tHalHandle hal_hdl = hdd_ctx->hHal; |
| 12143 | struct qdf_mac_addr bssid; |
| 12144 | tCsrRoamProfile roam_profile; |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 12145 | struct ch_params ch_params; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12146 | |
| 12147 | if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { |
| 12148 | hdd_err("Not supported, device is not in monitor mode"); |
| 12149 | return -EINVAL; |
| 12150 | } |
| 12151 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12152 | hdd_debug("Set monitor mode Channel %d", chan); |
Hong Shi | e531d1f | 2016-11-14 14:08:03 +0800 | [diff] [blame] | 12153 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12154 | roam_profile.ChannelInfo.ChannelList = &ch_info->channel; |
| 12155 | roam_profile.ChannelInfo.numOfChannels = 1; |
| 12156 | roam_profile.phyMode = ch_info->phy_mode; |
| 12157 | roam_profile.ch_params.ch_width = bandwidth; |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 12158 | hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12159 | |
| 12160 | qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes, |
| 12161 | QDF_MAC_ADDR_SIZE); |
| 12162 | |
| 12163 | ch_params.ch_width = bandwidth; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12164 | wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, chan, 0, &ch_params); |
Manjunathappa Prakash | c4dc938 | 2017-03-07 18:50:33 -0800 | [diff] [blame] | 12165 | if (ch_params.ch_width == CH_WIDTH_INVALID) { |
| 12166 | hdd_err("Invalid capture channel or bandwidth for a country"); |
| 12167 | return -EINVAL; |
| 12168 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12169 | |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12170 | status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, |
| 12171 | &roam_profile); |
| 12172 | if (status) { |
| 12173 | hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", |
| 12174 | status); |
| 12175 | } |
| 12176 | |
Arunk Khandavalli | 062fb03 | 2017-10-04 12:18:15 +0530 | [diff] [blame] | 12177 | adapter->mon_chan = chan; |
| 12178 | adapter->mon_bandwidth = bandwidth; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12179 | return qdf_status_to_os_return(status); |
| 12180 | } |
| 12181 | |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 12182 | static int printk_adapter(void *priv, const char *fmt, ...) |
| 12183 | { |
| 12184 | int ret; |
| 12185 | va_list args; |
| 12186 | |
| 12187 | va_start(args, fmt); |
| 12188 | ret = vprintk(fmt, args); |
| 12189 | ret += printk("\n"); |
| 12190 | va_end(args); |
| 12191 | |
| 12192 | return ret; |
| 12193 | } |
| 12194 | |
| 12195 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 12196 | static void hdd_ioctl_log_buffer(int log_id, uint32_t count) |
| 12197 | { |
| 12198 | qdf_abstract_print *print = &printk_adapter; |
| 12199 | |
| 12200 | switch (log_id) { |
| 12201 | case HTC_CREDIT_HISTORY_LOG: |
| 12202 | print(NULL, "HTC Credit History (count %u)", count); |
| 12203 | cds_print_htc_credit_history(count, print, NULL); |
| 12204 | break; |
| 12205 | case COMMAND_LOG: |
| 12206 | print(NULL, "Command Log (count %u)", count); |
| 12207 | wma_print_wmi_cmd_log(count, print, NULL); |
| 12208 | break; |
| 12209 | case COMMAND_TX_CMP_LOG: |
| 12210 | print(NULL, "Command Tx Complete Log (count %u)", count); |
| 12211 | wma_print_wmi_cmd_tx_cmp_log(count, print, NULL); |
| 12212 | break; |
| 12213 | case MGMT_COMMAND_LOG: |
| 12214 | print(NULL, "Management Command Log (count %u)", count); |
| 12215 | wma_print_wmi_mgmt_cmd_log(count, print, NULL); |
| 12216 | break; |
| 12217 | case MGMT_COMMAND_TX_CMP_LOG: |
| 12218 | print(NULL, "Management Command Tx Complete Log (count %u)", |
| 12219 | count); |
| 12220 | wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL); |
| 12221 | break; |
| 12222 | case EVENT_LOG: |
| 12223 | print(NULL, "Event Log (count %u)", count); |
| 12224 | wma_print_wmi_event_log(count, print, NULL); |
| 12225 | break; |
| 12226 | case RX_EVENT_LOG: |
| 12227 | print(NULL, "Rx Event Log (count %u)", count); |
| 12228 | wma_print_wmi_rx_event_log(count, print, NULL); |
| 12229 | break; |
| 12230 | case MGMT_EVENT_LOG: |
| 12231 | print(NULL, "Management Event Log (count %u)", count); |
| 12232 | wma_print_wmi_mgmt_event_log(count, print, NULL); |
| 12233 | break; |
| 12234 | default: |
| 12235 | print(NULL, "Invalid Log Id %d", log_id); |
| 12236 | break; |
| 12237 | } |
| 12238 | } |
| 12239 | #else |
| 12240 | static inline void hdd_ioctl_log_buffer(int log_id, uint32_t count) |
| 12241 | { |
| 12242 | } |
| 12243 | #endif /* WMI_INTERFACE_EVENT_LOGGING */ |
| 12244 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12245 | static int __iw_set_two_ints_getnone(struct net_device *dev, |
| 12246 | struct iw_request_info *info, |
| 12247 | union iwreq_data *wrqu, char *extra) |
| 12248 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12249 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12250 | int *value = (int *)extra; |
| 12251 | int sub_cmd = value[0]; |
| 12252 | int ret; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12253 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12254 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 12255 | ENTER_DEV(dev); |
| 12256 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12257 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 12258 | if (0 != ret) |
| 12259 | return ret; |
| 12260 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 12261 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 12262 | if (0 != ret) |
| 12263 | return ret; |
| 12264 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12265 | switch (sub_cmd) { |
| 12266 | case WE_SET_SMPS_PARAM: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12267 | hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12268 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12269 | WMI_STA_SMPS_PARAM_CMDID, |
| 12270 | value[1] << WMA_SMPS_PARAM_VALUE_S |
| 12271 | | value[2], |
| 12272 | VDEV_CMD); |
| 12273 | break; |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 12274 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12275 | case WE_SET_FW_CRASH_INJECT: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12276 | hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12277 | value[1], value[2]); |
DARAM SUDHA | 7e7e91b | 2015-05-29 11:38:47 +0530 | [diff] [blame] | 12278 | pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n", |
| 12279 | value[1], value[2]); |
SaidiReddy Yenuga | cc733af | 2016-11-09 17:45:42 +0530 | [diff] [blame] | 12280 | if (!hdd_ctx->config->crash_inject_enabled) { |
| 12281 | hdd_err("Crash Inject ini disabled, Ignore Crash Inject"); |
| 12282 | return 0; |
| 12283 | } |
Yue Ma | 0615235 | 2017-06-20 18:08:58 -0700 | [diff] [blame] | 12284 | if (value[1] == 3) { |
Anurag Chouhan | 4085ff7 | 2017-10-05 18:09:56 +0530 | [diff] [blame] | 12285 | cds_trigger_recovery(QDF_REASON_UNSPECIFIED); |
Yue Ma | 0615235 | 2017-06-20 18:08:58 -0700 | [diff] [blame] | 12286 | return 0; |
| 12287 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12288 | ret = wma_cli_set2_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12289 | GEN_PARAM_CRASH_INJECT, |
| 12290 | value[1], value[2], GEN_CMD); |
| 12291 | break; |
| 12292 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12293 | case WE_ENABLE_FW_PROFILE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12294 | hdd_err("WE_ENABLE_FW_PROFILE: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12295 | value[1], value[2]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12296 | ret = wma_cli_set2_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12297 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 12298 | value[1], value[2], DBG_CMD); |
| 12299 | break; |
| 12300 | case WE_SET_FW_PROFILE_HIST_INTVL: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12301 | hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12302 | value[1], value[2]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12303 | ret = wma_cli_set2_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12304 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 12305 | value[1], value[2], DBG_CMD); |
| 12306 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12307 | case WE_SET_DUAL_MAC_FW_MODE_CONFIG: |
| 12308 | hdd_debug("Ioctl to set dual fw mode config"); |
Tushnim Bhattacharyya | 49ed8ab | 2017-05-26 18:20:10 -0700 | [diff] [blame] | 12309 | if (hdd_ctx->config->dual_mac_feature_disable == |
| 12310 | DISABLE_DBS_CXN_AND_SCAN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12311 | hdd_err("Dual mac feature is disabled from INI"); |
| 12312 | return -EPERM; |
| 12313 | } |
| 12314 | hdd_debug("%d %d", value[1], value[2]); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 12315 | policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc, |
| 12316 | value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12317 | break; |
| 12318 | case WE_DUMP_DP_TRACE_LEVEL: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 12319 | hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12320 | value[1], value[2]); |
| 12321 | if (value[1] == DUMP_DP_TRACE) |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 12322 | qdf_dp_trace_dump_all(value[2], |
| 12323 | QDF_TRACE_DEFAULT_PDEV_ID); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 12324 | else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE) |
| 12325 | qdf_dp_trace_enable_live_mode(); |
Nirav Shah | da00834 | 2016-05-17 18:50:40 +0530 | [diff] [blame] | 12326 | else if (value[1] == CLEAR_DP_TRACE_BUFFER) |
| 12327 | qdf_dp_trace_clear_buffer(); |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 12328 | else if (value[1] == DISABLE_DP_TRACE_LIVE_MODE) |
| 12329 | qdf_dp_trace_disable_live_mode(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12330 | break; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12331 | case WE_SET_MON_MODE_CHAN: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12332 | ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12333 | break; |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 12334 | case WE_SET_WLAN_SUSPEND: { |
Dustin Brown | 3ed3e9b | 2017-03-23 12:57:58 -0700 | [diff] [blame] | 12335 | hdd_info("STA unit-test suspend(%d, %d)", value[1], value[2]); |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 12336 | ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev, |
| 12337 | value[1], value[2]); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 12338 | break; |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 12339 | } |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 12340 | case WE_SET_WLAN_RESUME: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 12341 | ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 12342 | break; |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 12343 | case WE_LOG_BUFFER: { |
| 12344 | int log_id = value[1]; |
| 12345 | uint32_t count = value[2] < 0 ? 0 : value[2]; |
| 12346 | |
| 12347 | hdd_ioctl_log_buffer(log_id, count); |
| 12348 | |
| 12349 | break; |
| 12350 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12351 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12352 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12353 | break; |
| 12354 | } |
| 12355 | |
| 12356 | return ret; |
| 12357 | } |
| 12358 | |
| 12359 | static int iw_set_two_ints_getnone(struct net_device *dev, |
| 12360 | struct iw_request_info *info, |
| 12361 | union iwreq_data *wrqu, char *extra) |
| 12362 | { |
| 12363 | int ret; |
| 12364 | |
| 12365 | cds_ssr_protect(__func__); |
| 12366 | ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra); |
| 12367 | cds_ssr_unprotect(__func__); |
| 12368 | |
| 12369 | return ret; |
| 12370 | } |
| 12371 | |
| 12372 | /* Define the Wireless Extensions to the Linux Network Device structure */ |
| 12373 | /* A number of these routines are NULL (meaning they are not implemented.) */ |
| 12374 | |
| 12375 | static const iw_handler we_handler[] = { |
| 12376 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 12377 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 12378 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 12379 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 12380 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 12381 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 12382 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 12383 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 12384 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 12385 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 12386 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 12387 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 12388 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 12389 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 12390 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 12391 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 12392 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 12393 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 12394 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 12395 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 12396 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 12397 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 12398 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 12399 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
Sandeep Puligilla | d000421 | 2017-02-26 18:34:56 -0800 | [diff] [blame] | 12400 | (iw_handler) NULL, /* SIOCSIWSCAN */ |
| 12401 | (iw_handler) NULL, /* SIOCGIWSCAN */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12402 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 12403 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 12404 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 12405 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 12406 | (iw_handler) NULL, /* -- hole -- */ |
| 12407 | (iw_handler) NULL, /* -- hole -- */ |
| 12408 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 12409 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 12410 | (iw_handler) iw_set_rts_threshold, /* SIOCSIWRTS */ |
| 12411 | (iw_handler) iw_get_rts_threshold, /* SIOCGIWRTS */ |
| 12412 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 12413 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 12414 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 12415 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 12416 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 12417 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 12418 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
Jeff Johnson | e84e8d0 | 2017-10-15 12:22:58 -0700 | [diff] [blame^] | 12419 | (iw_handler) NULL, /* SIOCGIWENCODE */ |
Jeff Johnson | 955e058 | 2017-10-15 11:56:52 -0700 | [diff] [blame] | 12420 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
Jeff Johnson | 330d8dc | 2017-10-15 11:43:13 -0700 | [diff] [blame] | 12421 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12422 | (iw_handler) NULL, /* -- hole -- */ |
| 12423 | (iw_handler) NULL, /* -- hole -- */ |
Jeff Johnson | 4bcdafa | 2017-10-15 11:33:42 -0700 | [diff] [blame] | 12424 | (iw_handler) NULL, /* SIOCSIWGENIE */ |
Jeff Johnson | f6562c6 | 2017-10-15 11:24:05 -0700 | [diff] [blame] | 12425 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
Jeff Johnson | 079f7de | 2017-10-15 11:04:08 -0700 | [diff] [blame] | 12426 | (iw_handler) NULL, /* SIOCSIWAUTH */ |
Jeff Johnson | 4139b82 | 2017-10-15 10:55:03 -0700 | [diff] [blame] | 12427 | (iw_handler) NULL, /* SIOCGIWAUTH */ |
Jeff Johnson | 5b30082 | 2017-10-15 10:44:40 -0700 | [diff] [blame] | 12428 | (iw_handler) NULL, /* SIOCSIWENCODEEXT */ |
Jeff Johnson | 6b74705 | 2017-10-15 10:29:04 -0700 | [diff] [blame] | 12429 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12430 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 12431 | }; |
| 12432 | |
| 12433 | static const iw_handler we_private[] = { |
| 12434 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 12435 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, |
| 12436 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, |
| 12437 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12438 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 12439 | iw_set_three_ints_getnone, |
| 12440 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 12441 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12442 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 12443 | iw_hdd_set_var_ints_getnone, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 12444 | [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = |
| 12445 | iw_setnone_get_threeint, |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 12446 | [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12447 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 12448 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 12449 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12450 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12451 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 12452 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 12453 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = |
| 12454 | iw_set_keepalive_params, |
| 12455 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 12456 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = |
| 12457 | iw_set_packet_filter_params, |
| 12458 | #endif |
| 12459 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 12460 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno, |
| 12461 | #endif |
| 12462 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 12463 | [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = |
| 12464 | iw_set_dynamic_mcbc_filter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12465 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed, |
| 12466 | [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 12467 | iw_set_two_ints_getnone, |
| 12468 | [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] = |
| 12469 | iw_set_dot11p_channel_sched, |
| 12470 | }; |
| 12471 | |
| 12472 | /*Maximum command length can be only 15 */ |
| 12473 | static const struct iw_priv_args we_private_args[] = { |
| 12474 | |
| 12475 | /* handlers for main ioctl */ |
| 12476 | {WLAN_PRIV_SET_INT_GET_NONE, |
| 12477 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12478 | 0, |
| 12479 | ""}, |
| 12480 | |
| 12481 | /* handlers for sub-ioctl */ |
| 12482 | {WE_SET_11D_STATE, |
| 12483 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12484 | 0, |
| 12485 | "set11Dstate"}, |
| 12486 | |
| 12487 | {WE_WOWL, |
| 12488 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12489 | 0, |
| 12490 | "wowl"}, |
| 12491 | |
| 12492 | {WE_SET_POWER, |
| 12493 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12494 | 0, |
| 12495 | "setPower"}, |
| 12496 | |
| 12497 | {WE_SET_MAX_ASSOC, |
| 12498 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12499 | 0, |
| 12500 | "setMaxAssoc"}, |
| 12501 | |
| 12502 | {WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 12503 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, |
| 12504 | "setAutoChannel" }, |
| 12505 | |
| 12506 | {WE_SET_SCAN_DISABLE, |
| 12507 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12508 | 0, |
| 12509 | "scan_disable"}, |
| 12510 | |
| 12511 | {WE_SET_DATA_INACTIVITY_TO, |
| 12512 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12513 | 0, |
| 12514 | "inactivityTO"}, |
| 12515 | |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 12516 | {WE_SET_WOW_DATA_INACTIVITY_TO, |
| 12517 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12518 | 0, |
| 12519 | "wow_ito"}, |
| 12520 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12521 | {WE_SET_MAX_TX_POWER, |
| 12522 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12523 | 0, |
| 12524 | "setMaxTxPower"}, |
| 12525 | |
| 12526 | {WE_SET_TX_POWER, |
| 12527 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12528 | 0, |
| 12529 | "setTxPower"}, |
| 12530 | |
| 12531 | {WE_SET_MC_RATE, |
| 12532 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12533 | 0, |
| 12534 | "setMcRate"}, |
| 12535 | |
| 12536 | {WE_SET_MAX_TX_POWER_2_4, |
| 12537 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12538 | 0, |
| 12539 | "setTxMaxPower2G"}, |
| 12540 | |
| 12541 | {WE_SET_MAX_TX_POWER_5_0, |
| 12542 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12543 | 0, |
| 12544 | "setTxMaxPower5G"}, |
| 12545 | |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 12546 | {WE_SET_PKTLOG, |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 12547 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 12548 | 0, |
| 12549 | "pktlog"}, |
| 12550 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12551 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 12552 | * as well to keep same syntax as in SAP. Now onwards, STA |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame] | 12553 | * will support both |
| 12554 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12555 | {WE_SET_MAX_TX_POWER, |
| 12556 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12557 | 0, |
| 12558 | "setTxMaxPower"}, |
| 12559 | |
| 12560 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame] | 12561 | * 1 = enable and 0 = disable |
| 12562 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12563 | { |
| 12564 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 12565 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12566 | 0, |
| 12567 | "setHDtimTransn" |
| 12568 | }, |
| 12569 | |
| 12570 | {WE_SET_TM_LEVEL, |
| 12571 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12572 | 0, |
| 12573 | "setTmLevel"}, |
| 12574 | |
| 12575 | {WE_SET_PHYMODE, |
| 12576 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12577 | 0, |
| 12578 | "setphymode"}, |
| 12579 | |
| 12580 | {WE_SET_NSS, |
| 12581 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12582 | 0, |
| 12583 | "nss"}, |
| 12584 | |
| 12585 | {WE_SET_LDPC, |
| 12586 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12587 | 0, |
| 12588 | "ldpc"}, |
| 12589 | |
| 12590 | {WE_SET_TX_STBC, |
| 12591 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12592 | 0, |
| 12593 | "tx_stbc"}, |
| 12594 | |
| 12595 | {WE_SET_RX_STBC, |
| 12596 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12597 | 0, |
| 12598 | "rx_stbc"}, |
| 12599 | |
| 12600 | {WE_SET_SHORT_GI, |
| 12601 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12602 | 0, |
| 12603 | "shortgi"}, |
| 12604 | |
| 12605 | {WE_SET_RTSCTS, |
| 12606 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12607 | 0, |
| 12608 | "enablertscts"}, |
| 12609 | |
| 12610 | {WE_SET_CHWIDTH, |
| 12611 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12612 | 0, |
| 12613 | "chwidth"}, |
| 12614 | |
| 12615 | {WE_SET_ANI_EN_DIS, |
| 12616 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12617 | 0, |
| 12618 | "anienable"}, |
| 12619 | |
| 12620 | {WE_SET_ANI_POLL_PERIOD, |
| 12621 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12622 | 0, |
| 12623 | "aniplen"}, |
| 12624 | |
| 12625 | {WE_SET_ANI_LISTEN_PERIOD, |
| 12626 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12627 | 0, |
| 12628 | "anilislen"}, |
| 12629 | |
| 12630 | {WE_SET_ANI_OFDM_LEVEL, |
| 12631 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12632 | 0, |
| 12633 | "aniofdmlvl"}, |
| 12634 | |
| 12635 | {WE_SET_ANI_CCK_LEVEL, |
| 12636 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12637 | 0, |
| 12638 | "aniccklvl"}, |
| 12639 | |
| 12640 | {WE_SET_DYNAMIC_BW, |
| 12641 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12642 | 0, |
| 12643 | "cwmenable"}, |
| 12644 | |
| 12645 | {WE_SET_CTS_CBW, |
| 12646 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12647 | 0, |
| 12648 | "cts_cbw" }, |
| 12649 | |
| 12650 | {WE_SET_GTX_HT_MCS, |
| 12651 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12652 | 0, |
| 12653 | "gtxHTMcs"}, |
| 12654 | |
| 12655 | {WE_SET_GTX_VHT_MCS, |
| 12656 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12657 | 0, |
| 12658 | "gtxVHTMcs"}, |
| 12659 | |
| 12660 | {WE_SET_GTX_USRCFG, |
| 12661 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12662 | 0, |
| 12663 | "gtxUsrCfg"}, |
| 12664 | |
| 12665 | {WE_SET_GTX_THRE, |
| 12666 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12667 | 0, |
| 12668 | "gtxThre"}, |
| 12669 | |
| 12670 | {WE_SET_GTX_MARGIN, |
| 12671 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12672 | 0, |
| 12673 | "gtxMargin"}, |
| 12674 | |
| 12675 | {WE_SET_GTX_STEP, |
| 12676 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12677 | 0, |
| 12678 | "gtxStep"}, |
| 12679 | |
| 12680 | {WE_SET_GTX_MINTPC, |
| 12681 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12682 | 0, |
| 12683 | "gtxMinTpc"}, |
| 12684 | |
| 12685 | {WE_SET_GTX_BWMASK, |
| 12686 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12687 | 0, |
| 12688 | "gtxBWMask"}, |
| 12689 | |
| 12690 | {WE_SET_TX_CHAINMASK, |
| 12691 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12692 | 0, |
| 12693 | "txchainmask"}, |
| 12694 | |
| 12695 | {WE_SET_RX_CHAINMASK, |
| 12696 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12697 | 0, |
| 12698 | "rxchainmask"}, |
| 12699 | |
| 12700 | {WE_SET_11N_RATE, |
| 12701 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12702 | 0, |
| 12703 | "set11NRates"}, |
| 12704 | |
| 12705 | {WE_SET_VHT_RATE, |
| 12706 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12707 | 0, |
| 12708 | "set11ACRates"}, |
| 12709 | |
| 12710 | {WE_SET_AMPDU, |
| 12711 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12712 | 0, |
| 12713 | "ampdu"}, |
| 12714 | |
| 12715 | {WE_SET_AMSDU, |
| 12716 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12717 | 0, |
| 12718 | "amsdu"}, |
| 12719 | |
| 12720 | {WE_SET_BURST_ENABLE, |
| 12721 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12722 | 0, |
| 12723 | "burst_enable"}, |
| 12724 | |
| 12725 | {WE_SET_BURST_DUR, |
| 12726 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12727 | 0, |
| 12728 | "burst_dur"}, |
| 12729 | |
| 12730 | {WE_SET_TXPOW_2G, |
| 12731 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12732 | 0, |
| 12733 | "txpow2g"}, |
| 12734 | |
| 12735 | {WE_SET_TXPOW_5G, |
| 12736 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12737 | 0, |
| 12738 | "txpow5g"}, |
| 12739 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12740 | /* Sub-cmds DBGLOG specific commands */ |
| 12741 | {WE_DBGLOG_LOG_LEVEL, |
| 12742 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12743 | 0, |
| 12744 | "dl_loglevel"}, |
| 12745 | |
| 12746 | {WE_DBGLOG_VAP_ENABLE, |
| 12747 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12748 | 0, |
| 12749 | "dl_vapon"}, |
| 12750 | |
| 12751 | {WE_DBGLOG_VAP_DISABLE, |
| 12752 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12753 | 0, |
| 12754 | "dl_vapoff"}, |
| 12755 | |
| 12756 | {WE_DBGLOG_MODULE_ENABLE, |
| 12757 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12758 | 0, |
| 12759 | "dl_modon"}, |
| 12760 | |
| 12761 | {WE_DBGLOG_MODULE_DISABLE, |
| 12762 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12763 | 0, |
| 12764 | "dl_modoff"}, |
| 12765 | |
| 12766 | {WE_DBGLOG_MOD_LOG_LEVEL, |
| 12767 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12768 | 0, |
| 12769 | "dl_mod_loglevel"}, |
| 12770 | |
| 12771 | {WE_DBGLOG_TYPE, |
| 12772 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12773 | 0, |
| 12774 | "dl_type"}, |
| 12775 | {WE_DBGLOG_REPORT_ENABLE, |
| 12776 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12777 | 0, |
| 12778 | "dl_report"}, |
| 12779 | |
| 12780 | {WE_SET_TXRX_FWSTATS, |
| 12781 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12782 | 0, |
| 12783 | "txrx_fw_stats"}, |
| 12784 | |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 12785 | {WE_SET_TXRX_STATS, |
| 12786 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12787 | 0, |
| 12788 | "txrx_stats"}, |
| 12789 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12790 | {WE_TXRX_FWSTATS_RESET, |
| 12791 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12792 | 0, |
| 12793 | "txrx_fw_st_rst"}, |
| 12794 | |
| 12795 | {WE_PPS_PAID_MATCH, |
| 12796 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12797 | 0, "paid_match"}, |
| 12798 | |
| 12799 | {WE_PPS_GID_MATCH, |
| 12800 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12801 | 0, "gid_match"}, |
| 12802 | |
| 12803 | {WE_PPS_EARLY_TIM_CLEAR, |
| 12804 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12805 | 0, "tim_clear"}, |
| 12806 | |
| 12807 | {WE_PPS_EARLY_DTIM_CLEAR, |
| 12808 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12809 | 0, "dtim_clear"}, |
| 12810 | |
| 12811 | {WE_PPS_EOF_PAD_DELIM, |
| 12812 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12813 | 0, "eof_delim"}, |
| 12814 | |
| 12815 | {WE_PPS_MACADDR_MISMATCH, |
| 12816 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12817 | 0, "mac_match"}, |
| 12818 | |
| 12819 | {WE_PPS_DELIM_CRC_FAIL, |
| 12820 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12821 | 0, "delim_fail"}, |
| 12822 | |
| 12823 | {WE_PPS_GID_NSTS_ZERO, |
| 12824 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12825 | 0, "nsts_zero"}, |
| 12826 | |
| 12827 | {WE_PPS_RSSI_CHECK, |
| 12828 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12829 | 0, "rssi_chk"}, |
| 12830 | |
| 12831 | {WE_PPS_5G_EBT, |
| 12832 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12833 | 0, "5g_ebt"}, |
| 12834 | |
| 12835 | {WE_SET_HTSMPS, |
| 12836 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12837 | 0, "htsmps"}, |
| 12838 | |
| 12839 | {WE_SET_QPOWER_MAX_PSPOLL_COUNT, |
| 12840 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12841 | 0, "set_qpspollcnt"}, |
| 12842 | |
| 12843 | {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 12844 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12845 | 0, "set_qtxwake"}, |
| 12846 | |
| 12847 | {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 12848 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12849 | 0, "set_qwakeintv"}, |
| 12850 | |
| 12851 | {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 12852 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12853 | 0, "set_qnodatapoll"}, |
| 12854 | |
| 12855 | /* handlers for MCC time quota and latency sub ioctls */ |
| 12856 | {WE_MCC_CONFIG_LATENCY, |
| 12857 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12858 | 0, "setMccLatency"}, |
| 12859 | |
| 12860 | {WE_MCC_CONFIG_QUOTA, |
| 12861 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12862 | 0, "setMccQuota"}, |
| 12863 | |
| 12864 | {WE_SET_DEBUG_LOG, |
| 12865 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12866 | 0, "setDbgLvl"}, |
| 12867 | |
| 12868 | /* handlers for early_rx power save */ |
| 12869 | {WE_SET_EARLY_RX_ADJUST_ENABLE, |
| 12870 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12871 | 0, "erx_enable"}, |
| 12872 | |
| 12873 | {WE_SET_EARLY_RX_TGT_BMISS_NUM, |
| 12874 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12875 | 0, "erx_bmiss_val"}, |
| 12876 | |
| 12877 | {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 12878 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12879 | 0, "erx_bmiss_smpl"}, |
| 12880 | |
| 12881 | {WE_SET_EARLY_RX_SLOP_STEP, |
| 12882 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12883 | 0, "erx_slop_step"}, |
| 12884 | |
| 12885 | {WE_SET_EARLY_RX_INIT_SLOP, |
| 12886 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12887 | 0, "erx_init_slop"}, |
| 12888 | |
| 12889 | {WE_SET_EARLY_RX_ADJUST_PAUSE, |
| 12890 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12891 | 0, "erx_adj_pause"}, |
| 12892 | |
| 12893 | {WE_SET_EARLY_RX_DRIFT_SAMPLE, |
| 12894 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12895 | 0, "erx_dri_sample"}, |
| 12896 | |
| 12897 | {WE_DUMP_STATS, |
| 12898 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12899 | 0, "dumpStats"}, |
| 12900 | |
| 12901 | {WE_CLEAR_STATS, |
| 12902 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12903 | 0, "clearStats"}, |
| 12904 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12905 | {WE_START_FW_PROFILE, |
| 12906 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12907 | 0, "startProfile"}, |
| 12908 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 12909 | {WE_SET_CHANNEL, |
| 12910 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12911 | 0, "setChanChange" }, |
| 12912 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 12913 | {WE_SET_CONC_SYSTEM_PREF, |
| 12914 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12915 | 0, "setConcSysPref" }, |
| 12916 | |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 12917 | {WE_SET_PDEV_RESET, |
| 12918 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12919 | 0, "pdev_reset" }, |
| 12920 | |
SaidiReddy Yenuga | a92f8cc | 2017-03-24 15:15:03 +0530 | [diff] [blame] | 12921 | {WE_SET_MODULATED_DTIM, |
| 12922 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12923 | 0, "setModDTIM" }, |
| 12924 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12925 | {WLAN_PRIV_SET_NONE_GET_INT, |
| 12926 | 0, |
| 12927 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12928 | ""}, |
| 12929 | |
| 12930 | /* handlers for sub-ioctl */ |
| 12931 | {WE_GET_11D_STATE, |
| 12932 | 0, |
| 12933 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12934 | "get11Dstate"}, |
| 12935 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12936 | {WE_GET_WLAN_DBG, |
| 12937 | 0, |
| 12938 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12939 | "getwlandbg"}, |
| 12940 | |
| 12941 | {WE_GET_MAX_ASSOC, |
| 12942 | 0, |
| 12943 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12944 | "getMaxAssoc"}, |
| 12945 | |
| 12946 | {WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 12947 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12948 | "getAutoChannel" }, |
| 12949 | |
| 12950 | {WE_GET_CONCURRENCY_MODE, |
| 12951 | 0, |
| 12952 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12953 | "getconcurrency"}, |
| 12954 | |
| 12955 | {WE_GET_NSS, |
| 12956 | 0, |
| 12957 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12958 | "get_nss"}, |
| 12959 | |
| 12960 | {WE_GET_LDPC, |
| 12961 | 0, |
| 12962 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12963 | "get_ldpc"}, |
| 12964 | |
| 12965 | {WE_GET_TX_STBC, |
| 12966 | 0, |
| 12967 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12968 | "get_tx_stbc"}, |
| 12969 | |
| 12970 | {WE_GET_RX_STBC, |
| 12971 | 0, |
| 12972 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12973 | "get_rx_stbc"}, |
| 12974 | |
| 12975 | {WE_GET_SHORT_GI, |
| 12976 | 0, |
| 12977 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12978 | "get_shortgi"}, |
| 12979 | |
| 12980 | {WE_GET_RTSCTS, |
| 12981 | 0, |
| 12982 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12983 | "get_rtscts"}, |
| 12984 | |
| 12985 | {WE_GET_CHWIDTH, |
| 12986 | 0, |
| 12987 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12988 | "get_chwidth"}, |
| 12989 | |
| 12990 | {WE_GET_ANI_EN_DIS, |
| 12991 | 0, |
| 12992 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12993 | "get_anienable"}, |
| 12994 | |
| 12995 | {WE_GET_ANI_POLL_PERIOD, |
| 12996 | 0, |
| 12997 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12998 | "get_aniplen"}, |
| 12999 | |
| 13000 | {WE_GET_ANI_LISTEN_PERIOD, |
| 13001 | 0, |
| 13002 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13003 | "get_anilislen"}, |
| 13004 | |
| 13005 | {WE_GET_ANI_OFDM_LEVEL, |
| 13006 | 0, |
| 13007 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13008 | "get_aniofdmlvl"}, |
| 13009 | |
| 13010 | {WE_GET_ANI_CCK_LEVEL, |
| 13011 | 0, |
| 13012 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13013 | "get_aniccklvl"}, |
| 13014 | |
| 13015 | {WE_GET_DYNAMIC_BW, |
| 13016 | 0, |
| 13017 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13018 | "get_cwmenable"}, |
| 13019 | |
| 13020 | {WE_GET_GTX_HT_MCS, |
| 13021 | 0, |
| 13022 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13023 | "get_gtxHTMcs"}, |
| 13024 | |
| 13025 | {WE_GET_GTX_VHT_MCS, |
| 13026 | 0, |
| 13027 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13028 | "get_gtxVHTMcs"}, |
| 13029 | |
| 13030 | {WE_GET_GTX_USRCFG, |
| 13031 | 0, |
| 13032 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13033 | "get_gtxUsrCfg"}, |
| 13034 | |
| 13035 | {WE_GET_GTX_THRE, |
| 13036 | 0, |
| 13037 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13038 | "get_gtxThre"}, |
| 13039 | |
| 13040 | {WE_GET_GTX_MARGIN, |
| 13041 | 0, |
| 13042 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13043 | "get_gtxMargin"}, |
| 13044 | |
| 13045 | {WE_GET_GTX_STEP, |
| 13046 | 0, |
| 13047 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13048 | "get_gtxStep"}, |
| 13049 | |
| 13050 | {WE_GET_GTX_MINTPC, |
| 13051 | 0, |
| 13052 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13053 | "get_gtxMinTpc"}, |
| 13054 | |
| 13055 | {WE_GET_GTX_BWMASK, |
| 13056 | 0, |
| 13057 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13058 | "get_gtxBWMask"}, |
| 13059 | |
| 13060 | {WE_GET_TX_CHAINMASK, |
| 13061 | 0, |
| 13062 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13063 | "get_txchainmask"}, |
| 13064 | |
| 13065 | {WE_GET_RX_CHAINMASK, |
| 13066 | 0, |
| 13067 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13068 | "get_rxchainmask"}, |
| 13069 | |
| 13070 | {WE_GET_11N_RATE, |
| 13071 | 0, |
| 13072 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13073 | "get_11nrate"}, |
| 13074 | |
| 13075 | {WE_GET_AMPDU, |
| 13076 | 0, |
| 13077 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13078 | "get_ampdu"}, |
| 13079 | |
| 13080 | {WE_GET_AMSDU, |
| 13081 | 0, |
| 13082 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13083 | "get_amsdu"}, |
| 13084 | |
| 13085 | {WE_GET_BURST_ENABLE, |
| 13086 | 0, |
| 13087 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13088 | "get_burst_en"}, |
| 13089 | |
| 13090 | {WE_GET_BURST_DUR, |
| 13091 | 0, |
| 13092 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13093 | "get_burst_dur"}, |
| 13094 | |
| 13095 | {WE_GET_TXPOW_2G, |
| 13096 | 0, |
| 13097 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13098 | "get_txpow2g"}, |
| 13099 | |
| 13100 | {WE_GET_TXPOW_5G, |
| 13101 | 0, |
| 13102 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13103 | "get_txpow5g"}, |
| 13104 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13105 | {WE_GET_PPS_PAID_MATCH, |
| 13106 | 0, |
| 13107 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13108 | "get_paid_match"}, |
| 13109 | |
| 13110 | {WE_GET_PPS_GID_MATCH, |
| 13111 | 0, |
| 13112 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13113 | "get_gid_match"}, |
| 13114 | |
| 13115 | {WE_GET_PPS_EARLY_TIM_CLEAR, |
| 13116 | 0, |
| 13117 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13118 | "get_tim_clear"}, |
| 13119 | |
| 13120 | {WE_GET_PPS_EARLY_DTIM_CLEAR, |
| 13121 | 0, |
| 13122 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13123 | "get_dtim_clear"}, |
| 13124 | |
| 13125 | {WE_GET_PPS_EOF_PAD_DELIM, |
| 13126 | 0, |
| 13127 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13128 | "get_eof_delim"}, |
| 13129 | |
| 13130 | {WE_GET_PPS_MACADDR_MISMATCH, |
| 13131 | 0, |
| 13132 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13133 | "get_mac_match"}, |
| 13134 | |
| 13135 | {WE_GET_PPS_DELIM_CRC_FAIL, |
| 13136 | 0, |
| 13137 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13138 | "get_delim_fail"}, |
| 13139 | |
| 13140 | {WE_GET_PPS_GID_NSTS_ZERO, |
| 13141 | 0, |
| 13142 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13143 | "get_nsts_zero"}, |
| 13144 | |
| 13145 | {WE_GET_PPS_RSSI_CHECK, |
| 13146 | 0, |
| 13147 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13148 | "get_rssi_chk"}, |
| 13149 | |
| 13150 | {WE_GET_QPOWER_MAX_PSPOLL_COUNT, |
| 13151 | 0, |
| 13152 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13153 | "get_qpspollcnt"}, |
| 13154 | |
| 13155 | {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 13156 | 0, |
| 13157 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13158 | "get_qtxwake"}, |
| 13159 | |
| 13160 | {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 13161 | 0, |
| 13162 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13163 | "get_qwakeintv"}, |
| 13164 | |
| 13165 | {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 13166 | 0, |
| 13167 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13168 | "get_qnodatapoll"}, |
| 13169 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 13170 | {WE_CAP_TSF, |
| 13171 | 0, |
| 13172 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13173 | "cap_tsf"}, |
| 13174 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13175 | {WE_GET_TEMPERATURE, |
| 13176 | 0, |
| 13177 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13178 | "get_temp"}, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 13179 | {WE_GET_DCM, |
| 13180 | 0, |
| 13181 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13182 | "get_dcm"}, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 13183 | {WE_GET_RANGE_EXT, |
| 13184 | 0, |
| 13185 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13186 | "get_range_ext"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13187 | /* handlers for main ioctl */ |
| 13188 | {WLAN_PRIV_SET_CHAR_GET_NONE, |
| 13189 | IW_PRIV_TYPE_CHAR | 512, |
| 13190 | 0, |
| 13191 | ""}, |
| 13192 | |
| 13193 | /* handlers for sub-ioctl */ |
| 13194 | {WE_WOWL_ADD_PTRN, |
| 13195 | IW_PRIV_TYPE_CHAR | 512, |
| 13196 | 0, |
| 13197 | "wowlAddPtrn"}, |
| 13198 | |
| 13199 | {WE_WOWL_DEL_PTRN, |
| 13200 | IW_PRIV_TYPE_CHAR | 512, |
| 13201 | 0, |
| 13202 | "wowlDelPtrn"}, |
| 13203 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13204 | /* handlers for sub-ioctl */ |
| 13205 | {WE_NEIGHBOR_REPORT_REQUEST, |
| 13206 | IW_PRIV_TYPE_CHAR | 512, |
| 13207 | 0, |
| 13208 | "neighbor"}, |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 13209 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13210 | {WE_SET_AP_WPS_IE, |
| 13211 | IW_PRIV_TYPE_CHAR | 512, |
| 13212 | 0, |
| 13213 | "set_ap_wps_ie"}, |
| 13214 | |
| 13215 | {WE_SET_CONFIG, |
| 13216 | IW_PRIV_TYPE_CHAR | 512, |
| 13217 | 0, |
| 13218 | "setConfig"}, |
| 13219 | |
| 13220 | /* handlers for main ioctl */ |
| 13221 | {WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 13222 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13223 | 0, |
| 13224 | ""}, |
| 13225 | |
| 13226 | /* handlers for sub-ioctl */ |
| 13227 | {WE_SET_WLAN_DBG, |
| 13228 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13229 | 0, |
| 13230 | "setwlandbg"}, |
| 13231 | |
| 13232 | /* handlers for sub-ioctl */ |
| 13233 | {WE_SET_DP_TRACE, |
| 13234 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13235 | 0, |
| 13236 | "set_dp_trace"}, |
| 13237 | |
| 13238 | {WE_SET_SAP_CHANNELS, |
| 13239 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13240 | 0, |
| 13241 | "setsapchannels"}, |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 13242 | |
| 13243 | {WE_SET_FW_TEST, |
| 13244 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13245 | 0, "fw_test"}, |
| 13246 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 13247 | /* handlers for main ioctl */ |
| 13248 | {WLAN_PRIV_SET_NONE_GET_THREE_INT, |
| 13249 | 0, |
| 13250 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13251 | "" }, |
| 13252 | {WE_GET_TSF, |
| 13253 | 0, |
| 13254 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13255 | "get_tsf" }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13256 | |
| 13257 | {WE_SET_DUAL_MAC_SCAN_CONFIG, |
| 13258 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 13259 | 0, |
| 13260 | "set_scan_cfg"}, |
| 13261 | |
| 13262 | /* handlers for main ioctl */ |
| 13263 | {WLAN_PRIV_GET_CHAR_SET_NONE, |
| 13264 | 0, |
| 13265 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13266 | ""}, |
| 13267 | |
| 13268 | /* handlers for sub-ioctl */ |
| 13269 | {WE_WLAN_VERSION, |
| 13270 | 0, |
| 13271 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13272 | "version"}, |
| 13273 | {WE_GET_STATS, |
| 13274 | 0, |
| 13275 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13276 | "getStats"}, |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 13277 | {WE_GET_SUSPEND_RESUME_STATS, |
| 13278 | 0, |
| 13279 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13280 | "getSuspendStats"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 13281 | {WE_LIST_FW_PROFILE, |
| 13282 | 0, |
| 13283 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13284 | "listProfile"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13285 | {WE_GET_STATES, |
| 13286 | 0, |
| 13287 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13288 | "getHostStates"}, |
| 13289 | {WE_GET_CFG, |
| 13290 | 0, |
| 13291 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13292 | "getConfig"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13293 | {WE_GET_RSSI, |
| 13294 | 0, |
| 13295 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13296 | "getRSSI"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13297 | {WE_GET_WMM_STATUS, |
| 13298 | 0, |
| 13299 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13300 | "getWmmStatus"}, |
| 13301 | { |
| 13302 | WE_GET_CHANNEL_LIST, |
| 13303 | 0, |
| 13304 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13305 | "getChannelList" |
| 13306 | }, |
| 13307 | #ifdef FEATURE_WLAN_TDLS |
| 13308 | { |
| 13309 | WE_GET_TDLS_PEERS, |
| 13310 | 0, |
| 13311 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13312 | "getTdlsPeers" |
| 13313 | }, |
| 13314 | #endif |
| 13315 | #ifdef WLAN_FEATURE_11W |
| 13316 | { |
| 13317 | WE_GET_11W_INFO, |
| 13318 | 0, |
| 13319 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13320 | "getPMFInfo" |
| 13321 | }, |
| 13322 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 13323 | { |
| 13324 | WE_GET_IBSS_STA_INFO, |
| 13325 | 0, |
| 13326 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13327 | "getIbssSTAs" |
| 13328 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13329 | {WE_GET_PHYMODE, |
| 13330 | 0, |
| 13331 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13332 | "getphymode"}, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 13333 | #if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13334 | {WE_GET_OEM_DATA_CAP, |
| 13335 | 0, |
| 13336 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13337 | "getOemDataCap"}, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 13338 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13339 | {WE_GET_SNR, |
| 13340 | 0, |
| 13341 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13342 | "getSNR"}, |
| 13343 | |
| 13344 | /* handlers for main ioctl */ |
| 13345 | {WLAN_PRIV_SET_NONE_GET_NONE, |
| 13346 | 0, |
| 13347 | 0, |
| 13348 | ""}, |
| 13349 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 13350 | /* handlers for sub-ioctl */ |
| 13351 | { |
| 13352 | WE_IBSS_GET_PEER_INFO_ALL, |
| 13353 | 0, |
| 13354 | 0, |
| 13355 | "ibssPeerInfoAll" |
| 13356 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13357 | {WE_GET_RECOVERY_STAT, |
| 13358 | 0, |
| 13359 | 0, |
| 13360 | "getRecoverStat"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 13361 | |
| 13362 | {WE_GET_FW_PROFILE_DATA, |
| 13363 | 0, |
| 13364 | 0, |
| 13365 | "getProfileData"}, |
| 13366 | |
| 13367 | {WE_SET_REASSOC_TRIGGER, |
| 13368 | 0, |
| 13369 | 0, |
| 13370 | "reassoc"}, |
| 13371 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 13372 | {WE_STOP_OBSS_SCAN, |
| 13373 | 0, |
| 13374 | 0, |
| 13375 | "stop_obss_scan"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13376 | /* handlers for main ioctl */ |
| 13377 | {WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 13378 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13379 | 0, |
| 13380 | ""}, |
| 13381 | |
| 13382 | /* handlers for sub-ioctl */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 13383 | {WE_IBSS_GET_PEER_INFO, |
| 13384 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13385 | 0, |
| 13386 | "ibssPeerInfo"}, |
| 13387 | |
| 13388 | /* handlers for sub-ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13389 | {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 13390 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13391 | 0, |
| 13392 | "setdumplog"}, |
| 13393 | |
| 13394 | {WE_MTRACE_DUMP_CMD, |
| 13395 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13396 | 0, |
| 13397 | "dumplog"}, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 13398 | |
| 13399 | {WE_POLICY_MANAGER_CINFO_CMD, |
| 13400 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13401 | 0, |
| 13402 | "pm_cinfo"}, |
| 13403 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13404 | #ifdef MPC_UT_FRAMEWORK |
| 13405 | {WE_POLICY_MANAGER_CLIST_CMD, |
| 13406 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13407 | 0, |
| 13408 | "pm_clist"}, |
| 13409 | |
| 13410 | {WE_POLICY_MANAGER_DLIST_CMD, |
| 13411 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13412 | 0, |
| 13413 | "pm_dlist"}, |
| 13414 | |
| 13415 | {WE_POLICY_MANAGER_DBS_CMD, |
| 13416 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13417 | 0, |
| 13418 | "pm_dbs"}, |
| 13419 | |
| 13420 | {WE_POLICY_MANAGER_PCL_CMD, |
| 13421 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13422 | 0, |
| 13423 | "pm_pcl"}, |
| 13424 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13425 | {WE_POLICY_MANAGER_ULIST_CMD, |
| 13426 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13427 | 0, |
| 13428 | "pm_ulist"}, |
| 13429 | |
| 13430 | {WE_POLICY_MANAGER_QUERY_ACTION_CMD, |
| 13431 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13432 | 0, |
| 13433 | "pm_query_action"}, |
| 13434 | |
| 13435 | {WE_POLICY_MANAGER_QUERY_ALLOW_CMD, |
| 13436 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13437 | 0, |
| 13438 | "pm_query_allow"}, |
| 13439 | |
| 13440 | {WE_POLICY_MANAGER_SCENARIO_CMD, |
| 13441 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13442 | 0, |
| 13443 | "pm_run_scenario"}, |
| 13444 | |
| 13445 | {WE_POLICY_SET_HW_MODE_CMD, |
| 13446 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13447 | 0, |
| 13448 | "pm_set_hw_mode"}, |
| 13449 | #endif |
| 13450 | #ifdef FEATURE_WLAN_TDLS |
| 13451 | /* handlers for sub ioctl */ |
| 13452 | { |
| 13453 | WE_TDLS_CONFIG_PARAMS, |
| 13454 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13455 | 0, |
| 13456 | "setTdlsConfig" |
| 13457 | }, |
| 13458 | #endif |
| 13459 | { |
| 13460 | WE_UNIT_TEST_CMD, |
| 13461 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13462 | 0, |
| 13463 | "setUnitTestCmd" |
| 13464 | }, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 13465 | { |
| 13466 | WE_MAC_PWR_DEBUG_CMD, |
| 13467 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13468 | 0, |
| 13469 | "halPwrDebug" |
| 13470 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13471 | |
| 13472 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 13473 | {WE_LED_FLASHING_PARAM, |
| 13474 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 13475 | 0, |
| 13476 | "gpio_control"}, |
| 13477 | #endif |
| 13478 | /* handlers for main ioctl */ |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 13479 | {WLAN_PRIV_FIPS_TEST, |
| 13480 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 13481 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 13482 | "fips_test"}, |
| 13483 | |
| 13484 | /* handlers for main ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13485 | {WLAN_PRIV_ADD_TSPEC, |
| 13486 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 13487 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13488 | "addTspec"}, |
| 13489 | |
| 13490 | /* handlers for main ioctl */ |
| 13491 | {WLAN_PRIV_DEL_TSPEC, |
| 13492 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13493 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13494 | "delTspec"}, |
| 13495 | |
| 13496 | /* handlers for main ioctl */ |
| 13497 | {WLAN_PRIV_GET_TSPEC, |
| 13498 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13499 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13500 | "getTspec"}, |
| 13501 | |
| 13502 | /* handlers for main ioctl - host offload */ |
| 13503 | { |
| 13504 | WLAN_PRIV_SET_HOST_OFFLOAD, |
Srinivas Girigowda | 077143e | 2017-03-25 10:47:27 -0700 | [diff] [blame] | 13505 | IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13506 | 0, |
| 13507 | "setHostOffload" |
| 13508 | } |
| 13509 | , |
| 13510 | |
| 13511 | { |
| 13512 | WLAN_GET_WLAN_STATISTICS, |
| 13513 | 0, |
| 13514 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 13515 | "getWlanStats" |
| 13516 | } |
| 13517 | , |
| 13518 | |
| 13519 | { |
| 13520 | WLAN_SET_KEEPALIVE_PARAMS, |
Mahesh A Saptasagar | 72d2e4b | 2016-04-20 12:44:17 +0530 | [diff] [blame] | 13521 | IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | |
| 13522 | IW_PRIV_SIZE_FIXED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13523 | 0, |
| 13524 | "setKeepAlive" |
| 13525 | } |
| 13526 | , |
| 13527 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 13528 | { |
| 13529 | WLAN_SET_PACKET_FILTER_PARAMS, |
Hanumanth Reddy Pothula | b3ef416 | 2016-10-25 15:13:26 +0530 | [diff] [blame] | 13530 | IW_PRIV_TYPE_BYTE | |
| 13531 | sizeof(struct pkt_filter_cfg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13532 | 0, |
| 13533 | "setPktFilter" |
| 13534 | } |
| 13535 | , |
| 13536 | #endif |
| 13537 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 13538 | { |
| 13539 | WLAN_SET_PNO, |
| 13540 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 13541 | 0, |
| 13542 | "setpno" |
| 13543 | } |
| 13544 | , |
| 13545 | #endif |
| 13546 | { |
| 13547 | WLAN_SET_BAND_CONFIG, |
| 13548 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13549 | 0, |
| 13550 | "SETBAND" |
| 13551 | } |
| 13552 | , |
| 13553 | { |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 13554 | WLAN_PRIV_SET_MCBC_FILTER, |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 13555 | 0, |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 13556 | 0, |
| 13557 | "setMCBCFilter" |
| 13558 | } |
| 13559 | , |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 13560 | |
| 13561 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13562 | WLAN_GET_LINK_SPEED, |
| 13563 | IW_PRIV_TYPE_CHAR | 18, |
| 13564 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" |
| 13565 | } |
| 13566 | , |
| 13567 | |
| 13568 | /* handlers for main ioctl */ |
| 13569 | {WLAN_PRIV_SET_TWO_INT_GET_NONE, |
| 13570 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13571 | 0, |
| 13572 | ""} |
| 13573 | , |
| 13574 | {WE_SET_SMPS_PARAM, |
| 13575 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13576 | 0, "set_smps_param"} |
| 13577 | , |
| 13578 | {WLAN_SET_DOT11P_CHANNEL_SCHED, |
| 13579 | IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched), |
| 13580 | 0, "set_dot11p" } |
| 13581 | , |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 13582 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13583 | {WE_SET_FW_CRASH_INJECT, |
| 13584 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13585 | 0, "crash_inject"} |
| 13586 | , |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 13587 | {WE_LOG_BUFFER, |
| 13588 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13589 | 0, "log_buffer"} |
| 13590 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13591 | #endif |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 13592 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 13593 | {WE_SET_WLAN_SUSPEND, |
| 13594 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13595 | 0, "wlan_suspend"} |
| 13596 | , |
| 13597 | {WE_SET_WLAN_RESUME, |
| 13598 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13599 | 0, "wlan_resume"} |
| 13600 | , |
| 13601 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 13602 | {WE_ENABLE_FW_PROFILE, |
| 13603 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13604 | 0, "enableProfile"} |
| 13605 | , |
| 13606 | {WE_SET_FW_PROFILE_HIST_INTVL, |
| 13607 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13608 | 0, "set_hist_intvl"} |
| 13609 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13610 | {WE_SET_DUAL_MAC_FW_MODE_CONFIG, |
| 13611 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13612 | 0, "set_fw_mode_cfg"} |
| 13613 | , |
| 13614 | {WE_DUMP_DP_TRACE_LEVEL, |
| 13615 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13616 | 0, "dump_dp_trace"} |
| 13617 | , |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 13618 | {WE_SET_MON_MODE_CHAN, |
| 13619 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 13620 | 0, "setMonChan"} |
| 13621 | , |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 13622 | |
| 13623 | {WE_GET_ROAM_SYNCH_DELAY, |
| 13624 | 0, |
| 13625 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13626 | "hostroamdelay"} |
| 13627 | , |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 13628 | {WE_SET_11AX_RATE, |
| 13629 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13630 | 0, |
| 13631 | "set_11ax_rate"} |
| 13632 | , |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 13633 | {WE_SET_DCM, |
| 13634 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13635 | 0, |
| 13636 | "enable_dcm"} |
| 13637 | , |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 13638 | {WE_SET_RANGE_EXT, |
| 13639 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 13640 | 0, |
| 13641 | "enable_range_ext"} |
| 13642 | , |
Naveen Rawat | c921c7b | 2017-06-13 17:29:51 -0700 | [diff] [blame] | 13643 | |
| 13644 | {WLAN_PRIV_SET_FTIES, |
| 13645 | IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE, |
| 13646 | 0, |
| 13647 | "set_ft_ies"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13648 | }; |
| 13649 | |
| 13650 | const struct iw_handler_def we_handler_def = { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13651 | .num_standard = QDF_ARRAY_SIZE(we_handler), |
| 13652 | .num_private = QDF_ARRAY_SIZE(we_private), |
| 13653 | .num_private_args = QDF_ARRAY_SIZE(we_private_args), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13654 | |
| 13655 | .standard = (iw_handler *) we_handler, |
| 13656 | .private = (iw_handler *) we_private, |
| 13657 | .private_args = we_private_args, |
| 13658 | .get_wireless_stats = NULL, |
| 13659 | }; |
| 13660 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13661 | /* hdd_set_wext() - configures bss parameters |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13662 | * @adapter: handle to adapter context |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13663 | * |
| 13664 | * Returns: none |
| 13665 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13666 | static int hdd_set_wext(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13667 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13668 | struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 13669 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13670 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13671 | ENTER(); |
| 13672 | |
| 13673 | if (!pwextBuf) { |
| 13674 | hdd_err("ERROR: pwextBuf is NULL"); |
| 13675 | return QDF_STATUS_E_FAILURE; |
| 13676 | } |
| 13677 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 13678 | if (!sta_ctx) { |
| 13679 | hdd_err("ERROR: sta_ctx is NULL"); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13680 | return QDF_STATUS_E_FAILURE; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 13681 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13682 | |
| 13683 | /* Now configure the roaming profile links. To SSID and bssid. */ |
| 13684 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 13685 | pwextBuf->roamProfile.SSIDs.SSIDList = &sta_ctx->conn_info.SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13686 | |
| 13687 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 13688 | pwextBuf->roamProfile.BSSIDs.bssid = &sta_ctx->conn_info.bssId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13689 | |
| 13690 | /*Set the numOfChannels to zero to scan all the channels */ |
| 13691 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 13692 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 13693 | |
| 13694 | /* Default is no encryption */ |
| 13695 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 13696 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = |
| 13697 | eCSR_ENCRYPT_TYPE_NONE; |
| 13698 | |
| 13699 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 13700 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = |
| 13701 | eCSR_ENCRYPT_TYPE_NONE; |
| 13702 | |
| 13703 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 13704 | |
| 13705 | /* Default is no authentication */ |
| 13706 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 13707 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 13708 | |
| 13709 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 13710 | sta_ctx->wpa_versions = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13711 | |
| 13712 | /*Set the default scan mode */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13713 | adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13714 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13715 | hdd_clear_roam_profile_ie(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13716 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13717 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13718 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13719 | |
| 13720 | } |
| 13721 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 13722 | #ifdef WLAN_FEATURE_FILS_SK |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 13723 | static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 13724 | { |
| 13725 | pwextBuf->roamProfile.fils_con_info = NULL; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 13726 | pwextBuf->roamProfile.hlp_ie = NULL; |
| 13727 | pwextBuf->roamProfile.hlp_ie_len = 0; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 13728 | } |
| 13729 | #else |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 13730 | static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 13731 | { } |
| 13732 | #endif |
| 13733 | |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 13734 | /** |
| 13735 | * hdd_register_wext() - register wext context |
| 13736 | * @dev: net device handle |
| 13737 | * |
| 13738 | * Registers wext interface context for a given net device |
| 13739 | * |
| 13740 | * Returns: 0 on success, errno on failure |
| 13741 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13742 | int hdd_register_wext(struct net_device *dev) |
| 13743 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13744 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13745 | struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 13746 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13747 | |
| 13748 | ENTER(); |
| 13749 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 13750 | if (!pwextBuf) { |
| 13751 | hdd_err(FL("ERROR: pwextBuf is NULL")); |
| 13752 | return QDF_STATUS_E_FAILURE; |
| 13753 | } |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 13754 | |
| 13755 | /* Zero the memory. This zeros the profile structure */ |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 13756 | memset(pwextBuf, 0, sizeof(struct hdd_wext_state)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13757 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 13758 | status = hdd_set_wext(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13759 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 13760 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 13761 | hdd_err("ERROR: hdd_set_wext failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13762 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13763 | } |
| 13764 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 13765 | status = qdf_event_create(&pwextBuf->hdd_qdf_event); |
| 13766 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 13767 | hdd_err("ERROR: HDD qdf event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13768 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13769 | } |
| 13770 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 13771 | hdd_initialize_fils_info(pwextBuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13772 | /* Register as a wireless device */ |
| 13773 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 13774 | |
| 13775 | EXIT(); |
| 13776 | return 0; |
| 13777 | } |
| 13778 | |
| 13779 | int hdd_unregister_wext(struct net_device *dev) |
| 13780 | { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 13781 | hdd_debug("dev(%pK)", dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13782 | |
| 13783 | if (dev != NULL) { |
| 13784 | rtnl_lock(); |
| 13785 | dev->wireless_handlers = NULL; |
| 13786 | rtnl_unlock(); |
| 13787 | } |
| 13788 | |
| 13789 | return 0; |
| 13790 | } |