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 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5026 | * __iw_get_range() - SIOCGIWRANGE 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_range(struct net_device *dev, struct iw_request_info *info, |
| 5035 | union iwreq_data *wrqu, char *extra) |
| 5036 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5037 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5038 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5039 | struct iw_range *range = (struct iw_range *)extra; |
| 5040 | |
| 5041 | uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5042 | |
| 5043 | uint32_t num_channels = sizeof(channels); |
| 5044 | uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 5045 | uint32_t a_len; |
| 5046 | uint32_t b_len; |
| 5047 | uint32_t active_phy_mode = 0; |
| 5048 | uint8_t index = 0, i; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5049 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5050 | int ret; |
| 5051 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5052 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5053 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5054 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5055 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5056 | if (0 != ret) |
| 5057 | return ret; |
| 5058 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5059 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5060 | if (0 != ret) |
| 5061 | return ret; |
| 5062 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5063 | wrqu->data.length = sizeof(struct iw_range); |
| 5064 | memset(range, 0, sizeof(struct iw_range)); |
| 5065 | |
| 5066 | |
| 5067 | /*Get the phy mode */ |
| 5068 | if (sme_cfg_get_int(hHal, |
| 5069 | WNI_CFG_DOT11_MODE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5070 | &active_phy_mode) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5071 | hdd_debug("active_phy_mode = %d", active_phy_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5072 | |
| 5073 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A |
| 5074 | || active_phy_mode == WNI_CFG_DOT11_MODE_11G) { |
| 5075 | /*Get the supported rates for 11G band */ |
| 5076 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 5077 | if (sme_cfg_get_str(hHal, |
| 5078 | WNI_CFG_SUPPORTED_RATES_11A, |
| 5079 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5080 | &a_len) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5081 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5082 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5083 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | for (i = 0; i < a_len; i++) { |
| 5085 | range->bitrate[i] = |
| 5086 | ((supp_rates[i] & 0x7F) / 2) * |
| 5087 | 1000000; |
| 5088 | } |
| 5089 | range->num_bitrates = a_len; |
| 5090 | } else { |
| 5091 | return -EIO; |
| 5092 | } |
| 5093 | } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) { |
| 5094 | /*Get the supported rates for 11B band */ |
| 5095 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 5096 | if (sme_cfg_get_str(hHal, |
| 5097 | WNI_CFG_SUPPORTED_RATES_11B, |
| 5098 | supp_rates, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5099 | &b_len) == QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5100 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5101 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5103 | for (i = 0; i < b_len; i++) { |
| 5104 | range->bitrate[i] = |
| 5105 | ((supp_rates[i] & 0x7F) / 2) * |
| 5106 | 1000000; |
| 5107 | } |
| 5108 | range->num_bitrates = b_len; |
| 5109 | } else { |
| 5110 | return -EIO; |
| 5111 | } |
| 5112 | } |
| 5113 | } |
| 5114 | |
| 5115 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 5116 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 5117 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 5118 | |
| 5119 | range->encoding_size[0] = 5; |
| 5120 | range->encoding_size[1] = 13; |
| 5121 | range->num_encoding_sizes = 2; |
| 5122 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 5123 | |
| 5124 | /* we support through Wireless Extensions 22 */ |
| 5125 | range->we_version_compiled = WIRELESS_EXT; |
| 5126 | range->we_version_source = 22; |
| 5127 | |
| 5128 | /*Supported Channels and Frequencies */ |
| 5129 | if (sme_cfg_get_str |
| 5130 | ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5131 | &num_channels) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5132 | hdd_err("Failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5133 | return -EIO; |
| 5134 | } |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5135 | if (num_channels > IW_MAX_FREQUENCIES) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | num_channels = IW_MAX_FREQUENCIES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5137 | |
| 5138 | range->num_channels = num_channels; |
| 5139 | range->num_frequency = num_channels; |
| 5140 | |
| 5141 | for (index = 0; index < num_channels; index++) { |
| 5142 | uint32_t frq_indx = 0; |
| 5143 | |
| 5144 | range->freq[index].i = channels[index]; |
| 5145 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) { |
| 5146 | if (channels[index] == freq_chan_map[frq_indx].chan) { |
| 5147 | range->freq[index].m = |
| 5148 | freq_chan_map[frq_indx].freq * 100000; |
| 5149 | range->freq[index].e = 1; |
| 5150 | break; |
| 5151 | } |
| 5152 | frq_indx++; |
| 5153 | } |
| 5154 | } |
| 5155 | |
| 5156 | /* Event capability (kernel + driver) */ |
| 5157 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 5158 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 5159 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 5160 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 5161 | |
| 5162 | /*Encryption capability */ |
| 5163 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 5164 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 5165 | |
| 5166 | /* Txpower capability */ |
| 5167 | range->txpower_capa = IW_TXPOW_MWATT; |
| 5168 | |
| 5169 | /*Scanning capability */ |
| 5170 | #if WIRELESS_EXT >= 22 |
| 5171 | range->scan_capa = |
| 5172 | IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 5173 | #endif |
| 5174 | |
| 5175 | EXIT(); |
| 5176 | return 0; |
| 5177 | } |
| 5178 | |
| 5179 | /** |
| 5180 | * iw_get_range() - SSR wrapper for __iw_get_range() |
| 5181 | * @dev: pointer to net_device |
| 5182 | * @info: pointer to iw_request_info |
| 5183 | * @wrqu: pointer to iwreq_data |
| 5184 | * @extra: pointer to extra ioctl payload |
| 5185 | * |
| 5186 | * Return: 0 on success, error number otherwise |
| 5187 | */ |
| 5188 | static int iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 5189 | union iwreq_data *wrqu, char *extra) |
| 5190 | { |
| 5191 | int ret; |
| 5192 | |
| 5193 | cds_ssr_protect(__func__); |
| 5194 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 5195 | cds_ssr_unprotect(__func__); |
| 5196 | |
| 5197 | return ret; |
| 5198 | } |
| 5199 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5200 | struct class_a_stats { |
| 5201 | tCsrGlobalClassAStatsInfo class_a_stats; |
| 5202 | }; |
| 5203 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5204 | /** |
| 5205 | * hdd_get_class_a_statistics_cb() - Get Class A stats callback function |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5206 | * @stats: pointer to Class A stats |
| 5207 | * @context: user context originally registered with SME (always the |
| 5208 | * cookie from the request context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5209 | * |
| 5210 | * Return: None |
| 5211 | */ |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5212 | static void hdd_get_class_a_statistics_cb(void *stats, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5213 | { |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5214 | struct hdd_request *request; |
| 5215 | struct class_a_stats *priv; |
| 5216 | tCsrGlobalClassAStatsInfo *returned_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5217 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5218 | ENTER(); |
| 5219 | if ((NULL == stats) || (NULL == context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 5220 | hdd_err("Bad param, stats [%pK] context [%pK]", |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5221 | stats, context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5222 | return; |
| 5223 | } |
| 5224 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5225 | request = hdd_request_get(context); |
| 5226 | if (!request) { |
| 5227 | hdd_err("Obsolete request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5228 | return; |
| 5229 | } |
| 5230 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5231 | returned_stats = stats; |
| 5232 | priv = hdd_request_priv(request); |
| 5233 | priv->class_a_stats = *returned_stats; |
| 5234 | hdd_request_complete(request); |
| 5235 | hdd_request_put(request); |
| 5236 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5237 | } |
| 5238 | |
| 5239 | /** |
| 5240 | * wlan_hdd_get_class_astats() - Get Class A statistics |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5241 | * @adapter: adapter for which statistics are desired |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5242 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5243 | * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5244 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5245 | QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5246 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5247 | 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] | 5248 | QDF_STATUS hstatus; |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5249 | int ret; |
| 5250 | void *cookie; |
| 5251 | struct hdd_request *request; |
| 5252 | struct class_a_stats *priv; |
| 5253 | static const struct hdd_request_params params = { |
| 5254 | .priv_size = sizeof(*priv), |
| 5255 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 5256 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5257 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5258 | if (NULL == adapter) { |
| 5259 | hdd_err("adapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5260 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5261 | } |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 5262 | if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5263 | hdd_debug("Recovery in Progress. State: 0x%x Ignore!!!", |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 5264 | cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5265 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5266 | } |
| 5267 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5268 | request = hdd_request_alloc(¶ms); |
| 5269 | if (!request) { |
| 5270 | hdd_err("Request allocation failure"); |
| 5271 | return QDF_STATUS_E_NOMEM; |
| 5272 | } |
| 5273 | cookie = hdd_request_cookie(request); |
| 5274 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | /* query only for Class A statistics (which include link speed) */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5276 | hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5277 | eCSR_HDD, SME_GLOBAL_CLASSA_STATS, |
| 5278 | hdd_get_class_a_statistics_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5279 | sta_ctx->conn_info.staId[0], |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5280 | cookie, adapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5281 | if (QDF_STATUS_SUCCESS != hstatus) { |
Archana Ramachandran | 31b5b65 | 2016-09-21 15:37:58 -0700 | [diff] [blame] | 5282 | hdd_warn("Unable to retrieve Class A statistics"); |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5283 | goto return_cached_results; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5284 | } |
| 5285 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5286 | /* request was sent -- wait for the response */ |
| 5287 | ret = hdd_request_wait_for_response(request); |
| 5288 | if (ret) { |
| 5289 | hdd_warn("SME timed out while retrieving Class A statistics"); |
| 5290 | goto return_cached_results; |
| 5291 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5292 | |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5293 | /* update the adapter with the fresh results */ |
| 5294 | priv = hdd_request_priv(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5295 | adapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
Jeff Johnson | a6ace5b | 2017-01-23 07:11:02 -0800 | [diff] [blame] | 5296 | |
| 5297 | return_cached_results: |
| 5298 | /* |
| 5299 | * either we never sent a request, we sent a request and |
| 5300 | * received a response or we sent a request and timed out. |
| 5301 | * regardless we are done with the request. |
| 5302 | */ |
| 5303 | hdd_request_put(request); |
| 5304 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5305 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5306 | } |
| 5307 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5308 | struct station_stats { |
| 5309 | tCsrSummaryStatsInfo summary_stats; |
| 5310 | tCsrGlobalClassAStatsInfo class_a_stats; |
| 5311 | struct csr_per_chain_rssi_stats_info per_chain_rssi_stats; |
| 5312 | }; |
| 5313 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5314 | /** |
| 5315 | * hdd_get_station_statistics_cb() - Get stats callback function |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5316 | * @stats: pointer to combined station stats |
| 5317 | * @context: user context originally registered with SME (always the |
| 5318 | * cookie from the request context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5319 | * |
| 5320 | * Return: None |
| 5321 | */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5322 | static void hdd_get_station_statistics_cb(void *stats, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5323 | { |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5324 | struct hdd_request *request; |
| 5325 | struct station_stats *priv; |
| 5326 | tCsrSummaryStatsInfo *summary_stats; |
| 5327 | tCsrGlobalClassAStatsInfo *class_a_stats; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 5328 | struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5329 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5330 | if ((NULL == stats) || (NULL == context)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 5331 | hdd_err("Bad param, pStats [%pK] pContext [%pK]", |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5332 | stats, context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5333 | return; |
| 5334 | } |
| 5335 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5336 | request = hdd_request_get(context); |
| 5337 | if (!request) { |
| 5338 | hdd_err("Obsolete request"); |
| 5339 | return; |
| 5340 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5341 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5342 | summary_stats = (tCsrSummaryStatsInfo *) stats; |
| 5343 | class_a_stats = (tCsrGlobalClassAStatsInfo *) (summary_stats + 1); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 5344 | per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *) |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5345 | (class_a_stats + 1); |
| 5346 | priv = hdd_request_priv(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5347 | |
| 5348 | /* copy over the stats. do so as a struct copy */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5349 | priv->summary_stats = *summary_stats; |
| 5350 | priv->class_a_stats = *class_a_stats; |
| 5351 | priv->per_chain_rssi_stats = *per_chain_rssi_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5353 | hdd_request_complete(request); |
| 5354 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5355 | } |
| 5356 | |
| 5357 | /** |
| 5358 | * wlan_hdd_get_station_stats() - Get station statistics |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5359 | * @adapter: adapter for which statistics are desired |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5360 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5361 | * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5362 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5363 | QDF_STATUS wlan_hdd_get_station_stats(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5364 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5365 | 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] | 5366 | QDF_STATUS status; |
| 5367 | int errno; |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5368 | void *cookie; |
| 5369 | struct hdd_request *request; |
| 5370 | struct station_stats *priv; |
| 5371 | static const struct hdd_request_params params = { |
| 5372 | .priv_size = sizeof(*priv), |
| 5373 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 5374 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5375 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5376 | if (NULL == adapter) { |
| 5377 | hdd_err("adapter is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5378 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5379 | } |
| 5380 | |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5381 | request = hdd_request_alloc(¶ms); |
| 5382 | if (!request) { |
| 5383 | hdd_err("Request allocation failure"); |
| 5384 | return QDF_STATUS_E_NOMEM; |
| 5385 | } |
| 5386 | cookie = hdd_request_cookie(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5387 | |
| 5388 | /* query only for Summary & Class A statistics */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5389 | status = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter), |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5390 | eCSR_HDD, |
| 5391 | SME_SUMMARY_STATS | |
| 5392 | SME_GLOBAL_CLASSA_STATS | |
| 5393 | SME_PER_CHAIN_RSSI_STATS, |
| 5394 | hdd_get_station_statistics_cb, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5395 | sta_ctx->conn_info.staId[0], |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5396 | cookie, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5397 | adapter->sessionId); |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5398 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5399 | hdd_err("Failed to retrieve statistics, status %d", status); |
| 5400 | goto put_request; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5401 | } |
| 5402 | |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5403 | /* request was sent -- wait for the response */ |
| 5404 | errno = hdd_request_wait_for_response(request); |
| 5405 | if (errno) { |
| 5406 | hdd_err("Failed to wait for statistics, errno %d", errno); |
| 5407 | goto put_request; |
| 5408 | } |
| 5409 | |
| 5410 | /* update the adapter with the fresh results */ |
| 5411 | priv = hdd_request_priv(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5412 | adapter->hdd_stats.summary_stat = priv->summary_stats; |
| 5413 | adapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
| 5414 | adapter->hdd_stats.per_chain_rssi_stats = priv->per_chain_rssi_stats; |
Dustin Brown | 0f5260d | 2017-06-12 16:17:38 -0700 | [diff] [blame] | 5415 | |
| 5416 | put_request: |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5417 | /* |
| 5418 | * either we never sent a request, we sent a request and |
| 5419 | * received a response or we sent a request and timed out. |
| 5420 | * regardless we are done with the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5421 | */ |
Jeff Johnson | dda167c | 2017-01-23 10:37:57 -0800 | [diff] [blame] | 5422 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5424 | /* either callback updated adapter stats or it has cached data */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5425 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5426 | } |
| 5427 | |
| 5428 | /** |
| 5429 | * iw_get_linkspeed() - Get current link speed ioctl |
| 5430 | * @dev: device upon which the ioctl was received |
| 5431 | * @info: ioctl request information |
| 5432 | * @wrqu: ioctl request data |
| 5433 | * @extra: extra ioctl buffer |
| 5434 | * |
| 5435 | * Return: 0 on success, non-zero on error |
| 5436 | */ |
| 5437 | static int __iw_get_linkspeed(struct net_device *dev, |
| 5438 | struct iw_request_info *info, |
| 5439 | union iwreq_data *wrqu, char *extra) |
| 5440 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5441 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5442 | char *pLinkSpeed = (char *)extra; |
| 5443 | int len = sizeof(uint32_t) + 1; |
| 5444 | uint32_t link_speed = 0; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5445 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5446 | int ret; |
| 5447 | int rc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5448 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 5449 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 5450 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5451 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5452 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5453 | if (0 != ret) |
| 5454 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5455 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5456 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 5457 | if (0 != ret) |
| 5458 | return ret; |
| 5459 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5460 | ret = wlan_hdd_get_link_speed(adapter, &link_speed); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5461 | if (0 != ret) |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5462 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5463 | |
| 5464 | wrqu->data.length = len; |
| 5465 | /* return the linkspeed as a string */ |
| 5466 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
| 5467 | if ((rc < 0) || (rc >= len)) { |
| 5468 | /* encoding or length error? */ |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5469 | hdd_err("Unable to encode link speed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5470 | return -EIO; |
| 5471 | } |
| 5472 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 5473 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5474 | /* a value is being successfully returned */ |
| 5475 | return 0; |
| 5476 | } |
| 5477 | |
| 5478 | static int iw_get_linkspeed(struct net_device *dev, |
| 5479 | struct iw_request_info *info, |
| 5480 | union iwreq_data *wrqu, char *extra) |
| 5481 | { |
| 5482 | int ret; |
| 5483 | |
| 5484 | cds_ssr_protect(__func__); |
| 5485 | ret = __iw_get_linkspeed(dev, info, wrqu, extra); |
| 5486 | cds_ssr_unprotect(__func__); |
| 5487 | |
| 5488 | return ret; |
| 5489 | } |
| 5490 | |
| 5491 | /** |
| 5492 | * wlan_hdd_change_country_code_callback() - Change country code callback |
| 5493 | * @context: opaque context originally passed to SME. All functions |
| 5494 | * which use this callback pass the adapter upon which the country |
| 5495 | * code change is active |
| 5496 | * |
| 5497 | * This function is registered as the callback function when |
| 5498 | * sme_change_country_code() is invoked. Callers of |
| 5499 | * sme_change_country_code() subsequently wait for the adapter's |
| 5500 | * @change_country_code completion variable, so all this function |
| 5501 | * needs to do is set that completion variable so that execution can |
| 5502 | * continue. |
| 5503 | * |
| 5504 | * Return: none |
| 5505 | */ |
| 5506 | void wlan_hdd_change_country_code_callback(void *context) |
| 5507 | { |
| 5508 | |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 5509 | struct hdd_adapter *adapter = context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5510 | |
| 5511 | if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) |
| 5512 | complete(&adapter->change_country_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5513 | } |
| 5514 | |
| 5515 | /** |
| 5516 | * __iw_set_nick() - SIOCSIWNICKN ioctl handler |
| 5517 | * @dev: device upon which the ioctl was received |
| 5518 | * @info: ioctl request information |
| 5519 | * @wrqu: ioctl request data |
| 5520 | * @extra: ioctl extra data |
| 5521 | * |
| 5522 | * Return: 0 on success, non-zero on error |
| 5523 | */ |
| 5524 | static int __iw_set_nick(struct net_device *dev, |
| 5525 | struct iw_request_info *info, |
| 5526 | union iwreq_data *wrqu, char *extra) |
| 5527 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 5528 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5529 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5530 | int ret; |
| 5531 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5532 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5533 | |
| 5534 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5535 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5536 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5537 | if (0 != ret) |
| 5538 | return ret; |
| 5539 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5540 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5541 | if (0 != ret) |
| 5542 | return ret; |
| 5543 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5544 | return 0; |
| 5545 | } |
| 5546 | |
| 5547 | /** |
| 5548 | * iw_set_nick() - SSR wrapper for __iw_set_nick |
| 5549 | * @dev: pointer to net_device |
| 5550 | * @info: pointer to iw_request_info |
| 5551 | * @wrqu: pointer to iwreq_data |
| 5552 | * @extra: extra |
| 5553 | * |
| 5554 | * Return: 0 on success, error number otherwise |
| 5555 | */ |
| 5556 | static int iw_set_nick(struct net_device *dev, |
| 5557 | struct iw_request_info *info, |
| 5558 | union iwreq_data *wrqu, char *extra) |
| 5559 | { |
| 5560 | int ret; |
| 5561 | |
| 5562 | cds_ssr_protect(__func__); |
| 5563 | ret = __iw_set_nick(dev, info, wrqu, extra); |
| 5564 | cds_ssr_unprotect(__func__); |
| 5565 | |
| 5566 | return ret; |
| 5567 | } |
| 5568 | |
| 5569 | /** |
| 5570 | * __iw_get_nick() - SIOCGIWNICKN ioctl handler |
| 5571 | * @dev: device upon which the ioctl was received |
| 5572 | * @info: ioctl request information |
| 5573 | * @wrqu: ioctl request data |
| 5574 | * @extra: ioctl extra data |
| 5575 | * |
| 5576 | * Return: 0 on success, non-zero on error |
| 5577 | */ |
| 5578 | static int __iw_get_nick(struct net_device *dev, |
| 5579 | struct iw_request_info *info, |
| 5580 | union iwreq_data *wrqu, char *extra) |
| 5581 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 5582 | struct hdd_adapter *adapter; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5583 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5584 | int ret; |
| 5585 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5586 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5587 | |
| 5588 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5589 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5590 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5591 | if (0 != ret) |
| 5592 | return ret; |
| 5593 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5594 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5595 | if (0 != ret) |
| 5596 | return ret; |
| 5597 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5598 | return 0; |
| 5599 | } |
| 5600 | |
| 5601 | /** |
| 5602 | * iw_get_nick() - SSR wrapper for __iw_get_nick |
| 5603 | * @dev: pointer to net_device |
| 5604 | * @info: pointer to iw_request_info |
| 5605 | * @wrqu: pointer to iwreq_data |
| 5606 | * @extra: extra |
| 5607 | * |
| 5608 | * Return: 0 on success, error number otherwise |
| 5609 | */ |
| 5610 | static int iw_get_nick(struct net_device *dev, |
| 5611 | struct iw_request_info *info, |
| 5612 | union iwreq_data *wrqu, char *extra) |
| 5613 | { |
| 5614 | int ret; |
| 5615 | |
| 5616 | cds_ssr_protect(__func__); |
| 5617 | ret = __iw_get_nick(dev, info, wrqu, extra); |
| 5618 | cds_ssr_unprotect(__func__); |
| 5619 | |
| 5620 | return ret; |
| 5621 | } |
| 5622 | |
| 5623 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5624 | * __iw_set_mlme() - SIOCSIWMLME ioctl handler |
| 5625 | * @dev: device upon which the ioctl was received |
| 5626 | * @info: ioctl request information |
| 5627 | * @wrqu: ioctl request data |
| 5628 | * @extra: ioctl extra data |
| 5629 | * |
| 5630 | * Return: 0 on success, non-zero on error |
| 5631 | */ |
| 5632 | static int __iw_set_mlme(struct net_device *dev, |
| 5633 | struct iw_request_info *info, |
| 5634 | union iwreq_data *wrqu, char *extra) |
| 5635 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5636 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5637 | 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] | 5638 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5639 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5640 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5641 | int ret; |
| 5642 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5643 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5644 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5645 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5646 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5647 | if (0 != ret) |
| 5648 | return ret; |
| 5649 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5650 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5651 | if (0 != ret) |
| 5652 | return ret; |
| 5653 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5654 | /* reason_code is unused. By default it is set to |
| 5655 | * eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 5656 | */ |
| 5657 | switch (mlme->cmd) { |
| 5658 | case IW_MLME_DISASSOC: |
| 5659 | case IW_MLME_DEAUTH: |
| 5660 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5661 | if (sta_ctx->conn_info.connState == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5662 | eConnectionState_Associated) { |
| 5663 | eCsrRoamDisconnectReason reason = |
| 5664 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 5665 | |
| 5666 | if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE) |
| 5667 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 5668 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5669 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5670 | status = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5671 | sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter), |
| 5672 | adapter->sessionId, reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5673 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5674 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5675 | unsigned long rc; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5676 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5677 | rc = wait_for_completion_timeout(&adapter-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5678 | disconnect_comp_var, |
| 5679 | msecs_to_jiffies |
| 5680 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 5681 | if (!rc) |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5682 | hdd_err("disconnect_comp_var failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5683 | } else |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5684 | hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d", |
| 5685 | (int)mlme->cmd, (int)status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5686 | |
| 5687 | /* Resetting authKeyMgmt */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5688 | (WLAN_HDD_GET_WEXT_STATE_PTR(adapter))->authKeyMgmt = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5689 | 0; |
| 5690 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 5691 | hdd_debug("Disabling queues"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5692 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5693 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5694 | WLAN_CONTROL_PATH); |
| 5695 | |
| 5696 | } else { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5697 | 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] | 5698 | (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5699 | } |
| 5700 | break; |
| 5701 | default: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5702 | hdd_err("Unexpected cmd: %d", (int)mlme->cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5703 | return -EINVAL; |
| 5704 | } /* end of switch */ |
| 5705 | |
| 5706 | EXIT(); |
| 5707 | |
| 5708 | return status; |
| 5709 | |
| 5710 | } |
| 5711 | |
| 5712 | /** |
| 5713 | * iw_set_mlme() - SSR wrapper for __iw_set_mlme() |
| 5714 | * @dev: pointer to net_device |
| 5715 | * @info: pointer to iw_request_info |
| 5716 | * @wrqu: pointer to iwreq_data |
| 5717 | * @extra: pointer to extra ioctl payload |
| 5718 | * |
| 5719 | * Return: 0 on success, error number otherwise |
| 5720 | */ |
| 5721 | static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info, |
| 5722 | union iwreq_data *wrqu, char *extra) |
| 5723 | { |
| 5724 | int ret; |
| 5725 | |
| 5726 | cds_ssr_protect(__func__); |
| 5727 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 5728 | cds_ssr_unprotect(__func__); |
| 5729 | |
| 5730 | return ret; |
| 5731 | } |
| 5732 | |
| 5733 | /** |
| 5734 | * wlan_hdd_update_phymode() - handle change in PHY mode |
| 5735 | * @net: device upon which PHY mode change was received |
| 5736 | * @hal: umac handle for the driver |
| 5737 | * @new_phymode: new PHY mode for the device |
| 5738 | * @phddctx: pointer to the HDD context |
| 5739 | * |
| 5740 | * This function is called when the device is set to a new PHY mode. |
| 5741 | * It takes a holistic look at the desired PHY mode along with the |
| 5742 | * configured capabilities of the driver and the reported capabilities |
| 5743 | * of the hardware in order to correctly configure all PHY-related |
| 5744 | * parameters. |
| 5745 | * |
| 5746 | * Return: 0 on success, negative errno value on error |
| 5747 | */ |
| 5748 | int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 5749 | int new_phymode, struct hdd_context *phddctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5750 | { |
| 5751 | #ifdef QCA_HT_2040_COEX |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5752 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5753 | QDF_STATUS halStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5754 | #endif |
| 5755 | bool band_24 = false, band_5g = false; |
| 5756 | bool ch_bond24 = false, ch_bond5g = false; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5757 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5758 | uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5759 | uint32_t vhtchanwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5760 | eCsrPhyMode phymode = -EIO, old_phymode; |
Srinivas Girigowda | 2fb677c | 2017-03-25 15:35:34 -0700 | [diff] [blame] | 5761 | enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5762 | eCsrBand curr_band = eCSR_BAND_ALL; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5763 | int retval = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5764 | |
| 5765 | old_phymode = sme_get_phy_mode(hal); |
| 5766 | |
| 5767 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 5768 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 5769 | nChannelBondingMode24GHz)) |
| 5770 | ch_bond24 = true; |
| 5771 | |
| 5772 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 5773 | sme_get_cb_phy_state_from_cb_ini_value(phddctx->config-> |
| 5774 | nChannelBondingMode5GHz)) |
| 5775 | ch_bond5g = true; |
| 5776 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5777 | if (phddctx->config->nBandCapability == eCSR_BAND_ALL) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5778 | band_24 = band_5g = true; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5779 | else if (phddctx->config->nBandCapability == eCSR_BAND_24) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5780 | band_24 = true; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 5781 | else if (phddctx->config->nBandCapability == eCSR_BAND_5G) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5782 | band_5g = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5783 | |
| 5784 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 5785 | 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] | 5786 | ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth); |
| 5787 | |
| 5788 | switch (new_phymode) { |
| 5789 | case IEEE80211_MODE_AUTO: |
| 5790 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5791 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5792 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5793 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5794 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5795 | curr_band = eCSR_BAND_ALL; |
| 5796 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5797 | } else { |
| 5798 | sme_set_phy_mode(hal, old_phymode); |
| 5799 | return -EIO; |
| 5800 | } |
| 5801 | break; |
| 5802 | case IEEE80211_MODE_11A: |
| 5803 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5804 | 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] | 5805 | phymode = eCSR_DOT11_MODE_11a; |
| 5806 | hdd_dot11mode = eHDD_DOT11_MODE_11a; |
| 5807 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5808 | curr_band = eCSR_BAND_5G; |
| 5809 | } else { |
| 5810 | sme_set_phy_mode(hal, old_phymode); |
| 5811 | return -EIO; |
| 5812 | } |
| 5813 | break; |
| 5814 | case IEEE80211_MODE_11B: |
| 5815 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5816 | 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] | 5817 | phymode = eCSR_DOT11_MODE_11b; |
| 5818 | hdd_dot11mode = eHDD_DOT11_MODE_11b; |
| 5819 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5820 | curr_band = eCSR_BAND_24; |
| 5821 | } else { |
| 5822 | sme_set_phy_mode(hal, old_phymode); |
| 5823 | return -EIO; |
| 5824 | } |
| 5825 | break; |
| 5826 | case IEEE80211_MODE_11G: |
| 5827 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5828 | 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] | 5829 | phymode = eCSR_DOT11_MODE_11g; |
| 5830 | hdd_dot11mode = eHDD_DOT11_MODE_11g; |
| 5831 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5832 | curr_band = eCSR_BAND_24; |
| 5833 | } else { |
| 5834 | sme_set_phy_mode(hal, old_phymode); |
| 5835 | return -EIO; |
| 5836 | } |
| 5837 | break; |
| 5838 | /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode |
| 5839 | * so setting phymode as eCSR_DOT11_MODE_11n and updating the band |
| 5840 | * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG |
| 5841 | */ |
| 5842 | case IEEE80211_MODE_11NA_HT20: |
| 5843 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5844 | 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] | 5845 | phymode = eCSR_DOT11_MODE_11n; |
| 5846 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5847 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5848 | curr_band = eCSR_BAND_5G; |
| 5849 | } else { |
| 5850 | sme_set_phy_mode(hal, old_phymode); |
| 5851 | return -EIO; |
| 5852 | } |
| 5853 | break; |
| 5854 | case IEEE80211_MODE_11NA_HT40: |
| 5855 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5856 | 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] | 5857 | phymode = eCSR_DOT11_MODE_11n; |
| 5858 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5859 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5860 | curr_band = eCSR_BAND_5G; |
| 5861 | } else { |
| 5862 | sme_set_phy_mode(hal, old_phymode); |
| 5863 | return -EIO; |
| 5864 | } |
| 5865 | break; |
| 5866 | case IEEE80211_MODE_11NG_HT20: |
| 5867 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5868 | 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] | 5869 | phymode = eCSR_DOT11_MODE_11n; |
| 5870 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5871 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5872 | curr_band = eCSR_BAND_24; |
| 5873 | } else { |
| 5874 | sme_set_phy_mode(hal, old_phymode); |
| 5875 | return -EIO; |
| 5876 | } |
| 5877 | break; |
| 5878 | case IEEE80211_MODE_11NG_HT40: |
| 5879 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5880 | 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] | 5881 | phymode = eCSR_DOT11_MODE_11n; |
| 5882 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5883 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5884 | curr_band = eCSR_BAND_24; |
| 5885 | } else { |
| 5886 | sme_set_phy_mode(hal, old_phymode); |
| 5887 | return -EIO; |
| 5888 | } |
| 5889 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5890 | case IEEE80211_MODE_11AC_VHT20: |
| 5891 | case IEEE80211_MODE_11AC_VHT40: |
| 5892 | case IEEE80211_MODE_11AC_VHT80: |
| 5893 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5894 | 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] | 5895 | phymode = eCSR_DOT11_MODE_11ac; |
| 5896 | hdd_dot11mode = eHDD_DOT11_MODE_11ac; |
| 5897 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5898 | curr_band = eCSR_BAND_5G; |
| 5899 | } else { |
| 5900 | sme_set_phy_mode(hal, old_phymode); |
| 5901 | return -EIO; |
| 5902 | } |
| 5903 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5904 | case IEEE80211_MODE_2G_AUTO: |
| 5905 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5906 | 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] | 5907 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5908 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5909 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5910 | curr_band = eCSR_BAND_24; |
| 5911 | } else { |
| 5912 | sme_set_phy_mode(hal, old_phymode); |
| 5913 | return -EIO; |
| 5914 | } |
| 5915 | break; |
| 5916 | case IEEE80211_MODE_5G_AUTO: |
| 5917 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5918 | 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] | 5919 | phymode = eCSR_DOT11_MODE_AUTO; |
| 5920 | hdd_dot11mode = eHDD_DOT11_MODE_AUTO; |
| 5921 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5922 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5923 | curr_band = eCSR_BAND_5G; |
| 5924 | } else { |
| 5925 | sme_set_phy_mode(hal, old_phymode); |
| 5926 | return -EIO; |
| 5927 | } |
| 5928 | break; |
| 5929 | case IEEE80211_MODE_11AGN: |
| 5930 | sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5931 | if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5932 | phymode = eCSR_DOT11_MODE_11n; |
| 5933 | hdd_dot11mode = eHDD_DOT11_MODE_11n; |
| 5934 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 5935 | curr_band = eCSR_BAND_ALL; |
| 5936 | } else { |
| 5937 | sme_set_phy_mode(hal, old_phymode); |
| 5938 | return -EIO; |
| 5939 | } |
| 5940 | break; |
| 5941 | default: |
| 5942 | return -EIO; |
| 5943 | } |
| 5944 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5945 | switch (new_phymode) { |
| 5946 | case IEEE80211_MODE_11AC_VHT20: |
| 5947 | chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5948 | vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ; |
| 5949 | break; |
| 5950 | case IEEE80211_MODE_11AC_VHT40: |
| 5951 | vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ; |
| 5952 | break; |
| 5953 | case IEEE80211_MODE_11AC_VHT80: |
| 5954 | vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ; |
| 5955 | break; |
| 5956 | default: |
| 5957 | vhtchanwidth = phddctx->config->vhtChannelWidth; |
| 5958 | break; |
| 5959 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5960 | |
| 5961 | if (phymode != -EIO) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5962 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 5963 | if (!sme_config) { |
| 5964 | hdd_err("Failed to allocate memory for sme_config"); |
| 5965 | return -ENOMEM; |
| 5966 | } |
| 5967 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 5968 | sme_get_config_param(hal, sme_config); |
| 5969 | sme_config->csrConfig.phyMode = phymode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5970 | #ifdef QCA_HT_2040_COEX |
| 5971 | if (phymode == eCSR_DOT11_MODE_11n && |
| 5972 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5973 | sme_config->csrConfig.obssEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5974 | halStatus = sme_set_ht2040_mode(hal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5975 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5976 | eHT_CHAN_HT20, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5977 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5978 | hdd_err("Failed to disable OBSS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5979 | retval = -EIO; |
| 5980 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5981 | } |
| 5982 | } else if (phymode == eCSR_DOT11_MODE_11n && |
| 5983 | chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5984 | sme_config->csrConfig.obssEnabled = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5985 | halStatus = sme_set_ht2040_mode(hal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 5986 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5987 | eHT_CHAN_HT20, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5988 | if (halStatus == QDF_STATUS_E_FAILURE) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 5989 | hdd_err("Failed to enable OBSS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5990 | retval = -EIO; |
| 5991 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5992 | } |
| 5993 | } |
| 5994 | #endif |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5995 | sme_config->csrConfig.eBand = curr_band; |
| 5996 | sme_config->csrConfig.bandCapability = curr_band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5997 | if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 5998 | sme_config->csrConfig.Is11hSupportEnabled = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5999 | else |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6000 | sme_config->csrConfig.Is11hSupportEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6001 | phddctx->config->Is11hSupportEnabled; |
| 6002 | if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6003 | sme_config->csrConfig.channelBondingMode24GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6004 | else if (curr_band == eCSR_BAND_24) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6005 | sme_config->csrConfig.channelBondingMode5GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6006 | else { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6007 | sme_config->csrConfig.channelBondingMode24GHz = chwidth; |
| 6008 | sme_config->csrConfig.channelBondingMode5GHz = chwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6009 | } |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6010 | sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth; |
| 6011 | sme_update_config(hal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6012 | |
| 6013 | phddctx->config->dot11Mode = hdd_dot11mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6014 | phddctx->config->nChannelBondingMode24GHz = |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6015 | sme_config->csrConfig.channelBondingMode24GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6016 | phddctx->config->nChannelBondingMode5GHz = |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6017 | sme_config->csrConfig.channelBondingMode5GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6018 | phddctx->config->vhtChannelWidth = vhtchanwidth; |
Krunal Soni | df0f874 | 2016-09-26 14:56:31 -0700 | [diff] [blame] | 6019 | if (hdd_update_config_cfg(phddctx) == false) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6020 | hdd_err("could not update config_dat"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6021 | retval = -EIO; |
| 6022 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6023 | } |
Rajeev Kumar Sirasanagandla | 4c9b675 | 2017-07-25 20:35:20 +0530 | [diff] [blame] | 6024 | |
| 6025 | if (band_5g) { |
| 6026 | struct ieee80211_supported_band *band; |
| 6027 | |
| 6028 | band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]; |
| 6029 | if (phddctx->config->nChannelBondingMode5GHz) |
| 6030 | band->ht_cap.cap |= |
| 6031 | IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 6032 | else |
| 6033 | band->ht_cap.cap &= |
| 6034 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 6035 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6036 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6037 | 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] | 6038 | phymode, chwidth, curr_band, vhtchanwidth); |
| 6039 | } |
| 6040 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6041 | free: |
| 6042 | if (sme_config) |
| 6043 | qdf_mem_free(sme_config); |
| 6044 | return retval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6045 | } |
| 6046 | |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6047 | struct temperature_priv { |
| 6048 | int temperature; |
| 6049 | }; |
| 6050 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6051 | /** |
| 6052 | * hdd_get_temperature_cb() - "Get Temperature" callback function |
| 6053 | * @temperature: measured temperature |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6054 | * @context: callback context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6055 | * |
| 6056 | * This function is passed to sme_get_temperature() as the callback |
| 6057 | * function to be invoked when the temperature measurement is |
| 6058 | * available. |
| 6059 | * |
| 6060 | * Return: None |
| 6061 | */ |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6062 | static void hdd_get_temperature_cb(int temperature, void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6063 | { |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6064 | struct hdd_request *request; |
| 6065 | struct temperature_priv *priv; |
| 6066 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6067 | ENTER(); |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6068 | |
| 6069 | request = hdd_request_get(context); |
| 6070 | if (!request) { |
| 6071 | hdd_err("Obsolete request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6072 | return; |
| 6073 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6074 | |
| 6075 | priv = hdd_request_priv(request); |
| 6076 | priv->temperature = temperature; |
| 6077 | hdd_request_complete(request); |
| 6078 | hdd_request_put(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6079 | EXIT(); |
| 6080 | } |
| 6081 | |
| 6082 | /** |
| 6083 | * wlan_hdd_get_temperature() - get current device temperature |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6084 | * @adapter: device upon which the request was made |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6085 | * @temperature: pointer to where the temperature is to be returned |
| 6086 | * |
| 6087 | * Return: 0 if a temperature value (either current or cached) was |
| 6088 | * returned, otherwise a negative errno is returned. |
| 6089 | * |
| 6090 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6091 | int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6092 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6093 | QDF_STATUS status; |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6094 | int ret; |
| 6095 | void *cookie; |
| 6096 | struct hdd_request *request; |
| 6097 | struct temperature_priv *priv; |
| 6098 | static const struct hdd_request_params params = { |
| 6099 | .priv_size = sizeof(*priv), |
| 6100 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 6101 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6102 | |
| 6103 | ENTER(); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6104 | if (NULL == adapter) { |
| 6105 | hdd_err("adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6106 | return -EPERM; |
| 6107 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6108 | |
| 6109 | request = hdd_request_alloc(¶ms); |
| 6110 | if (!request) { |
| 6111 | hdd_err("Request allocation failure"); |
| 6112 | return -ENOMEM; |
| 6113 | } |
| 6114 | cookie = hdd_request_cookie(request); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6115 | status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6116 | cookie, hdd_get_temperature_cb); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6117 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6118 | hdd_err("Unable to retrieve temperature"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6119 | } else { |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6120 | ret = hdd_request_wait_for_response(request); |
| 6121 | if (ret) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6122 | hdd_err("SME timed out while retrieving temperature"); |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6123 | } else { |
| 6124 | /* update the adapter with the fresh results */ |
| 6125 | priv = hdd_request_priv(request); |
| 6126 | if (priv->temperature) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6127 | adapter->temperature = priv->temperature; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6128 | } |
| 6129 | } |
Jeff Johnson | 0c5a2ba | 2017-01-23 16:36:43 -0800 | [diff] [blame] | 6130 | |
| 6131 | /* |
| 6132 | * either we never sent a request, we sent a request and |
| 6133 | * received a response or we sent a request and timed out. |
| 6134 | * regardless we are done with the request. |
| 6135 | */ |
| 6136 | hdd_request_put(request); |
| 6137 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6138 | *temperature = adapter->temperature; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6139 | EXIT(); |
| 6140 | return 0; |
| 6141 | } |
| 6142 | |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 6143 | static int hdd_validate_pdev_reset(int value) |
| 6144 | { |
| 6145 | if ((value < 1) || (value > 5)) { |
| 6146 | hdd_warn(" Invalid value %d: Use any one of the below values\n" |
| 6147 | " TX_FLUSH = 1\n" |
| 6148 | " WARM_RESET = 2\n" |
| 6149 | " COLD_RESET = 3\n" |
| 6150 | " WARM_RESET_RESTORE_CAL = 4\n" |
| 6151 | " COLD_RESET_RESTORE_CAL = 5", value); |
| 6152 | |
| 6153 | return -EINVAL; |
| 6154 | } |
| 6155 | |
| 6156 | return 0; |
| 6157 | } |
| 6158 | |
| 6159 | static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value) |
| 6160 | { |
| 6161 | int ret; |
| 6162 | |
| 6163 | hdd_debug("%d", value); |
| 6164 | |
| 6165 | ret = hdd_validate_pdev_reset(value); |
| 6166 | if (ret) |
| 6167 | return ret; |
| 6168 | |
| 6169 | ret = wma_cli_set_command(adapter->sessionId, |
| 6170 | WMI_PDEV_PARAM_PDEV_RESET, |
| 6171 | value, PDEV_CMD); |
| 6172 | |
| 6173 | return ret; |
| 6174 | } |
| 6175 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6176 | /** |
| 6177 | * iw_setint_getnone() - Generic "set integer" private ioctl handler |
| 6178 | * @dev: device upon which the ioctl was received |
| 6179 | * @info: ioctl request information |
| 6180 | * @wrqu: ioctl request data |
| 6181 | * @extra: ioctl extra data |
| 6182 | * |
| 6183 | * Return: 0 on success, non-zero on error |
| 6184 | */ |
| 6185 | static int __iw_setint_getnone(struct net_device *dev, |
| 6186 | struct iw_request_info *info, |
| 6187 | union iwreq_data *wrqu, char *extra) |
| 6188 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6189 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6190 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6191 | 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] | 6192 | struct hdd_context *hdd_ctx; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6193 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6194 | int *value = (int *)extra; |
| 6195 | int sub_cmd = value[0]; |
| 6196 | int set_value = value[1]; |
| 6197 | int ret; |
| 6198 | int enable_pbm, enable_mp; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6199 | QDF_STATUS status; |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 6200 | void *soc = NULL; |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 6201 | struct cdp_pdev *pdev = NULL; |
| 6202 | struct cdp_vdev *vdev = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6203 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 6204 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 6205 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6206 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6207 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6208 | if (0 != ret) |
| 6209 | return ret; |
| 6210 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6211 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 6212 | if (0 != ret) |
| 6213 | return ret; |
| 6214 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6215 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 6216 | if (!sme_config) { |
| 6217 | hdd_err("failed to allocate memory for sme_config"); |
| 6218 | return -ENOMEM; |
| 6219 | } |
| 6220 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6221 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6222 | switch (sub_cmd) { |
| 6223 | case WE_SET_11D_STATE: |
| 6224 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6225 | if (((ENABLE_11D == set_value) |
| 6226 | || (DISABLE_11D == set_value)) && hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6227 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6228 | sme_get_config_param(hHal, sme_config); |
| 6229 | sme_config->csrConfig.Is11dSupportEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6230 | (bool) set_value; |
| 6231 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6232 | hdd_debug("11D state=%d!!", |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6233 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6234 | Is11dSupportEnabled); |
| 6235 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6236 | sme_update_config(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6237 | } else { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6238 | ret = -EINVAL; |
| 6239 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6240 | } |
| 6241 | break; |
| 6242 | } |
| 6243 | |
| 6244 | case WE_WOWL: |
| 6245 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6246 | if (!hHal) |
| 6247 | return -EINVAL; |
| 6248 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6249 | switch (set_value) { |
| 6250 | case 0x00: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6251 | hdd_exit_wowl(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6252 | break; |
| 6253 | case 0x01: |
| 6254 | case 0x02: |
| 6255 | case 0x03: |
| 6256 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 6257 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6258 | hdd_debug("magic packet ? = %s pattern byte matching ? = %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6259 | (enable_mp ? "YES" : "NO"), |
| 6260 | (enable_pbm ? "YES" : "NO")); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6261 | hdd_enter_wowl(adapter, enable_mp, enable_pbm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6262 | break; |
| 6263 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6264 | hdd_err("Invalid arg %d in WE_WOWL IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | set_value); |
| 6266 | ret = -EINVAL; |
| 6267 | break; |
| 6268 | } |
| 6269 | |
| 6270 | break; |
| 6271 | } |
| 6272 | case WE_SET_POWER: |
| 6273 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6274 | if (!hHal) |
| 6275 | return -EINVAL; |
| 6276 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6277 | switch (set_value) { |
| 6278 | case 1: |
| 6279 | /* Enable PowerSave */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6280 | sme_ps_enable_disable(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6281 | SME_PS_ENABLE); |
| 6282 | break; |
| 6283 | case 2: |
| 6284 | /* Disable PowerSave */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6285 | sme_ps_enable_disable(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6286 | SME_PS_DISABLE); |
| 6287 | break; |
| 6288 | case 3: /* Enable UASPD */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6289 | sme_ps_uapsd_enable(hHal, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6290 | break; |
| 6291 | case 4: /* Disable UASPD */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6292 | sme_ps_uapsd_disable(hHal, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6293 | break; |
| 6294 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6295 | hdd_err("Invalid arg %d in WE_SET_POWER IOCTL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6296 | set_value); |
| 6297 | ret = -EINVAL; |
| 6298 | break; |
| 6299 | } |
| 6300 | break; |
| 6301 | } |
| 6302 | |
| 6303 | case WE_SET_MAX_ASSOC: |
| 6304 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6305 | if (!hHal) |
| 6306 | return -EINVAL; |
| 6307 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6308 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 6309 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) { |
| 6310 | ret = -EINVAL; |
| 6311 | } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 6312 | set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6313 | != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6314 | hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6315 | ret = -EIO; |
| 6316 | } |
| 6317 | break; |
| 6318 | } |
| 6319 | |
| 6320 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 6321 | if (set_value == 0 || set_value == 1) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6322 | (WLAN_HDD_GET_CTX(adapter))->config->force_sap_acs = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6323 | set_value; |
| 6324 | else |
| 6325 | ret = -EINVAL; |
| 6326 | break; |
| 6327 | |
| 6328 | case WE_SET_DATA_INACTIVITY_TO: |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6329 | if (!hHal) |
| 6330 | return -EINVAL; |
| 6331 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6332 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 6333 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6334 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6335 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6336 | set_value) == QDF_STATUS_E_FAILURE)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6337 | hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6338 | ret = -EINVAL; |
| 6339 | } |
| 6340 | break; |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 6341 | case WE_SET_WOW_DATA_INACTIVITY_TO: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6342 | if (!hHal) { |
| 6343 | ret = -EINVAL; |
| 6344 | goto free; |
| 6345 | } |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 6346 | |
| 6347 | if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 6348 | (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6349 | (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal, |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 6350 | WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT, |
| 6351 | set_value) == QDF_STATUS_E_FAILURE)) { |
| 6352 | hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail"); |
| 6353 | ret = -EINVAL; |
| 6354 | } |
| 6355 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6356 | case WE_SET_MC_RATE: |
| 6357 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6358 | if (!hHal) |
| 6359 | return -EINVAL; |
| 6360 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6361 | ret = wlan_hdd_set_mc_rate(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6362 | break; |
| 6363 | } |
| 6364 | case WE_SET_TX_POWER: |
| 6365 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6366 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6367 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6368 | if (!hHal) |
| 6369 | return -EINVAL; |
| 6370 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6371 | qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6372 | if (sme_set_tx_power |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6373 | (hHal, adapter->sessionId, bssid, |
| 6374 | adapter->device_mode, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6375 | set_value) != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6376 | hdd_err("Setting tx power failed"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6377 | ret = -EIO; |
| 6378 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6379 | } |
| 6380 | break; |
| 6381 | } |
| 6382 | case WE_SET_MAX_TX_POWER: |
| 6383 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6384 | struct qdf_mac_addr bssid; |
| 6385 | struct qdf_mac_addr selfMac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6386 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6387 | if (!hHal) |
| 6388 | return -EINVAL; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6389 | |
| 6390 | hdd_debug("Setting maximum tx power %d dBm", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6391 | set_value); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 6392 | qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId); |
| 6393 | qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6394 | |
| 6395 | if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6396 | != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6397 | hdd_err("Setting maximum tx power failed"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6398 | ret = -EIO; |
| 6399 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6400 | } |
| 6401 | |
| 6402 | break; |
| 6403 | } |
| 6404 | case WE_SET_MAX_TX_POWER_2_4: |
| 6405 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6406 | 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] | 6407 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6408 | 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] | 6409 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6410 | hdd_err("Setting max tx power failed for 2.4 GHz band"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6411 | ret = -EIO; |
| 6412 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6413 | } |
| 6414 | |
| 6415 | break; |
| 6416 | } |
| 6417 | case WE_SET_MAX_TX_POWER_5_0: |
| 6418 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6419 | 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] | 6420 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6421 | 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] | 6422 | QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6423 | hdd_err("Setting max tx power failed for 5.0 GHz band"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6424 | ret = -EIO; |
| 6425 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6426 | } |
| 6427 | |
| 6428 | break; |
| 6429 | } |
| 6430 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 6431 | { |
| 6432 | if (!((set_value == false) || (set_value == true))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6433 | hdd_err("Dynamic DTIM Incorrect data:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6434 | set_value); |
| 6435 | ret = -EINVAL; |
| 6436 | } else { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6437 | if (adapter->higherDtimTransition != set_value) { |
| 6438 | adapter->higherDtimTransition = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6439 | set_value; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6440 | hdd_debug("higherDtimTransition set to :%d", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6441 | adapter->higherDtimTransition); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6442 | } |
| 6443 | } |
| 6444 | |
| 6445 | break; |
| 6446 | } |
| 6447 | |
| 6448 | case WE_SET_TM_LEVEL: |
| 6449 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6450 | if (!hHal) |
| 6451 | return -EINVAL; |
| 6452 | |
| 6453 | hdd_notice("Set Thermal Mitigation Level %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6454 | (void)sme_set_thermal_level(hHal, set_value); |
| 6455 | break; |
| 6456 | } |
| 6457 | |
| 6458 | case WE_SET_PHYMODE: |
| 6459 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6460 | struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 6461 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6462 | if (!hHal) |
| 6463 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6464 | |
| 6465 | ret = |
| 6466 | wlan_hdd_update_phymode(dev, hHal, set_value, |
| 6467 | phddctx); |
| 6468 | break; |
| 6469 | } |
| 6470 | |
| 6471 | case WE_SET_NSS: |
| 6472 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6473 | if (!hHal) |
| 6474 | return -EINVAL; |
| 6475 | |
| 6476 | hdd_notice("Set NSS = %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6477 | if ((set_value > 2) || (set_value <= 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6478 | hdd_err("NSS greater than 2 not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6479 | ret = -EINVAL; |
| 6480 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6481 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6482 | hdd_update_nss(WLAN_HDD_GET_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6483 | set_value)) |
| 6484 | ret = -EINVAL; |
| 6485 | } |
| 6486 | break; |
| 6487 | } |
| 6488 | |
| 6489 | case WE_SET_GTX_HT_MCS: |
| 6490 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6491 | hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6492 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6493 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 6494 | set_value, GTX_CMD); |
| 6495 | break; |
| 6496 | } |
| 6497 | |
| 6498 | case WE_SET_GTX_VHT_MCS: |
| 6499 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6500 | hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6501 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6502 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6503 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 6504 | set_value, GTX_CMD); |
| 6505 | break; |
| 6506 | } |
| 6507 | |
| 6508 | case WE_SET_GTX_USRCFG: |
| 6509 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6510 | hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6511 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6512 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6513 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 6514 | set_value, GTX_CMD); |
| 6515 | break; |
| 6516 | } |
| 6517 | |
| 6518 | case WE_SET_GTX_THRE: |
| 6519 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6520 | hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6521 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6522 | WMI_VDEV_PARAM_GTX_THRE, |
| 6523 | set_value, GTX_CMD); |
| 6524 | break; |
| 6525 | } |
| 6526 | |
| 6527 | case WE_SET_GTX_MARGIN: |
| 6528 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6529 | hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6530 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6531 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 6532 | set_value, GTX_CMD); |
| 6533 | break; |
| 6534 | } |
| 6535 | |
| 6536 | case WE_SET_GTX_STEP: |
| 6537 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6538 | hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6539 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6540 | WMI_VDEV_PARAM_GTX_STEP, |
| 6541 | set_value, GTX_CMD); |
| 6542 | break; |
| 6543 | } |
| 6544 | |
| 6545 | case WE_SET_GTX_MINTPC: |
| 6546 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6547 | hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6548 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6549 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 6550 | set_value, GTX_CMD); |
| 6551 | break; |
| 6552 | } |
| 6553 | |
| 6554 | case WE_SET_GTX_BWMASK: |
| 6555 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6556 | hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6557 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6558 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 6559 | set_value, GTX_CMD); |
| 6560 | break; |
| 6561 | } |
| 6562 | |
| 6563 | case WE_SET_LDPC: |
| 6564 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6565 | if (!hHal) |
| 6566 | return -EINVAL; |
| 6567 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6568 | ret = hdd_set_ldpc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6569 | break; |
| 6570 | } |
| 6571 | |
| 6572 | case WE_SET_TX_STBC: |
| 6573 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6574 | if (!hHal) |
| 6575 | return -EINVAL; |
| 6576 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6577 | ret = hdd_set_tx_stbc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6578 | break; |
| 6579 | } |
| 6580 | |
| 6581 | case WE_SET_RX_STBC: |
| 6582 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6583 | if (!hHal) |
| 6584 | return -EINVAL; |
| 6585 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6586 | ret = hdd_set_rx_stbc(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6587 | break; |
| 6588 | } |
| 6589 | |
| 6590 | case WE_SET_SHORT_GI: |
| 6591 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6592 | if (!hHal) |
| 6593 | return -EINVAL; |
| 6594 | |
| 6595 | hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6596 | ret = sme_update_ht_config(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6597 | WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ, |
| 6598 | set_value); |
| 6599 | if (ret) |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6600 | hdd_err("Failed to set ShortGI value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6601 | break; |
| 6602 | } |
| 6603 | |
| 6604 | case WE_SET_RTSCTS: |
| 6605 | { |
| 6606 | uint32_t value; |
| 6607 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6608 | if (!hHal) |
| 6609 | return -EINVAL; |
| 6610 | |
| 6611 | hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6612 | set_value); |
| 6613 | |
| 6614 | if ((set_value & HDD_RTSCTS_EN_MASK) == |
| 6615 | HDD_RTSCTS_ENABLE) |
| 6616 | value = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6617 | (WLAN_HDD_GET_CTX(adapter))->config-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6618 | RTSThreshold; |
| 6619 | else if (((set_value & HDD_RTSCTS_EN_MASK) == 0) |
| 6620 | || ((set_value & HDD_RTSCTS_EN_MASK) == |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6621 | HDD_CTS_ENABLE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6622 | value = WNI_CFG_RTS_THRESHOLD_STAMAX; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6623 | } else { |
| 6624 | ret = -EIO; |
| 6625 | goto free; |
| 6626 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6627 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6628 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6629 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 6630 | set_value, VDEV_CMD); |
| 6631 | if (!ret) { |
| 6632 | if (sme_cfg_set_int |
| 6633 | (hHal, WNI_CFG_RTS_THRESHOLD, value) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6634 | QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6635 | hdd_err("FAILED TO SET RTSCTS"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6636 | ret = -EIO; |
| 6637 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6638 | } |
| 6639 | } |
| 6640 | |
| 6641 | break; |
| 6642 | } |
| 6643 | |
| 6644 | case WE_SET_CHWIDTH: |
| 6645 | { |
| 6646 | bool chwidth = false; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6647 | struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 6648 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 6649 | if (!hHal) |
| 6650 | return -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6651 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6652 | /*updating channel bonding only on 5Ghz */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6653 | hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6654 | set_value); |
| 6655 | if (set_value > eHT_CHANNEL_WIDTH_80MHZ) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 6656 | hdd_err("Invalid channel width 0->20 1->40 2->80"); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6657 | ret = -EINVAL; |
| 6658 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6659 | } |
| 6660 | |
| 6661 | if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
| 6662 | csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config-> |
| 6663 | nChannelBondingMode5GHz))) |
| 6664 | chwidth = true; |
| 6665 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6666 | sme_get_config_param(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6667 | switch (set_value) { |
| 6668 | case eHT_CHANNEL_WIDTH_20MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6669 | sme_config->csrConfig.channelBondingMode5GHz = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6670 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 6671 | break; |
| 6672 | case eHT_CHANNEL_WIDTH_40MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6673 | if (chwidth) { |
| 6674 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6675 | channelBondingMode5GHz = |
| 6676 | phddctx->config-> |
| 6677 | nChannelBondingMode5GHz; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6678 | } else { |
| 6679 | ret = -EINVAL; |
| 6680 | goto free; |
| 6681 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6682 | |
| 6683 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6684 | case eHT_CHANNEL_WIDTH_80MHZ: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6685 | if (chwidth) { |
| 6686 | sme_config->csrConfig. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6687 | channelBondingMode5GHz = |
| 6688 | phddctx->config-> |
| 6689 | nChannelBondingMode5GHz; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6690 | } else { |
| 6691 | ret = -EINVAL; |
| 6692 | goto free; |
| 6693 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6694 | |
| 6695 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6696 | |
| 6697 | default: |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6698 | ret = -EINVAL; |
| 6699 | goto free; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6700 | } |
| 6701 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6702 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6703 | WMI_VDEV_PARAM_CHWIDTH, |
| 6704 | set_value, VDEV_CMD); |
| 6705 | if (!ret) |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 6706 | sme_update_config(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6707 | |
| 6708 | break; |
| 6709 | } |
| 6710 | |
| 6711 | case WE_SET_ANI_EN_DIS: |
| 6712 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6713 | hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6714 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6715 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6716 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 6717 | set_value, PDEV_CMD); |
| 6718 | break; |
| 6719 | } |
| 6720 | |
| 6721 | case WE_SET_ANI_POLL_PERIOD: |
| 6722 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6723 | hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6724 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6725 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6726 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 6727 | set_value, PDEV_CMD); |
| 6728 | break; |
| 6729 | } |
| 6730 | |
| 6731 | case WE_SET_ANI_LISTEN_PERIOD: |
| 6732 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6733 | hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6734 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6735 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6736 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 6737 | set_value, PDEV_CMD); |
| 6738 | break; |
| 6739 | } |
| 6740 | |
| 6741 | case WE_SET_ANI_OFDM_LEVEL: |
| 6742 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6743 | hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6744 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6745 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6746 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 6747 | set_value, PDEV_CMD); |
| 6748 | break; |
| 6749 | } |
| 6750 | |
| 6751 | case WE_SET_ANI_CCK_LEVEL: |
| 6752 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6753 | hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6754 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6755 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6756 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 6757 | set_value, PDEV_CMD); |
| 6758 | break; |
| 6759 | } |
| 6760 | |
| 6761 | case WE_SET_DYNAMIC_BW: |
| 6762 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6763 | hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6764 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6765 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6766 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 6767 | set_value, PDEV_CMD); |
| 6768 | break; |
| 6769 | } |
| 6770 | |
| 6771 | case WE_SET_CTS_CBW: |
| 6772 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6773 | hdd_debug("WE_SET_CTS_CBW val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6774 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6775 | WMI_PDEV_PARAM_CTS_CBW, |
| 6776 | set_value, PDEV_CMD); |
| 6777 | break; |
| 6778 | } |
| 6779 | |
| 6780 | case WE_SET_11N_RATE: |
| 6781 | { |
| 6782 | uint8_t preamble = 0, nss = 0, rix = 0; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 6783 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6784 | hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6785 | set_value); |
| 6786 | |
| 6787 | if (set_value != 0xff) { |
| 6788 | rix = RC_2_RATE_IDX(set_value); |
| 6789 | if (set_value & 0x80) { |
| 6790 | preamble = WMI_RATE_PREAMBLE_HT; |
| 6791 | nss = HT_RC_2_STREAMS(set_value) - 1; |
| 6792 | } else { |
| 6793 | nss = 0; |
| 6794 | rix = RC_2_RATE_IDX(set_value); |
| 6795 | if (set_value & 0x10) { |
| 6796 | preamble = |
| 6797 | WMI_RATE_PREAMBLE_CCK; |
| 6798 | if (rix != 0x3) |
| 6799 | /* Enable Short |
| 6800 | * preamble always for |
| 6801 | * CCK except 1mbps |
| 6802 | */ |
| 6803 | rix |= 0x4; |
| 6804 | } else { |
| 6805 | preamble = |
| 6806 | WMI_RATE_PREAMBLE_OFDM; |
| 6807 | } |
| 6808 | } |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 6809 | set_value = hdd_assemble_rate_code(preamble, nss, rix); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6810 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6811 | 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] | 6812 | set_value, rix, preamble, nss); |
| 6813 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6814 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6815 | WMI_VDEV_PARAM_FIXED_RATE, |
| 6816 | set_value, VDEV_CMD); |
| 6817 | break; |
| 6818 | } |
| 6819 | |
| 6820 | case WE_SET_VHT_RATE: |
| 6821 | { |
| 6822 | uint8_t preamble = 0, nss = 0, rix = 0; |
| 6823 | |
| 6824 | if (set_value != 0xff) { |
| 6825 | rix = RC_2_RATE_IDX_11AC(set_value); |
| 6826 | preamble = WMI_RATE_PREAMBLE_VHT; |
| 6827 | nss = HT_RC_2_STREAMS_11AC(set_value) - 1; |
| 6828 | |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 6829 | set_value = hdd_assemble_rate_code(preamble, nss, rix); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6830 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6831 | 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] | 6832 | set_value, rix, preamble, nss); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6833 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6834 | WMI_VDEV_PARAM_FIXED_RATE, |
| 6835 | set_value, VDEV_CMD); |
| 6836 | break; |
| 6837 | } |
| 6838 | |
| 6839 | case WE_SET_AMPDU: |
| 6840 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6841 | hdd_debug("SET AMPDU val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6842 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6843 | GEN_VDEV_PARAM_AMPDU, |
| 6844 | set_value, GEN_CMD); |
| 6845 | break; |
| 6846 | } |
| 6847 | |
| 6848 | case WE_SET_AMSDU: |
| 6849 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6850 | hdd_debug("SET AMSDU val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6851 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6852 | GEN_VDEV_PARAM_AMSDU, |
| 6853 | set_value, GEN_CMD); |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 6854 | /* Update the stored ini value */ |
| 6855 | if (!ret) |
| 6856 | hdd_ctx->config->max_amsdu_num = set_value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6857 | break; |
| 6858 | } |
| 6859 | |
| 6860 | case WE_SET_BURST_ENABLE: |
| 6861 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6862 | hdd_debug("SET Burst enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6863 | if ((set_value == 0) || (set_value == 1)) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6864 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6865 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 6866 | set_value, PDEV_CMD); |
| 6867 | } else |
| 6868 | ret = -EINVAL; |
| 6869 | break; |
| 6870 | } |
| 6871 | case WE_SET_BURST_DUR: |
| 6872 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6873 | hdd_debug("SET Burst duration val %d", set_value); |
Jeff Johnson | da5ee77 | 2016-08-04 17:18:47 -0700 | [diff] [blame] | 6874 | if ((set_value > 0) && (set_value <= 102400)) |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6875 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6876 | WMI_PDEV_PARAM_BURST_DUR, |
| 6877 | set_value, PDEV_CMD); |
| 6878 | else |
| 6879 | ret = -EINVAL; |
| 6880 | break; |
| 6881 | } |
| 6882 | |
| 6883 | case WE_SET_TX_CHAINMASK: |
| 6884 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6885 | hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6886 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6887 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6888 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 6889 | set_value, PDEV_CMD); |
| 6890 | break; |
| 6891 | } |
| 6892 | |
| 6893 | case WE_SET_RX_CHAINMASK: |
| 6894 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6895 | hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6896 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6897 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6898 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 6899 | set_value, PDEV_CMD); |
| 6900 | break; |
| 6901 | } |
| 6902 | |
| 6903 | case WE_SET_TXPOW_2G: |
| 6904 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6905 | hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6906 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6907 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6908 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 6909 | set_value, PDEV_CMD); |
| 6910 | break; |
| 6911 | } |
| 6912 | |
| 6913 | case WE_SET_TXPOW_5G: |
| 6914 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6915 | hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6916 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6917 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6918 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 6919 | set_value, PDEV_CMD); |
| 6920 | break; |
| 6921 | } |
| 6922 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6923 | /* Firmware debug log */ |
| 6924 | case WE_DBGLOG_LOG_LEVEL: |
| 6925 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6926 | hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6927 | hdd_ctx->fw_log_settings.dl_loglevel = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6928 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6929 | WMI_DBGLOG_LOG_LEVEL, |
| 6930 | set_value, DBG_CMD); |
| 6931 | break; |
| 6932 | } |
| 6933 | |
| 6934 | case WE_DBGLOG_VAP_ENABLE: |
| 6935 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6936 | hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6937 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6938 | WMI_DBGLOG_VAP_ENABLE, |
| 6939 | set_value, DBG_CMD); |
| 6940 | break; |
| 6941 | } |
| 6942 | |
| 6943 | case WE_DBGLOG_VAP_DISABLE: |
| 6944 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6945 | hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6946 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6947 | WMI_DBGLOG_VAP_DISABLE, |
| 6948 | set_value, DBG_CMD); |
| 6949 | break; |
| 6950 | } |
| 6951 | |
| 6952 | case WE_DBGLOG_MODULE_ENABLE: |
| 6953 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6954 | hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6955 | set_value); |
| 6956 | hdd_ctx->fw_log_settings.enable = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6957 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6958 | WMI_DBGLOG_MODULE_ENABLE, |
| 6959 | set_value, DBG_CMD); |
| 6960 | break; |
| 6961 | } |
| 6962 | |
| 6963 | case WE_DBGLOG_MODULE_DISABLE: |
| 6964 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6965 | hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6966 | set_value); |
| 6967 | hdd_ctx->fw_log_settings.enable = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6968 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6969 | WMI_DBGLOG_MODULE_DISABLE, |
| 6970 | set_value, DBG_CMD); |
| 6971 | break; |
| 6972 | } |
| 6973 | case WE_DBGLOG_MOD_LOG_LEVEL: |
| 6974 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6975 | hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6976 | set_value); |
| 6977 | |
| 6978 | if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL) |
| 6979 | hdd_ctx->fw_log_settings.index = 0; |
| 6980 | |
| 6981 | hdd_ctx->fw_log_settings. |
| 6982 | dl_mod_loglevel[hdd_ctx->fw_log_settings.index] = |
| 6983 | set_value; |
| 6984 | hdd_ctx->fw_log_settings.index++; |
| 6985 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6986 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6987 | WMI_DBGLOG_MOD_LOG_LEVEL, |
| 6988 | set_value, DBG_CMD); |
| 6989 | break; |
| 6990 | } |
| 6991 | |
| 6992 | case WE_DBGLOG_TYPE: |
| 6993 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 6994 | hdd_debug("WE_DBGLOG_TYPE val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6995 | hdd_ctx->fw_log_settings.dl_type = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 6996 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6997 | WMI_DBGLOG_TYPE, |
| 6998 | set_value, DBG_CMD); |
| 6999 | break; |
| 7000 | } |
| 7001 | case WE_DBGLOG_REPORT_ENABLE: |
| 7002 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7003 | hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7004 | set_value); |
| 7005 | hdd_ctx->fw_log_settings.dl_report = set_value; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7006 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7007 | WMI_DBGLOG_REPORT_ENABLE, |
| 7008 | set_value, DBG_CMD); |
| 7009 | break; |
| 7010 | } |
| 7011 | |
| 7012 | case WE_SET_TXRX_FWSTATS: |
| 7013 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7014 | hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7015 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7016 | WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID, |
| 7017 | set_value, VDEV_CMD); |
| 7018 | break; |
| 7019 | } |
| 7020 | |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7021 | case WE_SET_TXRX_STATS: |
| 7022 | { |
| 7023 | hdd_notice("WE_SET_TXRX_STATS val %d", set_value); |
| 7024 | ret = cds_get_datapath_handles(&soc, &pdev, &vdev, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7025 | adapter->sessionId); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7026 | |
Venkata Sharath Chandra Manchala | bcdfdb1 | 2017-03-29 19:25:45 -0700 | [diff] [blame] | 7027 | if (ret != 0) { |
| 7028 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
| 7029 | "Invalid handles"); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7030 | break; |
Venkata Sharath Chandra Manchala | bcdfdb1 | 2017-03-29 19:25:45 -0700 | [diff] [blame] | 7031 | } |
| 7032 | ret = cdp_txrx_stats(soc, vdev, set_value); |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 7033 | break; |
| 7034 | } |
| 7035 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7036 | case WE_TXRX_FWSTATS_RESET: |
| 7037 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7038 | hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7039 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7040 | WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, |
| 7041 | set_value, VDEV_CMD); |
| 7042 | break; |
| 7043 | } |
| 7044 | |
| 7045 | case WE_DUMP_STATS: |
| 7046 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7047 | hdd_debug("WE_DUMP_STATS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7048 | ret = hdd_wlan_dump_stats(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7049 | break; |
| 7050 | } |
| 7051 | |
| 7052 | case WE_CLEAR_STATS: |
| 7053 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7054 | hdd_debug("WE_CLEAR_STATS val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7055 | switch (set_value) { |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 7056 | case CDP_HDD_STATS: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7057 | memset(&adapter->stats, 0, sizeof(adapter->stats)); |
| 7058 | memset(&adapter->hdd_stats, 0, |
| 7059 | sizeof(adapter->hdd_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7060 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 7061 | case CDP_TXRX_HIST_STATS: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7062 | wlan_hdd_clear_tx_rx_histogram(hdd_ctx); |
| 7063 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 7064 | case CDP_HDD_NETIF_OPER_HISTORY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7065 | wlan_hdd_clear_netif_queue_history(hdd_ctx); |
| 7066 | break; |
Venkata Sharath Chandra Manchala | 71032b6 | 2017-03-29 12:30:45 -0700 | [diff] [blame] | 7067 | case CDP_HIF_STATS: |
Nirav Shah | bf1b033 | 2016-05-25 14:27:39 +0530 | [diff] [blame] | 7068 | hdd_clear_hif_stats(); |
| 7069 | break; |
Yun Park | 1027e8c | 2017-10-13 15:17:37 -0700 | [diff] [blame] | 7070 | case CDP_NAPI_STATS: |
| 7071 | hdd_clear_napi_stats(); |
| 7072 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7073 | default: |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 7074 | cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), |
| 7075 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7076 | } |
| 7077 | break; |
| 7078 | } |
| 7079 | |
| 7080 | case WE_PPS_PAID_MATCH: |
| 7081 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7082 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7083 | ret = -EINVAL; |
| 7084 | goto free; |
| 7085 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7086 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7087 | hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7088 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7089 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7090 | WMI_VDEV_PPS_PAID_MATCH, |
| 7091 | set_value, PPS_CMD); |
| 7092 | break; |
| 7093 | } |
| 7094 | |
| 7095 | case WE_PPS_GID_MATCH: |
| 7096 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7097 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7098 | ret = -EINVAL; |
| 7099 | goto free; |
| 7100 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7101 | hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7102 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7103 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7104 | WMI_VDEV_PPS_GID_MATCH, |
| 7105 | set_value, PPS_CMD); |
| 7106 | break; |
| 7107 | } |
| 7108 | |
| 7109 | case WE_PPS_EARLY_TIM_CLEAR: |
| 7110 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7111 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7112 | ret = -EINVAL; |
| 7113 | goto free; |
| 7114 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7115 | hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7116 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7117 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7118 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 7119 | set_value, PPS_CMD); |
| 7120 | break; |
| 7121 | } |
| 7122 | |
| 7123 | case WE_PPS_EARLY_DTIM_CLEAR: |
| 7124 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7125 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7126 | ret = -EINVAL; |
| 7127 | goto free; |
| 7128 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7129 | hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7130 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7131 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7132 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 7133 | set_value, PPS_CMD); |
| 7134 | break; |
| 7135 | } |
| 7136 | |
| 7137 | case WE_PPS_EOF_PAD_DELIM: |
| 7138 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7139 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7140 | ret = -EINVAL; |
| 7141 | goto free; |
| 7142 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7143 | hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7144 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7145 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7146 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 7147 | set_value, PPS_CMD); |
| 7148 | break; |
| 7149 | } |
| 7150 | |
| 7151 | case WE_PPS_MACADDR_MISMATCH: |
| 7152 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7153 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7154 | ret = -EINVAL; |
| 7155 | goto free; |
| 7156 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7157 | hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7158 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7159 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7160 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 7161 | set_value, PPS_CMD); |
| 7162 | break; |
| 7163 | } |
| 7164 | |
| 7165 | case WE_PPS_DELIM_CRC_FAIL: |
| 7166 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7167 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7168 | ret = -EINVAL; |
| 7169 | goto free; |
| 7170 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7171 | hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7172 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7173 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7174 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 7175 | set_value, PPS_CMD); |
| 7176 | break; |
| 7177 | } |
| 7178 | |
| 7179 | case WE_PPS_GID_NSTS_ZERO: |
| 7180 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7181 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7182 | ret = -EINVAL; |
| 7183 | goto free; |
| 7184 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7185 | hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7186 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7187 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7188 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 7189 | set_value, PPS_CMD); |
| 7190 | break; |
| 7191 | } |
| 7192 | |
| 7193 | case WE_PPS_RSSI_CHECK: |
| 7194 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7195 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7196 | ret = -EINVAL; |
| 7197 | goto free; |
| 7198 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7199 | hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7200 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7201 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7202 | WMI_VDEV_PPS_RSSI_CHECK, |
| 7203 | set_value, PPS_CMD); |
| 7204 | break; |
| 7205 | } |
| 7206 | |
| 7207 | case WE_PPS_5G_EBT: |
| 7208 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7209 | if (adapter->device_mode != QDF_STA_MODE) { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7210 | ret = -EINVAL; |
| 7211 | goto free; |
| 7212 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7213 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7214 | hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7215 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7216 | WMI_VDEV_PPS_5G_EBT, |
| 7217 | set_value, PPS_CMD); |
| 7218 | break; |
| 7219 | } |
| 7220 | |
| 7221 | case WE_SET_HTSMPS: |
| 7222 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7223 | hdd_debug("WE_SET_HTSMPS val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7224 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7225 | WMI_STA_SMPS_FORCE_MODE_CMDID, |
| 7226 | set_value, VDEV_CMD); |
| 7227 | break; |
| 7228 | } |
| 7229 | |
| 7230 | case WE_SET_QPOWER_MAX_PSPOLL_COUNT: |
| 7231 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7232 | hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7233 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7234 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7235 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 7236 | set_value, QPOWER_CMD); |
| 7237 | break; |
| 7238 | } |
| 7239 | |
| 7240 | case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 7241 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7242 | hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7243 | set_value); |
| 7244 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7245 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7246 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 7247 | set_value, QPOWER_CMD); |
| 7248 | break; |
| 7249 | } |
| 7250 | |
| 7251 | case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 7252 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7253 | hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7254 | set_value); |
| 7255 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7256 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7257 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 7258 | set_value, QPOWER_CMD); |
| 7259 | break; |
| 7260 | } |
| 7261 | |
| 7262 | case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 7263 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7264 | hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7265 | set_value); |
| 7266 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7267 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7268 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 7269 | set_value, QPOWER_CMD); |
| 7270 | break; |
| 7271 | } |
| 7272 | |
| 7273 | case WE_MCC_CONFIG_LATENCY: |
| 7274 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7275 | wlan_hdd_set_mcc_latency(adapter, set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7276 | break; |
| 7277 | } |
| 7278 | |
| 7279 | case WE_MCC_CONFIG_QUOTA: |
| 7280 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7281 | hdd_debug("iwpriv cmd to set MCC quota with val %dms", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7282 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7283 | ret = wlan_hdd_set_mcc_p2p_quota(adapter, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 7284 | set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7285 | break; |
| 7286 | } |
| 7287 | case WE_SET_DEBUG_LOG: |
| 7288 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7289 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 7290 | |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7291 | if (!hHal) |
| 7292 | return -EINVAL; |
| 7293 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 7294 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7295 | hdd_ctx->config->gEnableDebugLog = set_value; |
| 7296 | sme_update_connect_debug(hdd_ctx->hHal, set_value); |
| 7297 | break; |
| 7298 | } |
| 7299 | case WE_SET_EARLY_RX_ADJUST_ENABLE: |
| 7300 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7301 | hdd_debug("SET early_rx enable val %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7302 | if ((set_value == 0) || (set_value == 1)) |
| 7303 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7304 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7305 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, |
| 7306 | set_value, VDEV_CMD); |
| 7307 | else |
| 7308 | ret = -EINVAL; |
| 7309 | break; |
| 7310 | } |
| 7311 | case WE_SET_EARLY_RX_TGT_BMISS_NUM: |
| 7312 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7313 | hdd_debug("SET early_rx bmiss val %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7314 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7315 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, |
| 7316 | set_value, VDEV_CMD); |
| 7317 | break; |
| 7318 | } |
| 7319 | case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 7320 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7321 | hdd_debug("SET early_rx bmiss sample cycle %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7322 | set_value); |
| 7323 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7324 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7325 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 7326 | set_value, VDEV_CMD); |
| 7327 | break; |
| 7328 | } |
| 7329 | case WE_SET_EARLY_RX_SLOP_STEP: |
| 7330 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7331 | hdd_debug("SET early_rx bmiss slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7332 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7333 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7334 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP, |
| 7335 | set_value, VDEV_CMD); |
| 7336 | break; |
| 7337 | } |
| 7338 | case WE_SET_EARLY_RX_INIT_SLOP: |
| 7339 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7340 | hdd_debug("SET early_rx init slop step val %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7341 | set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7342 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7343 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP, |
| 7344 | set_value, VDEV_CMD); |
| 7345 | break; |
| 7346 | } |
| 7347 | case WE_SET_EARLY_RX_ADJUST_PAUSE: |
| 7348 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7349 | hdd_debug("SET early_rx adjust pause %d", set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7350 | if ((set_value == 0) || (set_value == 1)) |
| 7351 | ret = wma_cli_set_command( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7352 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7353 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, |
| 7354 | set_value, VDEV_CMD); |
| 7355 | else |
| 7356 | ret = -EINVAL; |
| 7357 | break; |
| 7358 | } |
| 7359 | case WE_SET_EARLY_RX_DRIFT_SAMPLE: |
| 7360 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7361 | hdd_debug("SET early_rx drift sample %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7362 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7363 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE, |
| 7364 | set_value, VDEV_CMD); |
| 7365 | break; |
| 7366 | } |
| 7367 | case WE_SET_SCAN_DISABLE: |
| 7368 | { |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7369 | if (!hHal) |
| 7370 | return -EINVAL; |
| 7371 | |
| 7372 | hdd_notice("SET SCAN DISABLE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7373 | sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(adapter), set_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7374 | break; |
| 7375 | } |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7376 | case WE_START_FW_PROFILE: |
| 7377 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7378 | hdd_debug("WE_START_FW_PROFILE %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7379 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 7380 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 7381 | set_value, DBG_CMD); |
| 7382 | break; |
| 7383 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7384 | case WE_SET_CHANNEL: |
| 7385 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7386 | hdd_debug("Set Channel %d Session ID %d mode %d", set_value, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7387 | adapter->sessionId, adapter->device_mode); |
SaidiReddy Yenuga | 8cbd921 | 2017-02-15 15:35:29 +0530 | [diff] [blame] | 7388 | if (!hHal) |
| 7389 | return -EINVAL; |
| 7390 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7391 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7392 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 7393 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7394 | |
| 7395 | status = sme_ext_change_channel(hHal, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7396 | set_value, adapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7397 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7398 | hdd_err("Error in change channel status %d", |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7399 | status); |
| 7400 | ret = -EINVAL; |
| 7401 | } |
| 7402 | } else { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7403 | hdd_err("change channel not supported for device mode %d", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7404 | adapter->device_mode); |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7405 | ret = -EINVAL; |
| 7406 | } |
| 7407 | break; |
| 7408 | } |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 7409 | case WE_SET_CONC_SYSTEM_PREF: |
| 7410 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7411 | hdd_debug("New preference: %d", set_value); |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 7412 | if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) && |
| 7413 | (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) { |
| 7414 | hdd_err("Invalid system preference %d", set_value); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7415 | ret = -EINVAL; |
| 7416 | goto free; |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 7417 | } |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 7418 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 7419 | /* hdd_ctx, hdd_ctx->config are already checked for null */ |
| 7420 | hdd_ctx->config->conc_system_pref = set_value; |
| 7421 | break; |
| 7422 | } |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 7423 | case WE_SET_11AX_RATE: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7424 | ret = hdd_set_11ax_rate(adapter, set_value, NULL); |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 7425 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 7426 | case WE_SET_DCM: |
| 7427 | hdd_notice("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7428 | ret = wma_cli_set_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 7429 | WMI_VDEV_PARAM_HE_DCM, set_value, |
| 7430 | VDEV_CMD); |
| 7431 | break; |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 7432 | case WE_SET_RANGE_EXT: |
| 7433 | hdd_notice("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7434 | ret = wma_cli_set_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 7435 | WMI_VDEV_PARAM_HE_RANGE_EXT, |
| 7436 | set_value, VDEV_CMD); |
| 7437 | break; |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 7438 | case WE_SET_PDEV_RESET: |
| 7439 | ret = hdd_handle_pdev_reset(adapter, set_value); |
| 7440 | break; |
SaidiReddy Yenuga | a92f8cc | 2017-03-24 15:15:03 +0530 | [diff] [blame] | 7441 | case WE_SET_MODULATED_DTIM: |
| 7442 | { |
| 7443 | if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) || |
| 7444 | (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) { |
| 7445 | hdd_err("Invalid gEnableModuleDTIM value %d", |
| 7446 | set_value); |
| 7447 | return -EINVAL; |
| 7448 | } else { |
| 7449 | hdd_ctx->config->enableModulatedDTIM = set_value; |
| 7450 | } |
| 7451 | break; |
| 7452 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7453 | default: |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 7454 | hdd_err("Invalid sub command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7455 | ret = -EINVAL; |
| 7456 | break; |
| 7457 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7458 | EXIT(); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7459 | free: |
| 7460 | qdf_mem_free(sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7461 | return ret; |
| 7462 | } |
| 7463 | |
| 7464 | static int iw_setint_getnone(struct net_device *dev, |
| 7465 | struct iw_request_info *info, |
| 7466 | union iwreq_data *wrqu, |
| 7467 | char *extra) |
| 7468 | { |
| 7469 | int ret; |
| 7470 | |
| 7471 | cds_ssr_protect(__func__); |
| 7472 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 7473 | cds_ssr_unprotect(__func__); |
| 7474 | |
| 7475 | return ret; |
| 7476 | } |
| 7477 | |
| 7478 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7479 | * __iw_setnone_get_threeint() - return three value to up layer. |
| 7480 | * |
| 7481 | * @dev: pointer of net_device of this wireless card |
| 7482 | * @info: meta data about Request sent |
| 7483 | * @wrqu: include request info |
| 7484 | * @extra: buf used for in/Output |
| 7485 | * |
| 7486 | * Return: execute result |
| 7487 | */ |
| 7488 | static int __iw_setnone_get_threeint(struct net_device *dev, |
| 7489 | struct iw_request_info *info, |
| 7490 | union iwreq_data *wrqu, char *extra) |
| 7491 | { |
| 7492 | int ret = 0; /* success */ |
| 7493 | uint32_t *value = (int *)extra; |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 7494 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 7495 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7496 | |
| 7497 | ENTER_DEV(dev); |
| 7498 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7499 | if (0 != ret) |
| 7500 | return ret; |
| 7501 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 7502 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 7503 | if (0 != ret) |
| 7504 | return ret; |
| 7505 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7506 | hdd_debug("param = %d", value[0]); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7507 | switch (value[0]) { |
| 7508 | case WE_GET_TSF: |
| 7509 | ret = hdd_indicate_tsf(adapter, value, 3); |
| 7510 | break; |
| 7511 | default: |
| 7512 | hdd_err("Invalid IOCTL get_value command %d", value[0]); |
| 7513 | break; |
| 7514 | } |
| 7515 | return ret; |
| 7516 | } |
| 7517 | |
| 7518 | /** |
| 7519 | * iw_setnone_get_threeint() - return three value to up layer. |
| 7520 | * |
| 7521 | * @dev: pointer of net_device of this wireless card |
| 7522 | * @info: meta data about Request sent |
| 7523 | * @wrqu: include request info |
| 7524 | * @extra: buf used for in/Output |
| 7525 | * |
| 7526 | * Return: execute result |
| 7527 | */ |
| 7528 | static int iw_setnone_get_threeint(struct net_device *dev, |
| 7529 | struct iw_request_info *info, |
| 7530 | union iwreq_data *wrqu, char *extra) |
| 7531 | { |
| 7532 | int ret; |
| 7533 | |
| 7534 | cds_ssr_protect(__func__); |
| 7535 | ret = __iw_setnone_get_threeint(dev, info, wrqu, extra); |
| 7536 | cds_ssr_unprotect(__func__); |
| 7537 | |
| 7538 | return ret; |
| 7539 | } |
| 7540 | |
| 7541 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7542 | * iw_setchar_getnone() - Generic "set string" private ioctl handler |
| 7543 | * @dev: device upon which the ioctl was received |
| 7544 | * @info: ioctl request information |
| 7545 | * @wrqu: ioctl request data |
| 7546 | * @extra: ioctl extra data |
| 7547 | * |
| 7548 | * Return: 0 on success, non-zero on error |
| 7549 | */ |
| 7550 | static int __iw_setchar_getnone(struct net_device *dev, |
| 7551 | struct iw_request_info *info, |
| 7552 | union iwreq_data *wrqu, char *extra) |
| 7553 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7554 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7555 | int sub_cmd; |
| 7556 | int ret; |
| 7557 | char *pBuffer = NULL; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7558 | struct hdd_adapter *adapter = (netdev_priv(dev)); |
| 7559 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7560 | struct hdd_config *pConfig = hdd_ctx->config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7561 | struct iw_point s_priv_data; |
| 7562 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7563 | ENTER_DEV(dev); |
| 7564 | |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 7565 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7566 | hdd_err("permission check failed"); |
Mukul Sharma | 34777c6 | 2015-11-02 20:22:30 +0530 | [diff] [blame] | 7567 | return -EPERM; |
| 7568 | } |
| 7569 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7570 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7571 | if (0 != ret) |
| 7572 | return ret; |
| 7573 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 7574 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 7575 | if (0 != ret) |
| 7576 | return ret; |
| 7577 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7578 | /* helper function to get iwreq_data with compat handling. */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7579 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7580 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7581 | |
| 7582 | /* make sure all params are correctly passed to function */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7583 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7584 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7585 | |
| 7586 | sub_cmd = s_priv_data.flags; |
| 7587 | |
| 7588 | /* ODD number is used for set, copy data using copy_from_user */ |
| 7589 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 7590 | s_priv_data.length); |
| 7591 | if (NULL == pBuffer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7592 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7593 | return -ENOMEM; |
| 7594 | } |
| 7595 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7596 | hdd_debug("Received length: %d data: %s", |
| 7597 | s_priv_data.length, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7598 | |
| 7599 | switch (sub_cmd) { |
| 7600 | case WE_WOWL_ADD_PTRN: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7601 | hdd_debug("ADD_PTRN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7602 | hdd_add_wowl_ptrn(adapter, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7603 | break; |
| 7604 | case WE_WOWL_DEL_PTRN: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7605 | hdd_debug("DEL_PTRN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7606 | hdd_del_wowl_ptrn(adapter, pBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7607 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7608 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 7609 | { |
| 7610 | tRrmNeighborReq neighborReq; |
| 7611 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 7612 | |
| 7613 | if (pConfig->fRrmEnable) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7614 | hdd_debug("Neighbor Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7615 | neighborReq.no_ssid = |
| 7616 | (s_priv_data.length - 1) ? false : true; |
| 7617 | if (!neighborReq.no_ssid) { |
| 7618 | neighborReq.ssid.length = |
| 7619 | (s_priv_data.length - 1) > |
| 7620 | 32 ? 32 : (s_priv_data.length - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7621 | qdf_mem_copy(neighborReq.ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7622 | pBuffer, |
| 7623 | neighborReq.ssid.length); |
| 7624 | } |
| 7625 | |
| 7626 | callbackInfo.neighborRspCallback = NULL; |
| 7627 | callbackInfo.neighborRspCallbackContext = NULL; |
| 7628 | callbackInfo.timeout = 5000; /* 5 seconds */ |
| 7629 | sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7630 | (adapter), |
| 7631 | adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7632 | &neighborReq, |
| 7633 | &callbackInfo); |
| 7634 | } else { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7635 | hdd_err("Ignoring neighbor request as RRM not enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7636 | ret = -EINVAL; |
| 7637 | } |
| 7638 | } |
| 7639 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7640 | case WE_SET_AP_WPS_IE: |
Wu Gao | 02bd75b | 2017-10-13 18:34:02 +0800 | [diff] [blame] | 7641 | hdd_debug("Received WE_SET_AP_WPS_IE, won't process"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7642 | break; |
| 7643 | case WE_SET_CONFIG: |
| 7644 | vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7645 | if (QDF_STATUS_SUCCESS != vstatus) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7646 | ret = -EINVAL; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7647 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7648 | break; |
| 7649 | default: |
| 7650 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 7651 | hdd_err("Invalid sub command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7652 | sub_cmd); |
| 7653 | ret = -EINVAL; |
| 7654 | break; |
| 7655 | } |
| 7656 | } |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 7657 | qdf_mem_free(pBuffer); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7658 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7659 | return ret; |
| 7660 | } |
| 7661 | |
| 7662 | static int iw_setchar_getnone(struct net_device *dev, |
| 7663 | struct iw_request_info *info, |
| 7664 | union iwreq_data *wrqu, char *extra) |
| 7665 | { |
| 7666 | int ret; |
| 7667 | |
| 7668 | cds_ssr_protect(__func__); |
| 7669 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 7670 | cds_ssr_unprotect(__func__); |
| 7671 | |
| 7672 | return ret; |
| 7673 | } |
| 7674 | |
| 7675 | /** |
| 7676 | * iw_setnone_getint() - Generic "get integer" private ioctl handler |
| 7677 | * @dev: device upon which the ioctl was received |
| 7678 | * @info: ioctl request information |
| 7679 | * @wrqu: ioctl request data |
| 7680 | * @extra: ioctl extra data |
| 7681 | * |
| 7682 | * Return: 0 on success, non-zero on error |
| 7683 | */ |
| 7684 | static int __iw_setnone_getint(struct net_device *dev, |
| 7685 | struct iw_request_info *info, |
| 7686 | union iwreq_data *wrqu, char *extra) |
| 7687 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7688 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7689 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7690 | int *value = (int *)extra; |
| 7691 | int ret; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7692 | tSmeConfigParams *sme_config; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 7693 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7694 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7695 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 7696 | if (!sme_config) { |
| 7697 | hdd_err("failed to allocate memory for sme_config"); |
| 7698 | return -ENOMEM; |
| 7699 | } |
| 7700 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 7701 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 7702 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 7703 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7704 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7705 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7706 | if (0 != ret) |
| 7707 | return ret; |
| 7708 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 7709 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 7710 | if (0 != ret) |
| 7711 | return ret; |
| 7712 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7713 | switch (value[0]) { |
| 7714 | case WE_GET_11D_STATE: |
| 7715 | { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7716 | sme_get_config_param(hHal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7717 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7718 | *value = sme_config->csrConfig.Is11dSupportEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7719 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7720 | hdd_debug("11D state=%d!!", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7721 | |
| 7722 | break; |
| 7723 | } |
| 7724 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7725 | case WE_GET_WLAN_DBG: |
| 7726 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7727 | qdf_trace_display(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7728 | *value = 0; |
| 7729 | break; |
| 7730 | } |
| 7731 | case WE_GET_MAX_ASSOC: |
| 7732 | { |
| 7733 | if (sme_cfg_get_int |
| 7734 | (hHal, WNI_CFG_ASSOC_STA_LIMIT, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7735 | (uint32_t *) value) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 7736 | hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7737 | ret = -EIO; |
| 7738 | } |
| 7739 | break; |
| 7740 | } |
| 7741 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 7742 | *value = (WLAN_HDD_GET_CTX( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7743 | adapter))->config->force_sap_acs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7744 | break; |
| 7745 | |
| 7746 | case WE_GET_CONCURRENCY_MODE: |
| 7747 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 7748 | *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7749 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7750 | hdd_debug("concurrency mode=%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7751 | break; |
| 7752 | } |
| 7753 | |
| 7754 | case WE_GET_NSS: |
| 7755 | { |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 7756 | sme_get_config_param(hHal, sme_config); |
| 7757 | *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2; |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 7758 | if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc)) |
| 7759 | *value = *value - 1; |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7760 | hdd_debug("GET_NSS: Current NSS:%d", *value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7761 | break; |
| 7762 | } |
| 7763 | |
| 7764 | case WE_GET_GTX_HT_MCS: |
| 7765 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7766 | hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7767 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7768 | WMI_VDEV_PARAM_GTX_HT_MCS, |
| 7769 | GTX_CMD); |
| 7770 | break; |
| 7771 | } |
| 7772 | |
| 7773 | case WE_GET_GTX_VHT_MCS: |
| 7774 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7775 | hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7776 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7777 | WMI_VDEV_PARAM_GTX_VHT_MCS, |
| 7778 | GTX_CMD); |
| 7779 | break; |
| 7780 | } |
| 7781 | |
| 7782 | case WE_GET_GTX_USRCFG: |
| 7783 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7784 | hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7785 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7786 | WMI_VDEV_PARAM_GTX_USR_CFG, |
| 7787 | GTX_CMD); |
| 7788 | break; |
| 7789 | } |
| 7790 | |
| 7791 | case WE_GET_GTX_THRE: |
| 7792 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7793 | hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7794 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7795 | WMI_VDEV_PARAM_GTX_THRE, |
| 7796 | GTX_CMD); |
| 7797 | break; |
| 7798 | } |
| 7799 | |
| 7800 | case WE_GET_GTX_MARGIN: |
| 7801 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7802 | hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7803 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7804 | WMI_VDEV_PARAM_GTX_MARGIN, |
| 7805 | GTX_CMD); |
| 7806 | break; |
| 7807 | } |
| 7808 | |
| 7809 | case WE_GET_GTX_STEP: |
| 7810 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7811 | hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7812 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7813 | WMI_VDEV_PARAM_GTX_STEP, |
| 7814 | GTX_CMD); |
| 7815 | break; |
| 7816 | } |
| 7817 | |
| 7818 | case WE_GET_GTX_MINTPC: |
| 7819 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7820 | hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7821 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7822 | WMI_VDEV_PARAM_GTX_MINTPC, |
| 7823 | GTX_CMD); |
| 7824 | break; |
| 7825 | } |
| 7826 | |
| 7827 | case WE_GET_GTX_BWMASK: |
| 7828 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7829 | hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7830 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7831 | WMI_VDEV_PARAM_GTX_BW_MASK, |
| 7832 | GTX_CMD); |
| 7833 | break; |
| 7834 | } |
| 7835 | |
| 7836 | case WE_GET_LDPC: |
| 7837 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7838 | ret = hdd_get_ldpc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7839 | break; |
| 7840 | } |
| 7841 | |
| 7842 | case WE_GET_TX_STBC: |
| 7843 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7844 | ret = hdd_get_tx_stbc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7845 | break; |
| 7846 | } |
| 7847 | |
| 7848 | case WE_GET_RX_STBC: |
| 7849 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7850 | ret = hdd_get_rx_stbc(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7851 | break; |
| 7852 | } |
| 7853 | |
| 7854 | case WE_GET_SHORT_GI: |
| 7855 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7856 | hdd_debug("GET WMI_VDEV_PARAM_SGI"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7857 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 7858 | WMI_VDEV_PARAM_SGI, |
| 7859 | VDEV_CMD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7860 | break; |
| 7861 | } |
| 7862 | |
| 7863 | case WE_GET_RTSCTS: |
| 7864 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7865 | hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7866 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7867 | WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 7868 | VDEV_CMD); |
| 7869 | break; |
| 7870 | } |
| 7871 | |
| 7872 | case WE_GET_CHWIDTH: |
| 7873 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7874 | hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7875 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7876 | WMI_VDEV_PARAM_CHWIDTH, |
| 7877 | VDEV_CMD); |
| 7878 | break; |
| 7879 | } |
| 7880 | |
| 7881 | case WE_GET_ANI_EN_DIS: |
| 7882 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7883 | hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7884 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7885 | WMI_PDEV_PARAM_ANI_ENABLE, |
| 7886 | PDEV_CMD); |
| 7887 | break; |
| 7888 | } |
| 7889 | |
| 7890 | case WE_GET_ANI_POLL_PERIOD: |
| 7891 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7892 | hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7893 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7894 | WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 7895 | PDEV_CMD); |
| 7896 | break; |
| 7897 | } |
| 7898 | |
| 7899 | case WE_GET_ANI_LISTEN_PERIOD: |
| 7900 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7901 | hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7902 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7903 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 7904 | PDEV_CMD); |
| 7905 | break; |
| 7906 | } |
| 7907 | |
| 7908 | case WE_GET_ANI_OFDM_LEVEL: |
| 7909 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7910 | hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7911 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7912 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 7913 | PDEV_CMD); |
| 7914 | break; |
| 7915 | } |
| 7916 | |
| 7917 | case WE_GET_ANI_CCK_LEVEL: |
| 7918 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7919 | hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7920 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7921 | WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 7922 | PDEV_CMD); |
| 7923 | break; |
| 7924 | } |
| 7925 | |
| 7926 | case WE_GET_DYNAMIC_BW: |
| 7927 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7928 | hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7929 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7930 | WMI_PDEV_PARAM_DYNAMIC_BW, |
| 7931 | PDEV_CMD); |
| 7932 | break; |
| 7933 | } |
| 7934 | |
| 7935 | case WE_GET_11N_RATE: |
| 7936 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7937 | hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7938 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7939 | WMI_VDEV_PARAM_FIXED_RATE, |
| 7940 | VDEV_CMD); |
| 7941 | break; |
| 7942 | } |
| 7943 | |
| 7944 | case WE_GET_AMPDU: |
| 7945 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7946 | hdd_debug("GET AMPDU"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7947 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7948 | GEN_VDEV_PARAM_AMPDU, |
| 7949 | GEN_CMD); |
| 7950 | break; |
| 7951 | } |
| 7952 | |
| 7953 | case WE_GET_AMSDU: |
| 7954 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7955 | hdd_debug("GET AMSDU"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7956 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7957 | GEN_VDEV_PARAM_AMSDU, |
| 7958 | GEN_CMD); |
| 7959 | break; |
| 7960 | } |
| 7961 | |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 7962 | case WE_GET_ROAM_SYNCH_DELAY: |
| 7963 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7964 | hdd_debug("GET ROAM SYNCH DELAY"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7965 | *value = wma_cli_get_command(adapter->sessionId, |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 7966 | GEN_VDEV_ROAM_SYNCH_DELAY, |
| 7967 | GEN_CMD); |
| 7968 | break; |
| 7969 | } |
| 7970 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7971 | case WE_GET_BURST_ENABLE: |
| 7972 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7973 | hdd_debug("GET Burst enable value"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7974 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7975 | WMI_PDEV_PARAM_BURST_ENABLE, |
| 7976 | PDEV_CMD); |
| 7977 | break; |
| 7978 | } |
| 7979 | case WE_GET_BURST_DUR: |
| 7980 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7981 | hdd_debug("GET Burst Duration value"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7982 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7983 | WMI_PDEV_PARAM_BURST_DUR, |
| 7984 | PDEV_CMD); |
| 7985 | break; |
| 7986 | } |
| 7987 | |
| 7988 | case WE_GET_TX_CHAINMASK: |
| 7989 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7990 | hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 7991 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7992 | WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 7993 | PDEV_CMD); |
| 7994 | break; |
| 7995 | } |
| 7996 | |
| 7997 | case WE_GET_RX_CHAINMASK: |
| 7998 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 7999 | hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8000 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8001 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 8002 | PDEV_CMD); |
| 8003 | break; |
| 8004 | } |
| 8005 | |
| 8006 | case WE_GET_TXPOW_2G: |
| 8007 | { |
| 8008 | uint32_t txpow2g = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8009 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8010 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8011 | hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8012 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8013 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 8014 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8015 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8016 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 8017 | &txpow2g)) { |
| 8018 | return -EIO; |
| 8019 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8020 | hdd_debug("2G tx_power %d", txpow2g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8021 | break; |
| 8022 | } |
| 8023 | |
| 8024 | case WE_GET_TXPOW_5G: |
| 8025 | { |
| 8026 | uint32_t txpow5g = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8027 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8028 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8029 | hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8030 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8031 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 8032 | PDEV_CMD); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8033 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8034 | sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 8035 | &txpow5g)) { |
| 8036 | return -EIO; |
| 8037 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8038 | hdd_debug("5G tx_power %d", txpow5g); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8039 | break; |
| 8040 | } |
| 8041 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8042 | case WE_GET_PPS_PAID_MATCH: |
| 8043 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8044 | hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8045 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8046 | WMI_VDEV_PPS_PAID_MATCH, |
| 8047 | PPS_CMD); |
| 8048 | break; |
| 8049 | } |
| 8050 | |
| 8051 | case WE_GET_PPS_GID_MATCH: |
| 8052 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8053 | hdd_debug("GET WMI_VDEV_PPS_GID_MATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8054 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8055 | WMI_VDEV_PPS_GID_MATCH, |
| 8056 | PPS_CMD); |
| 8057 | break; |
| 8058 | } |
| 8059 | |
| 8060 | case WE_GET_PPS_EARLY_TIM_CLEAR: |
| 8061 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8062 | hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8063 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8064 | WMI_VDEV_PPS_EARLY_TIM_CLEAR, |
| 8065 | PPS_CMD); |
| 8066 | break; |
| 8067 | } |
| 8068 | |
| 8069 | case WE_GET_PPS_EARLY_DTIM_CLEAR: |
| 8070 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8071 | hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8072 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8073 | WMI_VDEV_PPS_EARLY_DTIM_CLEAR, |
| 8074 | PPS_CMD); |
| 8075 | break; |
| 8076 | } |
| 8077 | |
| 8078 | case WE_GET_PPS_EOF_PAD_DELIM: |
| 8079 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8080 | hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8081 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8082 | WMI_VDEV_PPS_EOF_PAD_DELIM, |
| 8083 | PPS_CMD); |
| 8084 | break; |
| 8085 | } |
| 8086 | |
| 8087 | case WE_GET_PPS_MACADDR_MISMATCH: |
| 8088 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8089 | hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8090 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8091 | WMI_VDEV_PPS_MACADDR_MISMATCH, |
| 8092 | PPS_CMD); |
| 8093 | break; |
| 8094 | } |
| 8095 | |
| 8096 | case WE_GET_PPS_DELIM_CRC_FAIL: |
| 8097 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8098 | hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8099 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8100 | WMI_VDEV_PPS_DELIM_CRC_FAIL, |
| 8101 | PPS_CMD); |
| 8102 | break; |
| 8103 | } |
| 8104 | |
| 8105 | case WE_GET_PPS_GID_NSTS_ZERO: |
| 8106 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8107 | hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8108 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8109 | WMI_VDEV_PPS_GID_NSTS_ZERO, |
| 8110 | PPS_CMD); |
| 8111 | break; |
| 8112 | } |
| 8113 | |
| 8114 | case WE_GET_PPS_RSSI_CHECK: |
| 8115 | { |
| 8116 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8117 | hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8118 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8119 | WMI_VDEV_PPS_RSSI_CHECK, |
| 8120 | PPS_CMD); |
| 8121 | break; |
| 8122 | } |
| 8123 | |
| 8124 | case WE_GET_QPOWER_MAX_PSPOLL_COUNT: |
| 8125 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8126 | hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8127 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8128 | WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 8129 | QPOWER_CMD); |
| 8130 | break; |
| 8131 | } |
| 8132 | |
| 8133 | case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE: |
| 8134 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8135 | hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8136 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8137 | WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 8138 | QPOWER_CMD); |
| 8139 | break; |
| 8140 | } |
| 8141 | |
| 8142 | case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 8143 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8144 | hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8145 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8146 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 8147 | QPOWER_CMD); |
| 8148 | break; |
| 8149 | } |
| 8150 | |
| 8151 | case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 8152 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8153 | hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8154 | *value = wma_cli_get_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8155 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 8156 | QPOWER_CMD); |
| 8157 | break; |
| 8158 | } |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 8159 | case WE_CAP_TSF: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8160 | ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 8161 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8162 | case WE_GET_TEMPERATURE: |
| 8163 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8164 | hdd_debug("WE_GET_TEMPERATURE"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8165 | ret = wlan_hdd_get_temperature(adapter, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8166 | break; |
| 8167 | } |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 8168 | case WE_GET_DCM: |
| 8169 | hdd_notice("GET WMI_VDEV_PARAM_HE_DCM"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8170 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 8171 | WMI_VDEV_PARAM_HE_DCM, |
| 8172 | VDEV_CMD); |
| 8173 | break; |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 8174 | case WE_GET_RANGE_EXT: |
| 8175 | hdd_notice("GET WMI_VDEV_PARAM_HE_RANGE_EXT"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8176 | *value = wma_cli_get_command(adapter->sessionId, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 8177 | WMI_VDEV_PARAM_HE_RANGE_EXT, |
| 8178 | VDEV_CMD); |
| 8179 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8180 | default: |
| 8181 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8182 | hdd_err("Invalid IOCTL get_value command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8183 | value[0]); |
| 8184 | break; |
| 8185 | } |
| 8186 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8187 | EXIT(); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 8188 | qdf_mem_free(sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8189 | return ret; |
| 8190 | } |
| 8191 | |
| 8192 | static int iw_setnone_getint(struct net_device *dev, |
| 8193 | struct iw_request_info *info, |
| 8194 | union iwreq_data *wrqu, char *extra) |
| 8195 | { |
| 8196 | int ret; |
| 8197 | |
| 8198 | cds_ssr_protect(__func__); |
| 8199 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 8200 | cds_ssr_unprotect(__func__); |
| 8201 | |
| 8202 | return ret; |
| 8203 | } |
| 8204 | |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 8205 | static int hdd_set_fwtest(int argc, int cmd, int value) |
| 8206 | { |
| 8207 | struct set_fwtest_params *fw_test; |
| 8208 | |
| 8209 | /* check for max number of arguments */ |
| 8210 | if (argc > (WMA_MAX_NUM_ARGS) || |
| 8211 | argc != HDD_FWTEST_PARAMS) { |
| 8212 | hdd_err("Too Many args %d", argc); |
| 8213 | return -EINVAL; |
| 8214 | } |
| 8215 | /* |
| 8216 | * check if number of arguments are 3 then, check |
| 8217 | * then set the default value for sounding interval. |
| 8218 | */ |
| 8219 | if (HDD_FWTEST_PARAMS == argc) { |
| 8220 | if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value) |
| 8221 | value = HDD_FWTEST_SU_DEFAULT_VALUE; |
| 8222 | if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value) |
| 8223 | value = HDD_FWTEST_MU_DEFAULT_VALUE; |
| 8224 | } |
| 8225 | /* check sounding interval value should not exceed to max */ |
| 8226 | if (value > HDD_FWTEST_MAX_VALUE) { |
| 8227 | hdd_err("Invalid arguments value should not exceed max: %d", |
| 8228 | value); |
| 8229 | return -EINVAL; |
| 8230 | } |
| 8231 | fw_test = qdf_mem_malloc(sizeof(*fw_test)); |
| 8232 | if (NULL == fw_test) { |
| 8233 | hdd_err("qdf_mem_malloc failed for fw_test"); |
| 8234 | return -ENOMEM; |
| 8235 | } |
| 8236 | fw_test->arg = cmd; |
| 8237 | fw_test->value = value; |
| 8238 | if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) { |
| 8239 | qdf_mem_free(fw_test); |
| 8240 | hdd_err("Not able to post FW_TEST_CMD message to WMA"); |
| 8241 | return -EINVAL; |
| 8242 | } |
| 8243 | return 0; |
| 8244 | } |
| 8245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8246 | /** |
| 8247 | * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler |
| 8248 | * @dev: device upon which the ioctl was received |
| 8249 | * @info: ioctl request information |
| 8250 | * @wrqu: ioctl request data |
| 8251 | * @extra: ioctl extra data |
| 8252 | * |
| 8253 | * Return: 0 on success, non-zero on error |
| 8254 | */ |
| 8255 | static int __iw_set_three_ints_getnone(struct net_device *dev, |
| 8256 | struct iw_request_info *info, |
| 8257 | union iwreq_data *wrqu, char *extra) |
| 8258 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8259 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8260 | int *value = (int *)extra; |
| 8261 | int sub_cmd = value[0]; |
| 8262 | int ret; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8263 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8264 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8265 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8266 | |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 8267 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8268 | hdd_err("permission check failed"); |
Rajeev Kumar | 2cce8a8 | 2016-04-14 15:10:41 -0700 | [diff] [blame] | 8269 | return -EPERM; |
| 8270 | } |
| 8271 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8272 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8273 | if (0 != ret) |
| 8274 | return ret; |
| 8275 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 8276 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 8277 | if (0 != ret) |
| 8278 | return ret; |
| 8279 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8280 | switch (sub_cmd) { |
| 8281 | |
| 8282 | case WE_SET_WLAN_DBG: |
Dustin Brown | 36e2e5c | 2017-05-16 15:41:37 -0700 | [diff] [blame] | 8283 | qdf_print_set_category_verbose(qdf_get_pidx(), value[1], |
| 8284 | value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8285 | break; |
| 8286 | case WE_SET_DP_TRACE: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8287 | qdf_dp_trace_set_value(value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8288 | break; |
| 8289 | |
| 8290 | /* value[3] the acs band is not required as start and end channels are |
| 8291 | * enough but this cmd is maintained under set three ints for historic |
| 8292 | * reasons. |
| 8293 | */ |
| 8294 | case WE_SET_SAP_CHANNELS: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8295 | if (wlan_hdd_validate_operation_channel(adapter, value[1]) != |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8296 | QDF_STATUS_SUCCESS || |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8297 | wlan_hdd_validate_operation_channel(adapter, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8298 | value[2]) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8299 | ret = -EINVAL; |
| 8300 | } else { |
| 8301 | hdd_ctx->config->force_sap_acs_st_ch = value[1]; |
| 8302 | hdd_ctx->config->force_sap_acs_end_ch = value[2]; |
| 8303 | } |
| 8304 | break; |
| 8305 | case WE_SET_DUAL_MAC_SCAN_CONFIG: |
| 8306 | hdd_debug("Ioctl to set dual mac scan config"); |
Tushnim Bhattacharyya | 49ed8ab | 2017-05-26 18:20:10 -0700 | [diff] [blame] | 8307 | if (hdd_ctx->config->dual_mac_feature_disable == |
| 8308 | DISABLE_DBS_CXN_AND_SCAN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8309 | hdd_err("Dual mac feature is disabled from INI"); |
| 8310 | return -EPERM; |
| 8311 | } |
| 8312 | hdd_debug("%d %d %d", value[1], value[2], value[3]); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 8313 | policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc, |
| 8314 | value[1], value[2], value[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8315 | break; |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 8316 | case WE_SET_FW_TEST: |
| 8317 | { |
| 8318 | ret = hdd_set_fwtest(value[1], value[2], value[3]); |
| 8319 | if (ret) { |
| 8320 | hdd_err("Not able to set fwtest %d", ret); |
| 8321 | return ret; |
| 8322 | } |
| 8323 | } |
| 8324 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8325 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8326 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8327 | break; |
| 8328 | |
| 8329 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8330 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8331 | return ret; |
| 8332 | } |
| 8333 | |
| 8334 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 8335 | struct iw_request_info *info, |
| 8336 | union iwreq_data *wrqu, char *extra) |
| 8337 | { |
| 8338 | int ret; |
| 8339 | |
| 8340 | cds_ssr_protect(__func__); |
| 8341 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 8342 | cds_ssr_unprotect(__func__); |
| 8343 | |
| 8344 | return ret; |
| 8345 | } |
| 8346 | |
| 8347 | /** |
| 8348 | * hdd_connection_state_string() - Get connection state string |
| 8349 | * @connection_state: enum to be converted to a string |
| 8350 | * |
| 8351 | * Return: the string equivalent of @connection_state |
| 8352 | */ |
| 8353 | static const char * |
| 8354 | hdd_connection_state_string(eConnectionState connection_state) |
| 8355 | { |
| 8356 | switch (connection_state) { |
| 8357 | CASE_RETURN_STRING(eConnectionState_NotConnected); |
| 8358 | CASE_RETURN_STRING(eConnectionState_Connecting); |
| 8359 | CASE_RETURN_STRING(eConnectionState_Associated); |
| 8360 | CASE_RETURN_STRING(eConnectionState_IbssDisconnected); |
| 8361 | CASE_RETURN_STRING(eConnectionState_IbssConnected); |
| 8362 | CASE_RETURN_STRING(eConnectionState_Disconnecting); |
| 8363 | default: |
| 8364 | return "UNKNOWN"; |
| 8365 | } |
| 8366 | } |
| 8367 | |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 8368 | #if defined(FEATURE_OEM_DATA_SUPPORT) |
| 8369 | /** |
| 8370 | * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new |
| 8371 | * wifi_pos api to get oem data caps |
| 8372 | * @dev: net device upon which the request was received |
| 8373 | * @info: ioctl request information |
| 8374 | * @wrqu: ioctl request data |
| 8375 | * @extra: ioctl data payload |
| 8376 | * |
| 8377 | * Return: 0 for success, negative errno value on failure |
| 8378 | */ |
| 8379 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 8380 | struct iw_request_info *info, |
| 8381 | union iwreq_data *wrqu, char *extra) |
| 8382 | { |
| 8383 | return iw_get_oem_data_cap(dev, info, wrqu, extra); |
| 8384 | } |
| 8385 | #elif defined(WIFI_POS_CONVERGED) |
| 8386 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 8387 | struct iw_request_info *info, |
| 8388 | union iwreq_data *wrqu, char *extra) |
| 8389 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 8390 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 8391 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 8392 | |
| 8393 | return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc, |
| 8394 | (struct wifi_pos_driver_caps *)extra); |
| 8395 | } |
| 8396 | #else |
| 8397 | static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev, |
| 8398 | struct iw_request_info *info, |
| 8399 | union iwreq_data *wrqu, char *extra) |
| 8400 | { |
| 8401 | return -ENOTSUPP; |
| 8402 | } |
| 8403 | #endif |
| 8404 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8405 | /** |
| 8406 | * iw_get_char_setnone() - Generic "get string" private ioctl handler |
| 8407 | * @dev: device upon which the ioctl was received |
| 8408 | * @info: ioctl request information |
| 8409 | * @wrqu: ioctl request data |
| 8410 | * @extra: ioctl extra data |
| 8411 | * |
| 8412 | * Return: 0 on success, non-zero on error |
| 8413 | */ |
| 8414 | static int __iw_get_char_setnone(struct net_device *dev, |
| 8415 | struct iw_request_info *info, |
| 8416 | union iwreq_data *wrqu, char *extra) |
| 8417 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8418 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8419 | int sub_cmd = wrqu->data.flags; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 8420 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8421 | int ret; |
| 8422 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 8423 | struct hdd_wext_state *pWextState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8424 | #endif |
| 8425 | |
| 8426 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8427 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8428 | #endif |
| 8429 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8430 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8431 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8432 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8433 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 8434 | if (0 != ret) |
| 8435 | return ret; |
| 8436 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 8437 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 8438 | if (0 != ret) |
| 8439 | return ret; |
| 8440 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8441 | switch (sub_cmd) { |
| 8442 | case WE_WLAN_VERSION: |
| 8443 | { |
Arun Khandavalli | a96c2c0 | 2016-05-17 19:15:34 +0530 | [diff] [blame] | 8444 | hdd_wlan_get_version(hdd_ctx, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8445 | break; |
| 8446 | } |
| 8447 | |
| 8448 | case WE_GET_STATS: |
| 8449 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8450 | hdd_wlan_get_stats(adapter, &(wrqu->data.length), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8451 | extra, WE_MAX_STR_LEN); |
| 8452 | break; |
| 8453 | } |
| 8454 | |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 8455 | case WE_GET_SUSPEND_RESUME_STATS: |
| 8456 | { |
| 8457 | ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra, |
| 8458 | WE_MAX_STR_LEN); |
| 8459 | if (ret >= 0) { |
| 8460 | wrqu->data.length = ret; |
| 8461 | ret = 0; |
| 8462 | } |
| 8463 | |
| 8464 | break; |
| 8465 | } |
| 8466 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 8467 | case WE_LIST_FW_PROFILE: |
| 8468 | hdd_wlan_list_fw_profile(&(wrqu->data.length), |
| 8469 | extra, WE_MAX_STR_LEN); |
| 8470 | break; |
| 8471 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8472 | /* The case prints the current state of the HDD, SME, CSR, PE, |
| 8473 | * TL it can be extended for WDI Global State as well. And |
| 8474 | * currently it only checks P2P_CLIENT adapter. P2P_DEVICE |
| 8475 | * and P2P_GO have not been added as of now. |
| 8476 | */ |
| 8477 | case WE_GET_STATES: |
| 8478 | { |
| 8479 | int buf = 0, len = 0; |
| 8480 | int adapter_num = 0; |
| 8481 | int count = 0, check = 1; |
| 8482 | |
| 8483 | tHalHandle hHal = NULL; |
| 8484 | tpAniSirGlobal pMac = NULL; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8485 | struct hdd_station_ctx *sta_ctx = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8486 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8487 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 8488 | struct hdd_adapter *useAdapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8489 | |
| 8490 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 8491 | * by using the correct adapter |
| 8492 | */ |
| 8493 | while (adapter_num < 2) { |
| 8494 | if (WLAN_ADAPTER == adapter_num) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8495 | useAdapter = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8496 | buf = |
| 8497 | scnprintf(extra + len, |
| 8498 | WE_MAX_STR_LEN - len, |
| 8499 | "\n\n wlan0 States:-"); |
| 8500 | len += buf; |
| 8501 | } else if (P2P_ADAPTER == adapter_num) { |
| 8502 | buf = |
| 8503 | scnprintf(extra + len, |
| 8504 | WE_MAX_STR_LEN - len, |
| 8505 | "\n\n p2p0 States:-"); |
| 8506 | len += buf; |
| 8507 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8508 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8509 | buf = |
| 8510 | scnprintf(extra + len, |
| 8511 | WE_MAX_STR_LEN - |
| 8512 | len, |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8513 | "\n hdd_ctx is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8514 | len += buf; |
| 8515 | break; |
| 8516 | } |
| 8517 | |
| 8518 | /* Printing p2p0 states only in the |
| 8519 | * case when the device is configured |
| 8520 | * as a p2p_client |
| 8521 | */ |
| 8522 | useAdapter = |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8523 | hdd_get_adapter(hdd_ctx, |
Krunal Soni | f07bb38 | 2016-03-10 13:02:11 -0800 | [diff] [blame] | 8524 | QDF_P2P_CLIENT_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8525 | if (!useAdapter) { |
| 8526 | buf = |
| 8527 | scnprintf(extra + len, |
| 8528 | WE_MAX_STR_LEN - |
| 8529 | len, |
| 8530 | "\n Device not configured as P2P_CLIENT."); |
| 8531 | len += buf; |
| 8532 | break; |
| 8533 | } |
| 8534 | } |
| 8535 | |
| 8536 | hHal = WLAN_HDD_GET_HAL_CTX(useAdapter); |
| 8537 | if (!hHal) { |
| 8538 | buf = |
| 8539 | scnprintf(extra + len, |
| 8540 | WE_MAX_STR_LEN - len, |
| 8541 | "\n pMac is NULL"); |
| 8542 | len += buf; |
| 8543 | break; |
| 8544 | } |
| 8545 | pMac = PMAC_STRUCT(hHal); |
| 8546 | if (!pMac) { |
| 8547 | buf = |
| 8548 | scnprintf(extra + len, |
| 8549 | WE_MAX_STR_LEN - len, |
| 8550 | "\n pMac is NULL"); |
| 8551 | len += buf; |
| 8552 | break; |
| 8553 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8554 | sta_ctx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8555 | WLAN_HDD_GET_STATION_CTX_PTR(useAdapter); |
| 8556 | |
| 8557 | |
| 8558 | buf = |
| 8559 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 8560 | "\n HDD Conn State - %s " |
| 8561 | "\n \n SME State:" |
| 8562 | "\n Neighbour Roam State - %s" |
| 8563 | "\n CSR State - %s" |
| 8564 | "\n CSR Substate - %s", |
| 8565 | hdd_connection_state_string |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8566 | (sta_ctx->conn_info.connState), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8567 | mac_trace_get_neighbour_roam_state |
| 8568 | (sme_get_neighbor_roam_state |
| 8569 | (hHal, useAdapter->sessionId)), |
| 8570 | mac_trace_getcsr_roam_state |
| 8571 | (sme_get_current_roam_state |
| 8572 | (hHal, useAdapter->sessionId)), |
| 8573 | mac_trace_getcsr_roam_sub_state |
| 8574 | (sme_get_current_roam_sub_state |
| 8575 | (hHal, useAdapter->sessionId)) |
| 8576 | ); |
| 8577 | len += buf; |
| 8578 | adapter_num++; |
| 8579 | } |
| 8580 | |
Mukul Sharma | 81661ae | 2015-10-30 20:26:02 +0530 | [diff] [blame] | 8581 | if (hHal) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8582 | /* Printing Lim State starting with global lim states */ |
| 8583 | buf = |
| 8584 | scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 8585 | "\n \n LIM STATES:-" |
| 8586 | "\n Global Sme State - %s " |
| 8587 | "\n Global mlm State - %s " "\n", |
| 8588 | mac_trace_get_lim_sme_state |
| 8589 | (sme_get_lim_sme_state(hHal)), |
| 8590 | mac_trace_get_lim_mlm_state |
| 8591 | (sme_get_lim_sme_state(hHal)) |
| 8592 | ); |
| 8593 | len += buf; |
| 8594 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8595 | while (check < 3 && count < 255) { |
| 8596 | if (sme_is_lim_session_valid(hHal, count)) { |
| 8597 | buf = |
| 8598 | scnprintf(extra + len, |
| 8599 | WE_MAX_STR_LEN - |
| 8600 | len, |
| 8601 | "\n Lim Valid Session %d:-" |
| 8602 | "\n PE Sme State - %s " |
| 8603 | "\n PE Mlm State - %s " |
| 8604 | "\n", check, |
| 8605 | mac_trace_get_lim_sme_state |
| 8606 | (sme_get_lim_sme_session_state |
| 8607 | (hHal, count)), |
| 8608 | mac_trace_get_lim_mlm_state |
| 8609 | (sme_get_lim_mlm_session_state |
| 8610 | (hHal, count)) |
| 8611 | ); |
| 8612 | |
| 8613 | len += buf; |
| 8614 | check++; |
| 8615 | } |
| 8616 | count++; |
| 8617 | } |
| 8618 | } |
| 8619 | |
| 8620 | wrqu->data.length = strlen(extra) + 1; |
| 8621 | break; |
| 8622 | } |
| 8623 | |
| 8624 | case WE_GET_CFG: |
| 8625 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8626 | hdd_debug("Printing CLD global INI Config"); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8627 | hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8628 | extra, |
| 8629 | QCSAP_IOCTL_MAX_STR_LEN); |
| 8630 | wrqu->data.length = strlen(extra) + 1; |
| 8631 | break; |
| 8632 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8633 | case WE_GET_RSSI: |
| 8634 | { |
| 8635 | int8_t s7Rssi = 0; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8636 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8637 | wlan_hdd_get_rssi(adapter, &s7Rssi); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8638 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 8639 | wrqu->data.length = strlen(extra) + 1; |
| 8640 | break; |
| 8641 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8642 | |
| 8643 | case WE_GET_WMM_STATUS: |
| 8644 | { |
| 8645 | snprintf(extra, WE_MAX_STR_LEN, |
| 8646 | "\nDir: 0=up, 1=down, 3=both\n" |
| 8647 | "|------------------------|\n" |
| 8648 | "|AC | ACM |Admitted| Dir |\n" |
| 8649 | "|------------------------|\n" |
| 8650 | "|VO | %d | %3s | %d |\n" |
| 8651 | "|VI | %d | %3s | %d |\n" |
| 8652 | "|BE | %d | %3s | %d |\n" |
| 8653 | "|BK | %d | %3s | %d |\n" |
| 8654 | "|------------------------|\n", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8655 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8656 | wmmAcStatus[SME_AC_VO].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8657 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8658 | wmmAcStatus[SME_AC_VO]. |
| 8659 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8660 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8661 | wmmAcStatus[SME_AC_VO].wmmAcTspecInfo. |
| 8662 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8663 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8664 | wmmAcStatus[SME_AC_VI].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8665 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8666 | wmmAcStatus[SME_AC_VI]. |
| 8667 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8668 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8669 | wmmAcStatus[SME_AC_VI].wmmAcTspecInfo. |
| 8670 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8671 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8672 | wmmAcStatus[SME_AC_BE].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8673 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8674 | wmmAcStatus[SME_AC_BE]. |
| 8675 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8676 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8677 | wmmAcStatus[SME_AC_BE].wmmAcTspecInfo. |
| 8678 | ts_info.direction, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8679 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8680 | wmmAcStatus[SME_AC_BK].wmmAcAccessRequired, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8681 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8682 | wmmAcStatus[SME_AC_BK]. |
| 8683 | wmmAcAccessAllowed ? "YES" : "NO", |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8684 | adapter->hddWmmStatus. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8685 | wmmAcStatus[SME_AC_BK].wmmAcTspecInfo. |
| 8686 | ts_info.direction); |
| 8687 | |
| 8688 | wrqu->data.length = strlen(extra) + 1; |
| 8689 | break; |
| 8690 | } |
| 8691 | case WE_GET_CHANNEL_LIST: |
| 8692 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8693 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8694 | uint8_t i, len; |
| 8695 | char *buf; |
| 8696 | uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN]; |
| 8697 | uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8698 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8699 | |
Srinivas Girigowda | c231df6 | 2017-03-24 18:27:57 -0700 | [diff] [blame] | 8700 | struct channel_list_info channel_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8701 | |
| 8702 | memset(&channel_list, 0, sizeof(channel_list)); |
Agrawal Ashish | 6c9bca7 | 2016-09-04 13:37:59 +0530 | [diff] [blame] | 8703 | status = iw_get_channel_list(dev, info, wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8704 | (char *)&channel_list); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8705 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8706 | hdd_err("GetChannelList Failed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8707 | return -EINVAL; |
| 8708 | } |
| 8709 | buf = extra; |
| 8710 | /* |
| 8711 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. |
| 8712 | * Maximum buffer needed = 5 * number of channels. |
| 8713 | * Check ifsufficient buffer is available and then |
| 8714 | * proceed to fill the buffer. |
| 8715 | */ |
| 8716 | if (WE_MAX_STR_LEN < |
| 8717 | (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8718 | hdd_err("Insufficient Buffer to populate channel list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8719 | return -EINVAL; |
| 8720 | } |
| 8721 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 8722 | channel_list.num_channels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8723 | if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8724 | ubuf, &ubuf_len)) { |
| 8725 | /* Printing Country code in getChannelList */ |
| 8726 | for (i = 0; i < (ubuf_len - 1); i++) |
| 8727 | len += scnprintf(buf + len, |
| 8728 | WE_MAX_STR_LEN - len, |
| 8729 | "%c", ubuf[i]); |
| 8730 | } |
| 8731 | for (i = 0; i < channel_list.num_channels; i++) { |
| 8732 | len += |
| 8733 | scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 8734 | " %u", channel_list.channels[i]); |
| 8735 | } |
| 8736 | wrqu->data.length = strlen(extra) + 1; |
| 8737 | |
| 8738 | break; |
| 8739 | } |
| 8740 | #ifdef FEATURE_WLAN_TDLS |
| 8741 | case WE_GET_TDLS_PEERS: |
| 8742 | { |
| 8743 | wrqu->data.length = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8744 | wlan_hdd_tdls_get_all_peers(adapter, extra, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8745 | WE_MAX_STR_LEN) + 1; |
| 8746 | break; |
| 8747 | } |
| 8748 | #endif |
| 8749 | #ifdef WLAN_FEATURE_11W |
| 8750 | case WE_GET_11W_INFO: |
| 8751 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8752 | hdd_debug("WE_GET_11W_ENABLED = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8753 | pWextState->roamProfile.MFPEnabled); |
| 8754 | |
| 8755 | snprintf(extra, WE_MAX_STR_LEN, |
| 8756 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 8757 | "\n Number of Unprotected Disassocs %d" |
| 8758 | "\n Number of Unprotected Deauths %d", |
| 8759 | pWextState->roamProfile.BSSIDs.bssid->bytes[0], |
| 8760 | pWextState->roamProfile.BSSIDs.bssid->bytes[1], |
| 8761 | pWextState->roamProfile.BSSIDs.bssid->bytes[2], |
| 8762 | pWextState->roamProfile.BSSIDs.bssid->bytes[3], |
| 8763 | pWextState->roamProfile.BSSIDs.bssid->bytes[4], |
| 8764 | pWextState->roamProfile.BSSIDs.bssid->bytes[5], |
| 8765 | pWextState->roamProfile.MFPEnabled, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8766 | adapter->hdd_stats.hddPmfStats. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8767 | numUnprotDisassocRx, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8768 | adapter->hdd_stats.hddPmfStats. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8769 | numUnprotDeauthRx); |
| 8770 | |
| 8771 | wrqu->data.length = strlen(extra) + 1; |
| 8772 | break; |
| 8773 | } |
| 8774 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8775 | case WE_GET_IBSS_STA_INFO: |
| 8776 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8777 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8778 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8779 | int idx = 0; |
| 8780 | int length = 0, buf = 0; |
| 8781 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 8782 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 8783 | if (HDD_WLAN_INVALID_STA_ID != |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8784 | sta_ctx->conn_info.staId[idx]) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8785 | buf = snprintf |
| 8786 | ((extra + length), |
| 8787 | WE_MAX_STR_LEN - length, |
| 8788 | "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8789 | sta_ctx->conn_info.staId[idx], |
| 8790 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8791 | peerMacAddress[idx].bytes[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8792 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8793 | peerMacAddress[idx].bytes[1], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8794 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8795 | peerMacAddress[idx].bytes[2], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8796 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8797 | peerMacAddress[idx].bytes[3], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8798 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8799 | peerMacAddress[idx].bytes[4], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8800 | sta_ctx->conn_info. |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8801 | peerMacAddress[idx].bytes[5] |
| 8802 | ); |
| 8803 | length += buf; |
| 8804 | } |
| 8805 | } |
| 8806 | wrqu->data.length = strlen(extra) + 1; |
| 8807 | break; |
| 8808 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8809 | case WE_GET_PHYMODE: |
| 8810 | { |
| 8811 | bool ch_bond24 = false, ch_bond5g = false; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8812 | struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter); |
| 8813 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8814 | eCsrPhyMode phymode; |
| 8815 | eCsrBand currBand; |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 8816 | tSmeConfigParams *sme_config; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8817 | |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 8818 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 8819 | if (!sme_config) { |
| 8820 | hdd_err("Out of memory"); |
| 8821 | ret = -ENOMEM; |
| 8822 | break; |
| 8823 | } |
| 8824 | |
| 8825 | sme_get_config_param(hal, sme_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8826 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 8827 | sme_config->csrConfig.channelBondingMode24GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8828 | ch_bond24 = true; |
| 8829 | |
| 8830 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 8831 | sme_config->csrConfig.channelBondingMode5GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8832 | ch_bond5g = true; |
| 8833 | |
Dustin Brown | e9c6b3a | 2017-01-23 17:17:32 -0800 | [diff] [blame] | 8834 | qdf_mem_free(sme_config); |
| 8835 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8836 | phymode = sme_get_phy_mode(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8837 | if ((QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8838 | sme_get_freq_band(hal, &currBand))) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 8839 | hdd_err("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8840 | return -EIO; |
| 8841 | } |
| 8842 | |
| 8843 | switch (phymode) { |
| 8844 | case eCSR_DOT11_MODE_AUTO: |
| 8845 | snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE"); |
| 8846 | break; |
| 8847 | case eCSR_DOT11_MODE_11n: |
| 8848 | case eCSR_DOT11_MODE_11n_ONLY: |
| 8849 | if (currBand == eCSR_BAND_24) { |
| 8850 | if (ch_bond24) |
| 8851 | snprintf(extra, WE_MAX_STR_LEN, |
| 8852 | "11NGHT40"); |
| 8853 | else |
| 8854 | snprintf(extra, WE_MAX_STR_LEN, |
| 8855 | "11NGHT20"); |
| 8856 | } else if (currBand == eCSR_BAND_5G) { |
| 8857 | if (ch_bond5g) |
| 8858 | snprintf(extra, WE_MAX_STR_LEN, |
| 8859 | "11NAHT40"); |
| 8860 | else |
| 8861 | snprintf(extra, WE_MAX_STR_LEN, |
| 8862 | "11NAHT20"); |
| 8863 | } else { |
| 8864 | snprintf(extra, WE_MAX_STR_LEN, "11N"); |
| 8865 | } |
| 8866 | break; |
| 8867 | case eCSR_DOT11_MODE_abg: |
| 8868 | snprintf(extra, WE_MAX_STR_LEN, "11ABG"); |
| 8869 | break; |
| 8870 | case eCSR_DOT11_MODE_11a: |
| 8871 | snprintf(extra, WE_MAX_STR_LEN, "11A"); |
| 8872 | break; |
| 8873 | case eCSR_DOT11_MODE_11b: |
| 8874 | case eCSR_DOT11_MODE_11b_ONLY: |
| 8875 | snprintf(extra, WE_MAX_STR_LEN, "11B"); |
| 8876 | break; |
| 8877 | case eCSR_DOT11_MODE_11g: |
| 8878 | case eCSR_DOT11_MODE_11g_ONLY: |
| 8879 | snprintf(extra, WE_MAX_STR_LEN, "11G"); |
| 8880 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8881 | case eCSR_DOT11_MODE_11ac: |
| 8882 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 8883 | if (hddctx->config->vhtChannelWidth == |
| 8884 | eHT_CHANNEL_WIDTH_20MHZ) |
| 8885 | snprintf(extra, WE_MAX_STR_LEN, |
| 8886 | "11ACVHT20"); |
| 8887 | else if (hddctx->config->vhtChannelWidth == |
| 8888 | eHT_CHANNEL_WIDTH_40MHZ) |
| 8889 | snprintf(extra, WE_MAX_STR_LEN, |
| 8890 | "11ACVHT40"); |
| 8891 | else if (hddctx->config->vhtChannelWidth == |
| 8892 | eHT_CHANNEL_WIDTH_80MHZ) |
| 8893 | snprintf(extra, WE_MAX_STR_LEN, |
| 8894 | "11ACVHT80"); |
| 8895 | else if (hddctx->config->vhtChannelWidth == |
| 8896 | eHT_CHANNEL_WIDTH_160MHZ) |
| 8897 | snprintf(extra, WE_MAX_STR_LEN, |
| 8898 | "11ACVHT160"); |
| 8899 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 8900 | case eCSR_DOT11_MODE_11ax: |
| 8901 | case eCSR_DOT11_MODE_11ax_ONLY: |
| 8902 | /* currently using vhtChannelWidth */ |
| 8903 | if (hddctx->config->vhtChannelWidth == |
| 8904 | eHT_CHANNEL_WIDTH_20MHZ) |
| 8905 | snprintf(extra, WE_MAX_STR_LEN, |
| 8906 | "11AX_HE_20"); |
| 8907 | else if (hddctx->config->vhtChannelWidth == |
| 8908 | eHT_CHANNEL_WIDTH_40MHZ) |
| 8909 | snprintf(extra, WE_MAX_STR_LEN, |
| 8910 | "11AX_HE_40"); |
| 8911 | else if (hddctx->config->vhtChannelWidth == |
| 8912 | eHT_CHANNEL_WIDTH_80MHZ) |
| 8913 | snprintf(extra, WE_MAX_STR_LEN, |
| 8914 | "11AX_HE_80"); |
| 8915 | else if (hddctx->config->vhtChannelWidth == |
| 8916 | eHT_CHANNEL_WIDTH_160MHZ) |
| 8917 | snprintf(extra, WE_MAX_STR_LEN, |
| 8918 | "11AX_HE_160"); |
| 8919 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8920 | } |
| 8921 | |
| 8922 | wrqu->data.length = strlen(extra) + 1; |
| 8923 | break; |
| 8924 | } |
| 8925 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8926 | case WE_GET_OEM_DATA_CAP: |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 8927 | return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8928 | case WE_GET_SNR: |
| 8929 | { |
| 8930 | int8_t s7snr = 0; |
| 8931 | int status = 0; |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8932 | struct hdd_context *hdd_ctx; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8933 | struct hdd_station_ctx *sta_ctx; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 8934 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8935 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8936 | status = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 8937 | if (status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8938 | return status; |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 8939 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8940 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8941 | if (0 == hdd_ctx->config->fEnableSNRMonitoring || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8942 | eConnectionState_Associated != |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8943 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8944 | hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 8945 | hdd_ctx->config->fEnableSNRMonitoring, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 8946 | sta_ctx->conn_info.connState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8947 | return -ENONET; |
| 8948 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 8949 | wlan_hdd_get_snr(adapter, &s7snr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8950 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr); |
| 8951 | wrqu->data.length = strlen(extra) + 1; |
| 8952 | break; |
| 8953 | } |
| 8954 | default: |
| 8955 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 8956 | hdd_err("Invalid IOCTL command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8957 | sub_cmd); |
| 8958 | break; |
| 8959 | } |
| 8960 | } |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 8961 | |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8962 | EXIT(); |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 8963 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8964 | } |
| 8965 | |
| 8966 | static int iw_get_char_setnone(struct net_device *dev, |
| 8967 | struct iw_request_info *info, |
| 8968 | union iwreq_data *wrqu, char *extra) |
| 8969 | { |
| 8970 | int ret; |
| 8971 | |
| 8972 | cds_ssr_protect(__func__); |
| 8973 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 8974 | cds_ssr_unprotect(__func__); |
| 8975 | |
| 8976 | return ret; |
| 8977 | } |
| 8978 | |
| 8979 | /** |
| 8980 | * iw_setnone_getnone() - Generic "action" private ioctl handler |
| 8981 | * @dev: device upon which the ioctl was received |
| 8982 | * @info: ioctl request information |
| 8983 | * @wrqu: ioctl request data |
| 8984 | * @extra: ioctl extra data |
| 8985 | * |
| 8986 | * Return: 0 on success, non-zero on error |
| 8987 | */ |
| 8988 | static int __iw_setnone_getnone(struct net_device *dev, |
| 8989 | struct iw_request_info *info, |
| 8990 | union iwreq_data *wrqu, char *extra) |
| 8991 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 8992 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 8993 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8994 | int ret; |
| 8995 | int sub_cmd; |
| 8996 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 8997 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 8998 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 8999 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9000 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9001 | if (0 != ret) |
| 9002 | return ret; |
| 9003 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9004 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9005 | if (0 != ret) |
| 9006 | return ret; |
| 9007 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9008 | #ifdef CONFIG_COMPAT |
| 9009 | /* this ioctl is a special case where a sub-ioctl is used and both |
| 9010 | * the number of get and set args is 0. in this specific case the |
| 9011 | * logic in iwpriv places the sub_cmd in the data.flags portion of |
| 9012 | * the iwreq. unfortunately the location of this field will be |
| 9013 | * different between 32-bit and 64-bit userspace, and the standard |
| 9014 | * compat support in the kernel does not handle this case. so we |
| 9015 | * need to explicitly handle it here. |
| 9016 | */ |
| 9017 | if (is_compat_task()) { |
| 9018 | struct compat_iw_point *compat_iw_point = |
| 9019 | (struct compat_iw_point *)&wrqu->data; |
| 9020 | sub_cmd = compat_iw_point->flags; |
| 9021 | } else { |
| 9022 | sub_cmd = wrqu->data.flags; |
| 9023 | } |
| 9024 | #else |
| 9025 | sub_cmd = wrqu->data.flags; |
| 9026 | #endif |
| 9027 | |
| 9028 | switch (sub_cmd) { |
| 9029 | case WE_GET_RECOVERY_STAT: |
| 9030 | { |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9031 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9032 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9033 | sme_get_recovery_stats(hal); |
| 9034 | break; |
| 9035 | } |
| 9036 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9037 | case WE_GET_FW_PROFILE_DATA: |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9038 | ret = wma_cli_set_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 9039 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 9040 | 0, DBG_CMD); |
| 9041 | break; |
| 9042 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9043 | case WE_IBSS_GET_PEER_INFO_ALL: |
| 9044 | { |
| 9045 | hdd_wlan_get_ibss_peer_info_all(adapter); |
| 9046 | break; |
| 9047 | } |
| 9048 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9049 | case WE_SET_REASSOC_TRIGGER: |
| 9050 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 9051 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9052 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9053 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 9054 | tSirMacAddr bssid; |
Krunal Soni | bfd0549 | 2017-10-03 15:48:37 -0700 | [diff] [blame] | 9055 | uint32_t roamId = INVALID_ROAM_ID; |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 9056 | uint8_t operating_ch = |
| 9057 | adapter->sessionCtx.station.conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9058 | tCsrRoamModifyProfileFields modProfileFields; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9059 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9060 | sme_get_modify_profile_fields(hHal, adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9061 | &modProfileFields); |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 9062 | if (roaming_offload_enabled(hdd_ctx)) { |
| 9063 | qdf_mem_copy(bssid, |
| 9064 | &adapter->sessionCtx.station.conn_info.bssId, |
| 9065 | sizeof(bssid)); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 9066 | hdd_wma_send_fastreassoc_cmd(adapter, |
Deepak Dhamdhere | 5fda0e4 | 2016-06-24 18:30:02 +0530 | [diff] [blame] | 9067 | bssid, operating_ch); |
| 9068 | } else { |
| 9069 | sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, |
| 9070 | NULL, modProfileFields, &roamId, 1); |
| 9071 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9072 | return 0; |
| 9073 | } |
| 9074 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 9075 | case WE_STOP_OBSS_SCAN: |
| 9076 | { |
| 9077 | /* |
| 9078 | * 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 9079 | * 2.OBSS scan is stopped by Firmware during the disassociation |
| 9080 | * 3.OBSS stop comamnd is added for debugging purpose |
| 9081 | */ |
| 9082 | tHalHandle hal; |
| 9083 | |
| 9084 | hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 9085 | if (hal == NULL) { |
| 9086 | hdd_err("hal context is NULL"); |
| 9087 | return -EINVAL; |
| 9088 | } |
| 9089 | sme_ht40_stop_obss_scan(hal, adapter->sessionId); |
| 9090 | } |
| 9091 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9092 | default: |
| 9093 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9094 | hdd_err("unknown ioctl %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9095 | break; |
| 9096 | } |
| 9097 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9098 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9099 | return ret; |
| 9100 | } |
| 9101 | |
| 9102 | static int iw_setnone_getnone(struct net_device *dev, |
| 9103 | struct iw_request_info *info, |
| 9104 | union iwreq_data *wrqu, char *extra) |
| 9105 | { |
| 9106 | int ret; |
| 9107 | |
| 9108 | cds_ssr_protect(__func__); |
| 9109 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 9110 | cds_ssr_unprotect(__func__); |
| 9111 | |
| 9112 | return ret; |
| 9113 | } |
| 9114 | |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9115 | #ifdef MPC_UT_FRAMEWORK |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9116 | 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] | 9117 | struct hdd_adapter *adapter, int sub_cmd, int *apps_args) |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9118 | { |
Jeff Johnson | ac8b0de | 2017-02-10 09:22:22 -0800 | [diff] [blame] | 9119 | switch (sub_cmd) { |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9120 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 9121 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9122 | hdd_debug("<iwpriv wlan0 pm_clist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9123 | policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc, |
| 9124 | apps_args[0], apps_args[1], apps_args[2], apps_args[3], |
| 9125 | apps_args[4], apps_args[5], apps_args[6], apps_args[7]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9126 | } |
| 9127 | break; |
| 9128 | |
| 9129 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 9130 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9131 | hdd_debug("<iwpriv wlan0 pm_dlist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9132 | policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc, |
| 9133 | apps_args[0], apps_args[1]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9134 | } |
| 9135 | break; |
| 9136 | |
| 9137 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 9138 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9139 | hdd_debug("<iwpriv wlan0 pm_ulist> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9140 | policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc, |
| 9141 | apps_args[0], apps_args[1], apps_args[2], apps_args[3], |
| 9142 | apps_args[4], apps_args[5], apps_args[6], apps_args[7]); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9143 | } |
| 9144 | break; |
| 9145 | |
| 9146 | case WE_POLICY_MANAGER_DBS_CMD: |
| 9147 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9148 | hdd_debug("<iwpriv wlan0 pm_dbs> is called"); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9149 | if (apps_args[0] == 0) |
| 9150 | wma_set_dbs_capability_ut(0); |
| 9151 | else |
| 9152 | wma_set_dbs_capability_ut(1); |
| 9153 | |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9154 | if (apps_args[1] >= PM_THROUGHPUT && |
| 9155 | apps_args[1] <= PM_LATENCY) { |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9156 | pr_info("setting system pref to [%d]\n", apps_args[1]); |
| 9157 | hdd_ctx->config->conc_system_pref = apps_args[1]; |
| 9158 | } |
| 9159 | } |
| 9160 | break; |
| 9161 | |
| 9162 | case WE_POLICY_MANAGER_PCL_CMD: |
| 9163 | { |
| 9164 | uint8_t pcl[QDF_MAX_NUM_CHAN] = {0}; |
| 9165 | uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0}; |
| 9166 | uint32_t pcl_len = 0, i = 0; |
| 9167 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 9168 | hdd_debug("<iwpriv wlan0 pm_pcl> is called"); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9169 | |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9170 | policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0], |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9171 | pcl, &pcl_len, |
| 9172 | weight_list, QDF_ARRAY_SIZE(weight_list)); |
| 9173 | pr_info("PCL list for role[%d] is {", apps_args[0]); |
| 9174 | for (i = 0 ; i < pcl_len; i++) |
| 9175 | pr_info(" %d, ", pcl[i]); |
| 9176 | pr_info("}--------->\n"); |
| 9177 | } |
| 9178 | break; |
| 9179 | |
| 9180 | case WE_POLICY_SET_HW_MODE_CMD: |
| 9181 | { |
| 9182 | if (apps_args[0] == 0) { |
| 9183 | hdd_err("set hw mode for single mac"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9184 | policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9185 | adapter->sessionId, |
| 9186 | HW_MODE_SS_2x2, |
| 9187 | HW_MODE_80_MHZ, |
| 9188 | HW_MODE_SS_0x0, HW_MODE_BW_NONE, |
| 9189 | HW_MODE_DBS_NONE, |
| 9190 | HW_MODE_AGILE_DFS_NONE, |
| 9191 | HW_MODE_SBS_NONE, |
| 9192 | SIR_UPDATE_REASON_UT); |
| 9193 | } else if (apps_args[0] == 1) { |
| 9194 | hdd_err("set hw mode for dual mac"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9195 | policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9196 | adapter->sessionId, |
| 9197 | HW_MODE_SS_1x1, |
| 9198 | HW_MODE_80_MHZ, |
| 9199 | HW_MODE_SS_1x1, HW_MODE_40_MHZ, |
| 9200 | HW_MODE_DBS, |
| 9201 | HW_MODE_AGILE_DFS_NONE, |
| 9202 | HW_MODE_SBS_NONE, |
| 9203 | SIR_UPDATE_REASON_UT); |
| 9204 | } |
| 9205 | } |
| 9206 | break; |
| 9207 | |
| 9208 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 9209 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9210 | enum policy_mgr_conc_next_action action; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9211 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 9212 | hdd_debug("<iwpriv wlan0 pm_query_action> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9213 | action = policy_mgr_current_connections_update( |
| 9214 | hdd_ctx->hdd_psoc, |
| 9215 | adapter->sessionId, apps_args[0], |
| 9216 | SIR_UPDATE_REASON_UT); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9217 | pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action); |
| 9218 | } |
| 9219 | break; |
| 9220 | |
| 9221 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 9222 | { |
| 9223 | bool allow; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9224 | |
| 9225 | hdd_notice("<iwpriv wlan0 pm_query_allow> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9226 | allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9227 | apps_args[0], apps_args[1], apps_args[2]); |
| 9228 | pr_info("allow %d {0 = don't allow, 1 = allow}", allow); |
| 9229 | } |
| 9230 | break; |
| 9231 | |
| 9232 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 9233 | { |
| 9234 | clean_report(hdd_ctx); |
| 9235 | if (apps_args[0] == 1) { |
| 9236 | wlan_hdd_one_connection_scenario(hdd_ctx); |
| 9237 | } else if (apps_args[0] == 2) { |
| 9238 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9239 | 6, POLICY_MGR_TWO_TWO); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9240 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9241 | 36, POLICY_MGR_TWO_TWO); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9242 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9243 | 6, POLICY_MGR_ONE_ONE); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9244 | wlan_hdd_two_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9245 | 36, POLICY_MGR_ONE_ONE); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9246 | } else if (apps_args[0] == 3) { |
| 9247 | /* MCC on same band with 2x2 same mac*/ |
| 9248 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9249 | 6, 11, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9250 | /* MCC on diff band with 2x2 same mac*/ |
| 9251 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9252 | 6, 36, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9253 | /* MCC on diff band with 1x1 diff mac */ |
| 9254 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9255 | 36, 6, POLICY_MGR_ONE_ONE, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9256 | /* MCC on diff band with 1x1 same mac */ |
| 9257 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9258 | 36, 6, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9259 | /* SCC on same band with 2x2 same mac */ |
| 9260 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9261 | 36, 36, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9262 | /* SCC on same band with 1x1 same mac */ |
| 9263 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9264 | 36, 36, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9265 | /* MCC on same band with 2x2 same mac */ |
| 9266 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9267 | 36, 149, POLICY_MGR_TWO_TWO, 0); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9268 | /* MCC on same band with 1x1 same mac */ |
| 9269 | wlan_hdd_three_connections_scenario(hdd_ctx, |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9270 | 36, 149, POLICY_MGR_ONE_ONE, 1); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9271 | } |
| 9272 | print_report(hdd_ctx); |
| 9273 | } |
| 9274 | break; |
| 9275 | } |
| 9276 | return 0; |
| 9277 | } |
| 9278 | #else |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9279 | 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] | 9280 | struct hdd_adapter *adapter, int sub_cmd, int *apps_args) |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9281 | { |
| 9282 | return 0; |
| 9283 | } |
| 9284 | #endif |
| 9285 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9286 | /** |
| 9287 | * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 9288 | * @dev: device upon which the ioctl was received |
| 9289 | * @info: ioctl request information |
| 9290 | * @wrqu: ioctl request data |
| 9291 | * @extra: ioctl extra data |
| 9292 | * |
| 9293 | * This is an SSR-protected generic handler for private ioctls which |
| 9294 | * take multiple arguments. Note that this implementation is also |
| 9295 | * somewhat unique in that it is shared by both STA-mode and SAP-mode |
| 9296 | * interfaces. |
| 9297 | * |
| 9298 | * Return: 0 on success, non-zero on error |
| 9299 | */ |
| 9300 | static int __iw_set_var_ints_getnone(struct net_device *dev, |
| 9301 | struct iw_request_info *info, |
| 9302 | union iwreq_data *wrqu, char *extra) |
| 9303 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9304 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9305 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9306 | int sub_cmd; |
| 9307 | int *apps_args = (int *) extra; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9308 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9309 | int ret, num_args; |
| 9310 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9311 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9312 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9313 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9314 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9315 | if (0 != ret) |
| 9316 | return ret; |
| 9317 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9318 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9319 | if (0 != ret) |
| 9320 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9321 | |
| 9322 | sub_cmd = wrqu->data.flags; |
| 9323 | num_args = wrqu->data.length; |
| 9324 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9325 | hdd_debug("Received length %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9326 | |
| 9327 | switch (sub_cmd) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9328 | case WE_IBSS_GET_PEER_INFO: |
| 9329 | { |
| 9330 | pr_info("Station ID = %d\n", apps_args[0]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9331 | hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9332 | } |
| 9333 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9334 | |
| 9335 | case WE_P2P_NOA_CMD: |
| 9336 | { |
Srinivas Girigowda | 5d5fdc5 | 2017-03-24 22:30:57 -0700 | [diff] [blame] | 9337 | struct p2p_app_set_ps p2pNoA; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9338 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9339 | if (adapter->device_mode != QDF_P2P_GO_MODE) { |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 9340 | hdd_err("Setting NoA is not allowed in Device mode %s(%d)", |
| 9341 | hdd_device_mode_to_string( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9342 | adapter->device_mode), |
| 9343 | adapter->device_mode); |
Rajeev Kumar | 274034c | 2015-11-23 11:28:58 -0800 | [diff] [blame] | 9344 | return -EINVAL; |
| 9345 | } |
| 9346 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9347 | p2pNoA.opp_ps = apps_args[0]; |
| 9348 | p2pNoA.ctWindow = apps_args[1]; |
| 9349 | p2pNoA.duration = apps_args[2]; |
| 9350 | p2pNoA.interval = apps_args[3]; |
| 9351 | p2pNoA.count = apps_args[4]; |
| 9352 | p2pNoA.single_noa_duration = apps_args[5]; |
| 9353 | p2pNoA.psSelection = apps_args[6]; |
| 9354 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9355 | 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] | 9356 | apps_args[0], apps_args[1], apps_args[2], |
| 9357 | apps_args[3], apps_args[4], |
| 9358 | apps_args[5], apps_args[6]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9359 | |
| 9360 | hdd_set_p2p_ps(dev, &p2pNoA); |
| 9361 | |
| 9362 | } |
| 9363 | break; |
| 9364 | |
| 9365 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 9366 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9367 | hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9368 | apps_args[0], apps_args[1]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9369 | qdf_trace_enable(apps_args[0], apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9370 | } |
| 9371 | break; |
| 9372 | |
| 9373 | case WE_MTRACE_DUMP_CMD: |
| 9374 | { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9375 | 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] | 9376 | apps_args[0], apps_args[1], |
| 9377 | apps_args[2], apps_args[3]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9378 | qdf_trace_dump_all((void *)hHal, apps_args[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9379 | apps_args[1], apps_args[2], |
| 9380 | apps_args[3]); |
| 9381 | |
| 9382 | } |
| 9383 | break; |
| 9384 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9385 | case WE_POLICY_MANAGER_CINFO_CMD: |
| 9386 | { |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9387 | struct policy_mgr_conc_connection_info *conn_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9388 | uint32_t i = 0, len = 0; |
| 9389 | |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9390 | hdd_info("<iwpriv wlan0 pm_cinfo> is called"); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 9391 | conn_info = policy_mgr_get_conn_info(&len); |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9392 | pr_info("+--------------------------+\n"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9393 | for (i = 0; i < len; i++) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 9394 | pr_info("|table_index[%d]\t\t\n", i); |
| 9395 | pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id); |
| 9396 | pr_info("|\t|chan - %-10d|\n", conn_info->chan); |
| 9397 | pr_info("|\t|bw - %-10d|\n", conn_info->bw); |
| 9398 | pr_info("|\t|mode - %-10d|\n", conn_info->mode); |
| 9399 | pr_info("|\t|mac - %-10d|\n", conn_info->mac); |
| 9400 | pr_info("|\t|in_use - %-10d|\n", conn_info->in_use); |
| 9401 | pr_info("+--------------------------+\n"); |
| 9402 | conn_info++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9403 | } |
| 9404 | } |
| 9405 | break; |
| 9406 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9407 | |
| 9408 | #ifdef FEATURE_WLAN_TDLS |
| 9409 | case WE_TDLS_CONFIG_PARAMS: |
| 9410 | { |
Jeff Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 9411 | struct hdd_tdls_config_params tdlsParams; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9412 | |
| 9413 | tdlsParams.tdls = apps_args[0]; |
| 9414 | tdlsParams.tx_period_t = apps_args[1]; |
| 9415 | tdlsParams.tx_packet_n = apps_args[2]; |
| 9416 | /* ignore args[3] as discovery_period is not used anymore */ |
| 9417 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 9418 | /* ignore args[5] as idle_timeout is not used anymore */ |
| 9419 | tdlsParams.idle_packet_n = apps_args[6]; |
| 9420 | /* ignore args[7] as rssi_hysteresis is not used anymore */ |
| 9421 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 9422 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
| 9423 | tdlsParams.rssi_delta = apps_args[10]; |
| 9424 | |
| 9425 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
| 9426 | } |
| 9427 | break; |
| 9428 | #endif |
| 9429 | case WE_UNIT_TEST_CMD: |
| 9430 | { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 9431 | QDF_STATUS status; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9432 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9433 | if ((apps_args[0] < WLAN_MODULE_ID_MIN) || |
| 9434 | (apps_args[0] >= WLAN_MODULE_ID_MAX)) { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 9435 | hdd_err("Invalid MODULE ID %d", apps_args[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9436 | return -EINVAL; |
| 9437 | } |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 9438 | if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) || |
Anurag Chouhan | 7756418 | 2016-09-03 16:38:01 +0530 | [diff] [blame] | 9439 | (apps_args[1] < 0)) { |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 9440 | hdd_err("Too Many/Few args %d", apps_args[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9441 | return -EINVAL; |
| 9442 | } |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 9443 | status = sme_send_unit_test_cmd(adapter->sessionId, |
| 9444 | apps_args[0], |
| 9445 | apps_args[1], |
| 9446 | &apps_args[2]); |
| 9447 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 21d63bb | 2017-10-07 17:45:33 -0700 | [diff] [blame] | 9448 | hdd_err("sme_send_unit_test_cmd returned %d", status); |
| 9449 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9450 | } |
| 9451 | } |
| 9452 | break; |
| 9453 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 9454 | case WE_LED_FLASHING_PARAM: |
| 9455 | { |
| 9456 | int i; |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9457 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9458 | if (num_args != 4) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9459 | hdd_err("gpio_control: 4 parameters are required"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9460 | return -EINVAL; |
| 9461 | } |
| 9462 | for (i = 0; i < num_args; i++) { |
| 9463 | if (apps_args[i] >= 0x7fffffff) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9464 | hdd_err("gpio_control: parameter should be less than 0x7fffffff"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9465 | return -EINVAL; |
| 9466 | } |
| 9467 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9468 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9469 | 0, apps_args[0], apps_args[1]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9470 | sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9471 | 1, apps_args[2], apps_args[3]); |
| 9472 | } |
| 9473 | break; |
| 9474 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 9475 | case WE_SET_PKTLOG: |
| 9476 | { |
| 9477 | int ret; |
| 9478 | |
| 9479 | if (num_args < 1 || num_args > 2) { |
| 9480 | hdd_err("pktlog: either 1 or 2 parameters are required"); |
| 9481 | return -EINVAL; |
| 9482 | } |
| 9483 | |
| 9484 | ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0], |
| 9485 | apps_args[1]); |
| 9486 | if (ret) |
| 9487 | return ret; |
| 9488 | break; |
| 9489 | } |
| 9490 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 9491 | case WE_MAC_PWR_DEBUG_CMD: |
| 9492 | { |
| 9493 | struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9494 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 9495 | int i, j; |
| 9496 | |
| 9497 | if (num_args < 3) { |
| 9498 | hdd_err("number of arguments can't be null %d", |
| 9499 | num_args); |
| 9500 | return -EINVAL; |
| 9501 | } |
| 9502 | if (num_args - 3 != apps_args[2]) { |
| 9503 | hdd_err("arg list of size %d doesn't match num_args %d", |
| 9504 | num_args-3, apps_args[2]); |
| 9505 | return -EINVAL; |
| 9506 | } |
| 9507 | if ((apps_args[1] < WLAN_MODULE_ID_MIN) || |
| 9508 | (apps_args[1] >= WLAN_MODULE_ID_MAX)) { |
| 9509 | hdd_err("Invalid MODULE ID %d", apps_args[1]); |
| 9510 | return -EINVAL; |
| 9511 | } |
| 9512 | if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) { |
| 9513 | hdd_err("Too Many args %d", apps_args[2]); |
| 9514 | return -EINVAL; |
| 9515 | } |
| 9516 | mac_pwr_dbg_args.pdev_id = apps_args[0]; |
| 9517 | mac_pwr_dbg_args.module_id = apps_args[1]; |
| 9518 | mac_pwr_dbg_args.num_args = apps_args[2]; |
| 9519 | |
| 9520 | for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++) |
| 9521 | mac_pwr_dbg_args.args[i] = apps_args[j]; |
| 9522 | |
| 9523 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9524 | sme_process_mac_pwr_dbg_cmd(hal, adapter->sessionId, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 9525 | &mac_pwr_dbg_args)) { |
| 9526 | return -EINVAL; |
| 9527 | } |
| 9528 | } |
| 9529 | break; |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9530 | case WE_POLICY_MANAGER_CLIST_CMD: |
| 9531 | case WE_POLICY_MANAGER_DLIST_CMD: |
| 9532 | case WE_POLICY_MANAGER_ULIST_CMD: |
| 9533 | case WE_POLICY_MANAGER_DBS_CMD: |
| 9534 | case WE_POLICY_MANAGER_PCL_CMD: |
| 9535 | case WE_POLICY_SET_HW_MODE_CMD: |
| 9536 | case WE_POLICY_MANAGER_QUERY_ACTION_CMD: |
| 9537 | case WE_POLICY_MANAGER_QUERY_ALLOW_CMD: |
| 9538 | case WE_POLICY_MANAGER_SCENARIO_CMD: |
| 9539 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9540 | iw_get_policy_manager_ut_ops(hdd_ctx, adapter, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 9541 | sub_cmd, apps_args); |
| 9542 | } |
| 9543 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9544 | default: |
| 9545 | { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9546 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9547 | } |
| 9548 | break; |
| 9549 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9550 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9551 | return 0; |
| 9552 | } |
| 9553 | |
| 9554 | /** |
| 9555 | * iw_hdd_set_var_ints_getnone() - set var ints getnone callback |
| 9556 | * @dev: pointer to net_device structure |
| 9557 | * @info: pointer to iw_request_info structure |
| 9558 | * @wrqu: pointer to iwreq_data |
| 9559 | * @extra; extra |
| 9560 | * |
| 9561 | * Return: 0 on success, error number otherwise |
| 9562 | * |
| 9563 | */ |
| 9564 | static int iw_hdd_set_var_ints_getnone(struct net_device *dev, |
| 9565 | struct iw_request_info *info, |
| 9566 | union iwreq_data *wrqu, char *extra) |
| 9567 | { |
| 9568 | union iwreq_data u_priv_wrqu; |
| 9569 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 9570 | int ret, num_args; |
| 9571 | |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 9572 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9573 | hdd_err("permission check failed"); |
Mukul Sharma | 64a70e8 | 2015-11-02 20:05:09 +0530 | [diff] [blame] | 9574 | return -EPERM; |
| 9575 | } |
| 9576 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9577 | /* Helper function to get iwreq_data with compat handling. */ |
| 9578 | if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) |
| 9579 | return -EINVAL; |
| 9580 | |
| 9581 | if (NULL == u_priv_wrqu.data.pointer) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9582 | hdd_err("NULL data pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9583 | return -EINVAL; |
| 9584 | } |
| 9585 | |
| 9586 | num_args = u_priv_wrqu.data.length; |
| 9587 | if (num_args > MAX_VAR_ARGS) |
| 9588 | num_args = MAX_VAR_ARGS; |
| 9589 | |
| 9590 | if (copy_from_user(apps_args, u_priv_wrqu.data.pointer, |
| 9591 | (sizeof(int)) * num_args)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9592 | hdd_err("failed to copy data from user buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9593 | return -EFAULT; |
| 9594 | } |
| 9595 | |
| 9596 | cds_ssr_protect(__func__); |
| 9597 | ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu, |
| 9598 | (char *)&apps_args); |
| 9599 | cds_ssr_unprotect(__func__); |
| 9600 | return ret; |
| 9601 | } |
| 9602 | |
| 9603 | /** |
| 9604 | * iw_set_var_ints_getnone - Generic "set many" private ioctl handler |
| 9605 | * @dev: device upon which the ioctl was received |
| 9606 | * @info: ioctl request information |
| 9607 | * @wrqu: ioctl request data |
| 9608 | * @extra: ioctl extra data |
| 9609 | * |
| 9610 | * This is a generic handler for private ioctls which take multiple |
| 9611 | * arguments. Note that this implementation is also somewhat unique |
| 9612 | * in that it is shared by both STA-mode and SAP-mode interfaces. |
| 9613 | * |
| 9614 | * Return: 0 on success, non-zero on error |
| 9615 | */ |
| 9616 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 9617 | struct iw_request_info *info, |
| 9618 | union iwreq_data *wrqu, char *extra) |
| 9619 | { |
| 9620 | int ret; |
| 9621 | |
| 9622 | cds_ssr_protect(__func__); |
| 9623 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 9624 | cds_ssr_unprotect(__func__); |
| 9625 | return ret; |
| 9626 | } |
| 9627 | |
| 9628 | /** |
| 9629 | * iw_add_tspec - Add TSpec private ioctl handler |
| 9630 | * @dev: device upon which the ioctl was received |
| 9631 | * @info: ioctl request information |
| 9632 | * @wrqu: ioctl request data |
| 9633 | * @extra: ioctl extra data |
| 9634 | * |
| 9635 | * Return: 0 on success, non-zero on error |
| 9636 | */ |
| 9637 | static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info, |
| 9638 | union iwreq_data *wrqu, char *extra) |
| 9639 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9640 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9641 | 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] | 9642 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 9643 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 9644 | struct sme_qos_wmmtspecinfo tSpec; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9645 | uint32_t handle; |
| 9646 | struct iw_point s_priv_data; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9647 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9648 | int ret; |
| 9649 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9650 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9651 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9652 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9653 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9654 | if (0 != ret) |
| 9655 | return ret; |
| 9656 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9657 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9658 | if (0 != ret) |
| 9659 | return ret; |
| 9660 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9661 | /* make sure the application is sufficiently priviledged */ |
| 9662 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 9663 | /* this ioctl wants to return status to user space it must be */ |
| 9664 | /* defined as a "get" ioctl */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9665 | if (!capable(CAP_NET_ADMIN)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9666 | return -EPERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9667 | |
| 9668 | /* we must be associated in order to add a tspec */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9669 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9670 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9671 | return 0; |
| 9672 | } |
| 9673 | /* since we are defined to be a "get" ioctl, and since the number */ |
| 9674 | /* of params exceeds the number of params that wireless extensions */ |
| 9675 | /* will pass down in the iwreq_data, we must copy the "set" params. */ |
| 9676 | /* We must handle the compat for iwreq_data in 32U/64K environment. */ |
| 9677 | |
| 9678 | /* helper function to get iwreq_data with compat handling. */ |
| 9679 | if (hdd_priv_get_data(&s_priv_data, wrqu)) { |
| 9680 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9681 | return 0; |
| 9682 | } |
| 9683 | /* make sure all params are correctly passed to function */ |
| 9684 | if ((NULL == s_priv_data.pointer) || |
| 9685 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) { |
| 9686 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9687 | return 0; |
| 9688 | } |
| 9689 | /* from user space ourselves */ |
| 9690 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) { |
| 9691 | /* hmmm, can't get them */ |
| 9692 | return -EIO; |
| 9693 | } |
| 9694 | /* clear the tspec */ |
| 9695 | memset(&tSpec, 0, sizeof(tSpec)); |
| 9696 | |
| 9697 | /* validate the handle */ |
| 9698 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 9699 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 9700 | /* that one is reserved */ |
| 9701 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9702 | return 0; |
| 9703 | } |
| 9704 | /* validate the TID */ |
| 9705 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) { |
| 9706 | /* out of range */ |
| 9707 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9708 | return 0; |
| 9709 | } |
| 9710 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 9711 | |
| 9712 | /* validate the direction */ |
| 9713 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) { |
| 9714 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 9715 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 9716 | break; |
| 9717 | |
| 9718 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 9719 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 9720 | break; |
| 9721 | |
| 9722 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 9723 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 9724 | break; |
| 9725 | |
| 9726 | default: |
| 9727 | /* unknown */ |
| 9728 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9729 | return 0; |
| 9730 | } |
| 9731 | |
| 9732 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 9733 | |
| 9734 | /* validate the user priority */ |
| 9735 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) { |
| 9736 | /* out of range */ |
| 9737 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9738 | return 0; |
| 9739 | } |
| 9740 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
| 9741 | 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] | 9742 | hdd_err("***ts_info.up out of bounds***"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9743 | return 0; |
| 9744 | } |
| 9745 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9746 | hdd_debug("TS_INFO PSB %d UP %d !!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9747 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 9748 | |
| 9749 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 9750 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 9751 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 9752 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 9753 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 9754 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 9755 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 9756 | tSpec.surplus_bw_allowance = |
| 9757 | params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 9758 | tSpec.min_service_interval = |
| 9759 | params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 9760 | tSpec.max_service_interval = |
| 9761 | params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 9762 | tSpec.suspension_interval = |
| 9763 | params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 9764 | tSpec.inactivity_interval = |
| 9765 | params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 9766 | |
| 9767 | tSpec.ts_info.burst_size_defn = |
| 9768 | params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 9769 | |
| 9770 | /* validate the ts info ack policy */ |
| 9771 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) { |
| 9772 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 9773 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 9774 | break; |
| 9775 | |
| 9776 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 9777 | tSpec.ts_info.ack_policy = |
| 9778 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 9779 | break; |
| 9780 | |
| 9781 | default: |
| 9782 | /* unknown */ |
| 9783 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9784 | return 0; |
| 9785 | } |
| 9786 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9787 | *pStatus = hdd_wmm_addts(adapter, handle, &tSpec); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9788 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9789 | return 0; |
| 9790 | } |
| 9791 | |
| 9792 | static int iw_add_tspec(struct net_device *dev, |
| 9793 | struct iw_request_info *info, |
| 9794 | union iwreq_data *wrqu, char *extra) |
| 9795 | { |
| 9796 | int ret; |
| 9797 | |
| 9798 | cds_ssr_protect(__func__); |
| 9799 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 9800 | cds_ssr_unprotect(__func__); |
| 9801 | |
| 9802 | return ret; |
| 9803 | } |
| 9804 | |
| 9805 | /** |
| 9806 | * iw_del_tspec - Delete TSpec private ioctl handler |
| 9807 | * @dev: device upon which the ioctl was received |
| 9808 | * @info: ioctl request information |
| 9809 | * @wrqu: ioctl request data |
| 9810 | * @extra: ioctl extra data |
| 9811 | * |
| 9812 | * Return: 0 on success, non-zero on error |
| 9813 | */ |
| 9814 | static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info, |
| 9815 | union iwreq_data *wrqu, char *extra) |
| 9816 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9817 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9818 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9819 | int *params = (int *)extra; |
| 9820 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 9821 | uint32_t handle; |
| 9822 | int ret; |
| 9823 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9824 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9825 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9826 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9827 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9828 | if (0 != ret) |
| 9829 | return ret; |
| 9830 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9831 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9832 | if (0 != ret) |
| 9833 | return ret; |
| 9834 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9835 | /* make sure the application is sufficiently priviledged */ |
| 9836 | /* note that the kernel will do this for "set" ioctls, but since */ |
| 9837 | /* this ioctl wants to return status to user space it must be */ |
| 9838 | /* defined as a "get" ioctl */ |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 9839 | if (!capable(CAP_NET_ADMIN)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9840 | return -EPERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9841 | |
| 9842 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 9843 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 9844 | /* is no need to copy the params from user space */ |
| 9845 | |
| 9846 | /* validate the handle */ |
| 9847 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 9848 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 9849 | /* that one is reserved */ |
| 9850 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9851 | return 0; |
| 9852 | } |
| 9853 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9854 | *pStatus = hdd_wmm_delts(adapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9855 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9856 | return 0; |
| 9857 | } |
| 9858 | |
| 9859 | static int iw_del_tspec(struct net_device *dev, |
| 9860 | struct iw_request_info *info, |
| 9861 | union iwreq_data *wrqu, char *extra) |
| 9862 | { |
| 9863 | int ret; |
| 9864 | |
| 9865 | cds_ssr_protect(__func__); |
| 9866 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 9867 | cds_ssr_unprotect(__func__); |
| 9868 | |
| 9869 | return ret; |
| 9870 | } |
| 9871 | |
| 9872 | /** |
| 9873 | * iw_get_tspec - Get TSpec private ioctl handler |
| 9874 | * @dev: device upon which the ioctl was received |
| 9875 | * @info: ioctl request information |
| 9876 | * @wrqu: ioctl request data |
| 9877 | * @extra: ioctl extra data |
| 9878 | * |
| 9879 | * Return: 0 on success, non-zero on error |
| 9880 | */ |
| 9881 | static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info, |
| 9882 | union iwreq_data *wrqu, char *extra) |
| 9883 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9884 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 9885 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9886 | int *params = (int *)extra; |
| 9887 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra; |
| 9888 | uint32_t handle; |
| 9889 | int ret; |
| 9890 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9891 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9892 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9893 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9894 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9895 | if (0 != ret) |
| 9896 | return ret; |
| 9897 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9898 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9899 | if (0 != ret) |
| 9900 | return ret; |
| 9901 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9902 | /* although we are defined to be a "get" ioctl, the params we require */ |
| 9903 | /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */ |
| 9904 | /* is no need to copy the params from user space */ |
| 9905 | |
| 9906 | /* validate the handle */ |
| 9907 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 9908 | if (HDD_WMM_HANDLE_IMPLICIT == handle) { |
| 9909 | /* that one is reserved */ |
| 9910 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 9911 | return 0; |
| 9912 | } |
| 9913 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9914 | *pStatus = hdd_wmm_checkts(adapter, handle); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9915 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9916 | return 0; |
| 9917 | } |
| 9918 | |
| 9919 | static int iw_get_tspec(struct net_device *dev, |
| 9920 | struct iw_request_info *info, |
| 9921 | union iwreq_data *wrqu, char *extra) |
| 9922 | { |
| 9923 | int ret; |
| 9924 | |
| 9925 | cds_ssr_protect(__func__); |
| 9926 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 9927 | cds_ssr_unprotect(__func__); |
| 9928 | |
| 9929 | return ret; |
| 9930 | } |
| 9931 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9932 | /** |
| 9933 | * iw_set_fties - Set FT IEs private ioctl handler |
| 9934 | * @dev: device upon which the ioctl was received |
| 9935 | * @info: ioctl request information |
| 9936 | * @wrqu: ioctl request data |
| 9937 | * @extra: ioctl extra data |
| 9938 | * |
| 9939 | * Each time the supplicant has the auth_request or reassoc request |
| 9940 | * IEs ready they are pushed to the driver. The driver will in turn |
| 9941 | * use it to send out the auth req and reassoc req for 11r FT Assoc. |
| 9942 | * |
| 9943 | * Return: 0 on success, non-zero on error |
| 9944 | */ |
| 9945 | static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info, |
| 9946 | union iwreq_data *wrqu, char *extra) |
| 9947 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9948 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9949 | 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] | 9950 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9951 | int ret; |
| 9952 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 9953 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9954 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9955 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9956 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9957 | if (0 != ret) |
| 9958 | return ret; |
| 9959 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 9960 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 9961 | if (0 != ret) |
| 9962 | return ret; |
| 9963 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9964 | if (!wrqu->data.length) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9965 | hdd_err("called with 0 length IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9966 | return -EINVAL; |
| 9967 | } |
| 9968 | if (wrqu->data.pointer == NULL) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 9969 | hdd_err("called with NULL IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9970 | return -EINVAL; |
| 9971 | } |
| 9972 | /* Added for debug on reception of Re-assoc Req. */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 9973 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9974 | hdd_debug("Called with Ie of length = %d when not associated", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9975 | wrqu->data.length); |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9976 | hdd_debug("Should be Re-assoc Req IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9977 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 9978 | hdd_debug("called with Ie of length = %d", wrqu->data.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9979 | |
| 9980 | /* Pass the received FT IEs to SME */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 9981 | sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(adapter), adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9982 | extra, wrqu->data.length); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 9983 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9984 | return 0; |
| 9985 | } |
| 9986 | |
| 9987 | static int iw_set_fties(struct net_device *dev, |
| 9988 | struct iw_request_info *info, |
| 9989 | union iwreq_data *wrqu, char *extra) |
| 9990 | { |
| 9991 | int ret; |
| 9992 | |
| 9993 | cds_ssr_protect(__func__); |
| 9994 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 9995 | cds_ssr_unprotect(__func__); |
| 9996 | |
| 9997 | return ret; |
| 9998 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9999 | |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10000 | /** |
| 10001 | * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler |
| 10002 | * @dev: device upon which the ioctl was received |
| 10003 | * @info: ioctl request information |
| 10004 | * @wrqu: ioctl request data |
| 10005 | * @extra: ioctl extra data |
| 10006 | * |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 10007 | * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the |
| 10008 | * time being to provide guidance in migrating to standard APIs. |
| 10009 | * |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10010 | * Return: 0 on success, non-zero on error |
| 10011 | */ |
| 10012 | static int iw_set_dynamic_mcbc_filter(struct net_device *dev, |
| 10013 | struct iw_request_info *info, |
| 10014 | union iwreq_data *wrqu, |
| 10015 | char *extra) |
| 10016 | { |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 10017 | hdd_err("\n" |
| 10018 | "setMCBCFilter is obsolete. Use the following instead:\n" |
| 10019 | "Configure multicast filtering via the ‘ip’ command.\n" |
| 10020 | "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n" |
| 10021 | "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n" |
| 10022 | "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n" |
| 10023 | "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n" |
| 10024 | "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic"); |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 10025 | return -EINVAL; |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 10026 | } |
| 10027 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10028 | /** |
| 10029 | * iw_set_host_offload - Set host offload ioctl handler |
| 10030 | * @dev: device upon which the ioctl was received |
| 10031 | * @info: ioctl request information |
| 10032 | * @wrqu: ioctl request data |
| 10033 | * @extra: ioctl extra data |
| 10034 | * |
| 10035 | * Return: 0 on success, non-zero on error |
| 10036 | */ |
| 10037 | static int __iw_set_host_offload(struct net_device *dev, |
| 10038 | struct iw_request_info *info, |
| 10039 | union iwreq_data *wrqu, char *extra) |
| 10040 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10041 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Srinivas Girigowda | 077143e | 2017-03-25 10:47:27 -0700 | [diff] [blame] | 10042 | struct host_offload_req *pRequest = (struct host_offload_req *) extra; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10043 | tSirHostOffloadReq offloadRequest; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10044 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10045 | int ret; |
| 10046 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10047 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10048 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10049 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10050 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10051 | if (0 != ret) |
| 10052 | return ret; |
| 10053 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10054 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10055 | if (0 != ret) |
| 10056 | return ret; |
| 10057 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10058 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10059 | hdd_err("dev is not in CONNECTED state, ignore!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10060 | return -EINVAL; |
| 10061 | } |
| 10062 | |
| 10063 | /* Debug display of request components. */ |
| 10064 | switch (pRequest->offloadType) { |
| 10065 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10066 | hdd_debug("Host offload request: ARP reply"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10067 | switch (pRequest->enableOrDisable) { |
| 10068 | case WLAN_OFFLOAD_DISABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10069 | hdd_debug(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10070 | break; |
| 10071 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10072 | hdd_debug(" BC Filtering enable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10073 | case WLAN_OFFLOAD_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10074 | hdd_debug(" ARP offload enable"); |
| 10075 | hdd_debug(" IP address: %d.%d.%d.%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10076 | pRequest->params.hostIpv4Addr[0], |
| 10077 | pRequest->params.hostIpv4Addr[1], |
| 10078 | pRequest->params.hostIpv4Addr[2], |
| 10079 | pRequest->params.hostIpv4Addr[3]); |
| 10080 | } |
| 10081 | break; |
| 10082 | |
| 10083 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10084 | hdd_debug("Host offload request: neighbor discovery"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10085 | switch (pRequest->enableOrDisable) { |
| 10086 | case WLAN_OFFLOAD_DISABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10087 | hdd_debug(" disable"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10088 | break; |
| 10089 | case WLAN_OFFLOAD_ENABLE: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10090 | hdd_debug(" enable"); |
| 10091 | hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10092 | *(uint16_t *) (pRequest->params.hostIpv6Addr), |
| 10093 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10094 | 2), |
| 10095 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10096 | 4), |
| 10097 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10098 | 6), |
| 10099 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10100 | 8), |
| 10101 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10102 | 10), |
| 10103 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10104 | 12), |
| 10105 | *(uint16_t *) (pRequest->params.hostIpv6Addr + |
| 10106 | 14)); |
| 10107 | } |
| 10108 | } |
| 10109 | |
| 10110 | /* Execute offload request. The reason that we can copy the |
| 10111 | * request information from the ioctl structure to the SME |
| 10112 | * structure is that they are laid out exactly the same. |
| 10113 | * Otherwise, each piece of information would have to be |
| 10114 | * copied individually. |
| 10115 | */ |
| 10116 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10117 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10118 | sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(adapter), |
| 10119 | adapter->sessionId, &offloadRequest)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10120 | hdd_err("Failure to execute host offload request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10121 | return -EINVAL; |
| 10122 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10123 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10124 | return 0; |
| 10125 | } |
| 10126 | |
| 10127 | static int iw_set_host_offload(struct net_device *dev, |
| 10128 | struct iw_request_info *info, |
| 10129 | union iwreq_data *wrqu, char *extra) |
| 10130 | { |
| 10131 | int ret; |
| 10132 | |
| 10133 | cds_ssr_protect(__func__); |
| 10134 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 10135 | cds_ssr_unprotect(__func__); |
| 10136 | |
| 10137 | return ret; |
| 10138 | } |
| 10139 | |
| 10140 | /** |
| 10141 | * iw_set_keepalive_params - Set keepalive params ioctl handler |
| 10142 | * @dev: device upon which the ioctl was received |
| 10143 | * @info: ioctl request information |
| 10144 | * @wrqu: ioctl request data |
| 10145 | * @extra: ioctl extra data |
| 10146 | * |
| 10147 | * Return: 0 on success, non-zero on error |
| 10148 | */ |
| 10149 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 10150 | struct iw_request_info *info, |
| 10151 | union iwreq_data *wrqu, char *extra) |
| 10152 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10153 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10154 | tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10155 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10156 | int ret; |
| 10157 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10158 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10159 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10160 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10161 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10162 | if (0 != ret) |
| 10163 | return ret; |
| 10164 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10165 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10166 | if (0 != ret) |
| 10167 | return ret; |
| 10168 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10169 | if (wrqu->data.length != sizeof(*request)) { |
| 10170 | hdd_err("Invalid length %d", wrqu->data.length); |
| 10171 | return -EINVAL; |
| 10172 | } |
| 10173 | |
| 10174 | if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) { |
| 10175 | hdd_err("Value of timePeriod %d exceed Max limit %d", |
| 10176 | request->timePeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10177 | WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX); |
| 10178 | return -EINVAL; |
| 10179 | } |
| 10180 | |
| 10181 | /* Debug display of request components. */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10182 | hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10183 | request->timePeriod, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10184 | |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10185 | switch (request->packetType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10186 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10187 | hdd_debug("Keep Alive Request: Tx NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10188 | break; |
| 10189 | |
| 10190 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10191 | hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10192 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10193 | hdd_debug("Host IP address: %d.%d.%d.%d", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10194 | request->hostIpv4Addr[0], request->hostIpv4Addr[1], |
| 10195 | request->hostIpv4Addr[2], request->hostIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10196 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10197 | hdd_debug("Dest IP address: %d.%d.%d.%d", |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10198 | request->destIpv4Addr[0], request->destIpv4Addr[1], |
| 10199 | request->destIpv4Addr[2], request->destIpv4Addr[3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10200 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10201 | hdd_debug("Dest MAC address: "MAC_ADDRESS_STR, |
Srinivas Girigowda | 9c330a9 | 2015-11-24 12:28:25 -0800 | [diff] [blame] | 10202 | MAC_ADDR_ARRAY(request->dest_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10203 | break; |
| 10204 | } |
| 10205 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10206 | hdd_debug("Keep alive period %d", request->timePeriod); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10207 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10208 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10209 | sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(adapter), |
| 10210 | adapter->sessionId, request)) { |
Rajeev Kumar | 3ddf1c6 | 2015-11-03 14:10:13 -0800 | [diff] [blame] | 10211 | hdd_err("Failure to execute Keep Alive"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10212 | return -EINVAL; |
| 10213 | } |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10214 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10215 | return 0; |
| 10216 | } |
| 10217 | |
| 10218 | static int iw_set_keepalive_params(struct net_device *dev, |
| 10219 | struct iw_request_info *info, |
| 10220 | union iwreq_data *wrqu, |
| 10221 | char *extra) |
| 10222 | { |
| 10223 | int ret; |
| 10224 | |
| 10225 | cds_ssr_protect(__func__); |
| 10226 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 10227 | cds_ssr_unprotect(__func__); |
| 10228 | |
| 10229 | return ret; |
| 10230 | } |
| 10231 | |
| 10232 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 10233 | /** |
| 10234 | * wlan_hdd_set_filter() - Set packet filter |
| 10235 | * @hdd_ctx: Global HDD context |
| 10236 | * @request: Packet filter request struct |
| 10237 | * @sessionId: Target session for the request |
| 10238 | * |
| 10239 | * Return: 0 on success, non-zero on error |
| 10240 | */ |
Hanumanth Reddy Pothula | 3def894 | 2017-10-05 16:19:36 +0530 | [diff] [blame] | 10241 | int wlan_hdd_set_filter(struct hdd_context *hdd_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10242 | struct pkt_filter_cfg *request, |
| 10243 | uint8_t sessionId) |
| 10244 | { |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10245 | struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req = NULL; |
| 10246 | 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] | 10247 | int i = 0; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10248 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10249 | |
| 10250 | if (hdd_ctx->config->disablePacketFilter) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10251 | hdd_warn("Packet filtering disabled in ini"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10252 | return 0; |
| 10253 | } |
| 10254 | |
| 10255 | /* Debug display of request components. */ |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10256 | hdd_debug("Packet Filter Request : FA %d params %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10257 | request->filter_action, request->num_params); |
| 10258 | |
| 10259 | switch (request->filter_action) { |
| 10260 | case HDD_RCV_FILTER_SET: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10261 | hdd_debug("Set Packet Filter Request for Id: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10262 | request->filter_id); |
| 10263 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10264 | pmo_set_pkt_fltr_req = |
| 10265 | qdf_mem_malloc(sizeof(*pmo_set_pkt_fltr_req)); |
| 10266 | if (!pmo_set_pkt_fltr_req) { |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 10267 | hdd_err("unable to allocate pmo_set_pkt_fltr_req"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10268 | return QDF_STATUS_E_NOMEM; |
| 10269 | } |
| 10270 | |
| 10271 | pmo_set_pkt_fltr_req->filter_id = request->filter_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10272 | if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) { |
| 10273 | hdd_err("Number of Params exceed Max limit %d", |
| 10274 | request->num_params); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10275 | status = QDF_STATUS_E_INVAL; |
| 10276 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10277 | } |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10278 | pmo_set_pkt_fltr_req->num_params = request->num_params; |
| 10279 | pmo_set_pkt_fltr_req->coalesce_time = 0; |
Srinivas Girigowda | bbbecad | 2017-06-28 16:01:48 -0700 | [diff] [blame] | 10280 | 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] | 10281 | for (i = 0; i < request->num_params; i++) { |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10282 | pmo_set_pkt_fltr_req->params_data[i].protocol_layer = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10283 | request->params_data[i].protocol_layer; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10284 | pmo_set_pkt_fltr_req->params_data[i].compare_flag = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10285 | request->params_data[i].compare_flag; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10286 | pmo_set_pkt_fltr_req->params_data[i].data_offset = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10287 | request->params_data[i].data_offset; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10288 | pmo_set_pkt_fltr_req->params_data[i].data_length = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10289 | request->params_data[i].data_length; |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10290 | pmo_set_pkt_fltr_req->params_data[i].reserved = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10291 | |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 10292 | if (request->params_data[i].data_offset > |
| 10293 | SIR_MAX_FILTER_TEST_DATA_OFFSET) { |
| 10294 | hdd_err("Invalid data offset %u for param %d (max = %d)", |
| 10295 | request->params_data[i].data_offset, |
| 10296 | i, |
| 10297 | SIR_MAX_FILTER_TEST_DATA_OFFSET); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10298 | status = QDF_STATUS_E_INVAL; |
| 10299 | goto out; |
Dustin Brown | 4d1e846 | 2016-12-14 12:12:24 -0800 | [diff] [blame] | 10300 | } |
| 10301 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10302 | if (request->params_data[i].data_length > |
| 10303 | SIR_MAX_FILTER_TEST_DATA_LEN) { |
| 10304 | hdd_err("Error invalid data length %d", |
| 10305 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10306 | status = QDF_STATUS_E_INVAL; |
| 10307 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10308 | } |
| 10309 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10310 | hdd_debug("Proto %d Comp Flag %d Filter Type %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10311 | request->params_data[i].protocol_layer, |
| 10312 | request->params_data[i].compare_flag, |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10313 | pmo_set_pkt_fltr_req->filter_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10314 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10315 | hdd_debug("Data Offset %d Data Len %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10316 | request->params_data[i].data_offset, |
| 10317 | request->params_data[i].data_length); |
| 10318 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10319 | if (sizeof( |
| 10320 | pmo_set_pkt_fltr_req->params_data[i].compare_data) |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 10321 | < (request->params_data[i].data_length)) { |
| 10322 | hdd_err("Error invalid data length %d", |
| 10323 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10324 | status = QDF_STATUS_E_INVAL; |
| 10325 | goto out; |
Rajeev Kumar | f5b6da2 | 2016-04-15 13:24:03 -0700 | [diff] [blame] | 10326 | } |
| 10327 | |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10328 | memcpy( |
| 10329 | &pmo_set_pkt_fltr_req->params_data[i].compare_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10330 | request->params_data[i].compare_data, |
| 10331 | request->params_data[i].data_length); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10332 | memcpy(&pmo_set_pkt_fltr_req->params_data[i].data_mask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10333 | request->params_data[i].data_mask, |
| 10334 | request->params_data[i].data_length); |
| 10335 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10336 | 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] | 10337 | request->params_data[i].compare_data[0], |
| 10338 | request->params_data[i].compare_data[1], |
| 10339 | request->params_data[i].compare_data[2], |
| 10340 | request->params_data[i].compare_data[3], |
| 10341 | request->params_data[i].compare_data[4], |
| 10342 | request->params_data[i].compare_data[5]); |
| 10343 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10344 | 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] | 10345 | request->params_data[i].data_mask[0], |
| 10346 | request->params_data[i].data_mask[1], |
| 10347 | request->params_data[i].data_mask[2], |
| 10348 | request->params_data[i].data_mask[3], |
| 10349 | request->params_data[i].data_mask[4], |
| 10350 | request->params_data[i].data_mask[5]); |
| 10351 | } |
| 10352 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10353 | if (QDF_STATUS_SUCCESS != |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10354 | pmo_ucfg_set_pkt_filter(hdd_ctx->hdd_psoc, |
| 10355 | pmo_set_pkt_fltr_req, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10356 | sessionId)) { |
| 10357 | hdd_err("Failure to execute Set Filter"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10358 | status = QDF_STATUS_E_INVAL; |
| 10359 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10360 | } |
| 10361 | |
| 10362 | break; |
| 10363 | |
| 10364 | case HDD_RCV_FILTER_CLEAR: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10365 | hdd_debug("Clear Packet Filter Request for Id: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10366 | request->filter_id); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10367 | |
| 10368 | pmo_clr_pkt_fltr_param = qdf_mem_malloc( |
| 10369 | sizeof(*pmo_clr_pkt_fltr_param)); |
| 10370 | if (!pmo_clr_pkt_fltr_param) { |
| 10371 | hdd_err("unable to allocate pmo_clr_pkt_fltr_param"); |
| 10372 | return QDF_STATUS_E_NOMEM; |
| 10373 | } |
| 10374 | |
| 10375 | pmo_clr_pkt_fltr_param->filter_id = request->filter_id; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10376 | if (QDF_STATUS_SUCCESS != |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10377 | pmo_ucfg_clear_pkt_filter(hdd_ctx->hdd_psoc, |
| 10378 | pmo_clr_pkt_fltr_param, |
| 10379 | sessionId)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10380 | hdd_err("Failure to execute Clear Filter"); |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10381 | status = QDF_STATUS_E_INVAL; |
| 10382 | goto out; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10383 | } |
| 10384 | break; |
| 10385 | |
| 10386 | default: |
| 10387 | hdd_err("Packet Filter Request: Invalid %d", |
| 10388 | request->filter_action); |
| 10389 | return -EINVAL; |
| 10390 | } |
Ravi Kumar Bokka | 4bd571d | 2017-04-17 14:21:10 +0530 | [diff] [blame] | 10391 | |
| 10392 | out: |
| 10393 | if (pmo_set_pkt_fltr_req) |
| 10394 | qdf_mem_free(pmo_set_pkt_fltr_req); |
| 10395 | if (pmo_clr_pkt_fltr_param) |
| 10396 | qdf_mem_free(pmo_clr_pkt_fltr_param); |
| 10397 | |
| 10398 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10399 | } |
| 10400 | |
| 10401 | /** |
| 10402 | * __iw_set_packet_filter_params() - set packet filter parameters in target |
| 10403 | * @dev: Pointer to netdev |
| 10404 | * @info: Pointer to iw request info |
| 10405 | * @wrqu: Pointer to data |
| 10406 | * @extra: Pointer to extra data |
| 10407 | * |
| 10408 | * Return: 0 on success, non-zero on error |
| 10409 | */ |
| 10410 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 10411 | struct iw_request_info *info, |
| 10412 | union iwreq_data *wrqu, char *extra) |
| 10413 | { |
| 10414 | int ret; |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10415 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10416 | struct iw_point priv_data; |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 10417 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10418 | struct pkt_filter_cfg *request = NULL; |
| 10419 | |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 10420 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10421 | hdd_err("permission check failed"); |
Mukul Sharma | 472382f | 2015-11-02 20:16:31 +0530 | [diff] [blame] | 10422 | return -EPERM; |
| 10423 | } |
| 10424 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10425 | ENTER_DEV(dev); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10426 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10427 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 10428 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10429 | if (0 != ret) |
| 10430 | return ret; |
| 10431 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10432 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10433 | if (0 != ret) |
| 10434 | return ret; |
| 10435 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10436 | if (hdd_priv_get_data(&priv_data, wrqu)) { |
| 10437 | hdd_err("failed to get priv data"); |
| 10438 | return -EINVAL; |
| 10439 | } |
| 10440 | |
| 10441 | if ((NULL == priv_data.pointer) || (0 == priv_data.length)) { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 10442 | hdd_err("invalid priv data %pK or invalid priv data length %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10443 | priv_data.pointer, priv_data.length); |
| 10444 | return -EINVAL; |
| 10445 | } |
| 10446 | |
Arun Khandavalli | 75d246b | 2017-08-07 19:46:06 +0530 | [diff] [blame] | 10447 | if (adapter->device_mode != QDF_STA_MODE) { |
| 10448 | hdd_err("Packet filter not supported for this mode :%d", |
| 10449 | adapter->device_mode); |
| 10450 | return -ENOTSUPP; |
| 10451 | } |
| 10452 | |
Mukul Sharma | be846bb | 2017-05-09 17:41:52 +0530 | [diff] [blame] | 10453 | if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) { |
| 10454 | hdd_err("Packet filter not supported in disconnected state"); |
| 10455 | return -ENOTSUPP; |
| 10456 | } |
| 10457 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10458 | /* copy data using copy_from_user */ |
| 10459 | request = mem_alloc_copy_from_user_helper(priv_data.pointer, |
| 10460 | priv_data.length); |
| 10461 | if (NULL == request) { |
| 10462 | hdd_err("mem_alloc_copy_from_user_helper fail"); |
| 10463 | return -ENOMEM; |
| 10464 | } |
| 10465 | |
Hanumanth Reddy Pothula | 3def894 | 2017-10-05 16:19:36 +0530 | [diff] [blame] | 10466 | if (request->filter_action == HDD_RCV_FILTER_SET) |
| 10467 | hdd_ctx->user_configured_pkt_filter_rules |= |
| 10468 | 1 << request->filter_id; |
| 10469 | else if (request->filter_action == HDD_RCV_FILTER_CLEAR) |
| 10470 | hdd_ctx->user_configured_pkt_filter_rules &= |
| 10471 | ~(1 << request->filter_id); |
| 10472 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10473 | ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId); |
| 10474 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 10475 | qdf_mem_free(request); |
Hanumantha Reddy Pothula | 2db50ed | 2015-11-23 10:48:33 +0530 | [diff] [blame] | 10476 | EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10477 | return ret; |
| 10478 | } |
| 10479 | |
| 10480 | /** |
| 10481 | * iw_set_packet_filter_params() - set packet filter parameters in target |
| 10482 | * @dev: Pointer to netdev |
| 10483 | * @info: Pointer to iw request info |
| 10484 | * @wrqu: Pointer to data |
| 10485 | * @extra: Pointer to extra data |
| 10486 | * |
| 10487 | * Return: 0 on success, non-zero on error |
| 10488 | */ |
| 10489 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 10490 | struct iw_request_info *info, |
| 10491 | union iwreq_data *wrqu, char *extra) |
| 10492 | { |
| 10493 | int ret; |
| 10494 | |
| 10495 | cds_ssr_protect(__func__); |
| 10496 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 10497 | cds_ssr_unprotect(__func__); |
| 10498 | |
| 10499 | return ret; |
| 10500 | } |
| 10501 | #endif |
| 10502 | |
| 10503 | |
| 10504 | static int __iw_get_statistics(struct net_device *dev, |
| 10505 | struct iw_request_info *info, |
| 10506 | union iwreq_data *wrqu, char *extra) |
| 10507 | { |
| 10508 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 10509 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10510 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 10511 | struct hdd_wext_state *pWextState; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10512 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10513 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10514 | char *p = extra; |
| 10515 | int tlen = 0; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10516 | tCsrSummaryStatsInfo *pStats = &(adapter->hdd_stats.summary_stat); |
| 10517 | tCsrGlobalClassAStatsInfo *aStats = &(adapter->hdd_stats.ClassA_stat); |
| 10518 | tCsrGlobalClassDStatsInfo *dStats = &(adapter->hdd_stats.ClassD_stat); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10519 | int ret; |
| 10520 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10521 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10522 | |
| 10523 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10524 | if (0 != ret) |
| 10525 | return ret; |
| 10526 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10527 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10528 | if (0 != ret) |
| 10529 | return ret; |
| 10530 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10531 | if (eConnectionState_Associated != |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10532 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter))->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10533 | |
| 10534 | wrqu->txpower.value = 0; |
| 10535 | } else { |
| 10536 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 10537 | SME_SUMMARY_STATS | |
| 10538 | SME_GLOBAL_CLASSA_STATS | |
Jeff Johnson | dfe8951 | 2017-03-10 15:50:00 -0800 | [diff] [blame] | 10539 | SME_GLOBAL_CLASSD_STATS, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 10540 | hdd_statistics_cb, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10541 | (WLAN_HDD_GET_STATION_CTX_PTR |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10542 | (adapter))->conn_info.staId[0], |
| 10543 | adapter, adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10544 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10545 | if (QDF_STATUS_SUCCESS != status) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10546 | hdd_err("Unable to retrieve SME statistics"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10547 | return -EINVAL; |
| 10548 | } |
| 10549 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10550 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10551 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 10552 | qdf_status = |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10553 | qdf_wait_single_event(&pWextState->hdd_qdf_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10554 | WLAN_WAIT_TIME_STATS); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 10555 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 10556 | hdd_err("SME timeout while retrieving statistics"); |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10557 | /* Remove the SME statistics list by |
| 10558 | * passing NULL in callback argument |
| 10559 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10560 | status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD, |
| 10561 | SME_SUMMARY_STATS | |
| 10562 | SME_GLOBAL_CLASSA_STATS | |
Jeff Johnson | dfe8951 | 2017-03-10 15:50:00 -0800 | [diff] [blame] | 10563 | SME_GLOBAL_CLASSD_STATS, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 10564 | NULL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10565 | (WLAN_HDD_GET_STATION_CTX_PTR |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 10566 | (adapter))->conn_info. |
| 10567 | staId[0], adapter, |
| 10568 | adapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10569 | |
| 10570 | return -EINVAL; |
| 10571 | } |
| 10572 | FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT, |
| 10573 | (uint8_t) sizeof(pStats->retry_cnt), |
| 10574 | (char *)&(pStats->retry_cnt[0]), tlen); |
| 10575 | |
| 10576 | FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT, |
| 10577 | (uint8_t) sizeof(pStats->multiple_retry_cnt), |
| 10578 | (char *)&(pStats->multiple_retry_cnt[0]), tlen); |
| 10579 | |
| 10580 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT, |
| 10581 | (uint8_t) sizeof(pStats->tx_frm_cnt), |
| 10582 | (char *)&(pStats->tx_frm_cnt[0]), tlen); |
| 10583 | |
| 10584 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT, |
| 10585 | (uint8_t) sizeof(pStats->rx_frm_cnt), |
| 10586 | (char *)&(pStats->rx_frm_cnt), tlen); |
| 10587 | |
| 10588 | FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT, |
| 10589 | (uint8_t) sizeof(pStats->frm_dup_cnt), |
| 10590 | (char *)&(pStats->frm_dup_cnt), tlen); |
| 10591 | |
| 10592 | FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT, |
| 10593 | (uint8_t) sizeof(pStats->fail_cnt), |
| 10594 | (char *)&(pStats->fail_cnt[0]), tlen); |
| 10595 | |
| 10596 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT, |
| 10597 | (uint8_t) sizeof(pStats->rts_fail_cnt), |
| 10598 | (char *)&(pStats->rts_fail_cnt), tlen); |
| 10599 | |
| 10600 | FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT, |
| 10601 | (uint8_t) sizeof(pStats->ack_fail_cnt), |
| 10602 | (char *)&(pStats->ack_fail_cnt), tlen); |
| 10603 | |
| 10604 | FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT, |
| 10605 | (uint8_t) sizeof(pStats->rts_succ_cnt), |
| 10606 | (char *)&(pStats->rts_succ_cnt), tlen); |
| 10607 | |
| 10608 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT, |
| 10609 | (uint8_t) sizeof(pStats->rx_discard_cnt), |
| 10610 | (char *)&(pStats->rx_discard_cnt), tlen); |
| 10611 | |
| 10612 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT, |
| 10613 | (uint8_t) sizeof(pStats->rx_error_cnt), |
| 10614 | (char *)&(pStats->rx_error_cnt), tlen); |
| 10615 | |
| 10616 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT, |
| 10617 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 10618 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 10619 | |
| 10620 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT, |
| 10621 | (uint8_t) sizeof(dStats->rx_byte_cnt), |
| 10622 | (char *)&(dStats->rx_byte_cnt), tlen); |
| 10623 | |
| 10624 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE, |
| 10625 | (uint8_t) sizeof(dStats->rx_rate), |
| 10626 | (char *)&(dStats->rx_rate), tlen); |
| 10627 | |
| 10628 | /* Transmit rate, in units of 500 kbit/sec */ |
| 10629 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE, |
| 10630 | (uint8_t) sizeof(aStats->tx_rate), |
| 10631 | (char *)&(aStats->tx_rate), tlen); |
| 10632 | |
| 10633 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT, |
| 10634 | (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]), |
| 10635 | (char *)&(dStats->rx_uc_byte_cnt[0]), tlen); |
| 10636 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT, |
| 10637 | (uint8_t) sizeof(dStats->rx_mc_byte_cnt), |
| 10638 | (char *)&(dStats->rx_mc_byte_cnt), tlen); |
| 10639 | FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT, |
| 10640 | (uint8_t) sizeof(dStats->rx_bc_byte_cnt), |
| 10641 | (char *)&(dStats->rx_bc_byte_cnt), tlen); |
| 10642 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT, |
| 10643 | (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]), |
| 10644 | (char *)&(dStats->tx_uc_byte_cnt[0]), tlen); |
| 10645 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT, |
| 10646 | (uint8_t) sizeof(dStats->tx_mc_byte_cnt), |
| 10647 | (char *)&(dStats->tx_mc_byte_cnt), tlen); |
| 10648 | FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT, |
| 10649 | (uint8_t) sizeof(dStats->tx_bc_byte_cnt), |
| 10650 | (char *)&(dStats->tx_bc_byte_cnt), tlen); |
| 10651 | |
| 10652 | wrqu->data.length = tlen; |
| 10653 | |
| 10654 | } |
| 10655 | |
| 10656 | EXIT(); |
| 10657 | |
| 10658 | return 0; |
| 10659 | } |
| 10660 | |
| 10661 | static int iw_get_statistics(struct net_device *dev, |
| 10662 | struct iw_request_info *info, |
| 10663 | union iwreq_data *wrqu, char *extra) |
| 10664 | { |
| 10665 | int ret; |
| 10666 | |
| 10667 | cds_ssr_protect(__func__); |
| 10668 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 10669 | cds_ssr_unprotect(__func__); |
| 10670 | |
| 10671 | return ret; |
| 10672 | } |
| 10673 | |
| 10674 | #ifdef FEATURE_WLAN_SCAN_PNO |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10675 | /*Max Len for PNO notification*/ |
| 10676 | #define MAX_PNO_NOTIFY_LEN 100 |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10677 | static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev, |
| 10678 | struct scan_event *event, void *args) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10679 | { |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10680 | struct vdev_osif_priv *osif_priv; |
| 10681 | struct wireless_dev *wdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10682 | union iwreq_data wrqu; |
| 10683 | char buf[MAX_PNO_NOTIFY_LEN + 1]; |
| 10684 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10685 | wlan_vdev_obj_lock(vdev); |
| 10686 | osif_priv = wlan_vdev_get_ospriv(vdev); |
| 10687 | wlan_vdev_obj_unlock(vdev); |
| 10688 | if (!osif_priv) { |
| 10689 | hdd_err("osif_priv is null"); |
| 10690 | return; |
| 10691 | } |
| 10692 | |
| 10693 | wdev = osif_priv->wdev; |
| 10694 | if (!wdev) { |
| 10695 | hdd_err("wdev is null"); |
| 10696 | return; |
| 10697 | } |
| 10698 | |
| 10699 | hdd_debug("A preferred network was found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10700 | |
| 10701 | /* create the event */ |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10702 | qdf_mem_zero(&wrqu, sizeof(wrqu)); |
| 10703 | qdf_mem_zero(buf, sizeof(buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10704 | |
| 10705 | snprintf(buf, MAX_PNO_NOTIFY_LEN, |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10706 | "QCOM: Found preferred network:"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10707 | |
| 10708 | wrqu.data.pointer = buf; |
| 10709 | wrqu.data.length = strlen(buf); |
| 10710 | |
| 10711 | /* send the event */ |
| 10712 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10713 | wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10714 | } |
| 10715 | |
| 10716 | /** |
| 10717 | * __iw_set_pno() - Preferred Network Offload ioctl handler |
| 10718 | * @dev: device upon which the ioctl was received |
| 10719 | * @info: ioctl request information |
| 10720 | * @wrqu: ioctl request data |
| 10721 | * @extra: ioctl extra data |
| 10722 | * |
| 10723 | * This function parses a Preferred Network Offload command |
| 10724 | * Input is string based and expected to be of the form: |
| 10725 | * |
| 10726 | * <enable(1) | disable(0)> |
| 10727 | * when enabling: |
| 10728 | * <number of networks> |
| 10729 | * for each network: |
| 10730 | * <ssid_len> <ssid> <authentication> <encryption> |
| 10731 | * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10732 | * <scan_time (seconds)> |
| 10733 | * <scan_repeat_count (0 means indefinite)> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10734 | * <suspend mode> |
| 10735 | * |
| 10736 | * e.g: |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10737 | * 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] | 10738 | * |
| 10739 | * this translates into: |
| 10740 | * ----------------------------- |
| 10741 | * enable PNO |
| 10742 | * 2 networks |
| 10743 | * Network 1: |
| 10744 | * test - with authentication type 0 and encryption type 0, |
| 10745 | * search on 3 channels: 1 6 and 11, |
| 10746 | * SSID bcast type is unknown (directed probe will be sent if |
| 10747 | * AP not found) and must meet -40dBm RSSI |
| 10748 | * Network 2: |
| 10749 | * test2 - with authentication type 4 and encryption type 4, |
| 10750 | * search on 6 channels 1, 2, 3, 4, 5 and 6 |
| 10751 | * bcast type is non-bcast (directed probe will be sent) |
| 10752 | * and must not meet any RSSI threshold |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10753 | * scan every 5 seconds 2 times |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10754 | * enable on suspend |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10755 | */ |
| 10756 | static int __iw_set_pno(struct net_device *dev, |
| 10757 | struct iw_request_info *info, |
| 10758 | union iwreq_data *wrqu, char *extra) |
| 10759 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 10760 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 10761 | struct hdd_context *hdd_ctx; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10762 | uint8_t value; |
| 10763 | struct wlan_objmgr_vdev *vdev; |
| 10764 | struct wlan_objmgr_psoc *psoc; |
| 10765 | int ret = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10766 | int offset; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10767 | char *ptr, *data; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10768 | uint8_t i, j, params; |
| 10769 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10770 | size_t len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10771 | |
| 10772 | /* request is a large struct, so we make it static to avoid |
| 10773 | * stack overflow. This API is only invoked via ioctl, so it |
| 10774 | * is serialized by the kernel rtnl_lock and hence does not |
| 10775 | * need to be reentrant |
| 10776 | */ |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10777 | static struct pno_scan_req_params req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10778 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 10779 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10780 | |
| 10781 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 10782 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10783 | if (ret) |
| 10784 | return ret; |
| 10785 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 10786 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 10787 | if (0 != ret) |
| 10788 | return ret; |
| 10789 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10790 | vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev, |
| 10791 | dev->dev_addr, WLAN_LEGACY_MAC_ID); |
| 10792 | if (!vdev) { |
| 10793 | hdd_err("vdev object is NULL"); |
| 10794 | return -EIO; |
| 10795 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10796 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10797 | hdd_debug("PNO data len %d data %s", wrqu->data.length, extra); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10798 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10799 | /* making sure argument string ends with '\0' */ |
| 10800 | len = (wrqu->data.length + 1); |
| 10801 | data = qdf_mem_malloc(len); |
| 10802 | if (!data) { |
| 10803 | hdd_err("fail to allocate memory %zu", len); |
| 10804 | return -EINVAL; |
| 10805 | } |
| 10806 | qdf_mem_copy(data, extra, (len-1)); |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10807 | ptr = data; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10808 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10809 | if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10810 | hdd_err("PNO enable input is not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10811 | ret = -EINVAL; |
| 10812 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10813 | } |
| 10814 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10815 | if (!value) { |
| 10816 | status = ucfg_scan_pno_stop(vdev); |
| 10817 | if (QDF_IS_STATUS_ERROR(status)) { |
| 10818 | hdd_err("Failed to disabled PNO"); |
| 10819 | ret = -EINVAL; |
| 10820 | } else { |
| 10821 | hdd_debug("PNO scan disabled"); |
| 10822 | } |
| 10823 | goto exit; |
| 10824 | } |
| 10825 | |
| 10826 | if (ucfg_scan_get_pno_in_progress(vdev)) { |
| 10827 | hdd_debug("pno is already in progress"); |
| 10828 | ret = -EBUSY; |
| 10829 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10830 | } |
| 10831 | |
| 10832 | ptr += offset; |
| 10833 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10834 | if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10835 | hdd_err("PNO count input not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10836 | ret = -EINVAL; |
| 10837 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10838 | } |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10839 | req.networks_cnt = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10840 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10841 | hdd_debug("PNO enable networks count %d offset %d", |
| 10842 | req.networks_cnt, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10843 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10844 | if ((0 == req.networks_cnt) || |
| 10845 | (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10846 | hdd_err("Network count %d invalid", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10847 | req.networks_cnt); |
| 10848 | ret = -EINVAL; |
| 10849 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10850 | } |
| 10851 | |
| 10852 | ptr += offset; |
| 10853 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10854 | for (i = 0; i < req.networks_cnt; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10855 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10856 | req.networks_list[i].ssid.length = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10857 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10858 | params = sscanf(ptr, " %hhu %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10859 | &(req.networks_list[i].ssid.length), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10860 | &offset); |
| 10861 | |
| 10862 | if (1 != params) { |
| 10863 | hdd_err("PNO ssid length input is not valid %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10864 | ret = -EINVAL; |
| 10865 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10866 | } |
| 10867 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10868 | if ((0 == req.networks_list[i].ssid.length) || |
| 10869 | (req.networks_list[i].ssid.length > 32)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10870 | hdd_err("SSID Len %d is not correct for network %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10871 | req.networks_list[i].ssid.length, i); |
| 10872 | ret = -EINVAL; |
| 10873 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10874 | } |
| 10875 | |
| 10876 | /* Advance to SSID */ |
| 10877 | ptr += offset; |
| 10878 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10879 | memcpy(req.networks_list[i].ssid.ssid, ptr, |
| 10880 | req.networks_list[i].ssid.length); |
| 10881 | ptr += req.networks_list[i].ssid.length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10882 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10883 | params = sscanf(ptr, " %u %u %hhu %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10884 | &(req.networks_list[i].authentication), |
| 10885 | &(req.networks_list[i].encryption), |
| 10886 | &(req.networks_list[i].channel_cnt), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10887 | &offset); |
| 10888 | |
| 10889 | if (3 != params) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10890 | hdd_err("Incorrect cmd %s", ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10891 | ret = -EINVAL; |
| 10892 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10893 | } |
| 10894 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10895 | 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] | 10896 | req.networks_list[i].ssid.length, |
| 10897 | req.networks_list[i].ssid.length, |
| 10898 | req.networks_list[i].ssid.ssid, |
| 10899 | req.networks_list[i].authentication, |
| 10900 | req.networks_list[i].encryption, |
| 10901 | req.networks_list[i].channel_cnt, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10902 | |
| 10903 | /* Advance to channel list */ |
| 10904 | ptr += offset; |
| 10905 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10906 | if (SCAN_PNO_MAX_NETW_CHANNELS_EX < |
| 10907 | req.networks_list[i].channel_cnt) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10908 | hdd_err("Incorrect number of channels"); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10909 | ret = -EINVAL; |
| 10910 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10911 | } |
| 10912 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10913 | if (0 != req.networks_list[i].channel_cnt) { |
| 10914 | for (j = 0; j < req.networks_list[i].channel_cnt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10915 | j++) { |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10916 | if (1 != sscanf(ptr, " %hhu %n", &value, |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10917 | &offset)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10918 | hdd_err("PNO network channel is not valid %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10919 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10920 | ret = -EINVAL; |
| 10921 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10922 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10923 | if (!IS_CHANNEL_VALID(value)) { |
| 10924 | hdd_err("invalid channel: %hhu", value); |
| 10925 | ret = -EINVAL; |
| 10926 | goto exit; |
| 10927 | } |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10928 | req.networks_list[i].channels[j] = |
| 10929 | cds_chan_to_freq(value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10930 | /* Advance to next channel number */ |
| 10931 | ptr += offset; |
| 10932 | } |
| 10933 | } |
| 10934 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10935 | if (1 != sscanf(ptr, " %u %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10936 | &(req.networks_list[i].bc_new_type), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10937 | &offset)) { |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 10938 | hdd_err("PNO broadcast network type is not valid %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10939 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10940 | ret = -EINVAL; |
| 10941 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10942 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10943 | if (req.networks_list[i].bc_new_type > 2) { |
| 10944 | hdd_err("invalid bcast nw type: %u", |
| 10945 | req.networks_list[i].bc_new_type); |
| 10946 | ret = -EINVAL; |
| 10947 | goto exit; |
| 10948 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10949 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10950 | hdd_debug("PNO bcastNetwType %d offset %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10951 | req.networks_list[i].bc_new_type, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10952 | |
| 10953 | /* Advance to rssi Threshold */ |
| 10954 | ptr += offset; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10955 | if (1 != sscanf(ptr, " %d %n", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10956 | &(req.networks_list[i].rssi_thresh), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10957 | &offset)) { |
| 10958 | hdd_err("PNO rssi threshold input is not valid %s", |
| 10959 | ptr); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10960 | ret = -EINVAL; |
| 10961 | goto exit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10962 | } |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 10963 | hdd_debug("PNO rssi %d offset %d", |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10964 | req.networks_list[i].rssi_thresh, offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10965 | /* Advance to next network */ |
| 10966 | ptr += offset; |
| 10967 | } /* For ucNetworkCount */ |
| 10968 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10969 | req.fast_scan_period = 0; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10970 | if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) { |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10971 | req.fast_scan_period *= MSEC_PER_SEC; |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10972 | ptr += offset; |
| 10973 | } |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10974 | if (req.fast_scan_period == 0) { |
| 10975 | hdd_err("invalid fast scan period %u", |
| 10976 | req.fast_scan_period); |
| 10977 | ret = -EINVAL; |
| 10978 | goto exit; |
| 10979 | } |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10980 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10981 | req.fast_scan_max_cycles = 0; |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 10982 | if (sscanf(ptr, " %hhu %n", &value, |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10983 | &offset) > 0) |
| 10984 | ptr += offset; |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10985 | req.fast_scan_max_cycles = value; |
Dustin Brown | 43e8729 | 2016-10-10 10:38:25 -0700 | [diff] [blame] | 10986 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10987 | wlan_pdev_obj_lock(hdd_ctx->hdd_pdev); |
| 10988 | psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev); |
| 10989 | wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev); |
| 10990 | ucfg_scan_register_pno_cb(psoc, |
| 10991 | found_pref_network_cb, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10992 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 10993 | ucfg_scan_get_pno_def_params(vdev, &req); |
| 10994 | status = ucfg_scan_pno_start(vdev, &req); |
| 10995 | if (QDF_IS_STATUS_ERROR(status)) { |
| 10996 | hdd_err("Failed to enable PNO"); |
| 10997 | ret = -EINVAL; |
| 10998 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10999 | |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11000 | exit: |
| 11001 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11002 | |
Hanumanth Reddy Pothula | 6310c77 | 2017-01-16 14:19:21 +0530 | [diff] [blame] | 11003 | qdf_mem_free(data); |
Abhishek Singh | 0481d66 | 2017-04-11 18:20:11 +0530 | [diff] [blame] | 11004 | return ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11005 | } |
| 11006 | |
| 11007 | static int iw_set_pno(struct net_device *dev, |
| 11008 | struct iw_request_info *info, |
| 11009 | union iwreq_data *wrqu, char *extra) |
| 11010 | { |
| 11011 | int ret; |
| 11012 | |
| 11013 | cds_ssr_protect(__func__); |
| 11014 | ret = __iw_set_pno(dev, info, wrqu, extra); |
| 11015 | cds_ssr_unprotect(__func__); |
| 11016 | |
| 11017 | return ret; |
| 11018 | } |
| 11019 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 11020 | |
| 11021 | /* Common function to SetBand */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11022 | int hdd_reg_set_band(struct net_device *dev, u8 ui_band) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11023 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11024 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11025 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11026 | enum band_info band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11027 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11028 | QDF_STATUS status; |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11029 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11030 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11031 | enum band_info currBand; |
| 11032 | enum band_info connectedBand; |
| 11033 | long lrc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11034 | |
| 11035 | pAdapterNode = NULL; |
| 11036 | pNext = NULL; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11037 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11038 | |
| 11039 | switch (ui_band) { |
| 11040 | case WLAN_HDD_UI_BAND_AUTO: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11041 | band = BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11042 | break; |
| 11043 | case WLAN_HDD_UI_BAND_5_GHZ: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11044 | band = BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11045 | break; |
| 11046 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11047 | band = BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11048 | break; |
| 11049 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11050 | hdd_err("Invalid band value %u", ui_band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11051 | return -EINVAL; |
| 11052 | } |
| 11053 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11054 | hdd_debug("change band to %u", band); |
| 11055 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11056 | if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) || |
Rajeev Kumar Sirasanagandla | 4c9b675 | 2017-07-25 20:35:20 +0530 | [diff] [blame] | 11057 | (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) || |
| 11058 | (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11059 | hdd_err("band value %u violate INI settings %u", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11060 | band, hdd_ctx->config->nBandCapability); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11061 | return -EIO; |
| 11062 | } |
| 11063 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11064 | if (band == BAND_ALL) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11065 | hdd_debug("Auto band received. Setting band same as ini value %d", |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11066 | hdd_ctx->config->nBandCapability); |
| 11067 | band = hdd_ctx->config->nBandCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11068 | } |
| 11069 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11070 | 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] | 11071 | &currBand)) { |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11072 | hdd_debug("Failed to get current band config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11073 | return -EIO; |
| 11074 | } |
| 11075 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11076 | if (currBand == band) |
| 11077 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11078 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11079 | hdd_ctx->curr_band = band; |
Amar Singhal | 58b45ef | 2017-08-01 13:43:54 -0700 | [diff] [blame] | 11080 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11081 | /* Change band request received. |
| 11082 | * Abort pending scan requests, flush the existing scan results, |
| 11083 | * and change the band capability |
| 11084 | */ |
| 11085 | hdd_debug("Current band value = %u, new setting %u ", |
| 11086 | currBand, band); |
| 11087 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11088 | status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11089 | while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11090 | adapter = pAdapterNode->adapter; |
| 11091 | hHal = WLAN_HDD_GET_HAL_CTX(adapter); |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11092 | wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID, |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11093 | adapter->sessionId, INVALID_SCAN_ID, false); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11094 | connectedBand = hdd_conn_get_connected_band( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11095 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11096 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11097 | /* Handling is done only for STA and P2P */ |
| 11098 | if (band != BAND_ALL && |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11099 | ((adapter->device_mode == QDF_STA_MODE) || |
| 11100 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) && |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11101 | (hdd_conn_is_connected( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11102 | WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11103 | && (connectedBand != band)) { |
| 11104 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11105 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11106 | /* STA already connected on current |
| 11107 | * band, So issue disconnect first, |
| 11108 | * then change the band |
| 11109 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11110 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11111 | 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] | 11112 | hdd_device_mode_to_string(adapter->device_mode), |
| 11113 | adapter->device_mode, currBand, band); |
| 11114 | INIT_COMPLETION(adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11115 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11116 | status = sme_roam_disconnect( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11117 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 11118 | adapter->sessionId, |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11119 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11120 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11121 | if (QDF_STATUS_SUCCESS != status) { |
| 11122 | hdd_err("sme_roam_disconnect failure, status: %d", |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11123 | (int)status); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11124 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11125 | } |
| 11126 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11127 | lrc = wait_for_completion_timeout( |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11128 | &adapter->disconnect_comp_var, |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11129 | msecs_to_jiffies( |
| 11130 | WLAN_WAIT_TIME_DISCONNECT)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11131 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11132 | if (lrc == 0) { |
| 11133 | hdd_err("Timeout while waiting for csr_roam_disconnect"); |
| 11134 | return -ETIMEDOUT; |
| 11135 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11136 | } |
| 11137 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11138 | sme_scan_flush_result(hHal); |
| 11139 | |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11140 | status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11141 | pAdapterNode = pNext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11142 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11143 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11144 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ce2ee98 | 2017-09-03 09:27:35 -0700 | [diff] [blame] | 11145 | ucfg_reg_set_band(hdd_ctx->hdd_pdev, band)) { |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11146 | hdd_err("Failed to set the band value to %u", |
| 11147 | band); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11148 | return -EINVAL; |
| 11149 | } |
| 11150 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11151 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11152 | } |
| 11153 | |
| 11154 | static int __iw_set_band_config(struct net_device *dev, |
| 11155 | struct iw_request_info *info, |
| 11156 | union iwreq_data *wrqu, char *extra) |
| 11157 | { |
Jeff Johnson | 3d278b0 | 2017-08-29 14:17:47 -0700 | [diff] [blame] | 11158 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 11159 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11160 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11161 | int *value = (int *)extra; |
| 11162 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11163 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11164 | |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 11165 | if (!capable(CAP_NET_ADMIN)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11166 | hdd_err("permission check failed"); |
Mukul Sharma | a5fe198 | 2015-11-02 19:28:14 +0530 | [diff] [blame] | 11167 | return -EPERM; |
| 11168 | } |
| 11169 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11170 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 11171 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11172 | if (0 != ret) |
| 11173 | return ret; |
| 11174 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 11175 | return hdd_reg_set_band(dev, value[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11176 | } |
| 11177 | |
| 11178 | static int iw_set_band_config(struct net_device *dev, |
| 11179 | struct iw_request_info *info, |
| 11180 | union iwreq_data *wrqu, char *extra) |
| 11181 | { |
| 11182 | int ret; |
| 11183 | |
| 11184 | cds_ssr_protect(__func__); |
| 11185 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 11186 | cds_ssr_unprotect(__func__); |
| 11187 | |
| 11188 | return ret; |
| 11189 | } |
| 11190 | |
Arunk Khandavalli | 062fb03 | 2017-10-04 12:18:15 +0530 | [diff] [blame] | 11191 | 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] | 11192 | uint32_t bandwidth) |
| 11193 | { |
Jeff Johnson | 6d38ab8 | 2017-08-28 11:36:27 -0700 | [diff] [blame] | 11194 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 11195 | 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] | 11196 | struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info; |
| 11197 | QDF_STATUS status; |
| 11198 | tHalHandle hal_hdl = hdd_ctx->hHal; |
| 11199 | struct qdf_mac_addr bssid; |
| 11200 | tCsrRoamProfile roam_profile; |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 11201 | struct ch_params ch_params; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11202 | |
| 11203 | if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { |
| 11204 | hdd_err("Not supported, device is not in monitor mode"); |
| 11205 | return -EINVAL; |
| 11206 | } |
| 11207 | |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11208 | hdd_debug("Set monitor mode Channel %d", chan); |
Hong Shi | e531d1f | 2016-11-14 14:08:03 +0800 | [diff] [blame] | 11209 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11210 | roam_profile.ChannelInfo.ChannelList = &ch_info->channel; |
| 11211 | roam_profile.ChannelInfo.numOfChannels = 1; |
| 11212 | roam_profile.phyMode = ch_info->phy_mode; |
| 11213 | roam_profile.ch_params.ch_width = bandwidth; |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 11214 | hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11215 | |
| 11216 | qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes, |
| 11217 | QDF_MAC_ADDR_SIZE); |
| 11218 | |
| 11219 | ch_params.ch_width = bandwidth; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11220 | 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] | 11221 | if (ch_params.ch_width == CH_WIDTH_INVALID) { |
| 11222 | hdd_err("Invalid capture channel or bandwidth for a country"); |
| 11223 | return -EINVAL; |
| 11224 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11225 | |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11226 | status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, |
| 11227 | &roam_profile); |
| 11228 | if (status) { |
| 11229 | hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", |
| 11230 | status); |
| 11231 | } |
| 11232 | |
Arunk Khandavalli | 062fb03 | 2017-10-04 12:18:15 +0530 | [diff] [blame] | 11233 | adapter->mon_chan = chan; |
| 11234 | adapter->mon_bandwidth = bandwidth; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11235 | return qdf_status_to_os_return(status); |
| 11236 | } |
| 11237 | |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 11238 | static int printk_adapter(void *priv, const char *fmt, ...) |
| 11239 | { |
| 11240 | int ret; |
| 11241 | va_list args; |
| 11242 | |
| 11243 | va_start(args, fmt); |
| 11244 | ret = vprintk(fmt, args); |
| 11245 | ret += printk("\n"); |
| 11246 | va_end(args); |
| 11247 | |
| 11248 | return ret; |
| 11249 | } |
| 11250 | |
| 11251 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 11252 | static void hdd_ioctl_log_buffer(int log_id, uint32_t count) |
| 11253 | { |
| 11254 | qdf_abstract_print *print = &printk_adapter; |
| 11255 | |
| 11256 | switch (log_id) { |
| 11257 | case HTC_CREDIT_HISTORY_LOG: |
| 11258 | print(NULL, "HTC Credit History (count %u)", count); |
| 11259 | cds_print_htc_credit_history(count, print, NULL); |
| 11260 | break; |
| 11261 | case COMMAND_LOG: |
| 11262 | print(NULL, "Command Log (count %u)", count); |
| 11263 | wma_print_wmi_cmd_log(count, print, NULL); |
| 11264 | break; |
| 11265 | case COMMAND_TX_CMP_LOG: |
| 11266 | print(NULL, "Command Tx Complete Log (count %u)", count); |
| 11267 | wma_print_wmi_cmd_tx_cmp_log(count, print, NULL); |
| 11268 | break; |
| 11269 | case MGMT_COMMAND_LOG: |
| 11270 | print(NULL, "Management Command Log (count %u)", count); |
| 11271 | wma_print_wmi_mgmt_cmd_log(count, print, NULL); |
| 11272 | break; |
| 11273 | case MGMT_COMMAND_TX_CMP_LOG: |
| 11274 | print(NULL, "Management Command Tx Complete Log (count %u)", |
| 11275 | count); |
| 11276 | wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL); |
| 11277 | break; |
| 11278 | case EVENT_LOG: |
| 11279 | print(NULL, "Event Log (count %u)", count); |
| 11280 | wma_print_wmi_event_log(count, print, NULL); |
| 11281 | break; |
| 11282 | case RX_EVENT_LOG: |
| 11283 | print(NULL, "Rx Event Log (count %u)", count); |
| 11284 | wma_print_wmi_rx_event_log(count, print, NULL); |
| 11285 | break; |
| 11286 | case MGMT_EVENT_LOG: |
| 11287 | print(NULL, "Management Event Log (count %u)", count); |
| 11288 | wma_print_wmi_mgmt_event_log(count, print, NULL); |
| 11289 | break; |
| 11290 | default: |
| 11291 | print(NULL, "Invalid Log Id %d", log_id); |
| 11292 | break; |
| 11293 | } |
| 11294 | } |
| 11295 | #else |
| 11296 | static inline void hdd_ioctl_log_buffer(int log_id, uint32_t count) |
| 11297 | { |
| 11298 | } |
| 11299 | #endif /* WMI_INTERFACE_EVENT_LOGGING */ |
| 11300 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11301 | static int __iw_set_two_ints_getnone(struct net_device *dev, |
| 11302 | struct iw_request_info *info, |
| 11303 | union iwreq_data *wrqu, char *extra) |
| 11304 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11305 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11306 | int *value = (int *)extra; |
| 11307 | int sub_cmd = value[0]; |
| 11308 | int ret; |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11309 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11310 | |
Jeff Johnson | 6ee91ee | 2016-02-11 18:55:30 -0800 | [diff] [blame] | 11311 | ENTER_DEV(dev); |
| 11312 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11313 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 11314 | if (0 != ret) |
| 11315 | return ret; |
| 11316 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 11317 | ret = hdd_check_private_wext_control(hdd_ctx, info); |
| 11318 | if (0 != ret) |
| 11319 | return ret; |
| 11320 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11321 | switch (sub_cmd) { |
| 11322 | case WE_SET_SMPS_PARAM: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11323 | 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] | 11324 | ret = wma_cli_set_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11325 | WMI_STA_SMPS_PARAM_CMDID, |
| 11326 | value[1] << WMA_SMPS_PARAM_VALUE_S |
| 11327 | | value[2], |
| 11328 | VDEV_CMD); |
| 11329 | break; |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 11330 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11331 | case WE_SET_FW_CRASH_INJECT: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11332 | hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11333 | value[1], value[2]); |
DARAM SUDHA | 7e7e91b | 2015-05-29 11:38:47 +0530 | [diff] [blame] | 11334 | pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n", |
| 11335 | value[1], value[2]); |
SaidiReddy Yenuga | cc733af | 2016-11-09 17:45:42 +0530 | [diff] [blame] | 11336 | if (!hdd_ctx->config->crash_inject_enabled) { |
| 11337 | hdd_err("Crash Inject ini disabled, Ignore Crash Inject"); |
| 11338 | return 0; |
| 11339 | } |
Yue Ma | 0615235 | 2017-06-20 18:08:58 -0700 | [diff] [blame] | 11340 | if (value[1] == 3) { |
Anurag Chouhan | 4085ff7 | 2017-10-05 18:09:56 +0530 | [diff] [blame] | 11341 | cds_trigger_recovery(QDF_REASON_UNSPECIFIED); |
Yue Ma | 0615235 | 2017-06-20 18:08:58 -0700 | [diff] [blame] | 11342 | return 0; |
| 11343 | } |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11344 | ret = wma_cli_set2_command(adapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11345 | GEN_PARAM_CRASH_INJECT, |
| 11346 | value[1], value[2], GEN_CMD); |
| 11347 | break; |
| 11348 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11349 | case WE_ENABLE_FW_PROFILE: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11350 | hdd_err("WE_ENABLE_FW_PROFILE: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11351 | value[1], value[2]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11352 | ret = wma_cli_set2_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11353 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 11354 | value[1], value[2], DBG_CMD); |
| 11355 | break; |
| 11356 | case WE_SET_FW_PROFILE_HIST_INTVL: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11357 | hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d", |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11358 | value[1], value[2]); |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11359 | ret = wma_cli_set2_command(adapter->sessionId, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11360 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 11361 | value[1], value[2], DBG_CMD); |
| 11362 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11363 | case WE_SET_DUAL_MAC_FW_MODE_CONFIG: |
| 11364 | hdd_debug("Ioctl to set dual fw mode config"); |
Tushnim Bhattacharyya | 49ed8ab | 2017-05-26 18:20:10 -0700 | [diff] [blame] | 11365 | if (hdd_ctx->config->dual_mac_feature_disable == |
| 11366 | DISABLE_DBS_CXN_AND_SCAN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11367 | hdd_err("Dual mac feature is disabled from INI"); |
| 11368 | return -EPERM; |
| 11369 | } |
| 11370 | hdd_debug("%d %d", value[1], value[2]); |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 11371 | policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc, |
| 11372 | value[1], value[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11373 | break; |
| 11374 | case WE_DUMP_DP_TRACE_LEVEL: |
Srinivas Girigowda | af2bfa4 | 2017-03-06 18:45:13 -0800 | [diff] [blame] | 11375 | hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11376 | value[1], value[2]); |
| 11377 | if (value[1] == DUMP_DP_TRACE) |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 11378 | qdf_dp_trace_dump_all(value[2], |
| 11379 | QDF_TRACE_DEFAULT_PDEV_ID); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 11380 | else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE) |
| 11381 | qdf_dp_trace_enable_live_mode(); |
Nirav Shah | da00834 | 2016-05-17 18:50:40 +0530 | [diff] [blame] | 11382 | else if (value[1] == CLEAR_DP_TRACE_BUFFER) |
| 11383 | qdf_dp_trace_clear_buffer(); |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 11384 | else if (value[1] == DISABLE_DP_TRACE_LIVE_MODE) |
| 11385 | qdf_dp_trace_disable_live_mode(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11386 | break; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11387 | case WE_SET_MON_MODE_CHAN: |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 11388 | ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 11389 | break; |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 11390 | case WE_SET_WLAN_SUSPEND: { |
Dustin Brown | 3ed3e9b | 2017-03-23 12:57:58 -0700 | [diff] [blame] | 11391 | hdd_info("STA unit-test suspend(%d, %d)", value[1], value[2]); |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 11392 | ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev, |
| 11393 | value[1], value[2]); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 11394 | break; |
Dustin Brown | 5409643 | 2017-02-23 13:00:44 -0800 | [diff] [blame] | 11395 | } |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 11396 | case WE_SET_WLAN_RESUME: |
Dustin Brown | bc81a47 | 2016-10-26 16:56:59 -0700 | [diff] [blame] | 11397 | ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev); |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 11398 | break; |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 11399 | case WE_LOG_BUFFER: { |
| 11400 | int log_id = value[1]; |
| 11401 | uint32_t count = value[2] < 0 ? 0 : value[2]; |
| 11402 | |
| 11403 | hdd_ioctl_log_buffer(log_id, count); |
| 11404 | |
| 11405 | break; |
| 11406 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11407 | default: |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 11408 | hdd_err("Invalid IOCTL command %d", sub_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11409 | break; |
| 11410 | } |
| 11411 | |
| 11412 | return ret; |
| 11413 | } |
| 11414 | |
| 11415 | static int iw_set_two_ints_getnone(struct net_device *dev, |
| 11416 | struct iw_request_info *info, |
| 11417 | union iwreq_data *wrqu, char *extra) |
| 11418 | { |
| 11419 | int ret; |
| 11420 | |
| 11421 | cds_ssr_protect(__func__); |
| 11422 | ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra); |
| 11423 | cds_ssr_unprotect(__func__); |
| 11424 | |
| 11425 | return ret; |
| 11426 | } |
| 11427 | |
| 11428 | /* Define the Wireless Extensions to the Linux Network Device structure */ |
| 11429 | /* A number of these routines are NULL (meaning they are not implemented.) */ |
| 11430 | |
| 11431 | static const iw_handler we_handler[] = { |
| 11432 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 11433 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 11434 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 11435 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 11436 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 11437 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 11438 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 11439 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 11440 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 11441 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 11442 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 11443 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 11444 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 11445 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 11446 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 11447 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 11448 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 11449 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 11450 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 11451 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 11452 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 11453 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 11454 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 11455 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
Sandeep Puligilla | d000421 | 2017-02-26 18:34:56 -0800 | [diff] [blame] | 11456 | (iw_handler) NULL, /* SIOCSIWSCAN */ |
| 11457 | (iw_handler) NULL, /* SIOCGIWSCAN */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11458 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 11459 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 11460 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 11461 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 11462 | (iw_handler) NULL, /* -- hole -- */ |
| 11463 | (iw_handler) NULL, /* -- hole -- */ |
Jeff Johnson | 64b2698 | 2017-10-15 15:48:38 -0700 | [diff] [blame^] | 11464 | (iw_handler) NULL, /* SIOCSIWRATE */ |
Jeff Johnson | 7b5b8e7 | 2017-10-15 15:41:00 -0700 | [diff] [blame] | 11465 | (iw_handler) NULL, /* SIOCGIWRATE */ |
Jeff Johnson | f231648 | 2017-10-15 14:57:02 -0700 | [diff] [blame] | 11466 | (iw_handler) NULL, /* SIOCSIWRTS */ |
Jeff Johnson | a95d5ca | 2017-10-15 14:49:45 -0700 | [diff] [blame] | 11467 | (iw_handler) NULL, /* SIOCGIWRTS */ |
Jeff Johnson | 40d7010 | 2017-10-15 14:39:01 -0700 | [diff] [blame] | 11468 | (iw_handler) NULL, /* SIOCSIWFRAG */ |
Jeff Johnson | 75956d3 | 2017-10-15 13:53:36 -0700 | [diff] [blame] | 11469 | (iw_handler) NULL, /* SIOCGIWFRAG */ |
Jeff Johnson | 744676f | 2017-10-15 12:56:16 -0700 | [diff] [blame] | 11470 | (iw_handler) NULL, /* SIOCSIWTXPOW */ |
Jeff Johnson | 918d35e | 2017-10-15 12:50:26 -0700 | [diff] [blame] | 11471 | (iw_handler) NULL, /* SIOCGIWTXPOW */ |
Jeff Johnson | d899504 | 2017-10-15 12:45:45 -0700 | [diff] [blame] | 11472 | (iw_handler) NULL, /* SIOCSIWRETRY */ |
Jeff Johnson | 00367e2 | 2017-10-15 12:40:15 -0700 | [diff] [blame] | 11473 | (iw_handler) NULL, /* SIOCGIWRETRY */ |
Jeff Johnson | 140e07a | 2017-10-15 12:32:29 -0700 | [diff] [blame] | 11474 | (iw_handler) NULL, /* SIOCSIWENCODE */ |
Jeff Johnson | e84e8d0 | 2017-10-15 12:22:58 -0700 | [diff] [blame] | 11475 | (iw_handler) NULL, /* SIOCGIWENCODE */ |
Jeff Johnson | 955e058 | 2017-10-15 11:56:52 -0700 | [diff] [blame] | 11476 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
Jeff Johnson | 330d8dc | 2017-10-15 11:43:13 -0700 | [diff] [blame] | 11477 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11478 | (iw_handler) NULL, /* -- hole -- */ |
| 11479 | (iw_handler) NULL, /* -- hole -- */ |
Jeff Johnson | 4bcdafa | 2017-10-15 11:33:42 -0700 | [diff] [blame] | 11480 | (iw_handler) NULL, /* SIOCSIWGENIE */ |
Jeff Johnson | f6562c6 | 2017-10-15 11:24:05 -0700 | [diff] [blame] | 11481 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
Jeff Johnson | 079f7de | 2017-10-15 11:04:08 -0700 | [diff] [blame] | 11482 | (iw_handler) NULL, /* SIOCSIWAUTH */ |
Jeff Johnson | 4139b82 | 2017-10-15 10:55:03 -0700 | [diff] [blame] | 11483 | (iw_handler) NULL, /* SIOCGIWAUTH */ |
Jeff Johnson | 5b30082 | 2017-10-15 10:44:40 -0700 | [diff] [blame] | 11484 | (iw_handler) NULL, /* SIOCSIWENCODEEXT */ |
Jeff Johnson | 6b74705 | 2017-10-15 10:29:04 -0700 | [diff] [blame] | 11485 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11486 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 11487 | }; |
| 11488 | |
| 11489 | static const iw_handler we_private[] = { |
| 11490 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 11491 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, |
| 11492 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, |
| 11493 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11494 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 11495 | iw_set_three_ints_getnone, |
| 11496 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 11497 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11498 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 11499 | iw_hdd_set_var_ints_getnone, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 11500 | [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = |
| 11501 | iw_setnone_get_threeint, |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 11502 | [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11503 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 11504 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 11505 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11506 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11507 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 11508 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 11509 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = |
| 11510 | iw_set_keepalive_params, |
| 11511 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 11512 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = |
| 11513 | iw_set_packet_filter_params, |
| 11514 | #endif |
| 11515 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 11516 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno, |
| 11517 | #endif |
| 11518 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 11519 | [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = |
| 11520 | iw_set_dynamic_mcbc_filter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11521 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed, |
| 11522 | [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 11523 | iw_set_two_ints_getnone, |
| 11524 | [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] = |
| 11525 | iw_set_dot11p_channel_sched, |
| 11526 | }; |
| 11527 | |
| 11528 | /*Maximum command length can be only 15 */ |
| 11529 | static const struct iw_priv_args we_private_args[] = { |
| 11530 | |
| 11531 | /* handlers for main ioctl */ |
| 11532 | {WLAN_PRIV_SET_INT_GET_NONE, |
| 11533 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11534 | 0, |
| 11535 | ""}, |
| 11536 | |
| 11537 | /* handlers for sub-ioctl */ |
| 11538 | {WE_SET_11D_STATE, |
| 11539 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11540 | 0, |
| 11541 | "set11Dstate"}, |
| 11542 | |
| 11543 | {WE_WOWL, |
| 11544 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11545 | 0, |
| 11546 | "wowl"}, |
| 11547 | |
| 11548 | {WE_SET_POWER, |
| 11549 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11550 | 0, |
| 11551 | "setPower"}, |
| 11552 | |
| 11553 | {WE_SET_MAX_ASSOC, |
| 11554 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11555 | 0, |
| 11556 | "setMaxAssoc"}, |
| 11557 | |
| 11558 | {WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 11559 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, |
| 11560 | "setAutoChannel" }, |
| 11561 | |
| 11562 | {WE_SET_SCAN_DISABLE, |
| 11563 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11564 | 0, |
| 11565 | "scan_disable"}, |
| 11566 | |
| 11567 | {WE_SET_DATA_INACTIVITY_TO, |
| 11568 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11569 | 0, |
| 11570 | "inactivityTO"}, |
| 11571 | |
Mukul Sharma | ed92f2f | 2017-04-20 00:06:28 +0530 | [diff] [blame] | 11572 | {WE_SET_WOW_DATA_INACTIVITY_TO, |
| 11573 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11574 | 0, |
| 11575 | "wow_ito"}, |
| 11576 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11577 | {WE_SET_MAX_TX_POWER, |
| 11578 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11579 | 0, |
| 11580 | "setMaxTxPower"}, |
| 11581 | |
| 11582 | {WE_SET_TX_POWER, |
| 11583 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11584 | 0, |
| 11585 | "setTxPower"}, |
| 11586 | |
| 11587 | {WE_SET_MC_RATE, |
| 11588 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11589 | 0, |
| 11590 | "setMcRate"}, |
| 11591 | |
| 11592 | {WE_SET_MAX_TX_POWER_2_4, |
| 11593 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11594 | 0, |
| 11595 | "setTxMaxPower2G"}, |
| 11596 | |
| 11597 | {WE_SET_MAX_TX_POWER_5_0, |
| 11598 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11599 | 0, |
| 11600 | "setTxMaxPower5G"}, |
| 11601 | |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 11602 | {WE_SET_PKTLOG, |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 11603 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 11604 | 0, |
| 11605 | "pktlog"}, |
| 11606 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11607 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 11608 | * as well to keep same syntax as in SAP. Now onwards, STA |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame] | 11609 | * will support both |
| 11610 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11611 | {WE_SET_MAX_TX_POWER, |
| 11612 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11613 | 0, |
| 11614 | "setTxMaxPower"}, |
| 11615 | |
| 11616 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
Jeff Johnson | 3bb7c73 | 2017-01-12 08:40:17 -0800 | [diff] [blame] | 11617 | * 1 = enable and 0 = disable |
| 11618 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11619 | { |
| 11620 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 11621 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11622 | 0, |
| 11623 | "setHDtimTransn" |
| 11624 | }, |
| 11625 | |
| 11626 | {WE_SET_TM_LEVEL, |
| 11627 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11628 | 0, |
| 11629 | "setTmLevel"}, |
| 11630 | |
| 11631 | {WE_SET_PHYMODE, |
| 11632 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11633 | 0, |
| 11634 | "setphymode"}, |
| 11635 | |
| 11636 | {WE_SET_NSS, |
| 11637 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11638 | 0, |
| 11639 | "nss"}, |
| 11640 | |
| 11641 | {WE_SET_LDPC, |
| 11642 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11643 | 0, |
| 11644 | "ldpc"}, |
| 11645 | |
| 11646 | {WE_SET_TX_STBC, |
| 11647 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11648 | 0, |
| 11649 | "tx_stbc"}, |
| 11650 | |
| 11651 | {WE_SET_RX_STBC, |
| 11652 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11653 | 0, |
| 11654 | "rx_stbc"}, |
| 11655 | |
| 11656 | {WE_SET_SHORT_GI, |
| 11657 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11658 | 0, |
| 11659 | "shortgi"}, |
| 11660 | |
| 11661 | {WE_SET_RTSCTS, |
| 11662 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11663 | 0, |
| 11664 | "enablertscts"}, |
| 11665 | |
| 11666 | {WE_SET_CHWIDTH, |
| 11667 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11668 | 0, |
| 11669 | "chwidth"}, |
| 11670 | |
| 11671 | {WE_SET_ANI_EN_DIS, |
| 11672 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11673 | 0, |
| 11674 | "anienable"}, |
| 11675 | |
| 11676 | {WE_SET_ANI_POLL_PERIOD, |
| 11677 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11678 | 0, |
| 11679 | "aniplen"}, |
| 11680 | |
| 11681 | {WE_SET_ANI_LISTEN_PERIOD, |
| 11682 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11683 | 0, |
| 11684 | "anilislen"}, |
| 11685 | |
| 11686 | {WE_SET_ANI_OFDM_LEVEL, |
| 11687 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11688 | 0, |
| 11689 | "aniofdmlvl"}, |
| 11690 | |
| 11691 | {WE_SET_ANI_CCK_LEVEL, |
| 11692 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11693 | 0, |
| 11694 | "aniccklvl"}, |
| 11695 | |
| 11696 | {WE_SET_DYNAMIC_BW, |
| 11697 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11698 | 0, |
| 11699 | "cwmenable"}, |
| 11700 | |
| 11701 | {WE_SET_CTS_CBW, |
| 11702 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11703 | 0, |
| 11704 | "cts_cbw" }, |
| 11705 | |
| 11706 | {WE_SET_GTX_HT_MCS, |
| 11707 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11708 | 0, |
| 11709 | "gtxHTMcs"}, |
| 11710 | |
| 11711 | {WE_SET_GTX_VHT_MCS, |
| 11712 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11713 | 0, |
| 11714 | "gtxVHTMcs"}, |
| 11715 | |
| 11716 | {WE_SET_GTX_USRCFG, |
| 11717 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11718 | 0, |
| 11719 | "gtxUsrCfg"}, |
| 11720 | |
| 11721 | {WE_SET_GTX_THRE, |
| 11722 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11723 | 0, |
| 11724 | "gtxThre"}, |
| 11725 | |
| 11726 | {WE_SET_GTX_MARGIN, |
| 11727 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11728 | 0, |
| 11729 | "gtxMargin"}, |
| 11730 | |
| 11731 | {WE_SET_GTX_STEP, |
| 11732 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11733 | 0, |
| 11734 | "gtxStep"}, |
| 11735 | |
| 11736 | {WE_SET_GTX_MINTPC, |
| 11737 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11738 | 0, |
| 11739 | "gtxMinTpc"}, |
| 11740 | |
| 11741 | {WE_SET_GTX_BWMASK, |
| 11742 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11743 | 0, |
| 11744 | "gtxBWMask"}, |
| 11745 | |
| 11746 | {WE_SET_TX_CHAINMASK, |
| 11747 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11748 | 0, |
| 11749 | "txchainmask"}, |
| 11750 | |
| 11751 | {WE_SET_RX_CHAINMASK, |
| 11752 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11753 | 0, |
| 11754 | "rxchainmask"}, |
| 11755 | |
| 11756 | {WE_SET_11N_RATE, |
| 11757 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11758 | 0, |
| 11759 | "set11NRates"}, |
| 11760 | |
| 11761 | {WE_SET_VHT_RATE, |
| 11762 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11763 | 0, |
| 11764 | "set11ACRates"}, |
| 11765 | |
| 11766 | {WE_SET_AMPDU, |
| 11767 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11768 | 0, |
| 11769 | "ampdu"}, |
| 11770 | |
| 11771 | {WE_SET_AMSDU, |
| 11772 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11773 | 0, |
| 11774 | "amsdu"}, |
| 11775 | |
| 11776 | {WE_SET_BURST_ENABLE, |
| 11777 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11778 | 0, |
| 11779 | "burst_enable"}, |
| 11780 | |
| 11781 | {WE_SET_BURST_DUR, |
| 11782 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11783 | 0, |
| 11784 | "burst_dur"}, |
| 11785 | |
| 11786 | {WE_SET_TXPOW_2G, |
| 11787 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11788 | 0, |
| 11789 | "txpow2g"}, |
| 11790 | |
| 11791 | {WE_SET_TXPOW_5G, |
| 11792 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11793 | 0, |
| 11794 | "txpow5g"}, |
| 11795 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11796 | /* Sub-cmds DBGLOG specific commands */ |
| 11797 | {WE_DBGLOG_LOG_LEVEL, |
| 11798 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11799 | 0, |
| 11800 | "dl_loglevel"}, |
| 11801 | |
| 11802 | {WE_DBGLOG_VAP_ENABLE, |
| 11803 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11804 | 0, |
| 11805 | "dl_vapon"}, |
| 11806 | |
| 11807 | {WE_DBGLOG_VAP_DISABLE, |
| 11808 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11809 | 0, |
| 11810 | "dl_vapoff"}, |
| 11811 | |
| 11812 | {WE_DBGLOG_MODULE_ENABLE, |
| 11813 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11814 | 0, |
| 11815 | "dl_modon"}, |
| 11816 | |
| 11817 | {WE_DBGLOG_MODULE_DISABLE, |
| 11818 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11819 | 0, |
| 11820 | "dl_modoff"}, |
| 11821 | |
| 11822 | {WE_DBGLOG_MOD_LOG_LEVEL, |
| 11823 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11824 | 0, |
| 11825 | "dl_mod_loglevel"}, |
| 11826 | |
| 11827 | {WE_DBGLOG_TYPE, |
| 11828 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11829 | 0, |
| 11830 | "dl_type"}, |
| 11831 | {WE_DBGLOG_REPORT_ENABLE, |
| 11832 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11833 | 0, |
| 11834 | "dl_report"}, |
| 11835 | |
| 11836 | {WE_SET_TXRX_FWSTATS, |
| 11837 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11838 | 0, |
| 11839 | "txrx_fw_stats"}, |
| 11840 | |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 11841 | {WE_SET_TXRX_STATS, |
| 11842 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11843 | 0, |
| 11844 | "txrx_stats"}, |
| 11845 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11846 | {WE_TXRX_FWSTATS_RESET, |
| 11847 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11848 | 0, |
| 11849 | "txrx_fw_st_rst"}, |
| 11850 | |
| 11851 | {WE_PPS_PAID_MATCH, |
| 11852 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11853 | 0, "paid_match"}, |
| 11854 | |
| 11855 | {WE_PPS_GID_MATCH, |
| 11856 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11857 | 0, "gid_match"}, |
| 11858 | |
| 11859 | {WE_PPS_EARLY_TIM_CLEAR, |
| 11860 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11861 | 0, "tim_clear"}, |
| 11862 | |
| 11863 | {WE_PPS_EARLY_DTIM_CLEAR, |
| 11864 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11865 | 0, "dtim_clear"}, |
| 11866 | |
| 11867 | {WE_PPS_EOF_PAD_DELIM, |
| 11868 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11869 | 0, "eof_delim"}, |
| 11870 | |
| 11871 | {WE_PPS_MACADDR_MISMATCH, |
| 11872 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11873 | 0, "mac_match"}, |
| 11874 | |
| 11875 | {WE_PPS_DELIM_CRC_FAIL, |
| 11876 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11877 | 0, "delim_fail"}, |
| 11878 | |
| 11879 | {WE_PPS_GID_NSTS_ZERO, |
| 11880 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11881 | 0, "nsts_zero"}, |
| 11882 | |
| 11883 | {WE_PPS_RSSI_CHECK, |
| 11884 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11885 | 0, "rssi_chk"}, |
| 11886 | |
| 11887 | {WE_PPS_5G_EBT, |
| 11888 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11889 | 0, "5g_ebt"}, |
| 11890 | |
| 11891 | {WE_SET_HTSMPS, |
| 11892 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11893 | 0, "htsmps"}, |
| 11894 | |
| 11895 | {WE_SET_QPOWER_MAX_PSPOLL_COUNT, |
| 11896 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11897 | 0, "set_qpspollcnt"}, |
| 11898 | |
| 11899 | {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 11900 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11901 | 0, "set_qtxwake"}, |
| 11902 | |
| 11903 | {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 11904 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11905 | 0, "set_qwakeintv"}, |
| 11906 | |
| 11907 | {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 11908 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11909 | 0, "set_qnodatapoll"}, |
| 11910 | |
| 11911 | /* handlers for MCC time quota and latency sub ioctls */ |
| 11912 | {WE_MCC_CONFIG_LATENCY, |
| 11913 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11914 | 0, "setMccLatency"}, |
| 11915 | |
| 11916 | {WE_MCC_CONFIG_QUOTA, |
| 11917 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11918 | 0, "setMccQuota"}, |
| 11919 | |
| 11920 | {WE_SET_DEBUG_LOG, |
| 11921 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11922 | 0, "setDbgLvl"}, |
| 11923 | |
| 11924 | /* handlers for early_rx power save */ |
| 11925 | {WE_SET_EARLY_RX_ADJUST_ENABLE, |
| 11926 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11927 | 0, "erx_enable"}, |
| 11928 | |
| 11929 | {WE_SET_EARLY_RX_TGT_BMISS_NUM, |
| 11930 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11931 | 0, "erx_bmiss_val"}, |
| 11932 | |
| 11933 | {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 11934 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11935 | 0, "erx_bmiss_smpl"}, |
| 11936 | |
| 11937 | {WE_SET_EARLY_RX_SLOP_STEP, |
| 11938 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11939 | 0, "erx_slop_step"}, |
| 11940 | |
| 11941 | {WE_SET_EARLY_RX_INIT_SLOP, |
| 11942 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11943 | 0, "erx_init_slop"}, |
| 11944 | |
| 11945 | {WE_SET_EARLY_RX_ADJUST_PAUSE, |
| 11946 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11947 | 0, "erx_adj_pause"}, |
| 11948 | |
| 11949 | {WE_SET_EARLY_RX_DRIFT_SAMPLE, |
| 11950 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11951 | 0, "erx_dri_sample"}, |
| 11952 | |
| 11953 | {WE_DUMP_STATS, |
| 11954 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11955 | 0, "dumpStats"}, |
| 11956 | |
| 11957 | {WE_CLEAR_STATS, |
| 11958 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11959 | 0, "clearStats"}, |
| 11960 | |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 11961 | {WE_START_FW_PROFILE, |
| 11962 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11963 | 0, "startProfile"}, |
| 11964 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 11965 | {WE_SET_CHANNEL, |
| 11966 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11967 | 0, "setChanChange" }, |
| 11968 | |
Manishekar Chandrasekaran | 97e077d | 2016-03-23 17:10:31 +0530 | [diff] [blame] | 11969 | {WE_SET_CONC_SYSTEM_PREF, |
| 11970 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11971 | 0, "setConcSysPref" }, |
| 11972 | |
Jeff Johnson | 011c450 | 2017-10-05 15:25:56 -0700 | [diff] [blame] | 11973 | {WE_SET_PDEV_RESET, |
| 11974 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11975 | 0, "pdev_reset" }, |
| 11976 | |
SaidiReddy Yenuga | a92f8cc | 2017-03-24 15:15:03 +0530 | [diff] [blame] | 11977 | {WE_SET_MODULATED_DTIM, |
| 11978 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11979 | 0, "setModDTIM" }, |
| 11980 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11981 | {WLAN_PRIV_SET_NONE_GET_INT, |
| 11982 | 0, |
| 11983 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11984 | ""}, |
| 11985 | |
| 11986 | /* handlers for sub-ioctl */ |
| 11987 | {WE_GET_11D_STATE, |
| 11988 | 0, |
| 11989 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11990 | "get11Dstate"}, |
| 11991 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11992 | {WE_GET_WLAN_DBG, |
| 11993 | 0, |
| 11994 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11995 | "getwlandbg"}, |
| 11996 | |
| 11997 | {WE_GET_MAX_ASSOC, |
| 11998 | 0, |
| 11999 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12000 | "getMaxAssoc"}, |
| 12001 | |
| 12002 | {WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 12003 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12004 | "getAutoChannel" }, |
| 12005 | |
| 12006 | {WE_GET_CONCURRENCY_MODE, |
| 12007 | 0, |
| 12008 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12009 | "getconcurrency"}, |
| 12010 | |
| 12011 | {WE_GET_NSS, |
| 12012 | 0, |
| 12013 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12014 | "get_nss"}, |
| 12015 | |
| 12016 | {WE_GET_LDPC, |
| 12017 | 0, |
| 12018 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12019 | "get_ldpc"}, |
| 12020 | |
| 12021 | {WE_GET_TX_STBC, |
| 12022 | 0, |
| 12023 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12024 | "get_tx_stbc"}, |
| 12025 | |
| 12026 | {WE_GET_RX_STBC, |
| 12027 | 0, |
| 12028 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12029 | "get_rx_stbc"}, |
| 12030 | |
| 12031 | {WE_GET_SHORT_GI, |
| 12032 | 0, |
| 12033 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12034 | "get_shortgi"}, |
| 12035 | |
| 12036 | {WE_GET_RTSCTS, |
| 12037 | 0, |
| 12038 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12039 | "get_rtscts"}, |
| 12040 | |
| 12041 | {WE_GET_CHWIDTH, |
| 12042 | 0, |
| 12043 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12044 | "get_chwidth"}, |
| 12045 | |
| 12046 | {WE_GET_ANI_EN_DIS, |
| 12047 | 0, |
| 12048 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12049 | "get_anienable"}, |
| 12050 | |
| 12051 | {WE_GET_ANI_POLL_PERIOD, |
| 12052 | 0, |
| 12053 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12054 | "get_aniplen"}, |
| 12055 | |
| 12056 | {WE_GET_ANI_LISTEN_PERIOD, |
| 12057 | 0, |
| 12058 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12059 | "get_anilislen"}, |
| 12060 | |
| 12061 | {WE_GET_ANI_OFDM_LEVEL, |
| 12062 | 0, |
| 12063 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12064 | "get_aniofdmlvl"}, |
| 12065 | |
| 12066 | {WE_GET_ANI_CCK_LEVEL, |
| 12067 | 0, |
| 12068 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12069 | "get_aniccklvl"}, |
| 12070 | |
| 12071 | {WE_GET_DYNAMIC_BW, |
| 12072 | 0, |
| 12073 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12074 | "get_cwmenable"}, |
| 12075 | |
| 12076 | {WE_GET_GTX_HT_MCS, |
| 12077 | 0, |
| 12078 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12079 | "get_gtxHTMcs"}, |
| 12080 | |
| 12081 | {WE_GET_GTX_VHT_MCS, |
| 12082 | 0, |
| 12083 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12084 | "get_gtxVHTMcs"}, |
| 12085 | |
| 12086 | {WE_GET_GTX_USRCFG, |
| 12087 | 0, |
| 12088 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12089 | "get_gtxUsrCfg"}, |
| 12090 | |
| 12091 | {WE_GET_GTX_THRE, |
| 12092 | 0, |
| 12093 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12094 | "get_gtxThre"}, |
| 12095 | |
| 12096 | {WE_GET_GTX_MARGIN, |
| 12097 | 0, |
| 12098 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12099 | "get_gtxMargin"}, |
| 12100 | |
| 12101 | {WE_GET_GTX_STEP, |
| 12102 | 0, |
| 12103 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12104 | "get_gtxStep"}, |
| 12105 | |
| 12106 | {WE_GET_GTX_MINTPC, |
| 12107 | 0, |
| 12108 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12109 | "get_gtxMinTpc"}, |
| 12110 | |
| 12111 | {WE_GET_GTX_BWMASK, |
| 12112 | 0, |
| 12113 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12114 | "get_gtxBWMask"}, |
| 12115 | |
| 12116 | {WE_GET_TX_CHAINMASK, |
| 12117 | 0, |
| 12118 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12119 | "get_txchainmask"}, |
| 12120 | |
| 12121 | {WE_GET_RX_CHAINMASK, |
| 12122 | 0, |
| 12123 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12124 | "get_rxchainmask"}, |
| 12125 | |
| 12126 | {WE_GET_11N_RATE, |
| 12127 | 0, |
| 12128 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12129 | "get_11nrate"}, |
| 12130 | |
| 12131 | {WE_GET_AMPDU, |
| 12132 | 0, |
| 12133 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12134 | "get_ampdu"}, |
| 12135 | |
| 12136 | {WE_GET_AMSDU, |
| 12137 | 0, |
| 12138 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12139 | "get_amsdu"}, |
| 12140 | |
| 12141 | {WE_GET_BURST_ENABLE, |
| 12142 | 0, |
| 12143 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12144 | "get_burst_en"}, |
| 12145 | |
| 12146 | {WE_GET_BURST_DUR, |
| 12147 | 0, |
| 12148 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12149 | "get_burst_dur"}, |
| 12150 | |
| 12151 | {WE_GET_TXPOW_2G, |
| 12152 | 0, |
| 12153 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12154 | "get_txpow2g"}, |
| 12155 | |
| 12156 | {WE_GET_TXPOW_5G, |
| 12157 | 0, |
| 12158 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12159 | "get_txpow5g"}, |
| 12160 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12161 | {WE_GET_PPS_PAID_MATCH, |
| 12162 | 0, |
| 12163 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12164 | "get_paid_match"}, |
| 12165 | |
| 12166 | {WE_GET_PPS_GID_MATCH, |
| 12167 | 0, |
| 12168 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12169 | "get_gid_match"}, |
| 12170 | |
| 12171 | {WE_GET_PPS_EARLY_TIM_CLEAR, |
| 12172 | 0, |
| 12173 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12174 | "get_tim_clear"}, |
| 12175 | |
| 12176 | {WE_GET_PPS_EARLY_DTIM_CLEAR, |
| 12177 | 0, |
| 12178 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12179 | "get_dtim_clear"}, |
| 12180 | |
| 12181 | {WE_GET_PPS_EOF_PAD_DELIM, |
| 12182 | 0, |
| 12183 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12184 | "get_eof_delim"}, |
| 12185 | |
| 12186 | {WE_GET_PPS_MACADDR_MISMATCH, |
| 12187 | 0, |
| 12188 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12189 | "get_mac_match"}, |
| 12190 | |
| 12191 | {WE_GET_PPS_DELIM_CRC_FAIL, |
| 12192 | 0, |
| 12193 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12194 | "get_delim_fail"}, |
| 12195 | |
| 12196 | {WE_GET_PPS_GID_NSTS_ZERO, |
| 12197 | 0, |
| 12198 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12199 | "get_nsts_zero"}, |
| 12200 | |
| 12201 | {WE_GET_PPS_RSSI_CHECK, |
| 12202 | 0, |
| 12203 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12204 | "get_rssi_chk"}, |
| 12205 | |
| 12206 | {WE_GET_QPOWER_MAX_PSPOLL_COUNT, |
| 12207 | 0, |
| 12208 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12209 | "get_qpspollcnt"}, |
| 12210 | |
| 12211 | {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE, |
| 12212 | 0, |
| 12213 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12214 | "get_qtxwake"}, |
| 12215 | |
| 12216 | {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
| 12217 | 0, |
| 12218 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12219 | "get_qwakeintv"}, |
| 12220 | |
| 12221 | {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
| 12222 | 0, |
| 12223 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12224 | "get_qnodatapoll"}, |
| 12225 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 12226 | {WE_CAP_TSF, |
| 12227 | 0, |
| 12228 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12229 | "cap_tsf"}, |
| 12230 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12231 | {WE_GET_TEMPERATURE, |
| 12232 | 0, |
| 12233 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12234 | "get_temp"}, |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 12235 | {WE_GET_DCM, |
| 12236 | 0, |
| 12237 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12238 | "get_dcm"}, |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 12239 | {WE_GET_RANGE_EXT, |
| 12240 | 0, |
| 12241 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12242 | "get_range_ext"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12243 | /* handlers for main ioctl */ |
| 12244 | {WLAN_PRIV_SET_CHAR_GET_NONE, |
| 12245 | IW_PRIV_TYPE_CHAR | 512, |
| 12246 | 0, |
| 12247 | ""}, |
| 12248 | |
| 12249 | /* handlers for sub-ioctl */ |
| 12250 | {WE_WOWL_ADD_PTRN, |
| 12251 | IW_PRIV_TYPE_CHAR | 512, |
| 12252 | 0, |
| 12253 | "wowlAddPtrn"}, |
| 12254 | |
| 12255 | {WE_WOWL_DEL_PTRN, |
| 12256 | IW_PRIV_TYPE_CHAR | 512, |
| 12257 | 0, |
| 12258 | "wowlDelPtrn"}, |
| 12259 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12260 | /* handlers for sub-ioctl */ |
| 12261 | {WE_NEIGHBOR_REPORT_REQUEST, |
| 12262 | IW_PRIV_TYPE_CHAR | 512, |
| 12263 | 0, |
| 12264 | "neighbor"}, |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 12265 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12266 | {WE_SET_AP_WPS_IE, |
| 12267 | IW_PRIV_TYPE_CHAR | 512, |
| 12268 | 0, |
| 12269 | "set_ap_wps_ie"}, |
| 12270 | |
| 12271 | {WE_SET_CONFIG, |
| 12272 | IW_PRIV_TYPE_CHAR | 512, |
| 12273 | 0, |
| 12274 | "setConfig"}, |
| 12275 | |
| 12276 | /* handlers for main ioctl */ |
| 12277 | {WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 12278 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12279 | 0, |
| 12280 | ""}, |
| 12281 | |
| 12282 | /* handlers for sub-ioctl */ |
| 12283 | {WE_SET_WLAN_DBG, |
| 12284 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12285 | 0, |
| 12286 | "setwlandbg"}, |
| 12287 | |
| 12288 | /* handlers for sub-ioctl */ |
| 12289 | {WE_SET_DP_TRACE, |
| 12290 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12291 | 0, |
| 12292 | "set_dp_trace"}, |
| 12293 | |
| 12294 | {WE_SET_SAP_CHANNELS, |
| 12295 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12296 | 0, |
| 12297 | "setsapchannels"}, |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 12298 | |
| 12299 | {WE_SET_FW_TEST, |
| 12300 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12301 | 0, "fw_test"}, |
| 12302 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 12303 | /* handlers for main ioctl */ |
| 12304 | {WLAN_PRIV_SET_NONE_GET_THREE_INT, |
| 12305 | 0, |
| 12306 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12307 | "" }, |
| 12308 | {WE_GET_TSF, |
| 12309 | 0, |
| 12310 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12311 | "get_tsf" }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12312 | |
| 12313 | {WE_SET_DUAL_MAC_SCAN_CONFIG, |
| 12314 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 12315 | 0, |
| 12316 | "set_scan_cfg"}, |
| 12317 | |
| 12318 | /* handlers for main ioctl */ |
| 12319 | {WLAN_PRIV_GET_CHAR_SET_NONE, |
| 12320 | 0, |
| 12321 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12322 | ""}, |
| 12323 | |
| 12324 | /* handlers for sub-ioctl */ |
| 12325 | {WE_WLAN_VERSION, |
| 12326 | 0, |
| 12327 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12328 | "version"}, |
| 12329 | {WE_GET_STATS, |
| 12330 | 0, |
| 12331 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12332 | "getStats"}, |
Dustin Brown | d932248 | 2017-01-09 12:46:03 -0800 | [diff] [blame] | 12333 | {WE_GET_SUSPEND_RESUME_STATS, |
| 12334 | 0, |
| 12335 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12336 | "getSuspendStats"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12337 | {WE_LIST_FW_PROFILE, |
| 12338 | 0, |
| 12339 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12340 | "listProfile"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12341 | {WE_GET_STATES, |
| 12342 | 0, |
| 12343 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12344 | "getHostStates"}, |
| 12345 | {WE_GET_CFG, |
| 12346 | 0, |
| 12347 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12348 | "getConfig"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12349 | {WE_GET_RSSI, |
| 12350 | 0, |
| 12351 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12352 | "getRSSI"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12353 | {WE_GET_WMM_STATUS, |
| 12354 | 0, |
| 12355 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12356 | "getWmmStatus"}, |
| 12357 | { |
| 12358 | WE_GET_CHANNEL_LIST, |
| 12359 | 0, |
| 12360 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12361 | "getChannelList" |
| 12362 | }, |
| 12363 | #ifdef FEATURE_WLAN_TDLS |
| 12364 | { |
| 12365 | WE_GET_TDLS_PEERS, |
| 12366 | 0, |
| 12367 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12368 | "getTdlsPeers" |
| 12369 | }, |
| 12370 | #endif |
| 12371 | #ifdef WLAN_FEATURE_11W |
| 12372 | { |
| 12373 | WE_GET_11W_INFO, |
| 12374 | 0, |
| 12375 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12376 | "getPMFInfo" |
| 12377 | }, |
| 12378 | #endif |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 12379 | { |
| 12380 | WE_GET_IBSS_STA_INFO, |
| 12381 | 0, |
| 12382 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12383 | "getIbssSTAs" |
| 12384 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12385 | {WE_GET_PHYMODE, |
| 12386 | 0, |
| 12387 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12388 | "getphymode"}, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 12389 | #if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12390 | {WE_GET_OEM_DATA_CAP, |
| 12391 | 0, |
| 12392 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12393 | "getOemDataCap"}, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 12394 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12395 | {WE_GET_SNR, |
| 12396 | 0, |
| 12397 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12398 | "getSNR"}, |
| 12399 | |
| 12400 | /* handlers for main ioctl */ |
| 12401 | {WLAN_PRIV_SET_NONE_GET_NONE, |
| 12402 | 0, |
| 12403 | 0, |
| 12404 | ""}, |
| 12405 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 12406 | /* handlers for sub-ioctl */ |
| 12407 | { |
| 12408 | WE_IBSS_GET_PEER_INFO_ALL, |
| 12409 | 0, |
| 12410 | 0, |
| 12411 | "ibssPeerInfoAll" |
| 12412 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12413 | {WE_GET_RECOVERY_STAT, |
| 12414 | 0, |
| 12415 | 0, |
| 12416 | "getRecoverStat"}, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12417 | |
| 12418 | {WE_GET_FW_PROFILE_DATA, |
| 12419 | 0, |
| 12420 | 0, |
| 12421 | "getProfileData"}, |
| 12422 | |
| 12423 | {WE_SET_REASSOC_TRIGGER, |
| 12424 | 0, |
| 12425 | 0, |
| 12426 | "reassoc"}, |
| 12427 | |
Sandeep Puligilla | 93a29ec | 2016-02-12 16:10:56 -0800 | [diff] [blame] | 12428 | {WE_STOP_OBSS_SCAN, |
| 12429 | 0, |
| 12430 | 0, |
| 12431 | "stop_obss_scan"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12432 | /* handlers for main ioctl */ |
| 12433 | {WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 12434 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12435 | 0, |
| 12436 | ""}, |
| 12437 | |
| 12438 | /* handlers for sub-ioctl */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 12439 | {WE_IBSS_GET_PEER_INFO, |
| 12440 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12441 | 0, |
| 12442 | "ibssPeerInfo"}, |
| 12443 | |
| 12444 | /* handlers for sub-ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12445 | {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 12446 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12447 | 0, |
| 12448 | "setdumplog"}, |
| 12449 | |
| 12450 | {WE_MTRACE_DUMP_CMD, |
| 12451 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12452 | 0, |
| 12453 | "dumplog"}, |
Krunal Soni | a6e505b | 2017-01-12 12:25:18 -0800 | [diff] [blame] | 12454 | |
| 12455 | {WE_POLICY_MANAGER_CINFO_CMD, |
| 12456 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12457 | 0, |
| 12458 | "pm_cinfo"}, |
| 12459 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12460 | #ifdef MPC_UT_FRAMEWORK |
| 12461 | {WE_POLICY_MANAGER_CLIST_CMD, |
| 12462 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12463 | 0, |
| 12464 | "pm_clist"}, |
| 12465 | |
| 12466 | {WE_POLICY_MANAGER_DLIST_CMD, |
| 12467 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12468 | 0, |
| 12469 | "pm_dlist"}, |
| 12470 | |
| 12471 | {WE_POLICY_MANAGER_DBS_CMD, |
| 12472 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12473 | 0, |
| 12474 | "pm_dbs"}, |
| 12475 | |
| 12476 | {WE_POLICY_MANAGER_PCL_CMD, |
| 12477 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12478 | 0, |
| 12479 | "pm_pcl"}, |
| 12480 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12481 | {WE_POLICY_MANAGER_ULIST_CMD, |
| 12482 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12483 | 0, |
| 12484 | "pm_ulist"}, |
| 12485 | |
| 12486 | {WE_POLICY_MANAGER_QUERY_ACTION_CMD, |
| 12487 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12488 | 0, |
| 12489 | "pm_query_action"}, |
| 12490 | |
| 12491 | {WE_POLICY_MANAGER_QUERY_ALLOW_CMD, |
| 12492 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12493 | 0, |
| 12494 | "pm_query_allow"}, |
| 12495 | |
| 12496 | {WE_POLICY_MANAGER_SCENARIO_CMD, |
| 12497 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12498 | 0, |
| 12499 | "pm_run_scenario"}, |
| 12500 | |
| 12501 | {WE_POLICY_SET_HW_MODE_CMD, |
| 12502 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12503 | 0, |
| 12504 | "pm_set_hw_mode"}, |
| 12505 | #endif |
| 12506 | #ifdef FEATURE_WLAN_TDLS |
| 12507 | /* handlers for sub ioctl */ |
| 12508 | { |
| 12509 | WE_TDLS_CONFIG_PARAMS, |
| 12510 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12511 | 0, |
| 12512 | "setTdlsConfig" |
| 12513 | }, |
| 12514 | #endif |
| 12515 | { |
| 12516 | WE_UNIT_TEST_CMD, |
| 12517 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12518 | 0, |
| 12519 | "setUnitTestCmd" |
| 12520 | }, |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 12521 | { |
| 12522 | WE_MAC_PWR_DEBUG_CMD, |
| 12523 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12524 | 0, |
| 12525 | "halPwrDebug" |
| 12526 | }, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12527 | |
| 12528 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 12529 | {WE_LED_FLASHING_PARAM, |
| 12530 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 12531 | 0, |
| 12532 | "gpio_control"}, |
| 12533 | #endif |
| 12534 | /* handlers for main ioctl */ |
Jeff Johnson | 6fa1e01 | 2017-04-05 06:40:53 -0700 | [diff] [blame] | 12535 | {WLAN_PRIV_FIPS_TEST, |
| 12536 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 12537 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 12538 | "fips_test"}, |
| 12539 | |
| 12540 | /* handlers for main ioctl */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12541 | {WLAN_PRIV_ADD_TSPEC, |
| 12542 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 12543 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12544 | "addTspec"}, |
| 12545 | |
| 12546 | /* handlers for main ioctl */ |
| 12547 | {WLAN_PRIV_DEL_TSPEC, |
| 12548 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12549 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12550 | "delTspec"}, |
| 12551 | |
| 12552 | /* handlers for main ioctl */ |
| 12553 | {WLAN_PRIV_GET_TSPEC, |
| 12554 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12555 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12556 | "getTspec"}, |
| 12557 | |
| 12558 | /* handlers for main ioctl - host offload */ |
| 12559 | { |
| 12560 | WLAN_PRIV_SET_HOST_OFFLOAD, |
Srinivas Girigowda | 077143e | 2017-03-25 10:47:27 -0700 | [diff] [blame] | 12561 | IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12562 | 0, |
| 12563 | "setHostOffload" |
| 12564 | } |
| 12565 | , |
| 12566 | |
| 12567 | { |
| 12568 | WLAN_GET_WLAN_STATISTICS, |
| 12569 | 0, |
| 12570 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 12571 | "getWlanStats" |
| 12572 | } |
| 12573 | , |
| 12574 | |
| 12575 | { |
| 12576 | WLAN_SET_KEEPALIVE_PARAMS, |
Mahesh A Saptasagar | 72d2e4b | 2016-04-20 12:44:17 +0530 | [diff] [blame] | 12577 | IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | |
| 12578 | IW_PRIV_SIZE_FIXED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12579 | 0, |
| 12580 | "setKeepAlive" |
| 12581 | } |
| 12582 | , |
| 12583 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 12584 | { |
| 12585 | WLAN_SET_PACKET_FILTER_PARAMS, |
Hanumanth Reddy Pothula | b3ef416 | 2016-10-25 15:13:26 +0530 | [diff] [blame] | 12586 | IW_PRIV_TYPE_BYTE | |
| 12587 | sizeof(struct pkt_filter_cfg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12588 | 0, |
| 12589 | "setPktFilter" |
| 12590 | } |
| 12591 | , |
| 12592 | #endif |
| 12593 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 12594 | { |
| 12595 | WLAN_SET_PNO, |
| 12596 | IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, |
| 12597 | 0, |
| 12598 | "setpno" |
| 12599 | } |
| 12600 | , |
| 12601 | #endif |
| 12602 | { |
| 12603 | WLAN_SET_BAND_CONFIG, |
| 12604 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12605 | 0, |
| 12606 | "SETBAND" |
| 12607 | } |
| 12608 | , |
| 12609 | { |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 12610 | WLAN_PRIV_SET_MCBC_FILTER, |
Dustin Brown | 860566f | 2017-01-31 15:24:43 -0800 | [diff] [blame] | 12611 | 0, |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 12612 | 0, |
| 12613 | "setMCBCFilter" |
| 12614 | } |
| 12615 | , |
Dustin Brown | 0cbc757 | 2016-12-16 13:54:40 -0800 | [diff] [blame] | 12616 | |
| 12617 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12618 | WLAN_GET_LINK_SPEED, |
| 12619 | IW_PRIV_TYPE_CHAR | 18, |
| 12620 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" |
| 12621 | } |
| 12622 | , |
| 12623 | |
| 12624 | /* handlers for main ioctl */ |
| 12625 | {WLAN_PRIV_SET_TWO_INT_GET_NONE, |
| 12626 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12627 | 0, |
| 12628 | ""} |
| 12629 | , |
| 12630 | {WE_SET_SMPS_PARAM, |
| 12631 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12632 | 0, "set_smps_param"} |
| 12633 | , |
| 12634 | {WLAN_SET_DOT11P_CHANNEL_SCHED, |
| 12635 | IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched), |
| 12636 | 0, "set_dot11p" } |
| 12637 | , |
Srinivas Girigowda | 6147c58 | 2016-10-18 12:26:15 -0700 | [diff] [blame] | 12638 | #ifdef WLAN_DEBUG |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12639 | {WE_SET_FW_CRASH_INJECT, |
| 12640 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12641 | 0, "crash_inject"} |
| 12642 | , |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 12643 | {WE_LOG_BUFFER, |
| 12644 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12645 | 0, "log_buffer"} |
| 12646 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12647 | #endif |
Rajeev Kumar | a78a0a4 | 2016-07-13 19:28:20 -0700 | [diff] [blame] | 12648 | #ifdef WLAN_SUSPEND_RESUME_TEST |
| 12649 | {WE_SET_WLAN_SUSPEND, |
| 12650 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12651 | 0, "wlan_suspend"} |
| 12652 | , |
| 12653 | {WE_SET_WLAN_RESUME, |
| 12654 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12655 | 0, "wlan_resume"} |
| 12656 | , |
| 12657 | #endif |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 12658 | {WE_ENABLE_FW_PROFILE, |
| 12659 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12660 | 0, "enableProfile"} |
| 12661 | , |
| 12662 | {WE_SET_FW_PROFILE_HIST_INTVL, |
| 12663 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12664 | 0, "set_hist_intvl"} |
| 12665 | , |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12666 | {WE_SET_DUAL_MAC_FW_MODE_CONFIG, |
| 12667 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12668 | 0, "set_fw_mode_cfg"} |
| 12669 | , |
| 12670 | {WE_DUMP_DP_TRACE_LEVEL, |
| 12671 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12672 | 0, "dump_dp_trace"} |
| 12673 | , |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 12674 | {WE_SET_MON_MODE_CHAN, |
| 12675 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, |
| 12676 | 0, "setMonChan"} |
| 12677 | , |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 12678 | |
| 12679 | {WE_GET_ROAM_SYNCH_DELAY, |
| 12680 | 0, |
| 12681 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12682 | "hostroamdelay"} |
| 12683 | , |
Krishna Kumaar Natarajan | 9e5339d | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 12684 | {WE_SET_11AX_RATE, |
| 12685 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12686 | 0, |
| 12687 | "set_11ax_rate"} |
| 12688 | , |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 12689 | {WE_SET_DCM, |
| 12690 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12691 | 0, |
| 12692 | "enable_dcm"} |
| 12693 | , |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 12694 | {WE_SET_RANGE_EXT, |
| 12695 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 12696 | 0, |
| 12697 | "enable_range_ext"} |
| 12698 | , |
Naveen Rawat | c921c7b | 2017-06-13 17:29:51 -0700 | [diff] [blame] | 12699 | |
| 12700 | {WLAN_PRIV_SET_FTIES, |
| 12701 | IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE, |
| 12702 | 0, |
| 12703 | "set_ft_ies"}, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12704 | }; |
| 12705 | |
| 12706 | const struct iw_handler_def we_handler_def = { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12707 | .num_standard = QDF_ARRAY_SIZE(we_handler), |
| 12708 | .num_private = QDF_ARRAY_SIZE(we_private), |
| 12709 | .num_private_args = QDF_ARRAY_SIZE(we_private_args), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12710 | |
| 12711 | .standard = (iw_handler *) we_handler, |
| 12712 | .private = (iw_handler *) we_private, |
| 12713 | .private_args = we_private_args, |
| 12714 | .get_wireless_stats = NULL, |
| 12715 | }; |
| 12716 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12717 | /* hdd_set_wext() - configures bss parameters |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12718 | * @adapter: handle to adapter context |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12719 | * |
| 12720 | * Returns: none |
| 12721 | */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12722 | static int hdd_set_wext(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12723 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12724 | struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 12725 | 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] | 12726 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12727 | ENTER(); |
| 12728 | |
| 12729 | if (!pwextBuf) { |
| 12730 | hdd_err("ERROR: pwextBuf is NULL"); |
| 12731 | return QDF_STATUS_E_FAILURE; |
| 12732 | } |
| 12733 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 12734 | if (!sta_ctx) { |
| 12735 | hdd_err("ERROR: sta_ctx is NULL"); |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12736 | return QDF_STATUS_E_FAILURE; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 12737 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12738 | |
| 12739 | /* Now configure the roaming profile links. To SSID and bssid. */ |
| 12740 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 12741 | pwextBuf->roamProfile.SSIDs.SSIDList = &sta_ctx->conn_info.SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12742 | |
| 12743 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 12744 | pwextBuf->roamProfile.BSSIDs.bssid = &sta_ctx->conn_info.bssId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12745 | |
| 12746 | /*Set the numOfChannels to zero to scan all the channels */ |
| 12747 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 12748 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 12749 | |
| 12750 | /* Default is no encryption */ |
| 12751 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 12752 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = |
| 12753 | eCSR_ENCRYPT_TYPE_NONE; |
| 12754 | |
| 12755 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 12756 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = |
| 12757 | eCSR_ENCRYPT_TYPE_NONE; |
| 12758 | |
| 12759 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 12760 | |
| 12761 | /* Default is no authentication */ |
| 12762 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 12763 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12764 | |
| 12765 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 12766 | sta_ctx->wpa_versions = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12767 | |
| 12768 | /*Set the default scan mode */ |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12769 | adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12770 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12771 | hdd_clear_roam_profile_ie(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12772 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12773 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12774 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12775 | |
| 12776 | } |
| 12777 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 12778 | #ifdef WLAN_FEATURE_FILS_SK |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 12779 | static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 12780 | { |
| 12781 | pwextBuf->roamProfile.fils_con_info = NULL; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 12782 | pwextBuf->roamProfile.hlp_ie = NULL; |
| 12783 | pwextBuf->roamProfile.hlp_ie_len = 0; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 12784 | } |
| 12785 | #else |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 12786 | static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 12787 | { } |
| 12788 | #endif |
| 12789 | |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 12790 | /** |
| 12791 | * hdd_register_wext() - register wext context |
| 12792 | * @dev: net device handle |
| 12793 | * |
| 12794 | * Registers wext interface context for a given net device |
| 12795 | * |
| 12796 | * Returns: 0 on success, errno on failure |
| 12797 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12798 | int hdd_register_wext(struct net_device *dev) |
| 12799 | { |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12800 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12801 | struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 12802 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12803 | |
| 12804 | ENTER(); |
| 12805 | |
Deepak Dhamdhere | 8360d4c | 2016-06-01 13:24:31 -0700 | [diff] [blame] | 12806 | if (!pwextBuf) { |
| 12807 | hdd_err(FL("ERROR: pwextBuf is NULL")); |
| 12808 | return QDF_STATUS_E_FAILURE; |
| 12809 | } |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 12810 | |
| 12811 | /* Zero the memory. This zeros the profile structure */ |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 12812 | memset(pwextBuf, 0, sizeof(struct hdd_wext_state)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12813 | |
Jeff Johnson | f23a89b | 2017-10-02 13:20:38 -0700 | [diff] [blame] | 12814 | status = hdd_set_wext(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12815 | |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 12816 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12817 | hdd_err("ERROR: hdd_set_wext failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12818 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12819 | } |
| 12820 | |
Srinivas Girigowda | fba82a0 | 2017-03-24 21:26:35 -0700 | [diff] [blame] | 12821 | status = qdf_event_create(&pwextBuf->hdd_qdf_event); |
| 12822 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 99bac31 | 2016-06-28 10:38:18 -0700 | [diff] [blame] | 12823 | hdd_err("ERROR: HDD qdf event init failed!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12824 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12825 | } |
| 12826 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 12827 | hdd_initialize_fils_info(pwextBuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12828 | /* Register as a wireless device */ |
| 12829 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 12830 | |
| 12831 | EXIT(); |
| 12832 | return 0; |
| 12833 | } |
| 12834 | |
| 12835 | int hdd_unregister_wext(struct net_device *dev) |
| 12836 | { |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 12837 | hdd_debug("dev(%pK)", dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12838 | |
| 12839 | if (dev != NULL) { |
| 12840 | rtnl_lock(); |
| 12841 | dev->wireless_handlers = NULL; |
| 12842 | rtnl_unlock(); |
| 12843 | } |
| 12844 | |
| 12845 | return 0; |
| 12846 | } |