Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 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 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 27 | |
| 28 | /**======================================================================== |
| 29 | |
| 30 | \file wlan_hdd_hostapd.c |
| 31 | \brief WLAN Host Device Driver implementation |
| 32 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | |
| 34 | ========================================================================*/ |
| 35 | /**========================================================================= |
| 36 | EDIT HISTORY FOR FILE |
| 37 | |
| 38 | |
| 39 | This section contains comments describing changes made to the module. |
| 40 | Notice that changes are listed in reverse chronological order. |
| 41 | |
| 42 | $Header:$ $DateTime: $ $Author: $ |
| 43 | |
| 44 | |
| 45 | when who what, where, why |
| 46 | -------- --- -------------------------------------------------------- |
| 47 | 04/5/09 Shailender Created module. |
| 48 | 06/03/10 js - Added support to hostapd driven deauth/disassoc/mic failure |
| 49 | ==========================================================================*/ |
| 50 | /*-------------------------------------------------------------------------- |
| 51 | Include Files |
| 52 | ------------------------------------------------------------------------*/ |
| 53 | |
| 54 | #include <linux/version.h> |
| 55 | #include <linux/module.h> |
| 56 | #include <linux/kernel.h> |
| 57 | #include <linux/init.h> |
| 58 | #include <linux/wireless.h> |
| 59 | #include <linux/semaphore.h> |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 60 | #include <linux/compat.h> |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 61 | #include <linux/rtnetlink.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | #include <vos_api.h> |
| 63 | #include <vos_sched.h> |
| 64 | #include <linux/etherdevice.h> |
| 65 | #include <wlan_hdd_includes.h> |
| 66 | #include <qc_sap_ioctl.h> |
| 67 | #include <wlan_hdd_hostapd.h> |
| 68 | #include <sapApi.h> |
| 69 | #include <sapInternal.h> |
| 70 | #include <wlan_qct_tl.h> |
| 71 | #include <wlan_hdd_softap_tx_rx.h> |
| 72 | #include <wlan_hdd_main.h> |
| 73 | #include <linux/netdevice.h> |
| 74 | #include <linux/mmc/sdio_func.h> |
| 75 | #include "wlan_nlink_common.h" |
| 76 | #include "wlan_btc_svc.h" |
| 77 | #include <bap_hdd_main.h> |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 78 | #include "wlan_hdd_tdls.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 79 | #include "wlan_hdd_p2p.h" |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 80 | #include "cfgApi.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 81 | #include "wniCfg.h" |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 82 | #include <wlan_hdd_wowl.h> |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 83 | #include "wlan_hdd_hostapd.h" |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_request_manager.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 85 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 86 | #ifdef FEATURE_WLAN_CH_AVOID |
| 87 | #include "wcnss_wlan.h" |
| 88 | #endif /* FEATURE_WLAN_CH_AVOID */ |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 89 | #include "wlan_hdd_trace.h" |
| 90 | #include "vos_types.h" |
| 91 | #include "vos_trace.h" |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 92 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | #define IS_UP(_dev) \ |
| 94 | (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP)) |
| 95 | #define IS_UP_AUTO(_ic) \ |
| 96 | (IS_UP((_ic)->ic_dev) && (_ic)->ic_roaming == IEEE80211_ROAMING_AUTO) |
| 97 | #define WE_WLAN_VERSION 1 |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 98 | #define WE_GET_STA_INFO_SIZE 30 |
| 99 | /* WEXT limition: MAX allowed buf len for any * |
| 100 | * IW_PRIV_TYPE_CHAR is 2Kbytes * |
| 101 | */ |
| 102 | #define WE_SAP_MAX_STA_INFO 0x7FF |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 103 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 104 | #define SAP_24GHZ_CH_COUNT (14) |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 105 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 106 | #ifdef FEATURE_WLAN_CH_AVOID |
| 107 | /* Channle/Freqency table */ |
| 108 | extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS]; |
| 109 | safeChannelType safeChannels[NUM_20MHZ_RF_CHANNELS] = |
| 110 | { |
| 111 | /*CH , SAFE, default safe */ |
| 112 | {1 , VOS_TRUE}, //RF_CHAN_1, |
| 113 | {2 , VOS_TRUE}, //RF_CHAN_2, |
| 114 | {3 , VOS_TRUE}, //RF_CHAN_3, |
| 115 | {4 , VOS_TRUE}, //RF_CHAN_4, |
| 116 | {5 , VOS_TRUE}, //RF_CHAN_5, |
| 117 | {6 , VOS_TRUE}, //RF_CHAN_6, |
| 118 | {7 , VOS_TRUE}, //RF_CHAN_7, |
| 119 | {8 , VOS_TRUE}, //RF_CHAN_8, |
| 120 | {9 , VOS_TRUE}, //RF_CHAN_9, |
| 121 | {10 , VOS_TRUE}, //RF_CHAN_10, |
| 122 | {11 , VOS_TRUE}, //RF_CHAN_11, |
| 123 | {12 , VOS_TRUE}, //RF_CHAN_12, |
| 124 | {13 , VOS_TRUE}, //RF_CHAN_13, |
| 125 | {14 , VOS_TRUE}, //RF_CHAN_14, |
| 126 | {240, VOS_TRUE}, //RF_CHAN_240, |
| 127 | {244, VOS_TRUE}, //RF_CHAN_244, |
| 128 | {248, VOS_TRUE}, //RF_CHAN_248, |
| 129 | {252, VOS_TRUE}, //RF_CHAN_252, |
| 130 | {208, VOS_TRUE}, //RF_CHAN_208, |
| 131 | {212, VOS_TRUE}, //RF_CHAN_212, |
| 132 | {216, VOS_TRUE}, //RF_CHAN_216, |
| 133 | {36 , VOS_TRUE}, //RF_CHAN_36, |
| 134 | {40 , VOS_TRUE}, //RF_CHAN_40, |
| 135 | {44 , VOS_TRUE}, //RF_CHAN_44, |
| 136 | {48 , VOS_TRUE}, //RF_CHAN_48, |
| 137 | {52 , VOS_TRUE}, //RF_CHAN_52, |
| 138 | {56 , VOS_TRUE}, //RF_CHAN_56, |
| 139 | {60 , VOS_TRUE}, //RF_CHAN_60, |
| 140 | {64 , VOS_TRUE}, //RF_CHAN_64, |
| 141 | {100, VOS_TRUE}, //RF_CHAN_100, |
| 142 | {104, VOS_TRUE}, //RF_CHAN_104, |
| 143 | {108, VOS_TRUE}, //RF_CHAN_108, |
| 144 | {112, VOS_TRUE}, //RF_CHAN_112, |
| 145 | {116, VOS_TRUE}, //RF_CHAN_116, |
| 146 | {120, VOS_TRUE}, //RF_CHAN_120, |
| 147 | {124, VOS_TRUE}, //RF_CHAN_124, |
| 148 | {128, VOS_TRUE}, //RF_CHAN_128, |
| 149 | {132, VOS_TRUE}, //RF_CHAN_132, |
| 150 | {136, VOS_TRUE}, //RF_CHAN_136, |
| 151 | {140, VOS_TRUE}, //RF_CHAN_140, |
| 152 | {149, VOS_TRUE}, //RF_CHAN_149, |
| 153 | {153, VOS_TRUE}, //RF_CHAN_153, |
| 154 | {157, VOS_TRUE}, //RF_CHAN_157, |
| 155 | {161, VOS_TRUE}, //RF_CHAN_161, |
| 156 | {165, VOS_TRUE}, //RF_CHAN_165, |
| 157 | }; |
| 158 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 159 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 160 | /*--------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | * Function definitions |
| 162 | *-------------------------------------------------------------------------*/ |
| 163 | /**--------------------------------------------------------------------------- |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 164 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 165 | \brief __hdd_hostapd_open() - HDD Open function for hostapd interface |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 167 | This is called in response to ifconfig up |
| 168 | |
| 169 | \param - dev Pointer to net_device structure |
| 170 | |
| 171 | \return - 0 for success non-zero for failure |
| 172 | |
| 173 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 174 | int __hdd_hostapd_open (struct net_device *dev) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | { |
Siddharth Bhal | 2db319d | 2014-12-03 12:37:18 +0530 | [diff] [blame] | 176 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 177 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 178 | ENTER(); |
| 179 | |
louisliu | 462edac | 2020-06-30 13:33:56 +0800 | [diff] [blame] | 180 | if(!test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
Arun Kumar Khandavalli | 9113aee | 2020-02-26 10:54:02 +0530 | [diff] [blame] | 181 | { |
louisliu | 462edac | 2020-06-30 13:33:56 +0800 | [diff] [blame] | 182 | //WMM_INIT OR BSS_START not completed |
| 183 | hddLog( LOGW, "Ignore hostadp open request"); |
| 184 | EXIT(); |
| 185 | return 0; |
Arun Kumar Khandavalli | 9113aee | 2020-02-26 10:54:02 +0530 | [diff] [blame] | 186 | } |
| 187 | |
louisliu | 462edac | 2020-06-30 13:33:56 +0800 | [diff] [blame] | 188 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 189 | TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST, NO_SESSION, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | //Turn ON carrier state |
| 191 | netif_carrier_on(dev); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 192 | //Enable all Tx queues |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 193 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 194 | netif_tx_start_all_queues(dev); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 195 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 196 | EXIT(); |
| 197 | return 0; |
| 198 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 199 | |
| 200 | int hdd_hostapd_open (struct net_device *dev) |
| 201 | { |
| 202 | int ret; |
| 203 | |
| 204 | vos_ssr_protect(__func__); |
| 205 | ret = __hdd_hostapd_open(dev); |
| 206 | vos_ssr_unprotect(__func__); |
| 207 | |
| 208 | return ret; |
| 209 | } |
| 210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | /**--------------------------------------------------------------------------- |
| 212 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 213 | \brief __hdd_hostapd_stop() - HDD stop function for hostapd interface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 214 | |
| 215 | This is called in response to ifconfig down |
| 216 | |
| 217 | \param - dev Pointer to net_device structure |
| 218 | |
| 219 | \return - 0 for success non-zero for failure |
| 220 | |
| 221 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 222 | int __hdd_hostapd_stop (struct net_device *dev) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | { |
Hanumanth Reddy Pothula | 972e1df | 2018-06-14 13:33:47 +0530 | [diff] [blame] | 224 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 225 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 226 | int ret; |
| 227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | ENTER(); |
| 229 | |
Hanumanth Reddy Pothula | 972e1df | 2018-06-14 13:33:47 +0530 | [diff] [blame] | 230 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 231 | if (0 != ret) |
| 232 | return ret; |
Kanchanapally, Vidyullatha | 99bd6c4 | 2014-12-10 13:54:38 +0530 | [diff] [blame] | 233 | |
Hanumanth Reddy Pothula | 972e1df | 2018-06-14 13:33:47 +0530 | [diff] [blame] | 234 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
| 235 | |
| 236 | //Stop all tx queues |
| 237 | netif_tx_disable(dev); |
| 238 | |
| 239 | //Turn OFF carrier state |
| 240 | netif_carrier_off(dev); |
| 241 | |
| 242 | if (!hdd_is_cli_iface_up(hdd_ctx)) |
| 243 | sme_ScanFlushResult(hdd_ctx->hHal, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | |
| 245 | EXIT(); |
| 246 | return 0; |
| 247 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 248 | |
| 249 | int hdd_hostapd_stop (struct net_device *dev) |
| 250 | { |
| 251 | int ret; |
| 252 | |
| 253 | vos_ssr_protect(__func__); |
| 254 | ret = __hdd_hostapd_stop(dev); |
| 255 | vos_ssr_unprotect(__func__); |
| 256 | |
| 257 | return ret; |
| 258 | } |
| 259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | /**--------------------------------------------------------------------------- |
| 261 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 262 | \brief __hdd_hostapd_uninit() - HDD uninit function |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | |
| 264 | This is called during the netdev unregister to uninitialize all data |
| 265 | associated with the device |
| 266 | |
| 267 | \param - dev Pointer to net_device structure |
| 268 | |
| 269 | \return - void |
| 270 | |
| 271 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 272 | static void __hdd_hostapd_uninit (struct net_device *dev) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | { |
| 274 | hdd_adapter_t *pHostapdAdapter = netdev_priv(dev); |
Mukul Sharma | fe1959a | 2015-02-28 20:02:55 +0530 | [diff] [blame] | 275 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | |
| 277 | ENTER(); |
| 278 | |
Mukul Sharma | fe1959a | 2015-02-28 20:02:55 +0530 | [diff] [blame] | 279 | if (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | { |
Mukul Sharma | fe1959a | 2015-02-28 20:02:55 +0530 | [diff] [blame] | 281 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 282 | FL("Invalid magic")); |
| 283 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | } |
Mukul Sharma | fe1959a | 2015-02-28 20:02:55 +0530 | [diff] [blame] | 285 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 286 | if (NULL == pHddCtx) |
| 287 | { |
| 288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 289 | FL("NULL pHddCtx")); |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | hdd_deinit_adapter(pHostapdAdapter->pHddCtx, pHostapdAdapter, TRUE); |
| 294 | |
| 295 | /* after uninit our adapter structure will no longer be valid */ |
| 296 | pHostapdAdapter->dev = NULL; |
| 297 | pHostapdAdapter->magic = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | |
| 299 | EXIT(); |
| 300 | } |
| 301 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 302 | static void hdd_hostapd_uninit (struct net_device *dev) |
| 303 | { |
| 304 | vos_ssr_protect(__func__); |
| 305 | __hdd_hostapd_uninit(dev); |
| 306 | vos_ssr_unprotect(__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 308 | return; |
| 309 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 310 | /**============================================================================ |
| 311 | @brief hdd_hostapd_hard_start_xmit() - Function registered with the Linux OS for |
| 312 | transmitting packets. There are 2 versions of this function. One that uses |
| 313 | locked queue and other that uses lockless queues. Both have been retained to |
| 314 | do some performance testing |
| 315 | @param skb : [in] pointer to OS packet (sk_buff) |
| 316 | @param dev : [in] pointer to Libra network device |
| 317 | |
| 318 | @return : NET_XMIT_DROP if packets are dropped |
| 319 | : NET_XMIT_SUCCESS if packet is enqueued succesfully |
| 320 | ===========================================================================*/ |
| 321 | int hdd_hostapd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 322 | { |
| 323 | return 0; |
| 324 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 325 | |
| 326 | int __hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | { |
| 328 | return 0; |
| 329 | } |
| 330 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 331 | int hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu) |
| 332 | { |
| 333 | int ret; |
| 334 | vos_ssr_protect(__func__); |
| 335 | ret = __hdd_hostapd_change_mtu(dev, new_mtu); |
| 336 | vos_ssr_unprotect(__func__); |
| 337 | |
| 338 | return ret; |
| 339 | } |
| 340 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 341 | static int hdd_hostapd_driver_command(hdd_adapter_t *pAdapter, |
| 342 | hdd_priv_data_t *priv_data) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | { |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 344 | tANI_U8 *command = NULL; |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 345 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 346 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 347 | int ret = 0; |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 348 | int status; |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 349 | /* |
| 350 | * Note that valid pointers are provided by caller |
| 351 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 353 | ENTER(); |
| 354 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 355 | if (priv_data->total_len <= 0 || |
| 356 | priv_data->total_len > HOSTAPD_IOCTL_COMMAND_STRLEN_MAX) |
| 357 | { |
| 358 | /* below we allocate one more byte for command buffer. |
| 359 | * To avoid addition overflow total_len should be |
| 360 | * smaller than INT_MAX. */ |
| 361 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: integer out of range len %d", |
| 362 | __func__, priv_data->total_len); |
| 363 | ret = -EFAULT; |
| 364 | goto exit; |
| 365 | } |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 366 | status = wlan_hdd_validate_context(pHddCtx); |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 367 | if (0 != status) |
| 368 | { |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 369 | return status; |
| 370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 372 | /* Allocate +1 for '\0' */ |
| 373 | command = kmalloc((priv_data->total_len + 1), GFP_KERNEL); |
| 374 | if (!command) |
| 375 | { |
| 376 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to allocate memory", __func__); |
| 377 | ret = -ENOMEM; |
| 378 | goto exit; |
| 379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 381 | if (copy_from_user(command, priv_data->buf, priv_data->total_len)) |
| 382 | { |
| 383 | ret = -EFAULT; |
| 384 | goto exit; |
| 385 | } |
Mingcheng Zhu | c7608ae | 2013-11-04 15:11:01 -0800 | [diff] [blame] | 386 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 387 | /* Make sure the command is NUL-terminated */ |
| 388 | command[priv_data->total_len] = '\0'; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 390 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 391 | "***HOSTAPD*** : Received %s cmd from Wi-Fi GUI***", command); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 393 | if (strncmp(command, "P2P_SET_NOA", 11) == 0) |
| 394 | { |
| 395 | hdd_setP2pNoa(pAdapter->dev, command); |
| 396 | } |
| 397 | else if (strncmp(command, "P2P_SET_PS", 10) == 0) |
| 398 | { |
| 399 | hdd_setP2pOpps(pAdapter->dev, command); |
| 400 | } |
Rajeev Kumar | 8b37329 | 2014-01-08 20:36:55 -0800 | [diff] [blame] | 401 | #ifdef FEATURE_WLAN_BATCH_SCAN |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 402 | else if (strncmp(command, "WLS_BATCHING", 12) == 0) |
| 403 | { |
| 404 | ret = hdd_handle_batch_scan_ioctl(pAdapter, priv_data, command); |
| 405 | } |
Rajeev Kumar | 8b37329 | 2014-01-08 20:36:55 -0800 | [diff] [blame] | 406 | #endif |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 407 | else if (strncmp(command, "SET_SAP_CHANNEL_LIST", 20) == 0) |
| 408 | { |
| 409 | /* |
| 410 | * command should be a string having format |
| 411 | * SET_SAP_CHANNEL_LIST <num channels> <channels seperated by spaces> |
| 412 | */ |
| 413 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 414 | "%s: Received Command to Set Preferred Channels for SAP", |
| 415 | __func__); |
Rajeev Kumar | 8b37329 | 2014-01-08 20:36:55 -0800 | [diff] [blame] | 416 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 417 | ret = sapSetPreferredChannel(command); |
| 418 | } |
Ganesh Kondabattini | 2d7c7f0 | 2014-09-04 22:21:39 +0530 | [diff] [blame] | 419 | else if ( strncasecmp(command, "MIRACAST", 8) == 0 ) |
| 420 | { |
| 421 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 422 | tANI_U8 filterType = 0; |
| 423 | tANI_U8 *value; |
Rajeev Kumar Sirasanagandla | f740b1e | 2017-08-23 18:07:01 +0530 | [diff] [blame] | 424 | |
| 425 | ret = hdd_drv_cmd_validate(command, 8); |
| 426 | if (ret) |
| 427 | goto exit; |
| 428 | |
Ganesh Kondabattini | 2d7c7f0 | 2014-09-04 22:21:39 +0530 | [diff] [blame] | 429 | value = command + 9; |
| 430 | |
| 431 | /* Convert the value from ascii to integer */ |
| 432 | ret = kstrtou8(value, 10, &filterType); |
| 433 | if (ret < 0) |
| 434 | { |
| 435 | /* If the input value is greater than max value of datatype, |
| 436 | * then also kstrtou8 fails |
| 437 | */ |
| 438 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 439 | "%s: kstrtou8 failed range ", __func__); |
| 440 | ret = -EINVAL; |
| 441 | goto exit; |
| 442 | } |
| 443 | if ((filterType < WLAN_HDD_DRIVER_MIRACAST_CFG_MIN_VAL ) || |
| 444 | (filterType > WLAN_HDD_DRIVER_MIRACAST_CFG_MAX_VAL)) |
| 445 | { |
| 446 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 447 | "%s: Accepted Values are 0 to 2. 0-Disabled, 1-Source," |
| 448 | " 2-Sink ", __func__); |
| 449 | ret = -EINVAL; |
| 450 | goto exit; |
| 451 | } |
| 452 | //Filtertype value should be either 0-Disabled, 1-Source, 2-sink |
| 453 | pHddCtx->drvr_miracast = filterType; |
Kaushik, Sushant | 9612244 | 2014-10-21 16:40:18 +0530 | [diff] [blame] | 454 | pScanInfo = &pHddCtx->scan_info; |
| 455 | if (filterType && pScanInfo != NULL && |
| 456 | pHddCtx->scan_info.mScanPending) |
| 457 | { |
| 458 | /*Miracast Session started. Abort Scan */ |
| 459 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 460 | "%s, Aborting Scan For Miracast",__func__); |
| 461 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
| 462 | eCSR_SCAN_ABORT_DEFAULT); |
| 463 | } |
Ganesh Kondabattini | 2d7c7f0 | 2014-09-04 22:21:39 +0530 | [diff] [blame] | 464 | hdd_tx_rx_pkt_cnt_stat_timer_handler(pHddCtx); |
| 465 | sme_SetMiracastMode(pHddCtx->hHal, pHddCtx->drvr_miracast); |
| 466 | } |
Mahesh A Saptasagar | beca12c | 2015-09-07 16:21:06 +0530 | [diff] [blame] | 467 | else if (strncasecmp(command, "DISABLE_CA_EVENT", 16) == 0) |
| 468 | { |
Rajeev Kumar Sirasanagandla | f740b1e | 2017-08-23 18:07:01 +0530 | [diff] [blame] | 469 | ret = hdd_drv_cmd_validate(command, 16); |
| 470 | if (ret) |
| 471 | goto exit; |
| 472 | |
Mahesh A Saptasagar | beca12c | 2015-09-07 16:21:06 +0530 | [diff] [blame] | 473 | ret = hdd_enable_disable_ca_event(pHddCtx, command, 16); |
| 474 | } |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 475 | |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 476 | /* |
| 477 | * command should be a string having format |
| 478 | * SET_DISABLE_CHANNEL_LIST <num of channels> |
| 479 | * <channels separated by spaces> |
| 480 | */ |
| 481 | else if (strncmp(command, "SET_DISABLE_CHANNEL_LIST", 24) == 0) { |
| 482 | tANI_U8 *ptr = command; |
| 483 | |
| 484 | ret = hdd_drv_cmd_validate(command, 24); |
| 485 | if (ret) |
| 486 | goto exit; |
| 487 | |
| 488 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 489 | " Received Command to disable Channels for in %s", |
| 490 | __func__); |
| 491 | ret = hdd_parse_disable_chan_cmd(pAdapter, ptr); |
| 492 | } |
Hanumanth Reddy Pothula | 8ae38bb | 2018-03-07 18:59:30 +0530 | [diff] [blame] | 493 | else if (strncmp(command, "GET_DISABLE_CHANNEL_LIST", 24) == 0) { |
| 494 | char extra[128] = {0}; |
| 495 | int len; |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 496 | |
Hanumanth Reddy Pothula | 8ae38bb | 2018-03-07 18:59:30 +0530 | [diff] [blame] | 497 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 498 | " Received Command to get disable Channels list %s", |
| 499 | __func__); |
| 500 | |
| 501 | len = hdd_get_disable_ch_list(pHddCtx, extra, sizeof(extra)); |
| 502 | if (len == 0) { |
| 503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 504 | FL("disable channel list are not yet programed")); |
| 505 | ret = -EINVAL; |
| 506 | goto exit; |
| 507 | } |
| 508 | |
| 509 | len = VOS_MIN(priv_data->total_len, len + 1); |
| 510 | if (copy_to_user(priv_data->buf, &extra, len)) { |
| 511 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 512 | "%s: failed to copy data to user buffer", __func__); |
| 513 | ret = -EFAULT; |
| 514 | goto exit; |
| 515 | } |
| 516 | |
| 517 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 518 | FL("data:%s"), extra); |
| 519 | } |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 520 | else { |
| 521 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 522 | TRACE_CODE_HDD_UNSUPPORTED_IOCTL, |
| 523 | pAdapter->sessionId, 0)); |
| 524 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Unsupported GUI command %s"), |
| 525 | command); |
| 526 | } |
| 527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | exit: |
| 529 | if (command) |
| 530 | { |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 531 | kfree(command); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 533 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 534 | return ret; |
| 535 | } |
| 536 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 537 | #ifdef CONFIG_COMPAT |
| 538 | static int hdd_hostapd_driver_compat_ioctl(hdd_adapter_t *pAdapter, |
| 539 | struct ifreq *ifr) |
| 540 | { |
| 541 | struct { |
| 542 | compat_uptr_t buf; |
| 543 | int used_len; |
| 544 | int total_len; |
| 545 | } compat_priv_data; |
| 546 | hdd_priv_data_t priv_data; |
| 547 | int ret = 0; |
| 548 | |
| 549 | /* |
| 550 | * Note that pAdapter and ifr have already been verified by caller, |
| 551 | * and HDD context has also been validated |
| 552 | */ |
| 553 | if (copy_from_user(&compat_priv_data, ifr->ifr_data, |
| 554 | sizeof(compat_priv_data))) { |
| 555 | ret = -EFAULT; |
| 556 | goto exit; |
| 557 | } |
| 558 | priv_data.buf = compat_ptr(compat_priv_data.buf); |
| 559 | priv_data.used_len = compat_priv_data.used_len; |
| 560 | priv_data.total_len = compat_priv_data.total_len; |
| 561 | ret = hdd_hostapd_driver_command(pAdapter, &priv_data); |
| 562 | exit: |
| 563 | return ret; |
| 564 | } |
| 565 | #else /* CONFIG_COMPAT */ |
| 566 | static int hdd_hostapd_driver_compat_ioctl(hdd_adapter_t *pAdapter, |
| 567 | struct ifreq *ifr) |
| 568 | { |
| 569 | /* will never be invoked */ |
| 570 | return 0; |
| 571 | } |
| 572 | #endif /* CONFIG_COMPAT */ |
| 573 | |
| 574 | static int hdd_hostapd_driver_ioctl(hdd_adapter_t *pAdapter, struct ifreq *ifr) |
| 575 | { |
| 576 | hdd_priv_data_t priv_data; |
| 577 | int ret = 0; |
| 578 | |
| 579 | /* |
| 580 | * Note that pAdapter and ifr have already been verified by caller, |
| 581 | * and HDD context has also been validated |
| 582 | */ |
| 583 | if (copy_from_user(&priv_data, ifr->ifr_data, sizeof(priv_data))) { |
| 584 | ret = -EFAULT; |
| 585 | } else { |
| 586 | ret = hdd_hostapd_driver_command(pAdapter, &priv_data); |
| 587 | } |
| 588 | return ret; |
| 589 | } |
| 590 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 591 | static int __hdd_hostapd_ioctl(struct net_device *dev, |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 592 | struct ifreq *ifr, int cmd) |
| 593 | { |
| 594 | hdd_adapter_t *pAdapter; |
| 595 | hdd_context_t *pHddCtx; |
| 596 | int ret; |
| 597 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 598 | ENTER(); |
| 599 | |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 600 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 601 | if (NULL == pAdapter) { |
| 602 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 603 | "%s: HDD adapter context is Null", __func__); |
| 604 | ret = -ENODEV; |
| 605 | goto exit; |
| 606 | } |
| 607 | if (dev != pAdapter->dev) { |
| 608 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 609 | "%s: HDD adapter/dev inconsistency", __func__); |
| 610 | ret = -ENODEV; |
| 611 | goto exit; |
| 612 | } |
| 613 | |
| 614 | if ((!ifr) || (!ifr->ifr_data)) { |
| 615 | ret = -EINVAL; |
| 616 | goto exit; |
| 617 | } |
| 618 | |
| 619 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 620 | ret = wlan_hdd_validate_context(pHddCtx); |
| 621 | if (ret) { |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 622 | ret = -EBUSY; |
| 623 | goto exit; |
| 624 | } |
| 625 | |
| 626 | switch (cmd) { |
| 627 | case (SIOCDEVPRIVATE + 1): |
| 628 | if (is_compat_task()) |
| 629 | ret = hdd_hostapd_driver_compat_ioctl(pAdapter, ifr); |
| 630 | else |
| 631 | ret = hdd_hostapd_driver_ioctl(pAdapter, ifr); |
| 632 | break; |
| 633 | default: |
| 634 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unknown ioctl %d", |
| 635 | __func__, cmd); |
| 636 | ret = -EINVAL; |
| 637 | break; |
| 638 | } |
| 639 | exit: |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 640 | EXIT(); |
Jeff Johnson | d6e7b3f | 2014-03-20 12:12:11 -0700 | [diff] [blame] | 641 | return ret; |
| 642 | } |
| 643 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 644 | static int hdd_hostapd_ioctl(struct net_device *dev, |
| 645 | struct ifreq *ifr, int cmd) |
| 646 | { |
| 647 | int ret; |
| 648 | |
| 649 | vos_ssr_protect(__func__); |
| 650 | ret = __hdd_hostapd_ioctl(dev, ifr, cmd); |
| 651 | vos_ssr_unprotect(__func__); |
| 652 | |
| 653 | return ret; |
| 654 | } |
| 655 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 656 | /**--------------------------------------------------------------------------- |
| 657 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 658 | \brief __hdd_hostapd_set_mac_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | This function sets the user specified mac address using |
| 660 | the command ifconfig wlanX hw ether <mac adress>. |
| 661 | |
| 662 | \param - dev - Pointer to the net device. |
| 663 | - addr - Pointer to the sockaddr. |
| 664 | \return - 0 for success, non zero for failure |
| 665 | |
| 666 | --------------------------------------------------------------------------*/ |
| 667 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 668 | static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | { |
| 670 | struct sockaddr *psta_mac_addr = addr; |
Arun Kumar Khandavalli | 18303eb | 2020-01-22 20:44:09 +0530 | [diff] [blame] | 671 | hdd_adapter_t *pAdapter, *adapter_temp; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 672 | hdd_context_t *pHddCtx; |
Arun Kumar Khandavalli | 18303eb | 2020-01-22 20:44:09 +0530 | [diff] [blame] | 673 | int ret = 0, i; |
| 674 | v_MACADDR_t mac_addr; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 675 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | ENTER(); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 677 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 678 | if (NULL == pAdapter) |
| 679 | { |
| 680 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 681 | "%s: Adapter is NULL",__func__); |
| 682 | return -EINVAL; |
| 683 | } |
| 684 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 685 | ret = wlan_hdd_validate_context(pHddCtx); |
| 686 | if (0 != ret) |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 687 | return ret; |
Arun Kumar Khandavalli | 18303eb | 2020-01-22 20:44:09 +0530 | [diff] [blame] | 688 | |
| 689 | |
| 690 | memcpy(&mac_addr, psta_mac_addr->sa_data, sizeof(mac_addr)); |
| 691 | if(vos_is_macaddr_zero(&mac_addr)) { |
| 692 | hddLog(VOS_TRACE_LEVEL_ERROR, "Zero Mac address"); |
| 693 | return -EINVAL; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 694 | } |
Arun Kumar Khandavalli | 18303eb | 2020-01-22 20:44:09 +0530 | [diff] [blame] | 695 | |
| 696 | if (vos_is_macaddr_broadcast(&mac_addr)) { |
| 697 | hddLog(VOS_TRACE_LEVEL_ERROR,"MAC is Broadcast"); |
| 698 | return -EINVAL; |
| 699 | } |
| 700 | |
| 701 | if (vos_is_macaddr_multicast(&mac_addr)) { |
| 702 | hddLog(VOS_TRACE_LEVEL_ERROR, "Multicast Mac address"); |
| 703 | return -EINVAL; |
| 704 | } |
| 705 | |
| 706 | |
| 707 | adapter_temp = hdd_get_adapter_by_macaddr(pHddCtx, mac_addr.bytes); |
| 708 | if (adapter_temp) { |
| 709 | if (!strcmp(adapter_temp->dev->name, dev->name)) |
| 710 | return 0; |
| 711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 712 | "%s: WLAN Mac Addr: " |
| 713 | MAC_ADDRESS_STR, __func__, |
| 714 | MAC_ADDR_ARRAY(mac_addr.bytes)); |
| 715 | return -EINVAL; |
| 716 | } |
| 717 | |
| 718 | for (i = 0; i < VOS_MAX_CONCURRENCY_PERSONA; i++) { |
| 719 | if (!vos_mem_compare(&pAdapter->macAddressCurrent.bytes, |
| 720 | &pHddCtx->cfg_ini->intfMacAddr[i].bytes[0], VOS_MAC_ADDR_SIZE)) { |
| 721 | memcpy(&pHddCtx->cfg_ini->intfMacAddr[i].bytes[0], mac_addr.bytes, |
| 722 | VOS_MAC_ADDR_SIZE); |
| 723 | break; |
| 724 | } |
| 725 | } |
| 726 | |
| 727 | memcpy(&pAdapter->macAddressCurrent, psta_mac_addr->sa_data, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN); |
Arun Kumar Khandavalli | 18303eb | 2020-01-22 20:44:09 +0530 | [diff] [blame] | 729 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | EXIT(); |
| 731 | return 0; |
| 732 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 733 | |
| 734 | static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) |
| 735 | { |
| 736 | int ret; |
| 737 | |
| 738 | vos_ssr_protect(__func__); |
| 739 | ret = __hdd_hostapd_set_mac_address(dev, addr); |
| 740 | vos_ssr_unprotect(__func__); |
| 741 | |
| 742 | return ret; |
| 743 | } |
| 744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | void hdd_hostapd_inactivity_timer_cb(v_PVOID_t usrDataForCallback) |
| 746 | { |
| 747 | struct net_device *dev = (struct net_device *)usrDataForCallback; |
| 748 | v_BYTE_t we_custom_event[64]; |
| 749 | union iwreq_data wrqu; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 750 | hdd_adapter_t *pHostapdAdapter; |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 751 | hdd_context_t *pHddCtx; |
| 752 | #ifdef DISABLE_CONCURRENCY_AUTOSAVE |
| 753 | VOS_STATUS vos_status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 754 | hdd_ap_ctx_t *pHddApCtx; |
| 755 | #endif /*DISABLE_CONCURRENCY_AUTOSAVE */ |
| 756 | |
| 757 | /* event_name space-delimiter driver_module_name */ |
| 758 | /* Format of the event is "AUTO-SHUT.indication" " " "module_name" */ |
| 759 | char * autoShutEvent = "AUTO-SHUT.indication" " " KBUILD_MODNAME; |
| 760 | int event_len = strlen(autoShutEvent) + 1; /* For the NULL at the end */ |
| 761 | |
| 762 | ENTER(); |
| 763 | |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 764 | pHostapdAdapter = netdev_priv(dev); |
| 765 | if ((NULL == pHostapdAdapter) || |
| 766 | (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic)) |
| 767 | { |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 768 | hddLog(LOGE, FL("invalid adapter: %pK"), pHostapdAdapter); |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 769 | return; |
| 770 | } |
| 771 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 772 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 773 | { |
| 774 | return; |
| 775 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 776 | #ifdef DISABLE_CONCURRENCY_AUTOSAVE |
| 777 | if (vos_concurrent_open_sessions_running()) |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 778 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | /* |
| 780 | This timer routine is going to be called only when AP |
| 781 | persona is up. |
| 782 | If there are concurrent sessions running we do not want |
| 783 | to shut down the Bss.Instead we run the timer again so |
| 784 | that if Autosave is enabled next time and other session |
| 785 | was down only then we bring down AP |
| 786 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 787 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 788 | vos_status = vos_timer_start( |
| 789 | &pHddApCtx->hdd_ap_inactivity_timer, |
| 790 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff |
| 791 | * 1000); |
| 792 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 793 | { |
| 794 | hddLog(LOGE, FL("Failed to init AP inactivity timer")); |
| 795 | } |
| 796 | EXIT(); |
| 797 | return; |
| 798 | } |
| 799 | #endif /*DISABLE_CONCURRENCY_AUTOSAVE */ |
| 800 | memset(&we_custom_event, '\0', sizeof(we_custom_event)); |
| 801 | memcpy(&we_custom_event, autoShutEvent, event_len); |
| 802 | |
| 803 | memset(&wrqu, 0, sizeof(wrqu)); |
| 804 | wrqu.data.length = event_len; |
| 805 | |
| 806 | hddLog(LOG1, FL("Shutting down AP interface due to inactivity")); |
| 807 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, (char *)we_custom_event); |
| 808 | |
| 809 | EXIT(); |
| 810 | } |
| 811 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 812 | VOS_STATUS hdd_change_mcc_go_beacon_interval(hdd_adapter_t *pHostapdAdapter) |
| 813 | { |
| 814 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 815 | ptSapContext pSapCtx = NULL; |
| 816 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 817 | v_PVOID_t hHal = NULL; |
| 818 | |
| 819 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 820 | "%s: UPDATE Beacon Params", __func__); |
| 821 | |
| 822 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
| 823 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 824 | if ( NULL == pSapCtx ) |
| 825 | { |
| 826 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 827 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 828 | return VOS_STATUS_E_FAULT; |
| 829 | } |
| 830 | |
| 831 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 832 | if ( NULL == hHal ){ |
| 833 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 834 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
| 835 | return VOS_STATUS_E_FAULT; |
| 836 | } |
| 837 | halStatus = sme_ChangeMCCBeaconInterval(hHal, pSapCtx->sessionId); |
| 838 | if(halStatus == eHAL_STATUS_FAILURE ){ |
| 839 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 840 | "%s: Failed to update Beacon Params", __func__); |
| 841 | return VOS_STATUS_E_FAILURE; |
| 842 | } |
| 843 | } |
| 844 | return VOS_STATUS_SUCCESS; |
| 845 | } |
| 846 | |
| 847 | void hdd_clear_all_sta(hdd_adapter_t *pHostapdAdapter, v_PVOID_t usrDataForCallback) |
| 848 | { |
| 849 | v_U8_t staId = 0; |
| 850 | struct net_device *dev; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 851 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 852 | ptSapContext pSapCtx = NULL; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 853 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 854 | dev = (struct net_device *)usrDataForCallback; |
| 855 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 856 | if(pSapCtx == NULL){ |
| 857 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 858 | FL("psapCtx is NULL")); |
| 859 | return; |
| 860 | } |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 861 | hddLog(LOGE, FL("Clearing all the STA entry....")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 862 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 863 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 864 | if ( pSapCtx->aStaInfo[staId].isUsed && |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 865 | ( staId != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId)) |
| 866 | { |
| 867 | //Disconnect all the stations |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 868 | hdd_softap_sta_disassoc(pHostapdAdapter, &pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 869 | } |
| 870 | } |
| 871 | } |
| 872 | |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 873 | static int hdd_stop_bss_link(hdd_adapter_t *pHostapdAdapter,v_PVOID_t usrDataForCallback) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 874 | { |
| 875 | struct net_device *dev; |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 876 | hdd_context_t *pHddCtx = NULL; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 877 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 878 | dev = (struct net_device *)usrDataForCallback; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 879 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 880 | ENTER(); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 881 | |
| 882 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 883 | status = wlan_hdd_validate_context(pHddCtx); |
| 884 | |
| 885 | if (0 != status) { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 886 | return status; |
| 887 | } |
| 888 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 889 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
| 890 | { |
| 891 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) ) |
| 892 | { |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("Deleting SAP/P2P link!!!!!!")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 894 | } |
| 895 | clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 896 | wlan_hdd_decr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 897 | } |
| 898 | EXIT(); |
| 899 | return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 902 | #ifdef SAP_AUTH_OFFLOAD |
Agrawal Ashish | 6773c90 | 2017-01-06 19:45:03 +0530 | [diff] [blame] | 903 | bool hdd_set_sap_auth_offload(hdd_adapter_t *pHostapdAdapter, |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 904 | bool enabled) |
| 905 | { |
| 906 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 907 | struct tSirSapOffloadInfo sap_offload_info; |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 908 | |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 909 | vos_mem_copy( &sap_offload_info.macAddr, |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 910 | pHostapdAdapter->macAddressCurrent.bytes, VOS_MAC_ADDR_SIZE); |
| 911 | |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 912 | sap_offload_info.sap_auth_offload_enable = enabled; |
| 913 | sap_offload_info.sap_auth_offload_sec_type = |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 914 | pHddCtx->cfg_ini->sap_auth_offload_sec_type; |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 915 | sap_offload_info.key_len = |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 916 | strlen(pHddCtx->cfg_ini->sap_auth_offload_key); |
| 917 | |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 918 | if (sap_offload_info.sap_auth_offload_enable && |
| 919 | sap_offload_info.sap_auth_offload_sec_type) |
| 920 | { |
| 921 | if (sap_offload_info.key_len < 8 || |
| 922 | sap_offload_info.key_len > WLAN_PSK_STRING_LENGTH) |
| 923 | { |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 924 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 925 | "%s: invalid key length(%d) of WPA security!", __func__, |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 926 | sap_offload_info.key_len); |
Agrawal Ashish | 6773c90 | 2017-01-06 19:45:03 +0530 | [diff] [blame] | 927 | return false; |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 928 | } |
| 929 | } |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 930 | if (sap_offload_info.key_len) |
| 931 | { |
| 932 | vos_mem_copy(sap_offload_info.key, |
| 933 | pHddCtx->cfg_ini->sap_auth_offload_key, |
| 934 | sap_offload_info.key_len); |
| 935 | } |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 936 | if (eHAL_STATUS_SUCCESS != |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 937 | sme_set_sap_auth_offload(pHddCtx->hHal, &sap_offload_info)) |
| 938 | { |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 939 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 940 | "%s: sme_set_sap_auth_offload fail!", __func__); |
Agrawal Ashish | 6773c90 | 2017-01-06 19:45:03 +0530 | [diff] [blame] | 941 | return false; |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 945 | "%s: sme_set_sap_auth_offload successfully!", __func__); |
Agrawal Ashish | 6773c90 | 2017-01-06 19:45:03 +0530 | [diff] [blame] | 946 | return true; |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 947 | } |
| 948 | #endif |
| 949 | |
Abhishek Singh | e8ebb92 | 2017-11-01 13:30:26 +0530 | [diff] [blame] | 950 | /** |
| 951 | * wlansap_get_phymode() - get SAP phymode. |
| 952 | * @pctx: Pointer to the global vos context; a handle to SAP's control block |
| 953 | * can be extracted from its context. When MBSSID feature is enabled, |
| 954 | * SAP context is directly passed to SAP APIs. |
| 955 | * |
| 956 | * This function provides current phymode of SAP interface. |
| 957 | * |
| 958 | * Return: phymode with eCsrPhyMode type. |
| 959 | */ |
| 960 | static eCsrPhyMode |
| 961 | wlansap_get_phymode(v_PVOID_t pctx) |
| 962 | { |
| 963 | ptSapContext psapctx = VOS_GET_SAP_CB(pctx); |
| 964 | |
| 965 | if (!psapctx) { |
| 966 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 967 | "%s: Invalid SAP pointer from pCtx", __func__); |
| 968 | return eCSR_DOT11_MODE_AUTO; |
| 969 | } |
| 970 | return psapctx->csrRoamProfile.phyMode; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * hdd_update_chandef() - Function to update channel width and center freq |
| 975 | * @chandef: cfg80211 chan def |
| 976 | * @cb_mode: chan offset |
| 977 | * |
| 978 | * This function will be called to update channel width and center freq |
| 979 | * |
| 980 | * Return: None |
| 981 | */ |
| 982 | static void |
| 983 | hdd_update_chandef(struct cfg80211_chan_def *chandef, |
| 984 | ePhyChanBondState cb_mode) |
| 985 | { |
| 986 | uint8_t center_chan, chan; |
| 987 | |
| 988 | if (cb_mode <= PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 989 | return; |
| 990 | |
| 991 | chan = vos_freq_to_chan(chandef->chan->center_freq); |
| 992 | chandef->width = NL80211_CHAN_WIDTH_80; |
| 993 | switch (cb_mode) { |
| 994 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 995 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 996 | center_chan = chan + 2; |
| 997 | break; |
| 998 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 999 | center_chan = chan + 6; |
| 1000 | break; |
| 1001 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1002 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1003 | center_chan = chan - 2; |
| 1004 | break; |
| 1005 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1006 | center_chan = chan - 6; |
| 1007 | break; |
| 1008 | default: |
| 1009 | center_chan = chan; |
| 1010 | break; |
| 1011 | } |
| 1012 | |
| 1013 | chandef->center_freq1 = vos_chan_to_freq(center_chan); |
| 1014 | } |
| 1015 | |
| 1016 | /** |
| 1017 | * hdd_chan_change_notify() - Function to notify hostapd about channel change |
| 1018 | * @hostapd_adapter: hostapd adapter |
| 1019 | * @dev: Net device structure |
| 1020 | * @oper_chan: New operating channel |
| 1021 | * |
| 1022 | * This function is used to notify hostapd about the channel change |
| 1023 | * |
| 1024 | * Return: Success on intimating userspace |
| 1025 | * |
| 1026 | */ |
| 1027 | static VOS_STATUS hdd_chan_change_notify(hdd_adapter_t *hostapd_adapter, |
| 1028 | struct net_device *dev, uint8_t oper_chan) |
| 1029 | { |
| 1030 | struct ieee80211_channel *chan; |
| 1031 | struct cfg80211_chan_def chandef; |
| 1032 | enum nl80211_channel_type channel_type; |
| 1033 | eCsrPhyMode phy_mode; |
| 1034 | ePhyChanBondState cb_mode; |
| 1035 | uint32_t freq; |
| 1036 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(hostapd_adapter); |
| 1037 | tSmeConfigParams sme_config; |
| 1038 | |
| 1039 | if (!hal) { |
| 1040 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1041 | "%s: hal is NULL", __func__); |
| 1042 | return VOS_STATUS_E_FAILURE; |
| 1043 | } |
| 1044 | |
| 1045 | freq = vos_chan_to_freq(oper_chan); |
| 1046 | |
| 1047 | chan = __ieee80211_get_channel(hostapd_adapter->wdev.wiphy, freq); |
| 1048 | |
| 1049 | if (!chan) { |
| 1050 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1051 | "%s: Invalid input frequency for channel conversion", __func__); |
| 1052 | return VOS_STATUS_E_FAILURE; |
| 1053 | } |
| 1054 | |
| 1055 | phy_mode = wlansap_get_phymode( |
| 1056 | (WLAN_HDD_GET_CTX(hostapd_adapter))->pvosContext); |
| 1057 | sme_GetConfigParam(hal, &sme_config); |
| 1058 | if (oper_chan <= 14) |
| 1059 | cb_mode = sme_get_cb_phy_mode_from_cb_ini_mode( |
| 1060 | sme_config.csrConfig.channelBondingMode24GHz); |
| 1061 | else |
| 1062 | cb_mode = sme_get_cb_phy_mode_from_cb_ini_mode( |
| 1063 | sme_config.csrConfig.channelBondingMode5GHz); |
| 1064 | |
| 1065 | switch (phy_mode) { |
| 1066 | case eCSR_DOT11_MODE_11n: |
| 1067 | case eCSR_DOT11_MODE_11n_ONLY: |
| 1068 | case eCSR_DOT11_MODE_11ac: |
| 1069 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 1070 | switch (cb_mode) { |
| 1071 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1072 | channel_type = NL80211_CHAN_HT20; |
| 1073 | break; |
| 1074 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1075 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1076 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1077 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1078 | channel_type = NL80211_CHAN_HT40MINUS; |
| 1079 | break; |
| 1080 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1081 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1082 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1083 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1084 | channel_type = NL80211_CHAN_HT40PLUS; |
| 1085 | break; |
| 1086 | default: |
| 1087 | channel_type = NL80211_CHAN_HT20; |
| 1088 | break; |
| 1089 | } |
| 1090 | break; |
| 1091 | default: |
| 1092 | channel_type = NL80211_CHAN_NO_HT; |
| 1093 | break; |
| 1094 | } |
| 1095 | |
| 1096 | cfg80211_chandef_create(&chandef, chan, channel_type); |
| 1097 | if ((phy_mode == eCSR_DOT11_MODE_11ac) || |
| 1098 | (phy_mode == eCSR_DOT11_MODE_11ac_ONLY)) |
| 1099 | hdd_update_chandef(&chandef, cb_mode); |
| 1100 | |
| 1101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1102 | "%s: phy_mode %d cb_mode %d chann_type %d oper_chan %d width %d freq_1 %d", |
| 1103 | __func__, phy_mode, cb_mode, channel_type, oper_chan, |
| 1104 | chandef.width, chandef.center_freq1); |
| 1105 | |
| 1106 | |
| 1107 | cfg80211_ch_switch_notify(dev, &chandef); |
| 1108 | |
| 1109 | return VOS_STATUS_SUCCESS; |
| 1110 | } |
| 1111 | |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 1112 | /** |
| 1113 | * hdd_convert_dot11mode_from_phymode() - get dot11mode to phymode |
| 1114 | * @phymode: phy mode |
| 1115 | * |
| 1116 | * This function is used to get dot11mode to phymode |
| 1117 | * |
| 1118 | * Return: dot11mode |
| 1119 | */ |
| 1120 | static int hdd_convert_dot11mode_from_phymode(int phymode) |
| 1121 | { |
| 1122 | switch (phymode) { |
Abhishek Singh | e8ebb92 | 2017-11-01 13:30:26 +0530 | [diff] [blame] | 1123 | |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 1124 | case VOS_MODE_11A: |
| 1125 | return QCA_WLAN_802_11_MODE_11A; |
| 1126 | |
| 1127 | case VOS_MODE_11B: |
| 1128 | return QCA_WLAN_802_11_MODE_11B; |
| 1129 | |
| 1130 | case VOS_MODE_11G: |
| 1131 | case VOS_MODE_11GONLY: |
| 1132 | return QCA_WLAN_802_11_MODE_11G; |
| 1133 | |
| 1134 | case VOS_MODE_11NA_HT20: |
| 1135 | case VOS_MODE_11NG_HT20: |
| 1136 | case VOS_MODE_11NA_HT40: |
| 1137 | case VOS_MODE_11NG_HT40: |
| 1138 | return QCA_WLAN_802_11_MODE_11N; |
| 1139 | |
| 1140 | case VOS_MODE_11AC_VHT20: |
| 1141 | case VOS_MODE_11AC_VHT40: |
| 1142 | case VOS_MODE_11AC_VHT80: |
| 1143 | case VOS_MODE_11AC_VHT20_2G: |
| 1144 | case VOS_MODE_11AC_VHT40_2G: |
| 1145 | case VOS_MODE_11AC_VHT80_2G: |
| 1146 | #ifdef CONFIG_160MHZ_SUPPORT |
| 1147 | case VOS_MODE_11AC_VHT80_80: |
| 1148 | case VOS_MODE_11AC_VHT160: |
| 1149 | #endif |
| 1150 | return QCA_WLAN_802_11_MODE_11AC; |
| 1151 | |
| 1152 | default: |
| 1153 | return QCA_WLAN_802_11_MODE_INVALID; |
| 1154 | } |
| 1155 | |
| 1156 | } |
| 1157 | |
| 1158 | /** |
| 1159 | * hdd_fill_station_info() - fill station information |
| 1160 | * @sap_ctx: sap context |
| 1161 | * @event: assoc event |
| 1162 | * This function updates sta information from assoc event |
| 1163 | * |
| 1164 | * Return: none |
| 1165 | */ |
| 1166 | static void hdd_fill_station_info(ptSapContext sap_ctx, |
| 1167 | tSap_StationAssocReassocCompleteEvent *event) |
| 1168 | { |
| 1169 | struct hdd_cache_sta_info *sta_info = sap_ctx->cache_sta_info; |
| 1170 | int i=0; |
| 1171 | |
| 1172 | /* check if there is any dup entry */ |
| 1173 | while (i < WLAN_MAX_STA_COUNT) { |
| 1174 | if (vos_mem_compare(sta_info[i].macAddrSTA.bytes, |
| 1175 | event->staMac.bytes, |
| 1176 | VOS_MAC_ADDR_SIZE)) { |
| 1177 | vos_mem_zero(&sta_info[i], sizeof(*sta_info)); |
| 1178 | break; |
| 1179 | } |
| 1180 | i++; |
| 1181 | } |
| 1182 | if (i >= WLAN_MAX_STA_COUNT) { |
| 1183 | i = 0; |
| 1184 | while (i < WLAN_MAX_STA_COUNT) { |
| 1185 | if (sta_info[i].isUsed != TRUE) |
| 1186 | break; |
| 1187 | i++; |
| 1188 | } |
| 1189 | } |
| 1190 | |
| 1191 | if (i < WLAN_MAX_STA_COUNT) { |
| 1192 | sta_info[i].isUsed = TRUE; |
| 1193 | sta_info[i].ucSTAId = event->staId; |
| 1194 | vos_mem_copy(sta_info[i].macAddrSTA.bytes, |
| 1195 | event->staMac.bytes, |
| 1196 | VOS_MAC_ADDR_SIZE); |
| 1197 | sta_info[i].freq = vos_chan_to_freq(event->chan_info.chan_id); |
| 1198 | sta_info[i].ch_width = event->ch_width; |
| 1199 | sta_info[i].nss = 1; |
| 1200 | sta_info[i].dot11_mode = hdd_convert_dot11mode_from_phymode( |
| 1201 | event->chan_info.info); |
| 1202 | if (event->HTCaps.present) { |
| 1203 | sta_info[i].ht_present = TRUE; |
| 1204 | hdd_copy_ht_caps(&sta_info[i].ht_caps, &event->HTCaps); |
| 1205 | } |
| 1206 | if (event->VHTCaps.present) { |
| 1207 | sta_info[i].vht_present = TRUE; |
| 1208 | hdd_copy_vht_caps(&sta_info[i].vht_caps, |
| 1209 | &event->VHTCaps); |
| 1210 | } |
| 1211 | } |
| 1212 | else |
| 1213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "reached max staid, stainfo can't be cached"); |
| 1214 | } |
Abhishek Singh | e8ebb92 | 2017-11-01 13:30:26 +0530 | [diff] [blame] | 1215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1216 | VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCallback) |
| 1217 | { |
| 1218 | hdd_adapter_t *pHostapdAdapter; |
| 1219 | hdd_ap_ctx_t *pHddApCtx; |
| 1220 | hdd_hostapd_state_t *pHostapdState; |
| 1221 | struct net_device *dev; |
| 1222 | eSapHddEvent sapEvent; |
| 1223 | union iwreq_data wrqu; |
| 1224 | v_BYTE_t *we_custom_event_generic = NULL; |
| 1225 | int we_event = 0; |
| 1226 | int i = 0; |
| 1227 | v_U8_t staId; |
| 1228 | VOS_STATUS vos_status; |
| 1229 | v_BOOL_t bWPSState; |
| 1230 | v_BOOL_t bApActive = FALSE; |
| 1231 | v_BOOL_t bAuthRequired = TRUE; |
| 1232 | tpSap_AssocMacAddr pAssocStasArray = NULL; |
| 1233 | char unknownSTAEvent[IW_CUSTOM_MAX+1]; |
| 1234 | char maxAssocExceededEvent[IW_CUSTOM_MAX+1]; |
| 1235 | v_BYTE_t we_custom_start_event[64]; |
| 1236 | char *startBssEvent; |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 1237 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1238 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 5f12e90 | 2013-04-03 10:21:46 -0700 | [diff] [blame] | 1239 | struct iw_michaelmicfailure msg; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 1240 | v_CONTEXT_t pVosContext = NULL; |
| 1241 | ptSapContext pSapCtx = NULL; |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1242 | hdd_config_t *cfg_param; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1243 | |
| 1244 | dev = (struct net_device *)usrDataForCallback; |
| 1245 | pHostapdAdapter = netdev_priv(dev); |
Madan Mohan Koyyalamudi | e1b791f | 2013-07-24 12:53:33 +0530 | [diff] [blame] | 1246 | |
| 1247 | if ((NULL == pHostapdAdapter) || |
| 1248 | (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic)) |
| 1249 | { |
| 1250 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1251 | "invalid adapter or adapter has invalid magic"); |
| 1252 | return eHAL_STATUS_FAILURE; |
| 1253 | } |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 1254 | pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 1255 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 1256 | if(pSapCtx == NULL){ |
| 1257 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1258 | FL("psapCtx is NULL")); |
| 1259 | return eHAL_STATUS_FAILURE; |
| 1260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1261 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 1262 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 1263 | sapEvent = pSapEvent->sapHddEventCode; |
| 1264 | memset(&wrqu, '\0', sizeof(wrqu)); |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 1265 | pHddCtx = (hdd_context_t*)(pHostapdAdapter->pHddCtx); |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1266 | cfg_param = pHddCtx->cfg_ini; |
| 1267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | switch(sapEvent) |
| 1269 | { |
| 1270 | case eSAP_START_BSS_EVENT : |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1271 | hddLog(LOG1, FL("BSS configured status = %s, channel = %u, bc sta Id = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1272 | pSapEvent->sapevt.sapStartBssCompleteEvent.status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS", |
| 1273 | pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel, |
| 1274 | pSapEvent->sapevt.sapStartBssCompleteEvent.staId); |
| 1275 | |
| 1276 | pHostapdState->vosStatus = pSapEvent->sapevt.sapStartBssCompleteEvent.status; |
| 1277 | vos_status = vos_event_set(&pHostapdState->vosEvent); |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1278 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | if (!VOS_IS_STATUS_SUCCESS(vos_status) || pHostapdState->vosStatus) |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1280 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1281 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: startbss event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | goto stopbss; |
| 1283 | } |
| 1284 | else |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1285 | { |
| 1286 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 1287 | { |
| 1288 | if ((cfg_param->dynSplitscan) && |
| 1289 | (!pHddCtx->issplitscan_enabled)) |
| 1290 | { |
| 1291 | pHddCtx->issplitscan_enabled = TRUE; |
| 1292 | sme_enable_disable_split_scan( |
| 1293 | WLAN_HDD_GET_HAL_CTX(pHostapdAdapter), |
| 1294 | cfg_param->nNumStaChanCombinedConc, |
| 1295 | cfg_param->nNumP2PChanCombinedConc); |
| 1296 | } |
| 1297 | } |
| 1298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1299 | pHddApCtx->uBCStaId = pSapEvent->sapevt.sapStartBssCompleteEvent.staId; |
| 1300 | //@@@ need wep logic here to set privacy bit |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1301 | vos_status = hdd_softap_Register_BC_STA(pHostapdAdapter, pHddApCtx->uPrivacy); |
| 1302 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 1303 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1304 | hddLog(LOGW, FL("Failed to register BC STA %d"), vos_status); |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 1305 | hdd_stop_bss_link(pHostapdAdapter, usrDataForCallback); |
| 1306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1307 | } |
Deepthi Gowri | ed08509 | 2015-10-20 19:30:52 +0530 | [diff] [blame] | 1308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1309 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1310 | { |
| 1311 | // AP Inactivity timer init and start |
| 1312 | vos_status = vos_timer_init( &pHddApCtx->hdd_ap_inactivity_timer, VOS_TIMER_TYPE_SW, |
| 1313 | hdd_hostapd_inactivity_timer_cb, (v_PVOID_t)dev ); |
| 1314 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1315 | hddLog(LOGE, FL("Failed to init AP inactivity timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | |
| 1317 | vos_status = vos_timer_start( &pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000); |
| 1318 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1319 | hddLog(LOGE, FL("Failed to init AP inactivity timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1320 | |
| 1321 | } |
| 1322 | pHddApCtx->operatingChannel = pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel; |
| 1323 | pHostapdState->bssState = BSS_START; |
| 1324 | |
| 1325 | // Send current operating channel of SoftAP to BTC-ES |
| 1326 | send_btc_nlink_msg(WLAN_BTC_SOFTAP_BSS_START, 0); |
| 1327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | //Check if there is any group key pending to set. |
| 1329 | if( pHddApCtx->groupKey.keyLength ) |
| 1330 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1331 | if( VOS_STATUS_SUCCESS != WLANSAP_SetKeySta( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1332 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, |
| 1333 | &pHddApCtx->groupKey ) ) |
| 1334 | { |
| 1335 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1336 | "%s: WLANSAP_SetKeySta failed", __func__); |
| 1337 | } |
| 1338 | pHddApCtx->groupKey.keyLength = 0; |
| 1339 | } |
| 1340 | else if ( pHddApCtx->wepKey[0].keyLength ) |
| 1341 | { |
| 1342 | int i=0; |
| 1343 | for ( i = 0; i < CSR_MAX_NUM_KEY; i++ ) |
| 1344 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1345 | if( VOS_STATUS_SUCCESS != WLANSAP_SetKeySta( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1346 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, |
| 1347 | &pHddApCtx->wepKey[i] ) ) |
| 1348 | { |
| 1349 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1350 | "%s: WLANSAP_SetKeySta failed idx %d", __func__, i); |
| 1351 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1352 | } |
| 1353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1354 | //Fill the params for sending IWEVCUSTOM Event with SOFTAP.enabled |
| 1355 | startBssEvent = "SOFTAP.enabled"; |
| 1356 | memset(&we_custom_start_event, '\0', sizeof(we_custom_start_event)); |
| 1357 | memcpy(&we_custom_start_event, startBssEvent, strlen(startBssEvent)); |
| 1358 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1359 | wrqu.data.length = strlen(startBssEvent); |
| 1360 | we_event = IWEVCUSTOM; |
| 1361 | we_custom_event_generic = we_custom_start_event; |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1362 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1363 | break; //Event will be sent after Switch-Case stmt |
| 1364 | |
| 1365 | case eSAP_STOP_BSS_EVENT: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1366 | hddLog(LOG1, FL("BSS stop status = %s"),pSapEvent->sapevt.sapStopBssCompleteEvent.status ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1367 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1368 | |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 1369 | //Free up Channel List incase if it is set |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1370 | sapCleanupChannelList(); |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 1371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1372 | pHddApCtx->operatingChannel = 0; //Invalidate the channel info. |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 1373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1374 | goto stopbss; |
| 1375 | case eSAP_STA_SET_KEY_EVENT: |
| 1376 | //TODO: forward the message to hostapd once implementtation is done for now just print |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1377 | hddLog(LOG1, FL("SET Key: configured status = %s"),pSapEvent->sapevt.sapStationSetKeyCompleteEvent.status ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1378 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1379 | return VOS_STATUS_SUCCESS; |
| 1380 | case eSAP_STA_DEL_KEY_EVENT: |
| 1381 | //TODO: forward the message to hostapd once implementtation is done for now just print |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1382 | hddLog(LOG1, FL("Event received %s"),"eSAP_STA_DEL_KEY_EVENT"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1383 | return VOS_STATUS_SUCCESS; |
| 1384 | case eSAP_STA_MIC_FAILURE_EVENT: |
| 1385 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | memset(&msg, '\0', sizeof(msg)); |
| 1387 | msg.src_addr.sa_family = ARPHRD_ETHER; |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1388 | memcpy(msg.src_addr.sa_data, &pSapEvent->sapevt.sapStationMICFailureEvent.staMac, sizeof(v_MACADDR_t)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1389 | hddLog(LOG1, "MIC MAC "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1390 | if(pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eSAP_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1391 | msg.flags = IW_MICFAILURE_GROUP; |
| 1392 | else |
| 1393 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 1394 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1395 | wrqu.data.length = sizeof(msg); |
| 1396 | we_event = IWEVMICHAELMICFAILURE; |
| 1397 | we_custom_event_generic = (v_BYTE_t *)&msg; |
| 1398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1399 | /* inform mic failure to nl80211 */ |
| 1400 | cfg80211_michael_mic_failure(dev, |
| 1401 | pSapEvent->sapevt. |
| 1402 | sapStationMICFailureEvent.staMac.bytes, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1403 | ((pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eSAP_TRUE) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | NL80211_KEYTYPE_GROUP : |
| 1405 | NL80211_KEYTYPE_PAIRWISE), |
| 1406 | pSapEvent->sapevt.sapStationMICFailureEvent.keyId, |
| 1407 | pSapEvent->sapevt.sapStationMICFailureEvent.TSC, |
| 1408 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1409 | break; |
| 1410 | |
| 1411 | case eSAP_STA_ASSOC_EVENT: |
| 1412 | case eSAP_STA_REASSOC_EVENT: |
| 1413 | wrqu.addr.sa_family = ARPHRD_ETHER; |
| 1414 | memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac, |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1415 | sizeof(v_MACADDR_t)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1416 | hddLog(LOG1, " associated "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1417 | we_event = IWEVREGISTERED; |
| 1418 | |
| 1419 | WLANSAP_Get_WPS_State((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, &bWPSState); |
| 1420 | |
| 1421 | if ( (eCSR_ENCRYPT_TYPE_NONE == pHddApCtx->ucEncryptType) || |
| 1422 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddApCtx->ucEncryptType ) || |
| 1423 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddApCtx->ucEncryptType ) ) |
| 1424 | { |
| 1425 | bAuthRequired = FALSE; |
| 1426 | } |
Abhishek Singh | 2c67928 | 2017-01-12 17:33:40 +0530 | [diff] [blame] | 1427 | /* fAuthRequiredshould should be false for sap offload */ |
| 1428 | if ((bAuthRequired || bWPSState) |
| 1429 | #ifdef SAP_AUTH_OFFLOAD |
| 1430 | && !cfg_param->enable_sap_auth_offload |
| 1431 | #endif |
| 1432 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1433 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1434 | vos_status = hdd_softap_RegisterSTA( pHostapdAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1435 | TRUE, |
| 1436 | pHddApCtx->uPrivacy, |
| 1437 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId, |
| 1438 | 0, |
| 1439 | 0, |
| 1440 | (v_MACADDR_t *)wrqu.addr.sa_data, |
| 1441 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1442 | |
| 1443 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1444 | hddLog(LOGW, FL("Failed to register STA %d "MAC_ADDRESS_STR""), |
| 1445 | vos_status, MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1446 | } |
| 1447 | else |
| 1448 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1449 | vos_status = hdd_softap_RegisterSTA( pHostapdAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1450 | FALSE, |
| 1451 | pHddApCtx->uPrivacy, |
| 1452 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId, |
| 1453 | 0, |
| 1454 | 0, |
| 1455 | (v_MACADDR_t *)wrqu.addr.sa_data, |
| 1456 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1457 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1458 | hddLog(LOGW, FL("Failed to register STA %d "MAC_ADDRESS_STR""), |
| 1459 | vos_status, MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
Amar Singhal | 6144c00 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 1460 | } |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 1461 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1462 | hdd_fill_station_info(pSapCtx, |
| 1463 | &pSapEvent->sapevt.sapStationAssocReassocCompleteEvent); |
Amar Singhal | 6144c00 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 1464 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 1465 | staId = |
| 1466 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId; |
| 1467 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1468 | { |
| 1469 | |
| 1470 | pSapCtx->aStaInfo[staId].rate_flags = |
| 1471 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.rate_flags; |
| 1472 | } |
| 1473 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1474 | // Stop AP inactivity timer |
| 1475 | if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_RUNNING) |
| 1476 | { |
| 1477 | vos_status = vos_timer_stop(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1478 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1479 | hddLog(LOGE, FL("Failed to start AP inactivity timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1480 | } |
Sameer Thalappil | 50dc009 | 2013-02-19 17:23:33 -0800 | [diff] [blame] | 1481 | #ifdef WLAN_OPEN_SOURCE |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 1482 | if (vos_wake_lock_active(&pHddCtx->sap_wake_lock)) |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 1483 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 1484 | vos_wake_lock_release(&pHddCtx->sap_wake_lock, |
| 1485 | WIFI_POWER_EVENT_WAKELOCK_SAP); |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 1486 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 1487 | vos_wake_lock_timeout_release(&pHddCtx->sap_wake_lock, |
| 1488 | HDD_SAP_WAKE_LOCK_DURATION, |
| 1489 | WIFI_POWER_EVENT_WAKELOCK_SAP); |
| 1490 | |
Sameer Thalappil | 50dc009 | 2013-02-19 17:23:33 -0800 | [diff] [blame] | 1491 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1492 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 1493 | { |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1494 | struct station_info *staInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | v_U16_t iesLen = pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.iesLen; |
| 1496 | |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1497 | staInfo = vos_mem_malloc(sizeof(*staInfo)); |
| 1498 | if (staInfo == NULL) { |
| 1499 | hddLog(LOGE, FL("alloc station_info failed")); |
| 1500 | return VOS_STATUS_E_NOMEM; |
| 1501 | } |
| 1502 | |
| 1503 | memset(staInfo, 0, sizeof(*staInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1504 | if (iesLen <= MAX_ASSOC_IND_IE_LEN ) |
| 1505 | { |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1506 | staInfo->assoc_req_ies = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1507 | (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.ies[0]; |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1508 | staInfo->assoc_req_ies_len = iesLen; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 1509 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,31)) && \ |
| 1510 | ((LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 1511 | !defined(WITH_BACKPORTS)) |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1512 | staInfo->filled |= STATION_INFO_ASSOC_REQ_IES; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1513 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1514 | cfg80211_new_sta(dev, |
| 1515 | (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac.bytes[0], |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 1516 | staInfo, GFP_KERNEL); |
| 1517 | vos_mem_free(staInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1518 | } |
| 1519 | else |
| 1520 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1521 | hddLog(LOGE, FL(" Assoc Ie length is too long")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1522 | } |
| 1523 | } |
| 1524 | #endif |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1525 | hdd_manage_delack_timer(pHddCtx); |
| 1526 | |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1527 | pScanInfo = &pHddCtx->scan_info; |
| 1528 | // Lets do abort scan to ensure smooth authentication for client |
| 1529 | if ((pScanInfo != NULL) && pScanInfo->mScanPending) |
| 1530 | { |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 1531 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 1532 | eCSR_SCAN_ABORT_DEFAULT); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | |
| 1535 | break; |
| 1536 | case eSAP_STA_DISASSOC_EVENT: |
| 1537 | memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1538 | sizeof(v_MACADDR_t)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1539 | hddLog(LOG1, " disassociated "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
Abhishek Singh | 1a9dbcf | 2019-09-06 12:50:03 +0530 | [diff] [blame] | 1540 | |
| 1541 | vos_status = vos_event_set(&pHostapdState->sta_discon_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1542 | if (pSapEvent->sapevt.sapStationDisassocCompleteEvent.reason == eSAP_USR_INITATED_DISASSOC) |
| 1543 | hddLog(LOG1," User initiated disassociation"); |
| 1544 | else |
| 1545 | hddLog(LOG1," MAC initiated disassociation"); |
| 1546 | we_event = IWEVEXPIRED; |
| 1547 | vos_status = hdd_softap_GetStaId(pHostapdAdapter, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, &staId); |
| 1548 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1549 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("ERROR: HDD Failed to find sta id!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1551 | return VOS_STATUS_E_FAILURE; |
| 1552 | } |
| 1553 | hdd_softap_DeregisterSTA(pHostapdAdapter, staId); |
| 1554 | |
| 1555 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1556 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 1557 | spin_lock_bh( &pSapCtx->staInfo_lock ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1558 | // Start AP inactivity timer if no stations associated with it |
| 1559 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 1560 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 1561 | if (pSapCtx->aStaInfo[i].isUsed && i != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1562 | { |
| 1563 | bApActive = TRUE; |
| 1564 | break; |
| 1565 | } |
| 1566 | } |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 1567 | spin_unlock_bh( &pSapCtx->staInfo_lock ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | |
| 1569 | if (bApActive == FALSE) |
| 1570 | { |
| 1571 | if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_STOPPED) |
| 1572 | { |
| 1573 | vos_status = vos_timer_start(&pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000); |
| 1574 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1575 | hddLog(LOGE, FL("Failed to init AP inactivity timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1576 | } |
| 1577 | else |
| 1578 | VOS_ASSERT(vos_timer_getCurrentState(&pHddApCtx->hdd_ap_inactivity_timer) == VOS_TIMER_STATE_STOPPED); |
| 1579 | } |
| 1580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 1582 | cfg80211_del_sta(dev, |
| 1583 | (const u8 *)&pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac.bytes[0], |
| 1584 | GFP_KERNEL); |
| 1585 | #endif |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1586 | //Update the beacon Interval if it is P2P GO |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1587 | vos_status = hdd_change_mcc_go_beacon_interval(pHostapdAdapter); |
| 1588 | if (VOS_STATUS_SUCCESS != vos_status) |
| 1589 | { |
| 1590 | hddLog(LOGE, "%s: failed to update Beacon interval %d", |
| 1591 | __func__, vos_status); |
| 1592 | } |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1593 | hdd_manage_delack_timer(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1594 | break; |
| 1595 | case eSAP_WPS_PBC_PROBE_REQ_EVENT: |
| 1596 | { |
| 1597 | static const char * message ="MLMEWPSPBCPROBEREQ.indication"; |
| 1598 | union iwreq_data wreq; |
| 1599 | |
| 1600 | down(&pHddApCtx->semWpsPBCOverlapInd); |
| 1601 | pHddApCtx->WPSPBCProbeReq.probeReqIELen = pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIELen; |
| 1602 | |
| 1603 | vos_mem_copy(pHddApCtx->WPSPBCProbeReq.probeReqIE, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIE, |
| 1604 | pHddApCtx->WPSPBCProbeReq.probeReqIELen); |
| 1605 | |
| 1606 | vos_mem_copy(pHddApCtx->WPSPBCProbeReq.peerMacAddr, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.peerMacAddr, sizeof(v_MACADDR_t)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1607 | hddLog(LOG1, "WPS PBC probe req "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pHddApCtx->WPSPBCProbeReq.peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | memset(&wreq, 0, sizeof(wreq)); |
| 1609 | wreq.data.length = strlen(message); // This is length of message |
| 1610 | wireless_send_event(dev, IWEVCUSTOM, &wreq, (char *)message); |
| 1611 | |
| 1612 | return VOS_STATUS_SUCCESS; |
| 1613 | } |
| 1614 | case eSAP_ASSOC_STA_CALLBACK_EVENT: |
| 1615 | pAssocStasArray = pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas; |
| 1616 | if (pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta != 0) |
| 1617 | { // List of associated stations |
| 1618 | for (i = 0; i < pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta; i++) |
| 1619 | { |
| 1620 | hddLog(LOG1,"Associated Sta Num %d:assocId=%d, staId=%d, staMac="MAC_ADDRESS_STR, |
| 1621 | i+1, |
| 1622 | pAssocStasArray->assocId, |
| 1623 | pAssocStasArray->staId, |
| 1624 | MAC_ADDR_ARRAY(pAssocStasArray->staMac.bytes)); |
| 1625 | pAssocStasArray++; |
| 1626 | } |
| 1627 | } |
| 1628 | vos_mem_free(pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas);// Release caller allocated memory here |
Srinivas Girigowda | 8d2348f | 2013-12-12 12:14:15 -0800 | [diff] [blame] | 1629 | pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1630 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1631 | case eSAP_REMAIN_CHAN_READY: |
| 1632 | hdd_remainChanReadyHandler( pHostapdAdapter ); |
| 1633 | return VOS_STATUS_SUCCESS; |
| 1634 | case eSAP_SEND_ACTION_CNF: |
| 1635 | hdd_sendActionCnf( pHostapdAdapter, |
| 1636 | ( eSAP_STATUS_SUCCESS == |
| 1637 | pSapEvent->sapevt.sapActionCnf.actionSendSuccess ) ? |
| 1638 | TRUE : FALSE ); |
| 1639 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1640 | case eSAP_UNKNOWN_STA_JOIN: |
| 1641 | snprintf(unknownSTAEvent, IW_CUSTOM_MAX, "JOIN_UNKNOWN_STA-%02x:%02x:%02x:%02x:%02x:%02x", |
| 1642 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[0], |
| 1643 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[1], |
| 1644 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[2], |
| 1645 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[3], |
| 1646 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[4], |
| 1647 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[5]); |
| 1648 | we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */ |
| 1649 | wrqu.data.pointer = unknownSTAEvent; |
| 1650 | wrqu.data.length = strlen(unknownSTAEvent); |
| 1651 | we_custom_event_generic = (v_BYTE_t *)unknownSTAEvent; |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1652 | hddLog(LOGE,"%s", unknownSTAEvent); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1653 | break; |
| 1654 | |
| 1655 | case eSAP_MAX_ASSOC_EXCEEDED: |
| 1656 | snprintf(maxAssocExceededEvent, IW_CUSTOM_MAX, "Peer %02x:%02x:%02x:%02x:%02x:%02x denied" |
| 1657 | " assoc due to Maximum Mobile Hotspot connections reached. Please disconnect" |
| 1658 | " one or more devices to enable the new device connection", |
| 1659 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[0], |
| 1660 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[1], |
| 1661 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[2], |
| 1662 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[3], |
| 1663 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[4], |
| 1664 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[5]); |
| 1665 | we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */ |
| 1666 | wrqu.data.pointer = maxAssocExceededEvent; |
| 1667 | wrqu.data.length = strlen(maxAssocExceededEvent); |
| 1668 | we_custom_event_generic = (v_BYTE_t *)maxAssocExceededEvent; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1669 | hddLog(LOG1,"%s", maxAssocExceededEvent); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | break; |
| 1671 | case eSAP_STA_ASSOC_IND: |
| 1672 | return VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1673 | |
| 1674 | case eSAP_DISCONNECT_ALL_P2P_CLIENT: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1675 | hddLog(LOG1, FL(" Disconnecting all the P2P Clients....")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1676 | hdd_clear_all_sta(pHostapdAdapter, usrDataForCallback); |
| 1677 | return VOS_STATUS_SUCCESS; |
| 1678 | |
| 1679 | case eSAP_MAC_TRIG_STOP_BSS_EVENT : |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 1680 | vos_status = hdd_stop_bss_link(pHostapdAdapter, usrDataForCallback); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1681 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1682 | { |
Agarwal Ashish | 8e53893 | 2014-12-24 18:12:52 +0530 | [diff] [blame] | 1683 | hddLog(LOGW, FL("hdd_stop_bss_link failed %d"), vos_status); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1684 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1685 | return VOS_STATUS_SUCCESS; |
Abhishek Singh | e8ebb92 | 2017-11-01 13:30:26 +0530 | [diff] [blame] | 1686 | case eSAP_CHANNEL_CHANGED_EVENT: |
| 1687 | hddLog(LOG1, FL("Received eSAP_CHANNEL_CHANGED_EVENT event")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1688 | |
Abhishek Singh | e8ebb92 | 2017-11-01 13:30:26 +0530 | [diff] [blame] | 1689 | return hdd_chan_change_notify(pHostapdAdapter, dev, |
| 1690 | pSapEvent->sapevt.sap_chan_selected.new_chan); |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 1691 | case eSAP_STA_LOSTLINK_DETECTED: |
| 1692 | { |
| 1693 | tSap_StationDisassocCompleteEvent *disassoc_comp = |
| 1694 | &pSapEvent->sapevt.sapStationDisassocCompleteEvent; |
| 1695 | |
| 1696 | struct hdd_cache_sta_info *sta_info = hdd_get_cache_stainfo( |
| 1697 | pSapCtx->cache_sta_info, |
| 1698 | disassoc_comp->staMac.bytes); |
| 1699 | if (!sta_info) { |
| 1700 | hddLog(LOGE, FL("invalid cache sta info")); |
| 1701 | return VOS_STATUS_E_FAILURE; |
| 1702 | } |
| 1703 | |
| 1704 | WLANTL_GetSAPStaRSSi(pVosContext, disassoc_comp->staId, |
| 1705 | &sta_info->rssi); |
| 1706 | sta_info->rx_rate = |
| 1707 | wlan_tl_get_sta_rx_rate(pVosContext, disassoc_comp->staId); |
| 1708 | if (disassoc_comp->reason != eSAP_USR_INITATED_DISASSOC) |
| 1709 | sta_info->reason_code = disassoc_comp->reason; |
| 1710 | return VOS_STATUS_SUCCESS; |
| 1711 | } |
| 1712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1713 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1714 | hddLog(LOG1,"SAP message is not handled"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1715 | goto stopbss; |
| 1716 | return VOS_STATUS_SUCCESS; |
| 1717 | } |
| 1718 | wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic); |
| 1719 | return VOS_STATUS_SUCCESS; |
| 1720 | |
| 1721 | stopbss : |
| 1722 | { |
| 1723 | v_BYTE_t we_custom_event[64]; |
| 1724 | char *stopBssEvent = "STOP-BSS.response";//17 |
| 1725 | int event_len = strlen(stopBssEvent); |
| 1726 | |
| 1727 | hddLog(LOG1, FL("BSS stop status = %s"), |
| 1728 | pSapEvent->sapevt.sapStopBssCompleteEvent.status ? |
| 1729 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1730 | |
| 1731 | /* Change the BSS state now since, as we are shutting things down, |
| 1732 | * we don't want interfaces to become re-enabled */ |
| 1733 | pHostapdState->bssState = BSS_STOP; |
| 1734 | |
Gopichand Nakkala | f8fe15d | 2013-05-27 13:55:40 +0530 | [diff] [blame] | 1735 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1736 | { |
| 1737 | if (VOS_TIMER_STATE_RUNNING == pHddApCtx->hdd_ap_inactivity_timer.state) |
| 1738 | { |
| 1739 | vos_status = vos_timer_stop(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1740 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1741 | hddLog(LOGE, FL("Failed to stop AP inactivity timer")); |
| 1742 | } |
| 1743 | |
| 1744 | vos_status = vos_timer_destroy(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1745 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1746 | hddLog(LOGE, FL("Failed to Destroy AP inactivity timer")); |
| 1747 | } |
| 1748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | /* Stop the pkts from n/w stack as we are going to free all of |
| 1750 | * the TX WMM queues for all STAID's */ |
Kapil Gupta | 0afd191 | 2016-12-28 12:52:13 +0530 | [diff] [blame] | 1751 | |
| 1752 | /* |
| 1753 | * If channel avoidance is in progress means driver is performing SAP |
| 1754 | * restart. So don't do carrier off, which may lead framework to do |
| 1755 | * driver reload. |
| 1756 | */ |
| 1757 | hddLog(LOG1, FL("ch avoid in progress: %d"), |
| 1758 | pHddCtx->is_ch_avoid_in_progress); |
| 1759 | if (pHddCtx->is_ch_avoid_in_progress && |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 1760 | pHddCtx->cfg_ini->sap_internal_restart) |
Kapil Gupta | 0afd191 | 2016-12-28 12:52:13 +0530 | [diff] [blame] | 1761 | netif_tx_disable(dev); |
| 1762 | else |
| 1763 | hdd_hostapd_stop(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | |
| 1765 | /* reclaim all resources allocated to the BSS */ |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1766 | vos_status = hdd_softap_stop_bss(pHostapdAdapter); |
| 1767 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1768 | hddLog(LOGW, FL("hdd_softap_stop_bss failed %d"), vos_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1769 | |
Amar Singhal | 37e6f05 | 2013-03-05 16:16:54 -0800 | [diff] [blame] | 1770 | /* once the event is set, structure dev/pHostapdAdapter should |
| 1771 | * not be touched since they are now subject to being deleted |
| 1772 | * by another thread */ |
| 1773 | if (eSAP_STOP_BSS_EVENT == sapEvent) |
| 1774 | vos_event_set(&pHostapdState->vosEvent); |
| 1775 | |
Yeshwanth Sriram Guntuka | b973f1c | 2018-03-29 19:35:49 +0530 | [diff] [blame] | 1776 | if (hdd_is_any_session_connected(pHddCtx) == VOS_STATUS_E_FAILURE) { |
| 1777 | hdd_enable_bmps_imps(pHddCtx); |
| 1778 | sme_request_imps(pHddCtx->hHal); |
| 1779 | } |
| 1780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1781 | /* notify userspace that the BSS has stopped */ |
| 1782 | memset(&we_custom_event, '\0', sizeof(we_custom_event)); |
| 1783 | memcpy(&we_custom_event, stopBssEvent, event_len); |
| 1784 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1785 | wrqu.data.length = event_len; |
| 1786 | we_event = IWEVCUSTOM; |
| 1787 | we_custom_event_generic = we_custom_event; |
| 1788 | wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic); |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1789 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1790 | } |
Bala Venkatesh | 5c06a25 | 2018-07-12 16:08:04 +0530 | [diff] [blame] | 1791 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO || |
| 1792 | pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 1793 | { |
| 1794 | hddLog(LOG1, |
| 1795 | FL("SAP or Go is getting removed and we are trying to re-enable TDLS")); |
| 1796 | wlan_hdd_tdls_reenable(pHddCtx); |
| 1797 | } |
| 1798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | return VOS_STATUS_SUCCESS; |
| 1800 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1801 | |
| 1802 | int hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1803 | tHalHandle halHandle, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1804 | eCsrEncryptionType *pEncryptType, |
| 1805 | eCsrEncryptionType *mcEncryptType, |
| 1806 | eCsrAuthType *pAuthType, |
| 1807 | v_BOOL_t *pMFPCapable, |
| 1808 | v_BOOL_t *pMFPRequired, |
| 1809 | u_int16_t gen_ie_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | u_int8_t *gen_ie ) |
| 1811 | { |
| 1812 | tDot11fIERSN dot11RSNIE; |
| 1813 | tDot11fIEWPA dot11WPAIE; |
| 1814 | |
| 1815 | tANI_U8 *pRsnIe; |
| 1816 | tANI_U16 RSNIeLen; |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 1817 | tANI_U32 status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1818 | |
| 1819 | if (NULL == halHandle) |
| 1820 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1821 | hddLog(LOGE, FL("Error haHandle returned NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1822 | return -EINVAL; |
| 1823 | } |
| 1824 | |
| 1825 | // Validity checks |
| 1826 | if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) || |
| 1827 | (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) |
| 1828 | return -EINVAL; |
| 1829 | // Type check |
| 1830 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 1831 | { |
| 1832 | // Validity checks |
| 1833 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
| 1834 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 1835 | { |
| 1836 | return VOS_STATUS_E_FAILURE; |
| 1837 | } |
| 1838 | // Skip past the EID byte and length byte |
| 1839 | pRsnIe = gen_ie + 2; |
| 1840 | RSNIeLen = gen_ie_len - 2; |
| 1841 | // Unpack the RSN IE |
| 1842 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 1843 | |
| 1844 | status = sme_unpack_rsn_ie(halHandle, |
| 1845 | pRsnIe, |
| 1846 | RSNIeLen, |
| 1847 | &dot11RSNIE); |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 1848 | if (!DOT11F_SUCCEEDED(status)) |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 1849 | { |
| 1850 | hddLog(LOGE, |
| 1851 | FL("unpack failed for RSN IE status:(0x%08x)"), |
| 1852 | status); |
| 1853 | return -EINVAL; |
| 1854 | } |
| 1855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1856 | // Copy out the encryption and authentication types |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1857 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1858 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1859 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 1860 | __func__, dot11RSNIE.akm_suite_cnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | /*Here we have followed the apple base code, |
| 1862 | but probably I suspect we can do something different*/ |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 1863 | //dot11RSNIE.akm_suite_cnt |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1864 | // Just translate the FIRST one |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 1865 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suite[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | //dot11RSNIE.pwise_cipher_suite_count |
| 1867 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 1868 | //dot11RSNIE.gp_cipher_suite_count |
| 1869 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
| 1870 | // Set the PMKSA ID Cache for this interface |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1871 | *pMFPCapable = 0 != (dot11RSNIE.RSN_Cap[0] & 0x80); |
| 1872 | *pMFPRequired = 0 != (dot11RSNIE.RSN_Cap[0] & 0x40); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1873 | |
| 1874 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
| 1875 | } else |
| 1876 | if (gen_ie[0] == DOT11F_EID_WPA) |
| 1877 | { |
| 1878 | // Validity checks |
| 1879 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 1880 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 1881 | { |
| 1882 | return VOS_STATUS_E_FAILURE; |
| 1883 | } |
| 1884 | // Skip past the EID byte and length byte - and four byte WiFi OUI |
| 1885 | pRsnIe = gen_ie + 2 + 4; |
| 1886 | RSNIeLen = gen_ie_len - (2 + 4); |
| 1887 | // Unpack the WPA IE |
| 1888 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 1889 | status = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 1890 | pRsnIe, |
| 1891 | RSNIeLen, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | &dot11WPAIE); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 1893 | if (DOT11F_FAILED(status)) |
| 1894 | { |
| 1895 | hddLog(LOGE, |
| 1896 | FL("unpack failed for WPA IE status:(0x%08x)"), |
| 1897 | status); |
| 1898 | return -EINVAL; |
| 1899 | } |
| 1900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | // Copy out the encryption and authentication types |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1902 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1903 | __func__, dot11WPAIE.unicast_cipher_count ); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1904 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1905 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1906 | //dot11WPAIE.auth_suite_count |
| 1907 | // Just translate the FIRST one |
| 1908 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 1909 | //dot11WPAIE.unicast_cipher_count |
| 1910 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 1911 | //dot11WPAIE.unicast_cipher_count |
| 1912 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1913 | *pMFPCapable = VOS_FALSE; |
| 1914 | *pMFPRequired = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1915 | } |
| 1916 | else |
| 1917 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1918 | hddLog(LOGW, FL("%s: gen_ie[0]: %d"), __func__, gen_ie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1919 | return VOS_STATUS_E_FAILURE; |
| 1920 | } |
| 1921 | return VOS_STATUS_SUCCESS; |
| 1922 | } |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 1923 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 1924 | #ifdef FEATURE_WLAN_CH_AVOID |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 1925 | |
| 1926 | /*========================================================================== |
| 1927 | FUNCTION sapUpdateUnsafeChannelList |
| 1928 | |
| 1929 | DESCRIPTION |
| 1930 | Function Undate unsafe channel list table |
| 1931 | |
| 1932 | DEPENDENCIES |
| 1933 | NA. |
| 1934 | |
| 1935 | PARAMETERS |
| 1936 | |
| 1937 | IN |
| 1938 | pSapCtx : SAP context pointer, include unsafe channel list |
| 1939 | |
| 1940 | RETURN VALUE |
| 1941 | NONE |
| 1942 | ============================================================================*/ |
| 1943 | void hdd_hostapd_update_unsafe_channel_list(hdd_context_t *pHddCtx, |
| 1944 | v_U16_t *unsafeChannelList, v_U16_t unsafeChannelCount) |
| 1945 | { |
| 1946 | v_U16_t i, j; |
| 1947 | |
| 1948 | vos_mem_zero((void *)pHddCtx->unsafeChannelList, |
| 1949 | sizeof(pHddCtx->unsafeChannelList)); |
| 1950 | if (0 == unsafeChannelCount) |
| 1951 | { |
| 1952 | pHddCtx->unsafeChannelCount = 0; |
| 1953 | } |
| 1954 | else |
| 1955 | { |
c_hpothu | 8de53e4 | 2014-08-22 15:00:37 +0530 | [diff] [blame] | 1956 | if (unsafeChannelCount > NUM_20MHZ_RF_CHANNELS) |
| 1957 | { |
| 1958 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1959 | FL("unsafeChannelCount%hd greater than %d"), |
| 1960 | unsafeChannelCount, NUM_20MHZ_RF_CHANNELS); |
| 1961 | unsafeChannelCount = NUM_20MHZ_RF_CHANNELS; |
| 1962 | } |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 1963 | vos_mem_copy((void *)pHddCtx->unsafeChannelList, |
| 1964 | unsafeChannelList, |
| 1965 | unsafeChannelCount * sizeof(tANI_U16)); |
| 1966 | pHddCtx->unsafeChannelCount = unsafeChannelCount; |
| 1967 | } |
| 1968 | |
| 1969 | /* Flush, default set all channel safe */ |
| 1970 | for (i = 0; i < NUM_20MHZ_RF_CHANNELS; i++) |
| 1971 | { |
| 1972 | safeChannels[i].isSafe = VOS_TRUE; |
| 1973 | } |
| 1974 | |
| 1975 | /* Try to find unsafe channel */ |
| 1976 | for (i = 0; i < pHddCtx->unsafeChannelCount; i++) |
| 1977 | { |
| 1978 | for (j = 0; j < NUM_20MHZ_RF_CHANNELS; j++) |
| 1979 | { |
| 1980 | if(safeChannels[j].channelNumber == pHddCtx->unsafeChannelList[i]) |
| 1981 | { |
| 1982 | /* Found unsafe channel, update it */ |
| 1983 | safeChannels[j].isSafe = VOS_FALSE; |
| 1984 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 1985 | "%s : CH %d is not safe", |
| 1986 | __func__, pHddCtx->unsafeChannelList[i]); |
| 1987 | break; |
| 1988 | } |
| 1989 | } |
| 1990 | } |
| 1991 | |
| 1992 | return; |
| 1993 | } |
| 1994 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 1995 | /** |
| 1996 | * hdd_unsafe_channel_restart_sap - restart sap if sap is on unsafe channel |
| 1997 | * @adapter: hdd ap adapter |
| 1998 | * |
| 1999 | * hdd_unsafe_channel_restart_sap check all unsafe channel list |
| 2000 | * and if ACS is enabled, driver will ask userspace to restart the |
| 2001 | * sap. User space on LTE coex indication restart driver. |
| 2002 | * |
| 2003 | * Return - none |
| 2004 | */ |
| 2005 | static void hdd_unsafe_channel_restart_sap(hdd_adapter_t *adapter, |
| 2006 | hdd_context_t *hdd_ctx) |
| 2007 | { |
| 2008 | |
| 2009 | if (!(adapter && (WLAN_HDD_SOFTAP == adapter->device_mode))) { |
| 2010 | return; |
| 2011 | } |
| 2012 | |
| 2013 | hddLog(LOG1, FL("Current operation channel %d"), |
| 2014 | adapter->sessionCtx.ap.operatingChannel); |
| 2015 | if (false == hdd_ctx->is_ch_avoid_in_progress) { |
| 2016 | hdd_change_ch_avoidance_status(hdd_ctx, true); |
| 2017 | |
| 2018 | vos_flush_work( |
| 2019 | &hdd_ctx->sap_start_work); |
| 2020 | |
| 2021 | /* |
| 2022 | * current operating channel |
| 2023 | * is un-safe channel, restart SAP |
| 2024 | */ |
| 2025 | hddLog(LOG1, |
| 2026 | FL("Restarting SAP due to unsafe channel")); |
| 2027 | |
| 2028 | adapter->sessionCtx.ap.sapConfig.channel = |
| 2029 | AUTO_CHANNEL_SELECT; |
| 2030 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2031 | |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 2032 | if (hdd_ctx->cfg_ini->sap_internal_restart) { |
Kapil Gupta | 0afd191 | 2016-12-28 12:52:13 +0530 | [diff] [blame] | 2033 | netif_tx_disable(adapter->dev); |
| 2034 | schedule_work(&hdd_ctx->sap_start_work); |
| 2035 | } else { |
| 2036 | hdd_hostapd_stop(adapter->dev); |
| 2037 | } |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2038 | |
| 2039 | return; |
| 2040 | } |
| 2041 | return; |
| 2042 | } |
| 2043 | |
Yeshwanth Sriram Guntuka | 06848b1 | 2018-07-20 14:58:22 +0530 | [diff] [blame] | 2044 | static v_U16_t hdd_get_safe_channel_from_acs_range(hdd_context_t *hdd_ctx, |
| 2045 | hdd_adapter_t *sap_adapter, v_U16_t *unsafeChannelList, |
| 2046 | v_U16_t unsafeChannelCount) |
| 2047 | { |
| 2048 | v_U8_t valid_channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2049 | v_U32_t startChannelNum; |
| 2050 | v_U32_t endChannelNum; |
| 2051 | v_U32_t valid_channel_count = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2052 | v_U16_t i, j; |
| 2053 | eHalStatus status; |
| 2054 | bool found; |
| 2055 | |
| 2056 | status = sme_GetCfgValidChannels(hdd_ctx->hHal, valid_channels, |
| 2057 | &valid_channel_count); |
| 2058 | if (!HAL_STATUS_SUCCESS(status)) |
| 2059 | return 0; |
| 2060 | |
| 2061 | ccmCfgGetInt(hdd_ctx->hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, |
| 2062 | &startChannelNum); |
| 2063 | ccmCfgGetInt(hdd_ctx->hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, |
| 2064 | &endChannelNum); |
| 2065 | |
| 2066 | for (i = 0; i < valid_channel_count; i++) { |
| 2067 | found = false; |
| 2068 | for (j = 0; j < unsafeChannelCount; j++) { |
| 2069 | if (valid_channels[i] == unsafeChannelList[j]) { |
| 2070 | found = true; |
| 2071 | break; |
| 2072 | } |
| 2073 | } |
| 2074 | |
| 2075 | if (found) |
| 2076 | continue; |
| 2077 | |
| 2078 | if ((valid_channels[i] >= startChannelNum) && |
| 2079 | (valid_channels[i] <= endChannelNum)) { |
| 2080 | return valid_channels[i]; |
| 2081 | } |
| 2082 | } |
| 2083 | |
| 2084 | return 0; |
| 2085 | } |
| 2086 | |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 2087 | void hdd_check_for_unsafe_ch(hdd_adapter_t *phostapd_adapter, |
| 2088 | hdd_context_t *hdd_ctxt) |
| 2089 | { |
| 2090 | v_U16_t channelLoop; |
| 2091 | v_U16_t unsafeChannelCount = 0; |
| 2092 | v_U16_t unsafeChannelList[NUM_20MHZ_RF_CHANNELS]; |
Yeshwanth Sriram Guntuka | 06848b1 | 2018-07-20 14:58:22 +0530 | [diff] [blame] | 2093 | v_U16_t sta_chan; |
| 2094 | v_U16_t restart_chan; |
| 2095 | v_CONTEXT_t vos_ctx; |
| 2096 | ptSapContext sap_ctx; |
| 2097 | |
| 2098 | vos_ctx = hdd_ctxt->pvosContext; |
| 2099 | if (!vos_ctx) { |
| 2100 | hddLog(LOGE, FL("vos_ctx is NULL")); |
| 2101 | return; |
| 2102 | } |
| 2103 | |
| 2104 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 2105 | if (!sap_ctx) { |
| 2106 | hddLog(LOGE, FL("sap_ctx is NULL")); |
| 2107 | return; |
| 2108 | } |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 2109 | |
| 2110 | /* Get unsafe channel list */ |
| 2111 | vos_get_wlan_unsafe_channel(unsafeChannelList, sizeof(unsafeChannelList), |
| 2112 | &unsafeChannelCount); |
Yeshwanth Sriram Guntuka | 06848b1 | 2018-07-20 14:58:22 +0530 | [diff] [blame] | 2113 | sta_chan = hdd_get_operating_channel(hdd_ctxt, WLAN_HDD_INFRA_STATION); |
| 2114 | |
| 2115 | if (sta_chan) { |
| 2116 | hddLog(LOG1, FL("Only SCC supported for STA+SAP")); |
| 2117 | return; |
| 2118 | } |
| 2119 | |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 2120 | for (channelLoop = 0; channelLoop < unsafeChannelCount; channelLoop++) |
| 2121 | { |
| 2122 | if ((unsafeChannelList[channelLoop] == |
| 2123 | phostapd_adapter->sessionCtx.ap.operatingChannel)) { |
| 2124 | if ((AUTO_CHANNEL_SELECT == |
| 2125 | phostapd_adapter->sessionCtx.ap.sapConfig.channel) |
| 2126 | && (WLAN_HDD_SOFTAP == phostapd_adapter->device_mode)) { |
| 2127 | /* |
| 2128 | * current operating channel is un-safe channel |
| 2129 | * restart driver |
| 2130 | */ |
Yeshwanth Sriram Guntuka | 06848b1 | 2018-07-20 14:58:22 +0530 | [diff] [blame] | 2131 | if (hdd_ctxt->cfg_ini->force_scc_with_ecsa) { |
| 2132 | restart_chan = hdd_get_safe_channel_from_acs_range(hdd_ctxt, |
| 2133 | phostapd_adapter, unsafeChannelList, |
| 2134 | unsafeChannelCount); |
| 2135 | |
| 2136 | if (!restart_chan) { |
| 2137 | hddLog(LOGE, FL("Failed to restart SAP as no safe channel found")); |
| 2138 | return; |
| 2139 | } else { |
| 2140 | if (wlansap_chk_n_set_chan_change_in_progress(sap_ctx)) |
| 2141 | return; |
| 2142 | INIT_COMPLETION(sap_ctx->ecsa_info.chan_switch_comp); |
| 2143 | if (wlansap_set_channel_change(vos_ctx, restart_chan, |
| 2144 | false)) { |
| 2145 | wlansap_reset_chan_change_in_progress(sap_ctx); |
| 2146 | complete(&sap_ctx->ecsa_info.chan_switch_comp); |
| 2147 | return; |
| 2148 | } |
| 2149 | } |
| 2150 | } else { |
| 2151 | hdd_unsafe_channel_restart_sap(phostapd_adapter, hdd_ctxt); |
| 2152 | } |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 2153 | /* |
| 2154 | * On LE, this event is handled by wlan-services to |
| 2155 | * restart SAP. On android, this event would be |
| 2156 | * ignored. |
| 2157 | */ |
| 2158 | wlan_hdd_send_svc_nlink_msg(WLAN_SVC_SAP_RESTART_IND, |
| 2159 | NULL, 0); |
| 2160 | } |
| 2161 | break; |
| 2162 | } |
| 2163 | } |
| 2164 | return; |
| 2165 | } |
| 2166 | |
| 2167 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2168 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2169 | /**--------------------------------------------------------------------------- |
| 2170 | |
| 2171 | \brief hdd_hostapd_ch_avoid_cb() - |
| 2172 | |
| 2173 | Avoid channel notification from FW handler. |
| 2174 | FW will send un-safe channle list to avoid overwrapping. |
| 2175 | hostapd should not use notified channel |
| 2176 | |
| 2177 | \param - pAdapter HDD adapter pointer |
| 2178 | indParam channel avoid notification parameter |
| 2179 | |
| 2180 | \return - None |
| 2181 | |
| 2182 | --------------------------------------------------------------------------*/ |
| 2183 | void hdd_hostapd_ch_avoid_cb |
| 2184 | ( |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2185 | void *context, |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2186 | void *indParam |
| 2187 | ) |
| 2188 | { |
| 2189 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 2190 | hdd_context_t *hddCtxt; |
| 2191 | tSirChAvoidIndType *chAvoidInd; |
| 2192 | v_U8_t rangeLoop; |
| 2193 | v_U16_t channelLoop; |
| 2194 | v_U16_t dupCheck; |
| 2195 | v_U16_t startChannel; |
| 2196 | v_U16_t endChannel; |
| 2197 | v_U16_t unsafeChannelCount = 0; |
| 2198 | v_U16_t unsafeChannelList[NUM_20MHZ_RF_CHANNELS]; |
| 2199 | v_CONTEXT_t pVosContext; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 2200 | tHddAvoidFreqList hddAvoidFreqList; |
| 2201 | tANI_U32 i; |
Hardik Kantilal Patel | 8c2d523 | 2015-01-08 00:31:38 +0530 | [diff] [blame] | 2202 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 2203 | ptSapContext pSapCtx = NULL; |
| 2204 | tHalHandle hHal; |
| 2205 | v_U8_t cbMode; |
| 2206 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2207 | v_U32_t delay; |
| 2208 | #endif |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2209 | |
| 2210 | /* Basic sanity */ |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2211 | if ((NULL == context) || (NULL == indParam)) |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2212 | { |
| 2213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2214 | "%s : Invalid arguments", __func__); |
| 2215 | return; |
| 2216 | } |
| 2217 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 2218 | hddCtxt = (hdd_context_t *)context; |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2219 | chAvoidInd = (tSirChAvoidIndType *)indParam; |
| 2220 | pVosContext = hddCtxt->pvosContext; |
| 2221 | |
| 2222 | /* Make unsafe channel list */ |
| 2223 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2224 | "%s : band count %d", |
| 2225 | __func__, chAvoidInd->avoidRangeCount); |
| 2226 | vos_mem_zero((void *)unsafeChannelList, |
| 2227 | NUM_20MHZ_RF_CHANNELS * sizeof(v_U16_t)); |
| 2228 | for (rangeLoop = 0; rangeLoop < chAvoidInd->avoidRangeCount; rangeLoop++) |
| 2229 | { |
Abhishek Singh | 57a3154 | 2016-01-04 21:01:43 +0530 | [diff] [blame] | 2230 | if (unsafeChannelCount >= NUM_20MHZ_RF_CHANNELS) { |
| 2231 | hddLog(LOGW, FL("LTE Coex unsafe channel list full")); |
| 2232 | break; |
| 2233 | } |
| 2234 | startChannel = ieee80211_frequency_to_channel( |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2235 | chAvoidInd->avoidFreqRange[rangeLoop].startFreq); |
Abhishek Singh | 57a3154 | 2016-01-04 21:01:43 +0530 | [diff] [blame] | 2236 | endChannel = ieee80211_frequency_to_channel( |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2237 | chAvoidInd->avoidFreqRange[rangeLoop].endFreq); |
| 2238 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2239 | "%s : start %d : %d, end %d : %d", |
| 2240 | __func__, |
| 2241 | chAvoidInd->avoidFreqRange[rangeLoop].startFreq, |
| 2242 | startChannel, |
| 2243 | chAvoidInd->avoidFreqRange[rangeLoop].endFreq, |
| 2244 | endChannel); |
| 2245 | for (channelLoop = startChannel; |
| 2246 | channelLoop < (endChannel + 1); |
| 2247 | channelLoop++) |
| 2248 | { |
| 2249 | /* Channel duplicate check routine */ |
| 2250 | for (dupCheck = 0; dupCheck < unsafeChannelCount; dupCheck++) |
| 2251 | { |
| 2252 | if (unsafeChannelList[dupCheck] == channelLoop) |
| 2253 | { |
| 2254 | /* This channel is duplicated */ |
| 2255 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2256 | "%s : found duplicated channel %d", |
| 2257 | __func__, channelLoop); |
| 2258 | break; |
| 2259 | } |
| 2260 | } |
| 2261 | if (dupCheck == unsafeChannelCount) |
| 2262 | { |
c_hpothu | 8de53e4 | 2014-08-22 15:00:37 +0530 | [diff] [blame] | 2263 | int ii; |
| 2264 | for(ii=0; ii<NUM_20MHZ_RF_CHANNELS; ii++) |
| 2265 | { |
| 2266 | if (channelLoop == safeChannels[ii].channelNumber) |
| 2267 | { |
| 2268 | unsafeChannelList[unsafeChannelCount] = channelLoop; |
| 2269 | unsafeChannelCount++; |
| 2270 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2271 | "%s : unsafe channel %d, count %d", |
| 2272 | __func__, |
| 2273 | channelLoop, unsafeChannelCount); |
Abhishek Singh | 57a3154 | 2016-01-04 21:01:43 +0530 | [diff] [blame] | 2274 | if (unsafeChannelCount >= NUM_20MHZ_RF_CHANNELS) { |
| 2275 | hddLog(LOGW, FL("LTE Coex unsafe channel list full")); |
| 2276 | break; |
| 2277 | } |
c_hpothu | 8de53e4 | 2014-08-22 15:00:37 +0530 | [diff] [blame] | 2278 | } |
| 2279 | } |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2280 | } |
| 2281 | else |
| 2282 | { |
| 2283 | /* DUP, do nothing */ |
| 2284 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2285 | "%s : duplicated channel %d", |
| 2286 | __func__, channelLoop); |
| 2287 | } |
| 2288 | } |
| 2289 | } |
| 2290 | /* Update unsafe channel cache |
| 2291 | * WCN Platform Driver cache */ |
| 2292 | wcnss_set_wlan_unsafe_channel(unsafeChannelList, |
| 2293 | unsafeChannelCount); |
| 2294 | |
| 2295 | /* Store into local cache |
| 2296 | * Start with STA and later start SAP |
| 2297 | * in this scenario, local cache will be used */ |
| 2298 | hdd_hostapd_update_unsafe_channel_list(hddCtxt, |
| 2299 | unsafeChannelList, |
| 2300 | unsafeChannelCount); |
| 2301 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 2302 | /* generate vendor specific event */ |
| 2303 | vos_mem_zero((void *)&hddAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 2304 | for (i = 0; i < chAvoidInd->avoidRangeCount; i++) |
| 2305 | { |
| 2306 | hddAvoidFreqList.avoidFreqRange[i].startFreq = |
| 2307 | chAvoidInd->avoidFreqRange[i].startFreq; |
| 2308 | hddAvoidFreqList.avoidFreqRange[i].endFreq = |
| 2309 | chAvoidInd->avoidFreqRange[i].endFreq; |
| 2310 | } |
| 2311 | hddAvoidFreqList.avoidFreqRangeCount = chAvoidInd->avoidRangeCount; |
| 2312 | |
| 2313 | wlan_hdd_send_avoid_freq_event(hddCtxt, &hddAvoidFreqList); |
| 2314 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2315 | /* Get SAP context first |
| 2316 | * SAP and P2PGO would not concurrent */ |
| 2317 | pHostapdAdapter = hdd_get_adapter(hddCtxt, WLAN_HDD_SOFTAP); |
Hardik Kantilal Patel | 8c2d523 | 2015-01-08 00:31:38 +0530 | [diff] [blame] | 2318 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 2319 | if (NULL == pHostapdAdapter) |
| 2320 | { |
| 2321 | pHostapdAdapter = hdd_get_adapter(hddCtxt, WLAN_HDD_P2P_GO); |
| 2322 | } |
| 2323 | #endif |
Kanchanapally, Vidyullatha | 99bd6c4 | 2014-12-10 13:54:38 +0530 | [diff] [blame] | 2324 | if ((pHostapdAdapter) && |
| 2325 | (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) && |
| 2326 | (unsafeChannelCount)) |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2327 | { |
| 2328 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2329 | "%s : Current operation channel %d", |
| 2330 | __func__, |
| 2331 | pHostapdAdapter->sessionCtx.ap.operatingChannel); |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 2332 | /* Check and Restart the SAP if it is on unsafe channel */ |
| 2333 | hdd_check_for_unsafe_ch(pHostapdAdapter, hddCtxt); |
| 2334 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2335 | } |
| 2336 | |
Hardik Kantilal Patel | 8c2d523 | 2015-01-08 00:31:38 +0530 | [diff] [blame] | 2337 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 2338 | if (hddCtxt->cfg_ini->apHT40_24GEnabled) |
| 2339 | { |
| 2340 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 2341 | |
| 2342 | if(pSapCtx == NULL) |
| 2343 | { |
| 2344 | VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR, |
| 2345 | FL("psapCtx is NULL")); |
| 2346 | return; |
| 2347 | } |
| 2348 | |
| 2349 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2350 | FL("SAP Secondary channel: %d "), |
| 2351 | pSapCtx->sap_sec_chan); |
| 2352 | |
| 2353 | /* tHalHandle */ |
| 2354 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2355 | |
| 2356 | if (NULL == hHal) |
| 2357 | { |
| 2358 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2359 | FL("In invalid hHal")); |
| 2360 | return; |
| 2361 | } |
| 2362 | |
| 2363 | cbMode = sme_GetChannelBondingMode24G(hHal); |
| 2364 | |
| 2365 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 2366 | FL("Selected Channel bonding : %d"), cbMode); |
| 2367 | |
| 2368 | if (cbMode && (pSapCtx->sap_sec_chan > 0)) |
| 2369 | { |
| 2370 | int i; |
| 2371 | eHalStatus halStatus; |
| 2372 | |
| 2373 | for (i = 0; i < unsafeChannelCount; i++) |
| 2374 | { |
| 2375 | if ((pSapCtx->sap_sec_chan == unsafeChannelList[i])) |
| 2376 | { |
| 2377 | /* Current SAP Secondary channel is un-safe channel */ |
| 2378 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2379 | FL("Move SAP from HT40 to HT20")); |
| 2380 | |
| 2381 | halStatus = sme_SetHT2040Mode(hHal, pSapCtx->sessionId, |
| 2382 | PHY_SINGLE_CHANNEL_CENTERED); |
| 2383 | |
| 2384 | if (halStatus == eHAL_STATUS_FAILURE) |
| 2385 | { |
| 2386 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2387 | FL("Failed to change HT20/40 mode")); |
| 2388 | return; |
| 2389 | } |
| 2390 | |
| 2391 | /* Disable Channel Bonding for 2.4GHz */ |
| 2392 | sme_UpdateChannelBondingMode24G(hHal, |
| 2393 | PHY_SINGLE_CHANNEL_CENTERED); |
| 2394 | return; |
| 2395 | } |
| 2396 | } |
| 2397 | } |
| 2398 | |
| 2399 | if ((!pSapCtx->numHT40IntoSta) |
| 2400 | && (pHostapdAdapter) |
| 2401 | && (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags))) |
| 2402 | { |
| 2403 | /* if Unsafe channel is Zero or SAP Primary/Secondary channel |
| 2404 | * are Safe then start HT20/40 timer to Move SAP from HT20 |
| 2405 | * to HT40. |
| 2406 | */ |
| 2407 | if (((!unsafeChannelCount) |
| 2408 | || (!sapCheckHT40SecondaryIsNotAllowed(pSapCtx))) && (!cbMode)) |
| 2409 | { |
| 2410 | /* Stop Previous Running HT20/40 Timer & Start timer |
| 2411 | with (OBSS TransitionDelayFactor * obss interval) |
| 2412 | delay after time out move AP from HT20 -> HT40 |
| 2413 | mode |
| 2414 | */ |
| 2415 | if (VOS_TIMER_STATE_RUNNING == pSapCtx->sap_HT2040_timer.state) |
| 2416 | { |
| 2417 | vosStatus = vos_timer_stop(&pSapCtx->sap_HT2040_timer); |
| 2418 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2419 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2420 | FL("Failed to Stop HT20/40 timer")); |
| 2421 | } |
| 2422 | |
| 2423 | delay = |
| 2424 | (pSapCtx->ObssScanInterval * pSapCtx->ObssTransitionDelayFactor); |
| 2425 | |
| 2426 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2427 | FL("Start HT20/40 transition timer (%d sec)"), delay); |
| 2428 | |
| 2429 | vosStatus = vos_timer_start( &pSapCtx->sap_HT2040_timer, |
| 2430 | (delay * 1000)); |
| 2431 | |
| 2432 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2433 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2434 | FL("Failed to Start HT20/40 timer")); |
| 2435 | } |
| 2436 | else |
| 2437 | { |
| 2438 | /* Stop HT20/40 Timer */ |
| 2439 | if (VOS_TIMER_STATE_RUNNING == pSapCtx->sap_HT2040_timer.state) |
| 2440 | { |
| 2441 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 2442 | FL("Stop HT20/40 transition timer")); |
| 2443 | vosStatus = vos_timer_stop(&pSapCtx->sap_HT2040_timer); |
| 2444 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2445 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2446 | FL("Failed to Stop HT20/40 timer")); |
| 2447 | } |
| 2448 | } |
| 2449 | } |
| 2450 | } |
| 2451 | #endif |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2452 | return; |
| 2453 | } |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 2454 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 2455 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2456 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 2457 | static __iw_softap_setparam(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | struct iw_request_info *info, |
| 2459 | union iwreq_data *wrqu, char *extra) |
| 2460 | { |
| 2461 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2462 | tHalHandle hHal; |
Mahesh A Saptasagar | c449f10 | 2015-01-09 21:15:18 +0530 | [diff] [blame] | 2463 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | int *value = (int *)extra; |
| 2465 | int sub_cmd = value[0]; |
| 2466 | int set_value = value[1]; |
| 2467 | eHalStatus status; |
| 2468 | int ret = 0; /* success */ |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 2469 | int enable_pattrn_byte_match, enable_magic_pkt; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2470 | v_CONTEXT_t pVosContext; |
| 2471 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2472 | ENTER(); |
| 2473 | |
Mahesh A Saptasagar | c449f10 | 2015-01-09 21:15:18 +0530 | [diff] [blame] | 2474 | if (NULL == pHostapdAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2475 | { |
| 2476 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | c449f10 | 2015-01-09 21:15:18 +0530 | [diff] [blame] | 2477 | "%s: hostapd Adapter is null", |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2478 | __func__); |
| 2479 | return -1; |
| 2480 | } |
| 2481 | |
Mahesh A Saptasagar | c449f10 | 2015-01-09 21:15:18 +0530 | [diff] [blame] | 2482 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 2483 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2484 | if (0 != ret) |
| 2485 | { |
Mahesh A Saptasagar | c449f10 | 2015-01-09 21:15:18 +0530 | [diff] [blame] | 2486 | return -1; |
| 2487 | } |
| 2488 | |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2489 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 2490 | if (!hHal) |
| 2491 | { |
| 2492 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2493 | "%s: Hal ctx is null", __func__); |
| 2494 | return -1; |
| 2495 | } |
| 2496 | |
| 2497 | pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2498 | if (!pVosContext) |
| 2499 | { |
| 2500 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2501 | "%s: Vos ctx is null", __func__); |
| 2502 | return -1; |
| 2503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2504 | |
| 2505 | switch(sub_cmd) |
| 2506 | { |
| 2507 | |
| 2508 | case QCSAP_PARAM_CLR_ACL: |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2509 | if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2510 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2511 | ret = -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | } |
| 2513 | break; |
| 2514 | |
| 2515 | case QCSAP_PARAM_ACL_MODE: |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2516 | if ((eSAP_ALLOW_ALL < (eSapMacAddrACL)set_value) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2517 | (eSAP_ACCEPT_UNLESS_DENIED > (eSapMacAddrACL)set_value)) |
| 2518 | { |
| 2519 | hddLog(LOGE, FL("Invalid ACL Mode value %d"), set_value); |
| 2520 | ret = -EINVAL; |
| 2521 | } |
| 2522 | else |
| 2523 | { |
| 2524 | WLANSAP_SetMode(pVosContext, set_value); |
| 2525 | } |
| 2526 | break; |
Ravi Shankar Upadrasta | bb216bb | 2014-06-13 14:40:24 +0530 | [diff] [blame] | 2527 | |
| 2528 | case QCSAP_PARAM_SET_AUTO_CHANNEL: |
| 2529 | if ((0 != set_value) && (1 != set_value)) |
| 2530 | { |
| 2531 | hddLog(LOGE, FL("Invalid setAutoChannel value %d"), set_value); |
| 2532 | ret = -EINVAL; |
| 2533 | } |
| 2534 | else |
| 2535 | { |
| 2536 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apAutoChannelSelection = set_value; |
| 2537 | } |
| 2538 | break; |
| 2539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2540 | case QCSAP_PARAM_MAX_ASSOC: |
| 2541 | if (WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) |
| 2542 | { |
| 2543 | hddLog(LOGE, FL("Invalid setMaxAssoc value %d"), set_value); |
| 2544 | ret = -EINVAL; |
| 2545 | } |
| 2546 | else |
| 2547 | { |
| 2548 | if (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value) |
| 2549 | { |
| 2550 | hddLog(LOGW, FL("setMaxAssoc value %d higher than max allowed %d." |
| 2551 | "Setting it to max allowed and continuing"), |
| 2552 | set_value, WNI_CFG_ASSOC_STA_LIMIT_STAMAX); |
| 2553 | set_value = WNI_CFG_ASSOC_STA_LIMIT_STAMAX; |
| 2554 | } |
| 2555 | status = ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 2556 | set_value, NULL, eANI_BOOLEAN_FALSE); |
| 2557 | if ( status != eHAL_STATUS_SUCCESS ) |
| 2558 | { |
| 2559 | hddLog(LOGE, FL("setMaxAssoc failure, status %d"), |
| 2560 | status); |
| 2561 | ret = -EIO; |
| 2562 | } |
| 2563 | } |
| 2564 | break; |
| 2565 | |
| 2566 | case QCSAP_PARAM_HIDE_SSID: |
| 2567 | { |
| 2568 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2569 | status = sme_HideSSID(hHal, pHostapdAdapter->sessionId, set_value); |
| 2570 | if(eHAL_STATUS_SUCCESS != status) |
| 2571 | { |
| 2572 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2573 | "%s: QCSAP_PARAM_HIDE_SSID failed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2574 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2575 | return status; |
| 2576 | } |
| 2577 | break; |
| 2578 | } |
| 2579 | |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 2580 | case QCSAP_PARAM_SET_MC_RATE: |
| 2581 | { |
Leo Chang | 1f98cbd | 2013-10-17 15:03:52 -0700 | [diff] [blame] | 2582 | tSirRateUpdateInd *rateUpdate; |
| 2583 | |
| 2584 | rateUpdate = (tSirRateUpdateInd *) |
| 2585 | vos_mem_malloc(sizeof(tSirRateUpdateInd)); |
| 2586 | if (NULL == rateUpdate) |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 2587 | { |
| 2588 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Leo Chang | 1f98cbd | 2013-10-17 15:03:52 -0700 | [diff] [blame] | 2589 | "%s: SET_MC_RATE indication alloc fail", __func__); |
| 2590 | ret = -1; |
| 2591 | break; |
| 2592 | } |
| 2593 | vos_mem_zero(rateUpdate, sizeof(tSirRateUpdateInd )); |
| 2594 | |
| 2595 | hddLog(VOS_TRACE_LEVEL_INFO, "MC Target rate %d", set_value); |
| 2596 | /* Ignore unicast */ |
| 2597 | rateUpdate->ucastDataRate = -1; |
| 2598 | rateUpdate->mcastDataRate24GHz = set_value; |
| 2599 | rateUpdate->mcastDataRate5GHz = set_value; |
| 2600 | rateUpdate->mcastDataRate24GHzTxFlag = 0; |
| 2601 | rateUpdate->mcastDataRate5GHzTxFlag = 0; |
| 2602 | status = sme_SendRateUpdateInd(hHal, rateUpdate); |
| 2603 | if (eHAL_STATUS_SUCCESS != status) |
| 2604 | { |
| 2605 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2606 | "%s: SET_MC_RATE failed", __func__); |
| 2607 | vos_mem_free(rateUpdate); |
| 2608 | ret = -1; |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 2609 | } |
| 2610 | break; |
| 2611 | } |
Mahesh A Saptasagar | 786266f | 2015-10-08 19:09:21 +0530 | [diff] [blame] | 2612 | case QCSAP_PARAM_GET_FRAME_LOGS: |
| 2613 | { |
| 2614 | if (wlan_hdd_get_frame_logs(pHostapdAdapter, set_value) |
| 2615 | != VOS_STATUS_SUCCESS) |
| 2616 | { |
| 2617 | ret = -EINVAL; |
| 2618 | } |
| 2619 | break; |
| 2620 | } |
Hanumantha Reddy Pothula | 0490027 | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 2621 | case QCSAP_PARAM_SET_PROXIMITY: |
| 2622 | { |
Padma, Santhosh Kumar | 98b5d25 | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 2623 | ret = wlan_hdd_set_proximity(set_value, hHal); |
Hanumantha Reddy Pothula | 0490027 | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 2624 | break; |
| 2625 | } |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 2626 | case QCSAP_PARAM_SET_WOWL: |
| 2627 | { |
| 2628 | if (!pHddCtx->is_ap_mode_wow_supported) |
| 2629 | { |
| 2630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2631 | "%s: Not supported",__func__); |
| 2632 | return -ENOTSUPP; |
| 2633 | } |
| 2634 | switch (set_value) |
| 2635 | { |
| 2636 | case 0x00: |
| 2637 | hdd_exit_wowl(pHostapdAdapter, eWOWL_EXIT_USER); |
| 2638 | break; |
| 2639 | case 0x01: |
| 2640 | case 0x02: |
| 2641 | case 0x03: |
| 2642 | enable_magic_pkt = (set_value & 0x01) ? 1 : 0; |
| 2643 | enable_pattrn_byte_match = (set_value & 0x02) ? 1 : 0; |
| 2644 | hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s", |
| 2645 | (enable_magic_pkt ? "YES":"NO"), |
| 2646 | (enable_pattrn_byte_match ? "YES":"NO")); |
| 2647 | hdd_enter_wowl(pHostapdAdapter, enable_magic_pkt, |
| 2648 | enable_pattrn_byte_match); |
| 2649 | break; |
| 2650 | default: |
| 2651 | hddLog(LOGE, "Invalid arg %d in WE_WOWL IOCTL", set_value); |
| 2652 | ret = -EINVAL; |
| 2653 | break; |
| 2654 | } |
| 2655 | break; |
| 2656 | } |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 2657 | case QCSAP_PARAM_CAP_TSF: |
| 2658 | { |
| 2659 | ret = hdd_capture_tsf(pHostapdAdapter, |
| 2660 | (uint32_t *)&set_value, 1); |
| 2661 | break; |
| 2662 | } |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2663 | case QCSAP_PARAM_SET_CHANNEL_CHANGE: |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2664 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) { |
| 2665 | ptSapContext sap_ctx; |
| 2666 | |
| 2667 | sap_ctx = VOS_GET_SAP_CB(pVosContext); |
| 2668 | if (!sap_ctx) { |
| 2669 | hddLog(LOGE, FL("sap_ctx is NULL")); |
| 2670 | return -EINVAL; |
| 2671 | } |
| 2672 | ret = wlansap_chk_n_set_chan_change_in_progress(sap_ctx); |
| 2673 | if (ret) |
| 2674 | return ret; |
| 2675 | INIT_COMPLETION(sap_ctx->ecsa_info.chan_switch_comp); |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2676 | hddLog(LOG1, FL("ET Channel Change to new channel= %d"), |
| 2677 | set_value); |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2678 | ret = wlansap_set_channel_change(pVosContext, set_value, false); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2679 | if (ret) { |
| 2680 | wlansap_reset_chan_change_in_progress(sap_ctx); |
| 2681 | complete(&sap_ctx->ecsa_info.chan_switch_comp); |
| 2682 | } |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2683 | } else { |
| 2684 | hddLog(LOGE, FL("Channel %d Change Failed, Device in not in SAP/GO mode"), |
| 2685 | set_value); |
| 2686 | ret = -EINVAL; |
| 2687 | } |
| 2688 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2689 | default: |
| 2690 | hddLog(LOGE, FL("Invalid setparam command %d value %d"), |
| 2691 | sub_cmd, set_value); |
| 2692 | ret = -EINVAL; |
| 2693 | break; |
| 2694 | } |
| 2695 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2696 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2697 | return ret; |
| 2698 | } |
| 2699 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 2700 | int |
| 2701 | static iw_softap_setparam(struct net_device *dev, |
| 2702 | struct iw_request_info *info, |
| 2703 | union iwreq_data *wrqu, char *extra) |
| 2704 | { |
| 2705 | int ret; |
| 2706 | |
| 2707 | vos_ssr_protect(__func__); |
| 2708 | ret = __iw_softap_setparam(dev, info, wrqu, extra); |
| 2709 | vos_ssr_unprotect(__func__); |
| 2710 | |
| 2711 | return ret; |
| 2712 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2713 | |
| 2714 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 2715 | static __iw_softap_getparam(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | struct iw_request_info *info, |
| 2717 | union iwreq_data *wrqu, char *extra) |
| 2718 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2719 | hdd_adapter_t *pHostapdAdapter; |
| 2720 | tHalHandle hHal; |
| 2721 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2722 | int *value = (int *)extra; |
| 2723 | int sub_cmd = value[0]; |
| 2724 | eHalStatus status; |
| 2725 | int ret = 0; /* success */ |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2726 | v_CONTEXT_t pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2728 | ENTER(); |
| 2729 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2730 | pHostapdAdapter = (netdev_priv(dev)); |
| 2731 | if (NULL == pHostapdAdapter) |
| 2732 | { |
| 2733 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2734 | "%s: Adapter is NULL",__func__); |
| 2735 | return -EINVAL; |
| 2736 | } |
| 2737 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 2738 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2739 | if (0 != ret) |
| 2740 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2741 | return ret; |
| 2742 | } |
| 2743 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 2744 | if (NULL == hHal) |
| 2745 | { |
| 2746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2747 | "%s: Hal Context is NULL",__func__); |
| 2748 | return -EINVAL; |
| 2749 | } |
| 2750 | pVosContext = pHddCtx->pvosContext; |
| 2751 | if (NULL == pVosContext) |
| 2752 | { |
| 2753 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2754 | "%s: pVosContext Context is NULL",__func__); |
| 2755 | return -EINVAL; |
| 2756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2757 | switch (sub_cmd) |
| 2758 | { |
| 2759 | case QCSAP_PARAM_MAX_ASSOC: |
| 2760 | status = ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value); |
| 2761 | if (eHAL_STATUS_SUCCESS != status) |
| 2762 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 2763 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2764 | FL("failed to get WNI_CFG_ASSOC_STA_LIMIT from cfg %d"),status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2765 | ret = -EIO; |
| 2766 | } |
Girish Gowli | 385be61 | 2014-09-18 11:17:20 +0530 | [diff] [blame] | 2767 | |
| 2768 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 2769 | if (pHddCtx->cfg_ini->fEnableVSTASupport) |
| 2770 | { |
| 2771 | if (*value > VSTA_NUM_ASSOC_STA) |
| 2772 | { |
| 2773 | *value = VSTA_NUM_ASSOC_STA; |
| 2774 | } |
| 2775 | if ((pHddCtx->hddAdapters.count > VSTA_NUM_RESV_SELFSTA) && |
| 2776 | (*value > (VSTA_NUM_ASSOC_STA - |
| 2777 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)))) |
| 2778 | { |
| 2779 | *value = (VSTA_NUM_ASSOC_STA - |
| 2780 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)); |
| 2781 | } |
| 2782 | } |
| 2783 | else |
| 2784 | #endif |
| 2785 | { |
| 2786 | if (*value > NUM_ASSOC_STA) |
| 2787 | { |
| 2788 | *value = NUM_ASSOC_STA; |
| 2789 | } |
| 2790 | if ((pHddCtx->hddAdapters.count > NUM_RESV_SELFSTA) && |
| 2791 | (*value > (NUM_ASSOC_STA - |
| 2792 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)))) |
| 2793 | { |
| 2794 | *value = (NUM_ASSOC_STA - |
| 2795 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)); |
| 2796 | } |
| 2797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2798 | break; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2800 | case QCSAP_PARAM_CLR_ACL: |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2801 | if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2802 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 2803 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2804 | FL("WLANSAP_ClearACL failed")); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2805 | ret = -EIO; |
| 2806 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2807 | *value = 0; |
| 2808 | break; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2809 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2810 | case QCSAP_PARAM_GET_WLAN_DBG: |
| 2811 | { |
| 2812 | vos_trace_display(); |
| 2813 | *value = 0; |
| 2814 | break; |
| 2815 | } |
| 2816 | |
| 2817 | case QCSAP_PARAM_AUTO_CHANNEL: |
| 2818 | { |
| 2819 | *value = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apAutoChannelSelection; |
| 2820 | break; |
| 2821 | } |
| 2822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2823 | default: |
| 2824 | hddLog(LOGE, FL("Invalid getparam command %d"), sub_cmd); |
| 2825 | ret = -EINVAL; |
| 2826 | break; |
| 2827 | |
| 2828 | } |
| 2829 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2830 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2831 | return ret; |
| 2832 | } |
| 2833 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 2834 | int |
| 2835 | static iw_softap_getparam(struct net_device *dev, |
| 2836 | struct iw_request_info *info, |
| 2837 | union iwreq_data *wrqu, char *extra) |
| 2838 | { |
| 2839 | int ret; |
| 2840 | |
| 2841 | vos_ssr_protect(__func__); |
| 2842 | ret = __iw_softap_getparam(dev, info, wrqu, extra); |
| 2843 | vos_ssr_unprotect(__func__); |
| 2844 | |
| 2845 | return ret; |
| 2846 | } |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 2847 | |
| 2848 | int |
| 2849 | static __iw_softap_setchar_getnone(struct net_device *dev, |
| 2850 | struct iw_request_info *info, |
| 2851 | union iwreq_data *wrqu, char *extra) |
| 2852 | { |
| 2853 | int sub_cmd; |
| 2854 | int ret = 0; /* success */ |
| 2855 | char *pBuffer = NULL; |
| 2856 | hdd_adapter_t *pAdapter; |
| 2857 | hdd_context_t *pHddCtx; |
| 2858 | struct iw_point s_priv_data; |
| 2859 | |
| 2860 | ENTER(); |
| 2861 | |
| 2862 | if (!capable(CAP_NET_ADMIN)) |
| 2863 | { |
| 2864 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2865 | FL("permission check failed")); |
| 2866 | return -EPERM; |
| 2867 | } |
| 2868 | |
| 2869 | pAdapter = (netdev_priv(dev)); |
| 2870 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2871 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2872 | if (0 != ret) |
| 2873 | { |
| 2874 | return ret; |
| 2875 | } |
| 2876 | |
| 2877 | if (!pHddCtx->is_ap_mode_wow_supported) |
| 2878 | { |
| 2879 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2880 | "%s: Not supported",__func__); |
| 2881 | return -ENOTSUPP; |
| 2882 | } |
| 2883 | |
| 2884 | /* helper function to get iwreq_data with compat handling. */ |
| 2885 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 2886 | { |
| 2887 | return -EINVAL; |
| 2888 | } |
| 2889 | |
| 2890 | /* make sure all params are correctly passed to function */ |
| 2891 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
| 2892 | { |
| 2893 | return -EINVAL; |
| 2894 | } |
| 2895 | |
| 2896 | sub_cmd = s_priv_data.flags; |
| 2897 | |
| 2898 | /* ODD number is used for set, copy data using copy_from_user */ |
| 2899 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 2900 | s_priv_data.length); |
| 2901 | if (NULL == pBuffer) |
| 2902 | { |
| 2903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2904 | "mem_alloc_copy_from_user_helper fail"); |
| 2905 | return -ENOMEM; |
| 2906 | } |
| 2907 | |
| 2908 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2909 | "%s: Received length %d", __func__, s_priv_data.length); |
| 2910 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2911 | "%s: Received data %s", __func__, pBuffer); |
| 2912 | |
| 2913 | switch(sub_cmd) |
| 2914 | { |
| 2915 | case WE_WOWL_ADD_PTRN: |
| 2916 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN"); |
| 2917 | ret = hdd_add_wowl_ptrn(pAdapter, pBuffer); |
| 2918 | if (!ret) |
| 2919 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2920 | "Failed to add pattern :%d", ret); |
| 2921 | break; |
| 2922 | case WE_WOWL_DEL_PTRN: |
| 2923 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN"); |
| 2924 | ret = hdd_del_wowl_ptrn(pAdapter, pBuffer); |
| 2925 | if (!ret) |
| 2926 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2927 | "Failed to del pattern :%d", ret); |
| 2928 | break; |
| 2929 | default: |
| 2930 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "ioctl not supported in SOFTAP"); |
| 2931 | ret = -EINVAL; |
| 2932 | break; |
| 2933 | } |
| 2934 | |
| 2935 | kfree(pBuffer); |
| 2936 | return ret; |
| 2937 | } |
| 2938 | |
| 2939 | int |
| 2940 | static iw_softap_setchar_getnone(struct net_device *dev, |
| 2941 | struct iw_request_info *info, |
| 2942 | union iwreq_data *wrqu, char *extra) |
| 2943 | { |
| 2944 | int ret; |
| 2945 | |
| 2946 | vos_ssr_protect(__func__); |
| 2947 | ret = __iw_softap_setchar_getnone(dev, info, wrqu, extra); |
| 2948 | vos_ssr_unprotect(__func__); |
| 2949 | |
| 2950 | return ret; |
| 2951 | } |
| 2952 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2953 | /* Usage: |
| 2954 | BLACK_LIST = 0 |
| 2955 | WHITE_LIST = 1 |
| 2956 | ADD MAC = 0 |
| 2957 | REMOVE MAC = 1 |
| 2958 | |
| 2959 | mac addr will be accepted as a 6 octet mac address with each octet inputted in hex |
| 2960 | for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 2961 | while using this ioctl |
| 2962 | |
| 2963 | Syntax: |
| 2964 | iwpriv softap.0 modify_acl |
| 2965 | <6 octet mac addr> <list type> <cmd type> |
| 2966 | |
| 2967 | Examples: |
| 2968 | eg 1. to add a mac addr 00:0a:f5:89:89:90 to the black list |
| 2969 | iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 0 0 |
| 2970 | eg 2. to delete a mac addr 00:0a:f5:89:89:90 from white list |
| 2971 | iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 1 1 |
| 2972 | */ |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 2973 | int __iw_softap_modify_acl(struct net_device *dev, |
| 2974 | struct iw_request_info *info, |
| 2975 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2976 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2977 | hdd_adapter_t *pHostapdAdapter; |
| 2978 | v_CONTEXT_t pVosContext; |
| 2979 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | v_BYTE_t *value = (v_BYTE_t*)extra; |
| 2981 | v_U8_t pPeerStaMac[VOS_MAC_ADDR_SIZE]; |
| 2982 | int listType, cmd, i; |
| 2983 | int ret = 0; /* success */ |
| 2984 | |
| 2985 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2986 | pHostapdAdapter = (netdev_priv(dev)); |
| 2987 | if (NULL == pHostapdAdapter) |
| 2988 | { |
| 2989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2990 | "%s: Adapter is NULL",__func__); |
| 2991 | return -EINVAL; |
| 2992 | } |
| 2993 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 2994 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2995 | if (0 != ret) |
| 2996 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2997 | return ret; |
| 2998 | } |
| 2999 | pVosContext = pHddCtx->pvosContext; |
| 3000 | if (NULL == pVosContext) |
| 3001 | { |
| 3002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3003 | "%s: Vos Context is NULL",__func__); |
| 3004 | return -EINVAL; |
| 3005 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3006 | for (i=0; i<VOS_MAC_ADDR_SIZE; i++) |
| 3007 | { |
| 3008 | pPeerStaMac[i] = *(value+i); |
| 3009 | } |
| 3010 | listType = (int)(*(value+i)); |
| 3011 | i++; |
| 3012 | cmd = (int)(*(value+i)); |
| 3013 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3014 | hddLog(LOG1, "%s: SAP Modify ACL arg0 " MAC_ADDRESS_STR " arg1 %d arg2 %d", |
| 3015 | __func__, MAC_ADDR_ARRAY(pPeerStaMac), listType, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3016 | |
| 3017 | if (WLANSAP_ModifyACL(pVosContext, pPeerStaMac,(eSapACLType)listType,(eSapACLCmdType)cmd) |
| 3018 | != VOS_STATUS_SUCCESS) |
| 3019 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3020 | hddLog(LOGE, FL("Modify ACL failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3021 | ret = -EIO; |
| 3022 | } |
| 3023 | EXIT(); |
| 3024 | return ret; |
| 3025 | } |
| 3026 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3027 | int iw_softap_modify_acl(struct net_device *dev, |
| 3028 | struct iw_request_info *info, |
| 3029 | union iwreq_data *wrqu, char *extra) |
| 3030 | { |
| 3031 | int ret; |
| 3032 | |
| 3033 | vos_ssr_protect(__func__); |
| 3034 | ret = __iw_softap_modify_acl(dev, info, wrqu, extra); |
| 3035 | vos_ssr_unprotect(__func__); |
| 3036 | |
| 3037 | return ret; |
| 3038 | } |
| 3039 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3040 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3041 | static __iw_softap_getchannel(struct net_device *dev, |
| 3042 | struct iw_request_info *info, |
| 3043 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3044 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3045 | hdd_adapter_t *pHostapdAdapter; |
| 3046 | hdd_context_t *pHddCtx; |
| 3047 | int ret = 0; |
| 3048 | int *value; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3049 | |
| 3050 | ENTER(); |
| 3051 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3052 | pHostapdAdapter = (netdev_priv(dev)); |
| 3053 | if (NULL == pHostapdAdapter) |
| 3054 | { |
| 3055 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3056 | "%s: Adapter is NULL",__func__); |
| 3057 | return -EINVAL; |
| 3058 | } |
| 3059 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3060 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3061 | if (0 != ret) |
| 3062 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3063 | return ret; |
| 3064 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | |
Mukul Sharma | 6d0762c | 2015-03-05 17:13:47 +0530 | [diff] [blame] | 3066 | value = (int *)extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3067 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3068 | *value = (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->operatingChannel; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3069 | |
| 3070 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | return 0; |
| 3072 | } |
| 3073 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3074 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3075 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3076 | static iw_softap_getchannel(struct net_device *dev, |
| 3077 | struct iw_request_info *info, |
| 3078 | union iwreq_data *wrqu, char *extra) |
| 3079 | { |
| 3080 | int ret; |
| 3081 | |
| 3082 | vos_ssr_protect(__func__); |
| 3083 | ret = __iw_softap_getchannel(dev, info, wrqu, extra); |
| 3084 | vos_ssr_unprotect(__func__); |
| 3085 | |
| 3086 | return ret; |
| 3087 | } |
| 3088 | |
| 3089 | int |
| 3090 | static __iw_softap_set_max_tx_power(struct net_device *dev, |
| 3091 | struct iw_request_info *info, |
| 3092 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3093 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3094 | hdd_adapter_t *pHostapdAdapter; |
| 3095 | tHalHandle hHal; |
| 3096 | hdd_context_t *pHddCtx; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3097 | int *value = (int *)extra; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3098 | int set_value, ret = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3099 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3100 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3101 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3102 | ENTER(); |
| 3103 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3104 | pHostapdAdapter = (netdev_priv(dev)); |
| 3105 | if (NULL == pHostapdAdapter) |
| 3106 | { |
| 3107 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3108 | "%s: Adapter is NULL",__func__); |
| 3109 | return -EINVAL; |
| 3110 | } |
| 3111 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3112 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3113 | if (0 != ret) |
| 3114 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3115 | return ret; |
| 3116 | } |
| 3117 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 3118 | if (NULL == hHal) |
| 3119 | { |
| 3120 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3121 | "%s: Hal Context is NULL",__func__); |
| 3122 | return -EINVAL; |
| 3123 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3124 | if (NULL == value) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3125 | return -ENOMEM; |
| 3126 | |
Leo Chang | d37675a | 2013-08-01 13:19:45 -0700 | [diff] [blame] | 3127 | /* Assign correct slef MAC address */ |
| 3128 | vos_mem_copy(bssid, pHostapdAdapter->macAddressCurrent.bytes, |
| 3129 | VOS_MAC_ADDR_SIZE); |
| 3130 | vos_mem_copy(selfMac, pHostapdAdapter->macAddressCurrent.bytes, |
| 3131 | VOS_MAC_ADDR_SIZE); |
| 3132 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3133 | set_value = value[0]; |
| 3134 | if (eHAL_STATUS_SUCCESS != sme_SetMaxTxPower(hHal, bssid, selfMac, set_value)) |
| 3135 | { |
| 3136 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3137 | __func__); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3138 | return -EIO; |
| 3139 | } |
| 3140 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3141 | EXIT(); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3142 | return 0; |
| 3143 | } |
| 3144 | |
| 3145 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3146 | static iw_softap_set_max_tx_power(struct net_device *dev, |
| 3147 | struct iw_request_info *info, |
| 3148 | union iwreq_data *wrqu, char *extra) |
| 3149 | { |
| 3150 | int ret; |
| 3151 | |
| 3152 | vos_ssr_protect(__func__); |
| 3153 | ret = __iw_softap_set_max_tx_power(dev, info, wrqu, extra); |
| 3154 | vos_ssr_unprotect(__func__); |
| 3155 | |
| 3156 | return ret; |
| 3157 | } |
| 3158 | |
| 3159 | |
| 3160 | int |
| 3161 | static __iw_display_data_path_snapshot(struct net_device *dev, |
| 3162 | struct iw_request_info *info, |
| 3163 | union iwreq_data *wrqu, char *extra) |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 3164 | { |
| 3165 | |
| 3166 | /* Function intitiating dumping states of |
| 3167 | * HDD(WMM Tx Queues) |
| 3168 | * TL State (with Per Client infor) |
| 3169 | * DXE Snapshot (Called at the end of TL Snapshot) |
| 3170 | */ |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3171 | hdd_adapter_t *pHostapdAdapter; |
| 3172 | hdd_context_t *pHddCtx; |
| 3173 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3174 | |
| 3175 | ENTER(); |
| 3176 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3177 | pHostapdAdapter = (netdev_priv(dev)); |
| 3178 | if (NULL == pHostapdAdapter) |
| 3179 | { |
| 3180 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3181 | "%s: Adapter is NULL",__func__); |
| 3182 | return -EINVAL; |
| 3183 | } |
| 3184 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3185 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3186 | if (0 != ret) |
| 3187 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3188 | return ret; |
| 3189 | } |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 3190 | hdd_wmm_tx_snapshot(pHostapdAdapter); |
Mihir Shete | 327c2ab | 2014-11-13 15:17:02 +0530 | [diff] [blame] | 3191 | WLANTL_TLDebugMessage(WLANTL_DEBUG_TX_SNAPSHOT); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3192 | |
| 3193 | EXIT(); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 3194 | return 0; |
| 3195 | } |
| 3196 | |
| 3197 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3198 | static iw_display_data_path_snapshot(struct net_device *dev, |
| 3199 | struct iw_request_info *info, |
| 3200 | union iwreq_data *wrqu, char *extra) |
| 3201 | { |
| 3202 | int ret; |
| 3203 | |
| 3204 | vos_ssr_protect(__func__); |
| 3205 | ret = __iw_display_data_path_snapshot(dev, info, wrqu, extra); |
| 3206 | vos_ssr_unprotect(__func__); |
| 3207 | |
| 3208 | return ret; |
| 3209 | } |
| 3210 | |
| 3211 | int |
| 3212 | static __iw_softap_set_tx_power(struct net_device *dev, |
| 3213 | struct iw_request_info *info, |
| 3214 | union iwreq_data *wrqu, char *extra) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3215 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3216 | hdd_adapter_t *pHostapdAdapter; |
| 3217 | hdd_context_t *pHddCtx; |
| 3218 | v_CONTEXT_t pVosContext; |
| 3219 | tHalHandle hHal; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3220 | int *value = (int *)extra; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3221 | int set_value, ret = 0; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3222 | ptSapContext pSapCtx = NULL; |
| 3223 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3224 | ENTER(); |
| 3225 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3226 | pHostapdAdapter = (netdev_priv(dev)); |
| 3227 | if (NULL == pHostapdAdapter) |
| 3228 | { |
| 3229 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3230 | "%s: Adapter is NULL",__func__); |
| 3231 | return -EINVAL; |
| 3232 | } |
| 3233 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3234 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3235 | if (0 != ret) |
| 3236 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3237 | return ret; |
| 3238 | } |
| 3239 | pVosContext = pHddCtx->pvosContext; |
| 3240 | if (NULL == pVosContext) |
| 3241 | { |
| 3242 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3243 | "%s: Vos Context is NULL",__func__); |
| 3244 | return -EINVAL; |
| 3245 | } |
| 3246 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 3247 | if (NULL == hHal) |
| 3248 | { |
| 3249 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3250 | "%s: Hal Context is NULL",__func__); |
| 3251 | return -EINVAL; |
| 3252 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3253 | if (NULL == value) |
| 3254 | return -ENOMEM; |
| 3255 | |
| 3256 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 3257 | if (NULL == pSapCtx) |
| 3258 | { |
| 3259 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 3260 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 3261 | return VOS_STATUS_E_FAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3262 | } |
| 3263 | |
| 3264 | set_value = value[0]; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3265 | if (eHAL_STATUS_SUCCESS != sme_SetTxPower(hHal, pSapCtx->sessionId, set_value)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3266 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3267 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting tx power failed", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3268 | __func__); |
| 3269 | return -EIO; |
| 3270 | } |
| 3271 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3272 | EXIT(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3273 | return 0; |
| 3274 | } |
| 3275 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3276 | int |
| 3277 | static iw_softap_set_tx_power(struct net_device *dev, |
| 3278 | struct iw_request_info *info, |
| 3279 | union iwreq_data *wrqu, char *extra) |
| 3280 | { |
| 3281 | int ret; |
| 3282 | |
| 3283 | vos_ssr_protect(__func__); |
| 3284 | ret = __iw_softap_set_tx_power(dev, info, wrqu, extra); |
| 3285 | vos_ssr_unprotect(__func__); |
| 3286 | |
| 3287 | return ret; |
| 3288 | } |
| 3289 | |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3290 | /**--------------------------------------------------------------------------- |
| 3291 | |
| 3292 | \brief iw_softap_set_trafficmonitor() - |
| 3293 | This function dynamically enable/disable traffic monitor functonality |
| 3294 | the command iwpriv wlanX setTrafficMon <value>. |
| 3295 | |
| 3296 | \param - dev - Pointer to the net device. |
| 3297 | - addr - Pointer to the sockaddr. |
| 3298 | \return - 0 for success, non zero for failure |
| 3299 | |
| 3300 | --------------------------------------------------------------------------*/ |
| 3301 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3302 | static int __iw_softap_set_trafficmonitor(struct net_device *dev, |
| 3303 | struct iw_request_info *info, |
| 3304 | union iwreq_data *wrqu, char *extra) |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3305 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3306 | hdd_adapter_t *pAdapter; |
Sushant Kaushik | 128a0bb | 2014-08-07 20:24:54 +0530 | [diff] [blame] | 3307 | int *isSetTrafficMon = (int *)extra; |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3308 | hdd_context_t *pHddCtx; |
| 3309 | int status; |
| 3310 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3311 | ENTER(); |
| 3312 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3313 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3314 | if (NULL == pAdapter) |
| 3315 | { |
| 3316 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 3317 | "%s: HDD adapter is Null", __func__); |
| 3318 | return -ENODEV; |
| 3319 | } |
| 3320 | |
| 3321 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3322 | |
| 3323 | status = wlan_hdd_validate_context(pHddCtx); |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3324 | if (0 != status) |
| 3325 | { |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3326 | return status; |
| 3327 | } |
| 3328 | |
| 3329 | hddLog(VOS_TRACE_LEVEL_INFO, "%s : ", __func__); |
| 3330 | |
| 3331 | if (NULL == isSetTrafficMon) |
| 3332 | { |
| 3333 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 3334 | "%s: Invalid SAP pointer from extra", __func__); |
| 3335 | return -ENOMEM; |
| 3336 | } |
| 3337 | |
| 3338 | if (TRUE == *isSetTrafficMon) |
| 3339 | { |
| 3340 | pHddCtx->cfg_ini->enableTrafficMonitor= TRUE; |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 3341 | if (VOS_STATUS_SUCCESS != hdd_start_trafficMonitor(pAdapter, false)) |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3342 | { |
| 3343 | VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, |
| 3344 | "%s: failed to Start Traffic Monitor timer ", __func__ ); |
| 3345 | return -EIO; |
| 3346 | } |
| 3347 | } |
| 3348 | else if (FALSE == *isSetTrafficMon) |
| 3349 | { |
| 3350 | pHddCtx->cfg_ini->enableTrafficMonitor= FALSE; |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 3351 | if (VOS_STATUS_SUCCESS != hdd_stop_trafficMonitor(pAdapter, false)) |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3352 | { |
| 3353 | VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, |
| 3354 | "%s: failed to Stop Traffic Monitor timer ", __func__ ); |
| 3355 | return -EIO; |
| 3356 | } |
| 3357 | |
| 3358 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3359 | |
| 3360 | EXIT(); |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 3361 | return 0; |
| 3362 | } |
| 3363 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3364 | static int iw_softap_set_trafficmonitor(struct net_device *dev, |
| 3365 | struct iw_request_info *info, |
| 3366 | union iwreq_data *wrqu, char *extra) |
| 3367 | { |
| 3368 | int ret; |
| 3369 | |
| 3370 | vos_ssr_protect(__func__); |
| 3371 | ret = __iw_softap_set_trafficmonitor(dev, info, wrqu, extra); |
| 3372 | vos_ssr_unprotect(__func__); |
| 3373 | |
| 3374 | return ret; |
| 3375 | } |
| 3376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3377 | #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0) |
| 3378 | |
| 3379 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3380 | static __iw_softap_getassoc_stamacaddr(struct net_device *dev, |
| 3381 | struct iw_request_info *info, |
| 3382 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3383 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3384 | hdd_adapter_t *pHostapdAdapter; |
| 3385 | hdd_context_t *pHddCtx; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3386 | hdd_station_info_t *pStaInfo = NULL; |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3387 | char *buf; |
| 3388 | int cnt = 0; |
| 3389 | int left; |
| 3390 | int ret = 0; |
| 3391 | /* maclist_index must be u32 to match userspace */ |
| 3392 | u32 maclist_index; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3393 | v_CONTEXT_t pVosContext = NULL; |
| 3394 | ptSapContext pSapCtx = NULL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3395 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3396 | ENTER(); |
| 3397 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3398 | pHostapdAdapter = (netdev_priv(dev)); |
| 3399 | if (NULL == pHostapdAdapter) |
| 3400 | { |
| 3401 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3402 | "%s: Adapter is NULL",__func__); |
| 3403 | return -EINVAL; |
| 3404 | } |
| 3405 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3406 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3407 | if (0 != ret) |
| 3408 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3409 | return ret; |
| 3410 | } |
| 3411 | |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3412 | /* |
| 3413 | * NOTE WELL: this is a "get" ioctl but it uses an even ioctl |
| 3414 | * number, and even numbered iocts are supposed to have "set" |
| 3415 | * semantics. Hence the wireless extensions support in the kernel |
| 3416 | * won't correctly copy the result to userspace, so the ioctl |
| 3417 | * handler itself must copy the data. Output format is 32-bit |
| 3418 | * record length, followed by 0 or more 6-byte STA MAC addresses. |
| 3419 | * |
| 3420 | * Further note that due to the incorrect semantics, the "iwpriv" |
| 3421 | * userspace application is unable to correctly invoke this API, |
| 3422 | * hence it is not registered in the hostapd_private_args. This |
| 3423 | * API can only be invoked by directly invoking the ioctl() system |
| 3424 | * call. |
| 3425 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3427 | /* make sure userspace allocated a reasonable buffer size */ |
| 3428 | if (wrqu->data.length < sizeof(maclist_index)) { |
| 3429 | hddLog(LOG1, "%s: invalid userspace buffer", __func__); |
| 3430 | return -EINVAL; |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3432 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3433 | pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 3434 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 3435 | if(pSapCtx == NULL){ |
| 3436 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 3437 | FL("psapCtx is NULL")); |
| 3438 | return -EFAULT; |
| 3439 | } |
Hema Aparna Medicharla | 749399f | 2015-03-10 13:02:04 +0530 | [diff] [blame] | 3440 | |
| 3441 | /* allocate local buffer to build the response */ |
| 3442 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); |
| 3443 | if (!buf) { |
| 3444 | hddLog(LOG1, "%s: failed to allocate response buffer", __func__); |
| 3445 | return -ENOMEM; |
| 3446 | } |
| 3447 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3448 | pStaInfo = pSapCtx->aStaInfo; |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3449 | /* start indexing beyond where the record count will be written */ |
| 3450 | maclist_index = sizeof(maclist_index); |
| 3451 | left = wrqu->data.length - maclist_index; |
| 3452 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3453 | spin_lock_bh(&pSapCtx->staInfo_lock); |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3454 | while ((cnt < WLAN_MAX_STA_COUNT) && (left >= VOS_MAC_ADDR_SIZE)) { |
| 3455 | if ((pStaInfo[cnt].isUsed) && |
| 3456 | (!IS_BROADCAST_MAC(pStaInfo[cnt].macAddrSTA.bytes))) { |
| 3457 | memcpy(&buf[maclist_index], &(pStaInfo[cnt].macAddrSTA), |
| 3458 | VOS_MAC_ADDR_SIZE); |
| 3459 | maclist_index += VOS_MAC_ADDR_SIZE; |
| 3460 | left -= VOS_MAC_ADDR_SIZE; |
| 3461 | } |
| 3462 | cnt++; |
| 3463 | } |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 3464 | spin_unlock_bh(&pSapCtx->staInfo_lock); |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3465 | |
| 3466 | *((u32 *)buf) = maclist_index; |
| 3467 | wrqu->data.length = maclist_index; |
| 3468 | if (copy_to_user(wrqu->data.pointer, buf, maclist_index)) { |
| 3469 | hddLog(LOG1, "%s: failed to copy response to user buffer", __func__); |
| 3470 | ret = -EFAULT; |
| 3471 | } |
| 3472 | kfree(buf); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3473 | |
| 3474 | EXIT(); |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 3475 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3476 | } |
| 3477 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3478 | int |
| 3479 | static iw_softap_getassoc_stamacaddr(struct net_device *dev, |
| 3480 | struct iw_request_info *info, |
| 3481 | union iwreq_data *wrqu, char *extra) |
| 3482 | { |
| 3483 | int ret; |
| 3484 | |
| 3485 | vos_ssr_protect(__func__); |
| 3486 | ret = __iw_softap_getassoc_stamacaddr(dev, info, wrqu, extra); |
| 3487 | vos_ssr_unprotect(__func__); |
| 3488 | |
| 3489 | return ret; |
| 3490 | } |
| 3491 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3492 | /* Usage: |
| 3493 | mac addr will be accepted as a 6 octet mac address with each octet inputted in hex |
| 3494 | for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 3495 | while using this ioctl |
| 3496 | |
| 3497 | Syntax: |
| 3498 | iwpriv softap.0 disassoc_sta <6 octet mac address> |
| 3499 | |
| 3500 | e.g. |
| 3501 | disassociate sta with mac addr 00:0a:f5:11:22:33 from softap |
| 3502 | iwpriv softap.0 disassoc_sta 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 3503 | */ |
| 3504 | |
| 3505 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3506 | static __iw_softap_disassoc_sta(struct net_device *dev, |
| 3507 | struct iw_request_info *info, |
| 3508 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3509 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3510 | hdd_adapter_t *pHostapdAdapter; |
| 3511 | hdd_context_t *pHddCtx; |
| 3512 | v_U8_t *peerMacAddr; |
| 3513 | int ret = 0; |
| 3514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3515 | ENTER(); |
Hanumantha Reddy Pothula | 6633f3f | 2015-10-27 23:01:21 +0530 | [diff] [blame] | 3516 | |
| 3517 | if (!capable(CAP_NET_ADMIN)) { |
| 3518 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3519 | FL("permission check failed")); |
| 3520 | return -EPERM; |
| 3521 | } |
| 3522 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3523 | pHostapdAdapter = (netdev_priv(dev)); |
| 3524 | if (NULL == pHostapdAdapter) |
| 3525 | { |
| 3526 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3527 | "%s: Adapter is NULL",__func__); |
| 3528 | return -EINVAL; |
| 3529 | } |
| 3530 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3531 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3532 | if (0 != ret) |
| 3533 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3534 | return ret; |
| 3535 | } |
Gopichand Nakkala | 252c9ef | 2013-02-27 17:01:23 +0530 | [diff] [blame] | 3536 | /* iwpriv tool or framework calls this ioctl with |
| 3537 | * data passed in extra (less than 16 octets); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3538 | */ |
Gopichand Nakkala | 252c9ef | 2013-02-27 17:01:23 +0530 | [diff] [blame] | 3539 | peerMacAddr = (v_U8_t *)(extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3540 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3541 | hddLog(LOG1, "%s data " MAC_ADDRESS_STR, |
| 3542 | __func__, MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3543 | hdd_softap_sta_disassoc(pHostapdAdapter, peerMacAddr); |
| 3544 | EXIT(); |
| 3545 | return 0; |
| 3546 | } |
| 3547 | |
| 3548 | int |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3549 | static iw_softap_disassoc_sta(struct net_device *dev, |
| 3550 | struct iw_request_info *info, |
| 3551 | union iwreq_data *wrqu, char *extra) |
| 3552 | { |
| 3553 | int ret; |
| 3554 | |
| 3555 | vos_ssr_protect(__func__); |
| 3556 | ret = __iw_softap_disassoc_sta(dev, info, wrqu, extra); |
| 3557 | vos_ssr_unprotect(__func__); |
| 3558 | |
| 3559 | return ret; |
| 3560 | } |
| 3561 | |
| 3562 | int |
| 3563 | static __iw_softap_ap_stats(struct net_device *dev, |
| 3564 | struct iw_request_info *info, |
| 3565 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3566 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3567 | hdd_adapter_t *pHostapdAdapter; |
| 3568 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3569 | WLANTL_TRANSFER_STA_TYPE statBuffer; |
| 3570 | char *pstatbuf; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3571 | int len, ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3572 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3573 | ENTER(); |
| 3574 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3575 | pHostapdAdapter = (netdev_priv(dev)); |
| 3576 | if (NULL == pHostapdAdapter) |
| 3577 | { |
| 3578 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3579 | "%s: Adapter is NULL",__func__); |
| 3580 | return -EINVAL; |
| 3581 | } |
| 3582 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3583 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3584 | if (0 != ret) |
| 3585 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3586 | return ret; |
| 3587 | } |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 3588 | memset(&statBuffer, 0, sizeof(statBuffer)); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3589 | WLANSAP_GetStatistics((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, |
| 3590 | &statBuffer, (v_BOOL_t)wrqu->data.flags); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3591 | |
Sandeep Puligilla | 38e31bf | 2014-05-12 15:37:02 +0530 | [diff] [blame] | 3592 | pstatbuf = kzalloc(QCSAP_MAX_WSC_IE, GFP_KERNEL); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3593 | if(NULL == pstatbuf) { |
| 3594 | hddLog(LOG1, "unable to allocate memory"); |
| 3595 | return -ENOMEM; |
| 3596 | } |
Sandeep Puligilla | 38e31bf | 2014-05-12 15:37:02 +0530 | [diff] [blame] | 3597 | |
| 3598 | len = scnprintf(pstatbuf, QCSAP_MAX_WSC_IE, |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3599 | "RUF=%d RMF=%d RBF=%d " |
| 3600 | "RUB=%d RMB=%d RBB=%d " |
| 3601 | "TUF=%d TMF=%d TBF=%d " |
Sandeep Puligilla | 38e31bf | 2014-05-12 15:37:02 +0530 | [diff] [blame] | 3602 | "TUB=%d TMB=%d TBB=%d ", |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3603 | (int)statBuffer.rxUCFcnt, (int)statBuffer.rxMCFcnt, |
| 3604 | (int)statBuffer.rxBCFcnt, (int)statBuffer.rxUCBcnt, |
| 3605 | (int)statBuffer.rxMCBcnt, (int)statBuffer.rxBCBcnt, |
| 3606 | (int)statBuffer.txUCFcnt, (int)statBuffer.txMCFcnt, |
| 3607 | (int)statBuffer.txBCFcnt, (int)statBuffer.txUCBcnt, |
| 3608 | (int)statBuffer.txMCBcnt, (int)statBuffer.txBCBcnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | |
Sandeep Puligilla | 38e31bf | 2014-05-12 15:37:02 +0530 | [diff] [blame] | 3610 | if (len >= QCSAP_MAX_WSC_IE) { |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3611 | hddLog(LOG1, "%s: failed to copy data to user buffer", __func__); |
| 3612 | kfree(pstatbuf); |
| 3613 | return -EFAULT; |
| 3614 | } |
Sandeep Puligilla | 38e31bf | 2014-05-12 15:37:02 +0530 | [diff] [blame] | 3615 | |
| 3616 | strlcpy(extra, pstatbuf, len); |
| 3617 | wrqu->data.length = len; |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 3618 | kfree(pstatbuf); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3619 | |
| 3620 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | return 0; |
| 3622 | } |
Bhargav Shah | 7f03b81 | 2015-08-21 11:17:32 +0530 | [diff] [blame] | 3623 | int |
| 3624 | static __iw_softap_ap_get_stats(struct net_device *dev, |
| 3625 | struct iw_request_info *info, |
| 3626 | union iwreq_data *wrqu, char *extra) |
| 3627 | { |
| 3628 | hdd_adapter_t *pAdapter; |
| 3629 | hdd_tx_rx_stats_t *pStats; |
| 3630 | |
| 3631 | ENTER(); |
| 3632 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3633 | if (NULL == pAdapter) |
| 3634 | { |
| 3635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3636 | "%s: Adapter is NULL",__func__); |
| 3637 | return -EINVAL; |
| 3638 | } |
| 3639 | |
| 3640 | pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 3641 | snprintf(extra, QCSAP_MAX_STR_LEN, |
| 3642 | "\nTransmit" |
| 3643 | "\ncalled %u, dropped %u, backpressured %u, queued %u" |
| 3644 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 3645 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 3646 | "\nbackpressured BK %u, BE %u, VI %u, VO %u" |
| 3647 | "\n queued BK %u, BE %u, VI %u, VO %u" |
| 3648 | "\nfetched %u, empty %u, lowres %u, deqerr %u" |
| 3649 | "\ndequeued %u, depressured %u, deque-depressured %u,\ |
| 3650 | completed %u, flushed %u" |
| 3651 | "\n fetched BK %u, BE %u, VI %u, VO %u" |
| 3652 | "\n dequeued BK %u, BE %u, VI %u, VO %u" |
| 3653 | "\n depressured BK %u, BE %u, VI %u, VO %u" |
| 3654 | "\nDeque depressured BK %u, BE %u, VI %u, VO %u" |
| 3655 | "\n flushed BK %u, BE %u, VI %u, VO %u" |
| 3656 | "\n\nReceive" |
| 3657 | "\nchains %u, packets %u, dropped %u, delivered %u, refused %u" |
| 3658 | "\n\nResetsStats" |
| 3659 | "\n", |
| 3660 | pStats->txXmitCalled, |
| 3661 | pStats->txXmitDropped, |
| 3662 | pStats->txXmitBackPressured, |
| 3663 | pStats->txXmitQueued, |
| 3664 | |
| 3665 | pStats->txXmitDroppedAC[WLANTL_AC_BK], |
| 3666 | pStats->txXmitDroppedAC[WLANTL_AC_BE], |
| 3667 | pStats->txXmitDroppedAC[WLANTL_AC_VI], |
| 3668 | pStats->txXmitDroppedAC[WLANTL_AC_VO], |
| 3669 | |
| 3670 | pStats->txXmitClassifiedAC[WLANTL_AC_BK], |
| 3671 | pStats->txXmitClassifiedAC[WLANTL_AC_BE], |
| 3672 | pStats->txXmitClassifiedAC[WLANTL_AC_VI], |
| 3673 | pStats->txXmitClassifiedAC[WLANTL_AC_VO], |
| 3674 | |
| 3675 | pStats->txXmitBackPressuredAC[WLANTL_AC_BK], |
| 3676 | pStats->txXmitBackPressuredAC[WLANTL_AC_BE], |
| 3677 | pStats->txXmitBackPressuredAC[WLANTL_AC_VI], |
| 3678 | pStats->txXmitBackPressuredAC[WLANTL_AC_VO], |
| 3679 | |
| 3680 | pStats->txXmitQueuedAC[WLANTL_AC_BK], |
| 3681 | pStats->txXmitQueuedAC[WLANTL_AC_BE], |
| 3682 | pStats->txXmitQueuedAC[WLANTL_AC_VI], |
| 3683 | pStats->txXmitQueuedAC[WLANTL_AC_VO], |
| 3684 | |
| 3685 | pStats->txFetched, |
| 3686 | pStats->txFetchEmpty, |
| 3687 | pStats->txFetchLowResources, |
| 3688 | pStats->txFetchDequeueError, |
| 3689 | |
| 3690 | pStats->txFetchDequeued, |
| 3691 | pStats->txFetchDePressured, |
| 3692 | pStats->txDequeDePressured, |
| 3693 | pStats->txCompleted, |
| 3694 | pStats->txFlushed, |
| 3695 | |
| 3696 | pStats->txFetchedAC[WLANTL_AC_BK], |
| 3697 | pStats->txFetchedAC[WLANTL_AC_BE], |
| 3698 | pStats->txFetchedAC[WLANTL_AC_VI], |
| 3699 | pStats->txFetchedAC[WLANTL_AC_VO], |
| 3700 | |
| 3701 | pStats->txFetchDequeuedAC[WLANTL_AC_BK], |
| 3702 | pStats->txFetchDequeuedAC[WLANTL_AC_BE], |
| 3703 | pStats->txFetchDequeuedAC[WLANTL_AC_VI], |
| 3704 | pStats->txFetchDequeuedAC[WLANTL_AC_VO], |
| 3705 | |
| 3706 | pStats->txFetchDePressuredAC[WLANTL_AC_BK], |
| 3707 | pStats->txFetchDePressuredAC[WLANTL_AC_BE], |
| 3708 | pStats->txFetchDePressuredAC[WLANTL_AC_VI], |
| 3709 | pStats->txFetchDePressuredAC[WLANTL_AC_VO], |
| 3710 | |
| 3711 | pStats->txDequeDePressuredAC[WLANTL_AC_BK], |
| 3712 | pStats->txDequeDePressuredAC[WLANTL_AC_BE], |
| 3713 | pStats->txDequeDePressuredAC[WLANTL_AC_VI], |
| 3714 | pStats->txDequeDePressuredAC[WLANTL_AC_VO], |
| 3715 | |
| 3716 | pStats->txFlushedAC[WLANTL_AC_BK], |
| 3717 | pStats->txFlushedAC[WLANTL_AC_BE], |
| 3718 | pStats->txFlushedAC[WLANTL_AC_VI], |
| 3719 | pStats->txFlushedAC[WLANTL_AC_VO], |
| 3720 | |
| 3721 | pStats->rxChains, |
| 3722 | pStats->rxPackets, |
| 3723 | pStats->rxDropped, |
| 3724 | pStats->rxDelivered, |
| 3725 | pStats->rxRefused |
| 3726 | ); |
| 3727 | |
| 3728 | wrqu->data.length = strlen(extra) + 1; |
| 3729 | |
| 3730 | return 0; |
| 3731 | } |
| 3732 | |
| 3733 | int |
| 3734 | static __iw_softap_ap_clear_stats(struct net_device *dev, |
| 3735 | struct iw_request_info *info, |
| 3736 | union iwreq_data *wrqu, char *extra) |
| 3737 | { |
| 3738 | hdd_adapter_t *pAdapter; |
| 3739 | |
| 3740 | ENTER(); |
| 3741 | |
| 3742 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3743 | if (NULL == pAdapter) |
| 3744 | { |
| 3745 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3746 | "%s: Adapter is NULL",__func__); |
| 3747 | return -EINVAL; |
| 3748 | } |
| 3749 | |
| 3750 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: clearing", __func__); |
| 3751 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 3752 | memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats)); |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
| 3756 | |
| 3757 | int |
| 3758 | static iw_softap_get_stats(struct net_device *dev, |
| 3759 | struct iw_request_info *info, |
| 3760 | union iwreq_data *wrqu, char *extra) |
| 3761 | { |
| 3762 | int ret; |
| 3763 | vos_ssr_protect(__func__); |
| 3764 | ret = __iw_softap_ap_get_stats(dev, info, wrqu, extra); |
| 3765 | vos_ssr_unprotect(__func__); |
| 3766 | return ret; |
| 3767 | } |
| 3768 | |
| 3769 | int |
| 3770 | static iw_softap_clear_stats(struct net_device *dev, |
| 3771 | struct iw_request_info *info, |
| 3772 | union iwreq_data *wrqu, char *extra) |
| 3773 | { |
| 3774 | int ret; |
| 3775 | vos_ssr_protect(__func__); |
| 3776 | ret = __iw_softap_ap_clear_stats(dev, info, wrqu, extra); |
| 3777 | vos_ssr_unprotect(__func__); |
| 3778 | return ret; |
| 3779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3780 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3781 | int |
| 3782 | static iw_softap_ap_stats(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3783 | struct iw_request_info *info, |
| 3784 | union iwreq_data *wrqu, char *extra) |
| 3785 | { |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3786 | int ret; |
| 3787 | |
| 3788 | vos_ssr_protect(__func__); |
| 3789 | ret = __iw_softap_ap_stats(dev, info, wrqu, extra); |
| 3790 | vos_ssr_unprotect(__func__); |
| 3791 | |
| 3792 | return ret; |
| 3793 | } |
| 3794 | |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 3795 | /** |
| 3796 | * __iw_softap_get_three() - return three value to upper layer. |
| 3797 | * |
| 3798 | * @dev: pointer of net_device of this wireless card |
| 3799 | * @info: meta data about Request sent |
| 3800 | * @wrqu: include request info |
| 3801 | * @extra: buf used for in/out |
| 3802 | * |
| 3803 | * Return: execute result |
| 3804 | */ |
| 3805 | static int __iw_softap_get_three(struct net_device *dev, |
| 3806 | struct iw_request_info *info, |
| 3807 | union iwreq_data *wrqu, char *extra) |
| 3808 | { |
| 3809 | uint32_t *value = (uint32_t *)extra; |
| 3810 | uint32_t sub_cmd = value[0]; |
| 3811 | int ret = 0; /* success */ |
| 3812 | |
| 3813 | hdd_adapter_t *padapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3814 | |
| 3815 | switch (sub_cmd) { |
| 3816 | case QCSAP_IOCTL_GET_TSF: |
| 3817 | ret = hdd_indicate_tsf(padapter, value, 3); |
| 3818 | break; |
| 3819 | default: |
| 3820 | hddLog(LOGE, FL("Invalid getparam command %d"), sub_cmd); |
| 3821 | break; |
| 3822 | } |
| 3823 | return ret; |
| 3824 | } |
| 3825 | |
| 3826 | |
| 3827 | /** |
| 3828 | * iw_softap_get_three() - return three value to upper layer. |
| 3829 | * |
| 3830 | * @dev: pointer of net_device of this wireless card |
| 3831 | * @info: meta data about Request sent |
| 3832 | * @wrqu: include request info |
| 3833 | * @extra: buf used for in/Output |
| 3834 | * |
| 3835 | * Return: execute result |
| 3836 | */ |
| 3837 | static int iw_softap_get_three(struct net_device *dev, |
| 3838 | struct iw_request_info *info, |
| 3839 | union iwreq_data *wrqu, char *extra) |
| 3840 | { |
| 3841 | int ret; |
| 3842 | |
| 3843 | vos_ssr_protect(__func__); |
| 3844 | ret = __iw_softap_get_three(dev, info, wrqu, extra); |
| 3845 | vos_ssr_unprotect(__func__); |
| 3846 | |
| 3847 | return ret; |
| 3848 | } |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3849 | static int __iw_softap_set_channel_range(struct net_device *dev, |
| 3850 | struct iw_request_info *info, |
| 3851 | union iwreq_data *wrqu, char *extra) |
| 3852 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3853 | hdd_adapter_t *pHostapdAdapter; |
| 3854 | tHalHandle hHal; |
| 3855 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3856 | int *value = (int *)extra; |
| 3857 | int startChannel = value[0]; |
| 3858 | int endChannel = value[1]; |
| 3859 | int band = value[2]; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3860 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3861 | int ret = 0; /* success */ |
| 3862 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3863 | ENTER(); |
| 3864 | |
Hanumantha Reddy Pothula | bcb1abf | 2015-10-28 00:21:00 +0530 | [diff] [blame] | 3865 | if (!capable(CAP_NET_ADMIN)) |
| 3866 | { |
| 3867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3868 | FL("permission check failed")); |
| 3869 | return -EPERM; |
| 3870 | } |
| 3871 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3872 | pHostapdAdapter = (netdev_priv(dev)); |
| 3873 | if (NULL == pHostapdAdapter) |
| 3874 | { |
| 3875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3876 | "%s: Adapter is NULL",__func__); |
| 3877 | return -EINVAL; |
| 3878 | } |
| 3879 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3880 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3881 | if (0 != ret) |
| 3882 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3883 | return ret; |
| 3884 | } |
| 3885 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 3886 | if (NULL == hHal) |
| 3887 | { |
| 3888 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3889 | "%s: Hal Context is NULL",__func__); |
| 3890 | return -EINVAL; |
| 3891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3892 | status = WLANSAP_SetChannelRange(hHal,startChannel,endChannel,band); |
| 3893 | if(status != VOS_STATUS_SUCCESS) |
| 3894 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3895 | hddLog( LOGE, FL("iw_softap_set_channel_range: startChannel = %d, endChannel = %d band = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3896 | startChannel,endChannel, band); |
| 3897 | ret = -EINVAL; |
| 3898 | } |
Gopichand Nakkala | f7e53c5 | 2013-01-07 14:52:52 -0800 | [diff] [blame] | 3899 | |
| 3900 | pHddCtx->is_dynamic_channel_range_set = 1; |
| 3901 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3902 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3903 | return ret; |
| 3904 | } |
| 3905 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 3906 | static int iw_softap_set_channel_range(struct net_device *dev, |
| 3907 | struct iw_request_info *info, |
| 3908 | union iwreq_data *wrqu, char *extra) |
| 3909 | { |
| 3910 | int ret; |
| 3911 | |
| 3912 | vos_ssr_protect(__func__); |
| 3913 | ret = __iw_softap_set_channel_range(dev, info, wrqu, extra); |
| 3914 | vos_ssr_unprotect(__func__); |
| 3915 | |
| 3916 | return ret; |
| 3917 | } |
| 3918 | |
| 3919 | |
| 3920 | int __iw_softap_get_channel_list(struct net_device *dev, |
| 3921 | struct iw_request_info *info, |
| 3922 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3923 | { |
| 3924 | v_U32_t num_channels = 0; |
| 3925 | v_U8_t i = 0; |
| 3926 | v_U8_t bandStartChannel = RF_CHAN_1; |
| 3927 | v_U8_t bandEndChannel = RF_CHAN_165; |
| 3928 | v_U32_t temp_num_channels = 0; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3929 | hdd_adapter_t *pHostapdAdapter; |
| 3930 | tHalHandle hHal; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3931 | v_REGDOMAIN_t domainIdCurrentSoftap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3932 | tpChannelListInfo channel_list = (tpChannelListInfo) extra; |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 3933 | eCsrBand curBand = eCSR_BAND_ALL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3934 | hdd_context_t *pHddCtx; |
| 3935 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3936 | |
| 3937 | ENTER(); |
| 3938 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3939 | pHostapdAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3940 | if (NULL == pHostapdAdapter) |
| 3941 | { |
| 3942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3943 | "%s: Adapter is NULL",__func__); |
| 3944 | return -EINVAL; |
| 3945 | } |
| 3946 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3947 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3948 | if (0 != ret) |
| 3949 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3950 | return ret; |
| 3951 | } |
| 3952 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 3953 | if (NULL == hHal) |
| 3954 | { |
| 3955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3956 | "%s: Hal Context is NULL",__func__); |
| 3957 | return -EINVAL; |
| 3958 | } |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 3959 | if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &curBand)) |
| 3960 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3961 | hddLog(LOGE,FL("not able get the current frequency band")); |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 3962 | return -EIO; |
| 3963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3964 | wrqu->data.length = sizeof(tChannelListInfo); |
| 3965 | ENTER(); |
| 3966 | |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 3967 | if (eCSR_BAND_24 == curBand) |
| 3968 | { |
| 3969 | bandStartChannel = RF_CHAN_1; |
| 3970 | bandEndChannel = RF_CHAN_14; |
| 3971 | } |
| 3972 | else if (eCSR_BAND_5G == curBand) |
| 3973 | { |
| 3974 | bandStartChannel = RF_CHAN_36; |
| 3975 | bandEndChannel = RF_CHAN_165; |
| 3976 | } |
| 3977 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3978 | hddLog(LOG1, FL("curBand = %d, bandStartChannel = %hu, " |
Gopichand Nakkala | 29d0019 | 2013-06-20 19:03:52 +0530 | [diff] [blame] | 3979 | "bandEndChannel = %hu "), curBand, |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 3980 | bandStartChannel, bandEndChannel ); |
| 3981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | for( i = bandStartChannel; i <= bandEndChannel; i++ ) |
| 3983 | { |
| 3984 | if( NV_CHANNEL_ENABLE == regChannels[i].enabled ) |
| 3985 | { |
| 3986 | channel_list->channels[num_channels] = rfChannels[i].channelNum; |
| 3987 | num_channels++; |
| 3988 | } |
| 3989 | } |
| 3990 | |
| 3991 | /* remove indoor channels if the domain is FCC, channels 36 - 48 */ |
| 3992 | |
| 3993 | temp_num_channels = num_channels; |
| 3994 | |
| 3995 | if(eHAL_STATUS_SUCCESS != sme_getSoftApDomain(hHal,(v_REGDOMAIN_t *) &domainIdCurrentSoftap)) |
| 3996 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3997 | hddLog(LOGE,FL("Failed to get Domain ID, %d"),domainIdCurrentSoftap); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 3998 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3999 | } |
| 4000 | |
Agarwal Ashish | 7b557c0 | 2014-07-02 12:32:39 +0530 | [diff] [blame] | 4001 | if(REGDOMAIN_FCC == domainIdCurrentSoftap && |
| 4002 | pHddCtx->cfg_ini->gEnableStrictRegulatoryForFCC ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4003 | { |
| 4004 | for(i = 0; i < temp_num_channels; i++) |
| 4005 | { |
| 4006 | |
| 4007 | if((channel_list->channels[i] > 35) && |
| 4008 | (channel_list->channels[i] < 49)) |
| 4009 | { |
| 4010 | vos_mem_move(&channel_list->channels[i], |
| 4011 | &channel_list->channels[i+1], |
| 4012 | temp_num_channels - (i-1)); |
| 4013 | num_channels--; |
| 4014 | temp_num_channels--; |
| 4015 | i--; |
| 4016 | } |
| 4017 | } |
| 4018 | } |
| 4019 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4020 | hddLog(LOG1,FL(" number of channels %d"), num_channels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4022 | channel_list->num_channels = num_channels; |
| 4023 | EXIT(); |
| 4024 | |
| 4025 | return 0; |
| 4026 | } |
| 4027 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4028 | int iw_softap_get_channel_list(struct net_device *dev, |
| 4029 | struct iw_request_info *info, |
| 4030 | union iwreq_data *wrqu, char *extra) |
| 4031 | { |
| 4032 | int ret; |
| 4033 | |
| 4034 | vos_ssr_protect(__func__); |
| 4035 | ret = __iw_softap_get_channel_list(dev, info, wrqu, extra); |
| 4036 | vos_ssr_unprotect(__func__); |
| 4037 | |
| 4038 | return ret; |
| 4039 | } |
| 4040 | |
| 4041 | static |
| 4042 | int __iw_get_genie(struct net_device *dev, |
| 4043 | struct iw_request_info *info, |
| 4044 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4046 | hdd_adapter_t *pHostapdAdapter; |
| 4047 | hdd_context_t *pHddCtx; |
| 4048 | v_CONTEXT_t pVosContext; |
Manjeet Singh | 0fc1271 | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 4049 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4050 | v_U32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 4051 | v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4052 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4054 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4055 | |
| 4056 | pHostapdAdapter = (netdev_priv(dev)); |
| 4057 | if (NULL == pHostapdAdapter) |
| 4058 | { |
| 4059 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4060 | "%s: Adapter is NULL",__func__); |
| 4061 | return -EINVAL; |
| 4062 | } |
| 4063 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4064 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4065 | if (0 != ret) |
| 4066 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4067 | return ret; |
| 4068 | } |
| 4069 | pVosContext = pHddCtx->pvosContext; |
| 4070 | if (NULL == pVosContext) |
| 4071 | { |
| 4072 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4073 | "%s: vos context is not valid ",__func__); |
| 4074 | return -EINVAL; |
| 4075 | } |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4076 | hddLog(LOG1,FL("getGEN_IE ioctl")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.) |
| 4078 | status = WLANSap_getstationIE_information(pVosContext, |
| 4079 | &length, |
| 4080 | genIeBytes); |
Manjeet Singh | 0fc1271 | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 4081 | |
| 4082 | if (VOS_STATUS_SUCCESS != status) { |
| 4083 | hddLog(LOGE, FL("failed to get sta ies")); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4084 | return -EFAULT; |
| 4085 | } |
Manjeet Singh | 0fc1271 | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 4086 | |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4087 | wrqu->data.length = length; |
Manjeet Singh | 0fc1271 | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 4088 | if (length > DOT11F_IE_RSN_MAX_LEN) { |
| 4089 | hddLog(LOGE, |
| 4090 | FL("invalid buffer length length:%d"), length); |
| 4091 | return -E2BIG; |
| 4092 | } |
| 4093 | |
| 4094 | vos_mem_copy(extra, genIeBytes, length); |
| 4095 | |
| 4096 | hddLog(LOG1, FL("RSN IE of %d bytes returned"), wrqu->data.length); |
| 4097 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4098 | EXIT(); |
| 4099 | return 0; |
| 4100 | } |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4101 | |
| 4102 | static |
| 4103 | int iw_get_genie(struct net_device *dev, |
| 4104 | struct iw_request_info *info, |
| 4105 | union iwreq_data *wrqu, char *extra) |
| 4106 | { |
| 4107 | int ret; |
| 4108 | |
| 4109 | vos_ssr_protect(__func__); |
| 4110 | ret = __iw_get_genie(dev, info, wrqu, extra); |
| 4111 | vos_ssr_unprotect(__func__); |
| 4112 | |
| 4113 | return ret; |
| 4114 | } |
| 4115 | |
| 4116 | static |
| 4117 | int __iw_get_WPSPBCProbeReqIEs(struct net_device *dev, |
| 4118 | struct iw_request_info *info, |
| 4119 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4120 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4121 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4122 | sQcSapreq_WPSPBCProbeReqIES_t WPSPBCProbeReqIEs; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4123 | hdd_ap_ctx_t *pHddApCtx; |
| 4124 | hdd_context_t *pHddCtx; |
| 4125 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4126 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | ENTER(); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4128 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4129 | pHostapdAdapter = (netdev_priv(dev)); |
| 4130 | if (NULL == pHostapdAdapter) |
| 4131 | { |
| 4132 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4133 | "%s: Adapter is NULL",__func__); |
| 4134 | return -EINVAL; |
| 4135 | } |
| 4136 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4137 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4138 | if (0 != ret) |
| 4139 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4140 | return ret; |
| 4141 | } |
| 4142 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 4143 | if (NULL == pHddApCtx) |
| 4144 | { |
| 4145 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4146 | "%s: AP context is NULL",__func__); |
| 4147 | return -EINVAL; |
| 4148 | } |
| 4149 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4150 | hddLog(LOG1,FL("get_WPSPBCProbeReqIEs ioctl")); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4151 | memset((void*)&WPSPBCProbeReqIEs, 0, sizeof(WPSPBCProbeReqIEs)); |
| 4152 | |
| 4153 | WPSPBCProbeReqIEs.probeReqIELen = pHddApCtx->WPSPBCProbeReq.probeReqIELen; |
| 4154 | vos_mem_copy(&WPSPBCProbeReqIEs.probeReqIE, |
| 4155 | pHddApCtx->WPSPBCProbeReq.probeReqIE, |
| 4156 | WPSPBCProbeReqIEs.probeReqIELen); |
| 4157 | vos_mem_copy(&WPSPBCProbeReqIEs.macaddr, |
| 4158 | pHddApCtx->WPSPBCProbeReq.peerMacAddr, |
| 4159 | sizeof(v_MACADDR_t)); |
| 4160 | if (copy_to_user(wrqu->data.pointer, |
| 4161 | (void *)&WPSPBCProbeReqIEs, |
| 4162 | sizeof(WPSPBCProbeReqIEs))) |
| 4163 | { |
| 4164 | hddLog(LOG1, "%s: failed to copy data to user buffer", __func__); |
| 4165 | return -EFAULT; |
| 4166 | } |
| 4167 | wrqu->data.length = 12 + WPSPBCProbeReqIEs.probeReqIELen; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4168 | hddLog(LOG1, FL("Macaddress : "MAC_ADDRESS_STR), |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4169 | MAC_ADDR_ARRAY(WPSPBCProbeReqIEs.macaddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4170 | up(&pHddApCtx->semWpsPBCOverlapInd); |
| 4171 | EXIT(); |
| 4172 | return 0; |
| 4173 | } |
| 4174 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4175 | static |
| 4176 | int iw_get_WPSPBCProbeReqIEs(struct net_device *dev, |
| 4177 | struct iw_request_info *info, |
| 4178 | union iwreq_data *wrqu, char *extra) |
| 4179 | { |
| 4180 | int ret; |
| 4181 | |
| 4182 | vos_ssr_protect(__func__); |
| 4183 | ret = __iw_get_WPSPBCProbeReqIEs(dev, info, wrqu, extra); |
| 4184 | vos_ssr_unprotect(__func__); |
| 4185 | |
| 4186 | return ret; |
| 4187 | } |
| 4188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4189 | /**--------------------------------------------------------------------------- |
| 4190 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4191 | \brief __iw_set_auth_hostap() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | This function sets the auth type received from the wpa_supplicant. |
| 4193 | |
| 4194 | \param - dev - Pointer to the net device. |
| 4195 | - info - Pointer to the iw_request_info. |
| 4196 | - wrqu - Pointer to the iwreq_data. |
| 4197 | - extra - Pointer to the data. |
| 4198 | \return - 0 for success, non zero for failure |
| 4199 | |
| 4200 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4201 | int __iw_set_auth_hostap(struct net_device *dev, |
| 4202 | struct iw_request_info *info, |
| 4203 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4205 | hdd_adapter_t *pAdapter; |
| 4206 | hdd_context_t *pHddCtx; |
| 4207 | hdd_wext_state_t *pWextState; |
| 4208 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4209 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4210 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4211 | |
| 4212 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4213 | if (NULL == pAdapter) |
| 4214 | { |
| 4215 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4216 | "%s: Adapter is NULL",__func__); |
| 4217 | return -EINVAL; |
| 4218 | } |
| 4219 | |
| 4220 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4221 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4222 | if (0 != ret) |
| 4223 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4224 | return ret; |
| 4225 | } |
| 4226 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4227 | if (NULL == pWextState) |
| 4228 | { |
| 4229 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4230 | "%s: pWextState is NULL",__func__); |
| 4231 | return -EINVAL; |
| 4232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4233 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 4234 | { |
| 4235 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 4236 | { |
| 4237 | if(wrqu->param.value) { |
| 4238 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 4239 | "Counter Measure started %d", wrqu->param.value); |
| 4240 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4241 | } |
| 4242 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4243 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 4244 | "Counter Measure stopped=%d", wrqu->param.value); |
| 4245 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 4246 | } |
| 4247 | |
| 4248 | hdd_softap_tkip_mic_fail_counter_measure(pAdapter, |
| 4249 | wrqu->param.value); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4250 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4251 | break; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4253 | default: |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4254 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4255 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4256 | wrqu->param.flags & IW_AUTH_INDEX); |
| 4257 | break; |
| 4258 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4260 | EXIT(); |
| 4261 | return 0; |
| 4262 | } |
| 4263 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4264 | int iw_set_auth_hostap(struct net_device *dev, |
| 4265 | struct iw_request_info *info, |
| 4266 | union iwreq_data *wrqu,char *extra) |
| 4267 | { |
| 4268 | int ret; |
| 4269 | |
| 4270 | vos_ssr_protect(__func__); |
| 4271 | ret = __iw_set_auth_hostap(dev, info, wrqu, extra); |
| 4272 | vos_ssr_unprotect(__func__); |
| 4273 | |
| 4274 | return ret; |
| 4275 | } |
| 4276 | |
| 4277 | static int __iw_set_ap_encodeext(struct net_device *dev, |
| 4278 | struct iw_request_info *info, |
| 4279 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4280 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4281 | hdd_adapter_t *pHostapdAdapter; |
| 4282 | v_CONTEXT_t pVosContext; |
| 4283 | hdd_context_t *pHddCtx; |
| 4284 | hdd_ap_ctx_t *pHddApCtx; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4285 | int retval = 0; |
| 4286 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4287 | struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; |
| 4288 | v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 4289 | int key_index; |
| 4290 | struct iw_point *encoding = &wrqu->encoding; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4291 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | // tCsrRoamRemoveKey RemoveKey; |
| 4293 | int i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4294 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4295 | ENTER(); |
| 4296 | pHostapdAdapter = (netdev_priv(dev)); |
| 4297 | if (NULL == pHostapdAdapter) |
| 4298 | { |
| 4299 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4300 | "%s: Adapter is NULL",__func__); |
| 4301 | return -EINVAL; |
| 4302 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4303 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4304 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4305 | retval = wlan_hdd_validate_context(pHddCtx); |
| 4306 | if (0 != retval) |
| 4307 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4308 | return retval; |
| 4309 | } |
| 4310 | pVosContext = pHddCtx->pvosContext; |
| 4311 | if (NULL == pVosContext) |
| 4312 | { |
| 4313 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4314 | "%s: pVosContext is NULL",__func__); |
| 4315 | return -EINVAL; |
| 4316 | } |
| 4317 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 4318 | if (NULL == pHddApCtx) |
| 4319 | { |
| 4320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4321 | "%s: AP Context is NULL",__func__); |
| 4322 | return -EINVAL; |
| 4323 | } |
| 4324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4325 | key_index = encoding->flags & IW_ENCODE_INDEX; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4327 | if(key_index > 0) { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4329 | /*Convert from 1-based to 0-based keying*/ |
| 4330 | key_index--; |
| 4331 | } |
Ashish Kumar Dhanotiya | 2855c95 | 2018-01-02 19:52:26 +0530 | [diff] [blame] | 4332 | if(!ext->key_len || ext->key_len > CSR_MAX_KEY_LEN) { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4333 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | /*Set the encrytion type to NONE*/ |
| 4335 | #if 0 |
| 4336 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4337 | #endif |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4339 | RemoveKey.keyId = key_index; |
| 4340 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4341 | /*Key direction for group is RX only*/ |
| 4342 | vos_mem_copy(RemoveKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 4343 | } |
| 4344 | else { |
| 4345 | vos_mem_copy(RemoveKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 4346 | } |
| 4347 | switch(ext->alg) |
| 4348 | { |
| 4349 | case IW_ENCODE_ALG_NONE: |
| 4350 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4351 | break; |
| 4352 | case IW_ENCODE_ALG_WEP: |
| 4353 | RemoveKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 4354 | break; |
| 4355 | case IW_ENCODE_ALG_TKIP: |
| 4356 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4357 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4358 | case IW_ENCODE_ALG_CCMP: |
| 4359 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4360 | break; |
| 4361 | default: |
| 4362 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4363 | break; |
| 4364 | } |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Remove key cipher_alg:%d key_len%d *pEncryptionType :%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4366 | __func__,(int)ext->alg,(int)ext->key_len,RemoveKey.encType); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Peer Mac = "MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4368 | __func__, MAC_ADDR_ARRAY(RemoveKey.peerMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4369 | ); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4370 | vstatus = WLANSAP_DelKeySta( pVosContext, &RemoveKey); |
| 4371 | if ( vstatus != VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4372 | { |
| 4373 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "[%4d] WLANSAP_DeleteKeysSta returned ERROR status= %d", |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4374 | __LINE__, vstatus ); |
| 4375 | retval = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4376 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4377 | #endif |
Ashish Kumar Dhanotiya | 2855c95 | 2018-01-02 19:52:26 +0530 | [diff] [blame] | 4378 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4379 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4381 | |
| 4382 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4383 | |
| 4384 | setKey.keyId = key_index; |
| 4385 | setKey.keyLength = ext->key_len; |
| 4386 | |
Ashish Kumar Dhanotiya | 2855c95 | 2018-01-02 19:52:26 +0530 | [diff] [blame] | 4387 | vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4388 | |
| 4389 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4390 | /*Key direction for group is RX only*/ |
| 4391 | setKey.keyDirection = eSIR_RX_ONLY; |
| 4392 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 4393 | } |
| 4394 | else { |
| 4395 | |
| 4396 | setKey.keyDirection = eSIR_TX_RX; |
| 4397 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 4398 | } |
| 4399 | if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 4400 | { |
| 4401 | setKey.keyDirection = eSIR_TX_DEFAULT; |
| 4402 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 4403 | } |
| 4404 | |
| 4405 | /*For supplicant pae role is zero*/ |
| 4406 | setKey.paeRole = 0; |
| 4407 | |
| 4408 | switch(ext->alg) |
| 4409 | { |
| 4410 | case IW_ENCODE_ALG_NONE: |
| 4411 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4412 | break; |
| 4413 | |
| 4414 | case IW_ENCODE_ALG_WEP: |
| 4415 | setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 4416 | pHddApCtx->uPrivacy = 1; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4417 | hddLog(LOG1, "(%s) uPrivacy=%d", __func__, pHddApCtx->uPrivacy); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4418 | break; |
| 4419 | |
| 4420 | case IW_ENCODE_ALG_TKIP: |
| 4421 | { |
| 4422 | v_U8_t *pKey = &setKey.Key[0]; |
| 4423 | |
| 4424 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 4425 | |
| 4426 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 4427 | |
| 4428 | /*Supplicant sends the 32bytes key in this order |
| 4429 | |
| 4430 | |--------------|----------|----------| |
| 4431 | | Tk1 |TX-MIC | RX Mic | |
| 4432 | |--------------|----------|----------| |
| 4433 | <---16bytes---><--8bytes--><--8bytes--> |
| 4434 | |
| 4435 | */ |
| 4436 | /*Sme expects the 32 bytes key to be in the below order |
| 4437 | |
| 4438 | |--------------|----------|----------| |
| 4439 | | Tk1 |RX-MIC | TX Mic | |
| 4440 | |--------------|----------|----------| |
| 4441 | <---16bytes---><--8bytes--><--8bytes--> |
| 4442 | */ |
| 4443 | /* Copy the Temporal Key 1 (TK1) */ |
| 4444 | vos_mem_copy(pKey,ext->key,16); |
| 4445 | |
| 4446 | /*Copy the rx mic first*/ |
| 4447 | vos_mem_copy(&pKey[16],&ext->key[24],8); |
| 4448 | |
| 4449 | /*Copy the tx mic */ |
| 4450 | vos_mem_copy(&pKey[24],&ext->key[16],8); |
| 4451 | |
| 4452 | } |
| 4453 | break; |
| 4454 | |
| 4455 | case IW_ENCODE_ALG_CCMP: |
| 4456 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4457 | break; |
| 4458 | |
| 4459 | default: |
| 4460 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4461 | break; |
| 4462 | } |
| 4463 | |
| 4464 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 4465 | ("%s:EncryptionType:%d key_len:%d, KeyId:%d"), __func__, setKey.encType, setKey.keyLength, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4466 | setKey.keyId); |
| 4467 | for(i=0; i< ext->key_len; i++) |
| 4468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4469 | ("%02x"), setKey.Key[i]); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4470 | |
| 4471 | vstatus = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 4472 | if ( vstatus != VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4473 | { |
| 4474 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4475 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", __LINE__, vstatus ); |
| 4476 | retval = -EINVAL; |
| 4477 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4478 | |
| 4479 | EXIT(); |
| 4480 | return retval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4482 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4483 | static int iw_set_ap_encodeext(struct net_device *dev, |
| 4484 | struct iw_request_info *info, |
| 4485 | union iwreq_data *wrqu, char *extra) |
| 4486 | { |
| 4487 | int ret; |
| 4488 | |
| 4489 | vos_ssr_protect(__func__); |
| 4490 | ret = __iw_set_ap_encodeext(dev, info, wrqu, extra); |
| 4491 | vos_ssr_unprotect(__func__); |
| 4492 | |
| 4493 | return ret; |
| 4494 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4495 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4496 | static int __iw_set_ap_mlme(struct net_device *dev, |
| 4497 | struct iw_request_info *info, |
| 4498 | union iwreq_data *wrqu, |
| 4499 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4500 | { |
| 4501 | #if 0 |
| 4502 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 4503 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
| 4504 | |
| 4505 | ENTER(); |
| 4506 | |
| 4507 | //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 4508 | switch (mlme->cmd) { |
| 4509 | case IW_MLME_DISASSOC: |
| 4510 | case IW_MLME_DEAUTH: |
| 4511 | hddLog(LOG1, "Station disassociate"); |
| 4512 | if( pAdapter->conn_info.connState == eConnectionState_Associated ) |
| 4513 | { |
| 4514 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 4515 | |
| 4516 | if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE ) |
| 4517 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 4518 | |
| 4519 | status = sme_RoamDisconnect( pAdapter->hHal,pAdapter->sessionId, reason); |
| 4520 | |
| 4521 | //clear all the reason codes |
| 4522 | if (status != 0) |
| 4523 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4524 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d", __func__, (int)mlme->cmd, (int)status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4525 | } |
| 4526 | |
| 4527 | netif_stop_queue(dev); |
| 4528 | netif_carrier_off(dev); |
| 4529 | } |
| 4530 | else |
| 4531 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4532 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state", __func__, (int)mlme->cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4533 | } |
| 4534 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4535 | hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate", __func__, (int)mlme->cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4536 | return -EINVAL; |
| 4537 | }//end of switch |
| 4538 | EXIT(); |
| 4539 | #endif |
| 4540 | return 0; |
| 4541 | // return status; |
| 4542 | } |
| 4543 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4544 | static int iw_set_ap_mlme(struct net_device *dev, |
| 4545 | struct iw_request_info *info, |
| 4546 | union iwreq_data *wrqu, |
| 4547 | char *extra) |
| 4548 | { |
| 4549 | int ret; |
| 4550 | |
| 4551 | vos_ssr_protect(__func__); |
| 4552 | ret = __iw_set_ap_mlme(dev, info, wrqu, extra); |
| 4553 | vos_ssr_unprotect(__func__); |
| 4554 | |
| 4555 | return ret; |
| 4556 | } |
| 4557 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4558 | static int __iw_get_ap_rts_threshold(struct net_device *dev, |
| 4559 | struct iw_request_info *info, |
| 4560 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4561 | { |
| 4562 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 4563 | v_U32_t status = 0; |
| 4564 | |
| 4565 | status = hdd_wlan_get_rts_threshold(pHostapdAdapter, wrqu); |
| 4566 | |
| 4567 | return status; |
| 4568 | } |
| 4569 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4570 | static int iw_get_ap_rts_threshold(struct net_device *dev, |
| 4571 | struct iw_request_info *info, |
| 4572 | union iwreq_data *wrqu, char *extra) |
| 4573 | { |
| 4574 | int ret; |
| 4575 | |
| 4576 | vos_ssr_protect(__func__); |
| 4577 | ret = __iw_get_ap_rts_threshold(dev, info, wrqu, extra); |
| 4578 | vos_ssr_unprotect(__func__); |
| 4579 | |
| 4580 | return ret; |
| 4581 | } |
| 4582 | |
| 4583 | static int __iw_get_ap_frag_threshold(struct net_device *dev, |
| 4584 | struct iw_request_info *info, |
| 4585 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | { |
| 4587 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 4588 | v_U32_t status = 0; |
| 4589 | |
| 4590 | status = hdd_wlan_get_frag_threshold(pHostapdAdapter, wrqu); |
| 4591 | |
| 4592 | return status; |
| 4593 | } |
| 4594 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4595 | static int iw_get_ap_frag_threshold(struct net_device *dev, |
| 4596 | struct iw_request_info *info, |
| 4597 | union iwreq_data *wrqu, char *extra) |
| 4598 | { |
| 4599 | int ret; |
| 4600 | |
| 4601 | vos_ssr_protect(__func__); |
| 4602 | ret = __iw_get_ap_frag_threshold(dev, info, wrqu, extra); |
| 4603 | vos_ssr_unprotect(__func__); |
| 4604 | |
| 4605 | return ret; |
| 4606 | } |
| 4607 | |
| 4608 | static int __iw_get_ap_freq(struct net_device *dev, |
| 4609 | struct iw_request_info *info, |
| 4610 | struct iw_freq *fwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4611 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4612 | v_U32_t status = FALSE, channel = 0, freq = 0; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4613 | hdd_adapter_t *pHostapdAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | tHalHandle hHal; |
| 4615 | hdd_hostapd_state_t *pHostapdState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4616 | hdd_ap_ctx_t *pHddApCtx; |
| 4617 | hdd_context_t *pHddCtx; |
| 4618 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4619 | |
| 4620 | ENTER(); |
| 4621 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4622 | pHostapdAdapter = (netdev_priv(dev)); |
| 4623 | if (NULL == pHostapdAdapter) |
| 4624 | { |
| 4625 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4626 | "%s: Adapter is NULL",__func__); |
| 4627 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4628 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4629 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4630 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4631 | if (0 != ret) |
| 4632 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4633 | return ret; |
| 4634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4635 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4636 | if (NULL == pHostapdState) |
| 4637 | { |
| 4638 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4639 | "%s: pHostapdState is NULL",__func__); |
| 4640 | return -EINVAL; |
| 4641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4642 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4643 | if (NULL == hHal) |
| 4644 | { |
| 4645 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4646 | "%s: Hal Context is NULL",__func__); |
| 4647 | return -EINVAL; |
| 4648 | } |
| 4649 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 4650 | if (NULL == pHddApCtx) |
| 4651 | { |
| 4652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4653 | "%s: AP context is NULL",__func__); |
| 4654 | return -EINVAL; |
| 4655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4656 | if(pHostapdState->bssState == BSS_STOP ) |
| 4657 | { |
| 4658 | if (ccmCfgGetInt(hHal, WNI_CFG_CURRENT_CHANNEL, &channel) |
| 4659 | != eHAL_STATUS_SUCCESS) |
| 4660 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 4661 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4662 | FL("failed to get WNI_CFG_CURRENT_CHANNEL from cfg")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | return -EIO; |
| 4664 | } |
| 4665 | else |
| 4666 | { |
| 4667 | status = hdd_wlan_get_freq(channel, &freq); |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 4668 | if( 0 == status) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4669 | { |
| 4670 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 4671 | * iwlist & iwconfig command shows frequency into proper |
| 4672 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 4673 | fwrq->m = freq; |
| 4674 | fwrq->e = MHZ; |
| 4675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4676 | } |
| 4677 | } |
| 4678 | else |
| 4679 | { |
| 4680 | channel = pHddApCtx->operatingChannel; |
| 4681 | status = hdd_wlan_get_freq(channel, &freq); |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 4682 | if( 0 == status) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4683 | { |
| 4684 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 4685 | * iwlist & iwconfig command shows frequency into proper |
| 4686 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 4687 | fwrq->m = freq; |
| 4688 | fwrq->e = MHZ; |
| 4689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4690 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4691 | |
| 4692 | EXIT(); |
| 4693 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4694 | } |
| 4695 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4696 | static int iw_get_ap_freq(struct net_device *dev, |
| 4697 | struct iw_request_info *info, |
| 4698 | struct iw_freq *fwrq, char *extra) |
| 4699 | { |
| 4700 | int ret; |
| 4701 | |
| 4702 | vos_ssr_protect(__func__); |
| 4703 | ret = __iw_get_ap_freq(dev, info, fwrq, extra); |
| 4704 | vos_ssr_unprotect(__func__); |
| 4705 | |
| 4706 | return ret; |
| 4707 | } |
| 4708 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4709 | static int __iw_softap_stopbss(struct net_device *dev, |
| 4710 | struct iw_request_info *info, |
| 4711 | union iwreq_data *wrqu, |
| 4712 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4713 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4714 | hdd_adapter_t *pHostapdAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4715 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 4716 | hdd_context_t *pHddCtx = NULL; |
| 4717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4718 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4719 | pHostapdAdapter = (netdev_priv(dev)); |
| 4720 | if (NULL == pHostapdAdapter) |
| 4721 | { |
| 4722 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4723 | "%s: Adapter is NULL",__func__); |
| 4724 | return -EINVAL; |
| 4725 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 4726 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4727 | status = wlan_hdd_validate_context(pHddCtx); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 4728 | if (0 != status) { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 4729 | return status; |
| 4730 | } |
| 4731 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4732 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4733 | { |
Hanumanth Reddy Pothula | 74ba68c | 2018-06-22 17:52:09 +0530 | [diff] [blame] | 4734 | hdd_hostapd_state_t *pHostapdState = |
| 4735 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 4736 | |
| 4737 | vos_event_reset(&pHostapdState->vosEvent); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4738 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) ) |
| 4739 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4740 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4742 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4743 | { |
| 4744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4745 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4746 | VOS_ASSERT(0); |
| 4747 | } |
| 4748 | } |
| 4749 | clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 4750 | wlan_hdd_decr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | } |
| 4752 | EXIT(); |
| 4753 | return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 4754 | } |
| 4755 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4756 | static int iw_softap_stopbss(struct net_device *dev, |
| 4757 | struct iw_request_info *info, |
| 4758 | union iwreq_data *wrqu, |
| 4759 | char *extra) |
| 4760 | { |
| 4761 | int ret; |
| 4762 | |
| 4763 | vos_ssr_protect(__func__); |
| 4764 | ret = __iw_softap_stopbss(dev, info, wrqu, extra); |
| 4765 | vos_ssr_unprotect(__func__); |
| 4766 | |
| 4767 | return ret; |
| 4768 | } |
| 4769 | |
| 4770 | static int __iw_softap_version(struct net_device *dev, |
| 4771 | struct iw_request_info *info, |
| 4772 | union iwreq_data *wrqu, |
| 4773 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4774 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4775 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4776 | hdd_context_t *pHddCtx; |
| 4777 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4779 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4780 | pHostapdAdapter = (netdev_priv(dev)); |
| 4781 | if (NULL == pHostapdAdapter) |
| 4782 | { |
| 4783 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4784 | "%s: Adapter is NULL",__func__); |
| 4785 | return -EINVAL; |
| 4786 | } |
| 4787 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4788 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4789 | if (0 != ret) |
| 4790 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4791 | return ret; |
| 4792 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 4793 | hdd_wlan_get_version(pHostapdAdapter, wrqu, extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4794 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4795 | return 0; |
| 4796 | } |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4797 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 4798 | static int iw_softap_version(struct net_device *dev, |
| 4799 | struct iw_request_info *info, |
| 4800 | union iwreq_data *wrqu, |
| 4801 | char *extra) |
| 4802 | { |
| 4803 | int ret; |
| 4804 | |
| 4805 | vos_ssr_protect(__func__); |
| 4806 | ret = __iw_softap_version(dev, info, wrqu, extra); |
| 4807 | vos_ssr_unprotect(__func__); |
| 4808 | |
| 4809 | return ret; |
| 4810 | } |
| 4811 | |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4812 | int hdd_softap_get_sta_info(hdd_adapter_t *pAdapter, v_U8_t *pBuf, int buf_len) |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4813 | { |
| 4814 | v_U8_t i; |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 4815 | int len = 0; |
| 4816 | const char sta_info_header[] = "staId staAddress\n"; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4817 | v_CONTEXT_t pVosContext; |
| 4818 | hdd_context_t *pHddCtx; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 4819 | ptSapContext pSapCtx = NULL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4820 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4821 | ENTER(); |
| 4822 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4823 | if (NULL == pAdapter) |
| 4824 | { |
| 4825 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4826 | "%s: Adapter is NULL",__func__); |
| 4827 | return -EINVAL; |
| 4828 | } |
| 4829 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4830 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 4831 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4832 | return VOS_STATUS_E_FAULT; |
| 4833 | } |
| 4834 | pVosContext = pHddCtx->pvosContext; |
| 4835 | if (NULL == pVosContext) |
| 4836 | { |
| 4837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4838 | "%s: VOS context is not valid",__func__); |
| 4839 | return VOS_STATUS_E_FAULT; |
| 4840 | } |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 4841 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4842 | if(pSapCtx == NULL) |
| 4843 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 4844 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 4845 | FL("psapCtx is NULL")); |
| 4846 | return VOS_STATUS_E_FAULT; |
| 4847 | } |
| 4848 | |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4849 | len = snprintf(pBuf, buf_len, sta_info_header); |
| 4850 | if (len >= buf_len) { |
| 4851 | hddLog(LOGE, FL("Insufficient buffer:%d, %d"), buf_len, len); |
| 4852 | return -E2BIG; |
| 4853 | } |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 4854 | pBuf += len; |
| 4855 | buf_len -= len; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4856 | |
| 4857 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 4858 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 4859 | if(pSapCtx->aStaInfo[i].isUsed) |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4860 | { |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 4861 | len = scnprintf(pBuf, buf_len, "%5d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 4862 | pSapCtx->aStaInfo[i].ucSTAId, |
| 4863 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[0], |
| 4864 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[1], |
| 4865 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[2], |
| 4866 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[3], |
| 4867 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[4], |
| 4868 | pSapCtx->aStaInfo[i].macAddrSTA.bytes[5]); |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4869 | if (len >= buf_len) { |
| 4870 | hddLog(LOGE, FL("Insufficient buffer:%d, %d"), buf_len, len); |
| 4871 | return -E2BIG; |
| 4872 | } |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 4873 | pBuf += len; |
| 4874 | buf_len -= len; |
| 4875 | } |
| 4876 | if(WE_GET_STA_INFO_SIZE > buf_len) |
| 4877 | { |
| 4878 | break; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4879 | } |
| 4880 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4881 | EXIT(); |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4882 | return 0; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4883 | } |
| 4884 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4885 | static int __iw_softap_get_sta_info(struct net_device *dev, |
| 4886 | struct iw_request_info *info, |
| 4887 | union iwreq_data *wrqu, |
| 4888 | char *extra) |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4889 | { |
| 4890 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4891 | int ret; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4892 | ENTER(); |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4893 | ret = hdd_softap_get_sta_info(pHostapdAdapter, extra, WE_SAP_MAX_STA_INFO); |
| 4894 | if (ret) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4895 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!",__func__); |
Chandrasekaran, Manishekar | ac8122b | 2016-04-22 16:42:41 +0530 | [diff] [blame] | 4896 | return ret; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 4897 | } |
| 4898 | wrqu->data.length = strlen(extra); |
| 4899 | EXIT(); |
| 4900 | return 0; |
| 4901 | } |
| 4902 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4903 | static int iw_softap_get_sta_info(struct net_device *dev, |
| 4904 | struct iw_request_info *info, |
| 4905 | union iwreq_data *wrqu, |
| 4906 | char *extra) |
| 4907 | { |
| 4908 | int ret; |
| 4909 | |
| 4910 | vos_ssr_protect(__func__); |
| 4911 | ret = __iw_softap_get_sta_info(dev, info, wrqu, extra); |
| 4912 | vos_ssr_unprotect(__func__); |
| 4913 | |
| 4914 | return ret; |
| 4915 | } |
| 4916 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4917 | static int __iw_set_ap_genie(struct net_device *dev, |
| 4918 | struct iw_request_info *info, |
| 4919 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4920 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4921 | |
| 4922 | hdd_adapter_t *pHostapdAdapter; |
| 4923 | hdd_context_t *pHddCtx; |
| 4924 | v_CONTEXT_t pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4925 | eHalStatus halStatus= eHAL_STATUS_SUCCESS; |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4926 | u_int8_t *genie = (u_int8_t *)extra; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4927 | int ret = 0; |
| 4928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4929 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4930 | pHostapdAdapter = (netdev_priv(dev)); |
| 4931 | if (NULL == pHostapdAdapter) |
| 4932 | { |
| 4933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4934 | "%s: Adapter is NULL",__func__); |
| 4935 | return -EINVAL; |
| 4936 | } |
| 4937 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 4938 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4939 | if (0 != ret) |
| 4940 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4941 | return ret; |
| 4942 | } |
| 4943 | pVosContext = pHddCtx->pvosContext; |
| 4944 | if (NULL == pVosContext) |
| 4945 | { |
| 4946 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4947 | "%s: VOS Context is NULL",__func__); |
| 4948 | return -EINVAL; |
| 4949 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4950 | if(!wrqu->data.length) |
| 4951 | { |
| 4952 | EXIT(); |
| 4953 | return 0; |
| 4954 | } |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4955 | |
Nishank Aggarwal | bd8e0f6 | 2017-02-10 15:48:13 +0530 | [diff] [blame] | 4956 | if (wrqu->data.length > DOT11F_IE_RSN_MAX_LEN) |
| 4957 | { |
| 4958 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4959 | "%s: WPARSN Ie input length is more than max[%d]", __func__, |
| 4960 | wrqu->data.length); |
| 4961 | return -EINVAL; |
| 4962 | } |
| 4963 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4964 | switch (genie[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4965 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4966 | case DOT11F_EID_WPA: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4967 | case DOT11F_EID_RSN: |
| 4968 | if((WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy == 0) |
| 4969 | { |
| 4970 | hdd_softap_Deregister_BC_STA(pHostapdAdapter); |
| 4971 | hdd_softap_Register_BC_STA(pHostapdAdapter, 1); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4972 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4973 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = 1; |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 4974 | halStatus = WLANSAP_Set_WPARSNIes(pVosContext, genie, wrqu->data.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4975 | break; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4977 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4978 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, genie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4979 | halStatus = 0; |
| 4980 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | EXIT(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4983 | return halStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4984 | } |
| 4985 | |
Mahesh A Saptasagar | f176a86 | 2014-08-20 21:25:21 +0530 | [diff] [blame] | 4986 | static int iw_set_ap_genie(struct net_device *dev, |
| 4987 | struct iw_request_info *info, |
| 4988 | union iwreq_data *wrqu, char *extra) |
| 4989 | { |
| 4990 | int ret; |
| 4991 | |
| 4992 | vos_ssr_protect(__func__); |
| 4993 | ret = __iw_set_ap_genie(dev, info, wrqu, extra); |
| 4994 | vos_ssr_unprotect(__func__); |
| 4995 | |
| 4996 | return ret; |
| 4997 | } |
| 4998 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4999 | static VOS_STATUS wlan_hdd_get_classAstats_for_station(hdd_adapter_t *pAdapter, u8 staid) |
| 5000 | { |
| 5001 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5002 | int ret; |
| 5003 | void *cookie; |
| 5004 | struct hdd_request *request; |
| 5005 | struct stats_class_a_ctx *priv; |
| 5006 | static const struct hdd_request_params params = { |
| 5007 | .priv_size = sizeof(*priv), |
| 5008 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 5009 | }; |
| 5010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5011 | |
| 5012 | if (NULL == pAdapter) |
| 5013 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5014 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: pAdapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5015 | return VOS_STATUS_E_FAULT; |
| 5016 | } |
| 5017 | |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5018 | request = hdd_request_alloc(¶ms); |
| 5019 | if (!request) { |
| 5020 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 5021 | return VOS_STATUS_E_NOMEM; |
| 5022 | } |
| 5023 | cookie = hdd_request_cookie(request); |
| 5024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5025 | hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5026 | eCSR_HDD, |
| 5027 | SME_GLOBAL_CLASSA_STATS, |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5028 | hdd_get_class_a_statistics_cb, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5029 | 0, // not periodic |
| 5030 | FALSE, //non-cached results |
| 5031 | staid, |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5032 | cookie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 5034 | { |
| 5035 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5036 | "%s: Unable to retrieve statistics for link speed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5037 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5038 | } |
| 5039 | else |
| 5040 | { |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5041 | ret = hdd_request_wait_for_response(request); |
| 5042 | if (ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5043 | { |
| 5044 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5045 | FL("SME timeout while retrieving link speed")); |
| 5046 | } |
| 5047 | else |
| 5048 | { |
| 5049 | priv = hdd_request_priv(request); |
| 5050 | pAdapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5051 | } |
| 5052 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5053 | |
Hanumanth Reddy Pothula | c76f065 | 2018-04-06 17:31:52 +0530 | [diff] [blame] | 5054 | /* |
| 5055 | * either we never sent a request, we sent a request and received a |
| 5056 | * response or we sent a request and timed out. Regardless we are |
| 5057 | * done with the request. |
| 5058 | */ |
| 5059 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5061 | return VOS_STATUS_SUCCESS; |
| 5062 | } |
| 5063 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 5064 | int __iw_get_softap_linkspeed(struct net_device *dev, |
| 5065 | struct iw_request_info *info, |
| 5066 | union iwreq_data *wrqu, |
| 5067 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5068 | |
| 5069 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5070 | hdd_adapter_t *pHostapdAdapter; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5071 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5072 | char *pLinkSpeed = (char*)extra; |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 5073 | char *pmacAddress; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5074 | v_U32_t link_speed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5075 | unsigned short staId; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5076 | int len = sizeof(v_U32_t)+1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5077 | v_BYTE_t macAddress[VOS_MAC_ADDR_SIZE]; |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5078 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5079 | int rc, valid; |
| 5080 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5081 | ENTER(); |
| 5082 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5083 | pHostapdAdapter = (netdev_priv(dev)); |
| 5084 | if (NULL == pHostapdAdapter) |
| 5085 | { |
| 5086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5087 | "%s: Adapter is NULL",__func__); |
| 5088 | return -EINVAL; |
| 5089 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5090 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5091 | valid = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5092 | if (0 != valid) |
| 5093 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5094 | return valid; |
| 5095 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5097 | hddLog(VOS_TRACE_LEVEL_INFO, "%s wrqu->data.length= %d", __func__, wrqu->data.length); |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5098 | |
| 5099 | if (wrqu->data.length >= MAC_ADDRESS_STR_LEN - 1) |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 5100 | { |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5101 | pmacAddress = kmalloc(MAC_ADDRESS_STR_LEN, GFP_KERNEL); |
| 5102 | if (NULL == pmacAddress) { |
| 5103 | hddLog(LOG1, "unable to allocate memory"); |
| 5104 | return -ENOMEM; |
| 5105 | } |
| 5106 | if (copy_from_user((void *)pmacAddress, |
| 5107 | wrqu->data.pointer, MAC_ADDRESS_STR_LEN)) |
| 5108 | { |
| 5109 | hddLog(LOG1, "%s: failed to copy data to user buffer", __func__); |
| 5110 | kfree(pmacAddress); |
| 5111 | return -EFAULT; |
| 5112 | } |
Manjeet Singh | a373974 | 2016-05-03 16:21:46 +0530 | [diff] [blame] | 5113 | pmacAddress[MAC_ADDRESS_STR_LEN-1] = '\0'; |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5114 | |
| 5115 | status = hdd_string_to_hex (pmacAddress, MAC_ADDRESS_STR_LEN, macAddress ); |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 5116 | kfree(pmacAddress); |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5117 | |
| 5118 | if (!VOS_IS_STATUS_SUCCESS(status )) |
| 5119 | { |
| 5120 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("String to Hex conversion Failed")); |
| 5121 | } |
Arif Hussain | ed66764 | 2013-10-27 23:01:14 -0700 | [diff] [blame] | 5122 | } |
Kiet Lam | 6158985 | 2013-09-19 17:10:58 +0530 | [diff] [blame] | 5123 | /* If no mac address is passed and/or its length is less than 17, |
Madan Mohan Koyyalamudi | e68989b | 2013-09-10 01:15:19 +0530 | [diff] [blame] | 5124 | * link speed for first connected client will be returned. |
| 5125 | */ |
Arif Hussain | a957184 | 2014-01-15 16:43:41 -0800 | [diff] [blame] | 5126 | if (wrqu->data.length < 17 || !VOS_IS_STATUS_SUCCESS(status )) |
Madan Mohan Koyyalamudi | e68989b | 2013-09-10 01:15:19 +0530 | [diff] [blame] | 5127 | { |
| 5128 | status = hdd_softap_GetConnectedStaId(pHostapdAdapter, (void *)(&staId)); |
| 5129 | } |
| 5130 | else |
| 5131 | { |
| 5132 | status = hdd_softap_GetStaId(pHostapdAdapter, |
| 5133 | (v_MACADDR_t *)macAddress, (void *)(&staId)); |
| 5134 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5135 | |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5136 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5137 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5138 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("ERROR: HDD Failed to find sta id!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5139 | link_speed = 0; |
| 5140 | } |
| 5141 | else |
| 5142 | { |
| 5143 | status = wlan_hdd_get_classAstats_for_station(pHostapdAdapter , staId); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5144 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5145 | if (!VOS_IS_STATUS_SUCCESS(status )) |
| 5146 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to retrieve SME statistics")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5148 | return -EINVAL; |
| 5149 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5150 | |
| 5151 | WLANTL_GetSTALinkCapacity(pHddCtx->pvosContext, |
| 5152 | staId, &link_speed); |
| 5153 | |
| 5154 | link_speed = link_speed / 10; |
| 5155 | |
| 5156 | if (0 == link_speed) |
| 5157 | { |
| 5158 | /* The linkspeed returned by HAL is in units of 500kbps. |
| 5159 | * converting it to mbps. |
| 5160 | * This is required to support legacy firmware which does |
| 5161 | * not return link capacity. |
| 5162 | */ |
| 5163 | link_speed =(int)pHostapdAdapter->hdd_stats.ClassA_stat.tx_rate/2; |
| 5164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5165 | } |
| 5166 | |
| 5167 | wrqu->data.length = len; |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 5168 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5170 | if ((rc < 0) || (rc >= len)) |
| 5171 | { |
| 5172 | // encoding or length error? |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5173 | hddLog(VOS_TRACE_LEVEL_ERROR,FL( "Unable to encode link speed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5174 | return -EIO; |
| 5175 | } |
| 5176 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5177 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5178 | return 0; |
| 5179 | } |
| 5180 | |
Mahesh A Saptasagar | 69e944e | 2014-08-13 20:01:27 +0530 | [diff] [blame] | 5181 | int iw_get_softap_linkspeed(struct net_device *dev, |
| 5182 | struct iw_request_info *info, |
| 5183 | union iwreq_data *wrqu, |
| 5184 | char *extra) |
| 5185 | { |
| 5186 | int ret; |
| 5187 | |
| 5188 | vos_ssr_protect(__func__); |
| 5189 | ret = __iw_get_softap_linkspeed(dev, info, wrqu, extra); |
| 5190 | vos_ssr_unprotect(__func__); |
| 5191 | |
| 5192 | return ret; |
| 5193 | } |
| 5194 | |
| 5195 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5196 | static const iw_handler hostapd_handler[] = |
| 5197 | { |
| 5198 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
| 5199 | (iw_handler) NULL, /* SIOCGIWNAME */ |
| 5200 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 5201 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 5202 | (iw_handler) NULL, /* SIOCSIWFREQ */ |
| 5203 | (iw_handler) iw_get_ap_freq, /* SIOCGIWFREQ */ |
| 5204 | (iw_handler) NULL, /* SIOCSIWMODE */ |
Ashish Kumar Dhanotiya | 6b484a8 | 2018-04-24 15:11:55 +0530 | [diff] [blame] | 5205 | (iw_handler) NULL, /* SIOCGIWMODE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 5207 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 5208 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 5209 | (iw_handler) NULL, /* SIOCGIWRANGE */ |
| 5210 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 5211 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 5212 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 5213 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 5214 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 5215 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 5216 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 5217 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 5218 | (iw_handler) NULL, /* SIOCSIWAP */ |
| 5219 | (iw_handler) NULL, /* SIOCGIWAP */ |
| 5220 | (iw_handler) iw_set_ap_mlme, /* SIOCSIWMLME */ |
| 5221 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 5222 | (iw_handler) NULL, /* SIOCSIWSCAN */ |
| 5223 | (iw_handler) NULL, /* SIOCGIWSCAN */ |
| 5224 | (iw_handler) NULL, /* SIOCSIWESSID */ |
| 5225 | (iw_handler) NULL, /* SIOCGIWESSID */ |
| 5226 | (iw_handler) NULL, /* SIOCSIWNICKN */ |
| 5227 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
| 5228 | (iw_handler) NULL, /* -- hole -- */ |
| 5229 | (iw_handler) NULL, /* -- hole -- */ |
| 5230 | (iw_handler) NULL, /* SIOCSIWRATE */ |
| 5231 | (iw_handler) NULL, /* SIOCGIWRATE */ |
| 5232 | (iw_handler) NULL, /* SIOCSIWRTS */ |
| 5233 | (iw_handler) iw_get_ap_rts_threshold, /* SIOCGIWRTS */ |
| 5234 | (iw_handler) NULL, /* SIOCSIWFRAG */ |
| 5235 | (iw_handler) iw_get_ap_frag_threshold, /* SIOCGIWFRAG */ |
| 5236 | (iw_handler) NULL, /* SIOCSIWTXPOW */ |
| 5237 | (iw_handler) NULL, /* SIOCGIWTXPOW */ |
| 5238 | (iw_handler) NULL, /* SIOCSIWRETRY */ |
| 5239 | (iw_handler) NULL, /* SIOCGIWRETRY */ |
| 5240 | (iw_handler) NULL, /* SIOCSIWENCODE */ |
| 5241 | (iw_handler) NULL, /* SIOCGIWENCODE */ |
| 5242 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
| 5243 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
| 5244 | (iw_handler) NULL, /* -- hole -- */ |
| 5245 | (iw_handler) NULL, /* -- hole -- */ |
| 5246 | (iw_handler) iw_set_ap_genie, /* SIOCSIWGENIE */ |
| 5247 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
| 5248 | (iw_handler) iw_set_auth_hostap, /* SIOCSIWAUTH */ |
| 5249 | (iw_handler) NULL, /* SIOCGIWAUTH */ |
| 5250 | (iw_handler) iw_set_ap_encodeext, /* SIOCSIWENCODEEXT */ |
| 5251 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
| 5252 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 5253 | }; |
| 5254 | |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 5255 | /* |
| 5256 | * Note that the following ioctls were defined with semantics which |
| 5257 | * cannot be handled by the "iwpriv" userspace application and hence |
| 5258 | * they are not included in the hostapd_private_args array |
| 5259 | * QCSAP_IOCTL_ASSOC_STA_MACADDR |
| 5260 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5261 | |
| 5262 | static const struct iw_priv_args hostapd_private_args[] = { |
| 5263 | { QCSAP_IOCTL_SETPARAM, |
| 5264 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" }, |
| 5265 | { QCSAP_IOCTL_SETPARAM, |
| 5266 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" }, |
Mahesh A Saptasagar | 786266f | 2015-10-08 19:09:21 +0530 | [diff] [blame] | 5267 | { QCSAP_PARAM_GET_FRAME_LOGS, |
| 5268 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "getFrameLogs" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5269 | { QCSAP_PARAM_MAX_ASSOC, |
| 5270 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMaxAssoc" }, |
| 5271 | { QCSAP_PARAM_HIDE_SSID, |
| 5272 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "hideSSID" }, |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 5273 | { QCSAP_PARAM_SET_MC_RATE, |
| 5274 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMcRate" }, |
Hanumantha Reddy Pothula | 0490027 | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5275 | { QCSAP_PARAM_SET_PROXIMITY, |
| 5276 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setProximity" }, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 5277 | { QCSAP_PARAM_CAP_TSF, |
| 5278 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "cap_tsf" }, |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 5279 | {QCSAP_PARAM_SET_CHANNEL_CHANGE, |
| 5280 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setChanChange"}, |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 5281 | { QCSAP_PARAM_SET_WOWL, |
| 5282 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wowl" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | { QCSAP_IOCTL_GETPARAM, |
| 5284 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 5285 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getparam" }, |
| 5286 | { QCSAP_IOCTL_GETPARAM, 0, |
| 5287 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "" }, |
| 5288 | { QCSAP_PARAM_MAX_ASSOC, 0, |
| 5289 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getMaxAssoc" }, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 5290 | { QCSAP_PARAM_GET_WLAN_DBG, 0, |
| 5291 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getwlandbg" }, |
| 5292 | { QCSAP_PARAM_AUTO_CHANNEL, 0, |
| 5293 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getAutoChannel" }, |
Ravi Shankar Upadrasta | bb216bb | 2014-06-13 14:40:24 +0530 | [diff] [blame] | 5294 | { QCSAP_PARAM_SET_AUTO_CHANNEL, |
| 5295 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAutoChannel" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5296 | { QCSAP_PARAM_CLR_ACL, 0, |
| 5297 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "setClearAcl" }, |
| 5298 | { QCSAP_PARAM_ACL_MODE, |
| 5299 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAclMode" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5300 | { QCSAP_IOCTL_GET_STAWPAIE, |
Manjeet Singh | 0fc1271 | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 5301 | 0, IW_PRIV_TYPE_BYTE | DOT11F_IE_RSN_MAX_LEN, "get_staWPAIE" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | { QCSAP_IOCTL_STOPBSS, |
| 5303 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED, 0, "stopbss" }, |
| 5304 | { QCSAP_IOCTL_VERSION, 0, |
| 5305 | IW_PRIV_TYPE_CHAR | QCSAP_MAX_WSC_IE, "version" }, |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 5306 | { QCSAP_IOCTL_GET_STA_INFO, 0, |
| 5307 | IW_PRIV_TYPE_CHAR | WE_SAP_MAX_STA_INFO, "get_sta_info" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5308 | { QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES, |
Arif Hussain | d443e33 | 2013-11-18 23:59:44 -0800 | [diff] [blame] | 5309 | IW_PRIV_TYPE_BYTE | sizeof(sQcSapreq_WPSPBCProbeReqIES_t) | IW_PRIV_SIZE_FIXED, 0, "getProbeReqIEs" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5310 | { QCSAP_IOCTL_GET_CHANNEL, 0, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 5311 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getchannel" }, |
Jeff Johnson | 224f370 | 2014-03-26 11:09:47 -0700 | [diff] [blame] | 5312 | { QCSAP_IOCTL_DISASSOC_STA, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5313 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 6 , 0, "disassoc_sta" }, |
Girish Gowli | f376980 | 2014-06-16 21:17:16 +0530 | [diff] [blame] | 5314 | { QCSAP_IOCTL_AP_STATS, 0, |
| 5315 | IW_PRIV_TYPE_CHAR | QCSAP_MAX_WSC_IE, "ap_stats" }, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 5316 | /* handlers for main ioctl */ |
| 5317 | { QCSAP_IOCTL_PRIV_SET_NONE_GET_THREE_INT, 0, |
| 5318 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, "" }, |
| 5319 | #ifdef WLAN_FEATURE_TSF |
| 5320 | { QCSAP_IOCTL_GET_TSF, 0, |
| 5321 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 5322 | "get_tsf" }, |
| 5323 | #endif |
Bhargav Shah | 7f03b81 | 2015-08-21 11:17:32 +0530 | [diff] [blame] | 5324 | { QCSAP_IOCTL_GET_STATS, 0, |
| 5325 | IW_PRIV_TYPE_CHAR | QCSAP_MAX_STR_LEN, "getStats"}, |
| 5326 | { QCSAP_IOCTL_CLR_STATS, 0, 0, "clearStats" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5327 | { QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED, |
| 5328 | IW_PRIV_TYPE_CHAR | 18, |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 5329 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5330 | |
| 5331 | { QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE, |
| 5332 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "" }, |
| 5333 | /* handlers for sub-ioctl */ |
| 5334 | { WE_SET_WLAN_DBG, |
| 5335 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 5336 | 0, |
| 5337 | "setwlandbg" }, |
| 5338 | |
| 5339 | /* handlers for main ioctl */ |
| 5340 | { QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE, |
| 5341 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 5342 | 0, |
| 5343 | "" }, |
| 5344 | |
| 5345 | /* handlers for sub-ioctl */ |
| 5346 | { WE_LOG_DUMP_CMD, |
| 5347 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 5348 | 0, |
| 5349 | "dump" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5350 | { WE_P2P_NOA_CMD, |
| 5351 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 5352 | 0, |
| 5353 | "SetP2pPs" }, |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 5354 | /* handlers for sub ioctl */ |
| 5355 | { |
| 5356 | WE_MCC_CONFIG_CREDENTIAL, |
| 5357 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 5358 | 0, |
| 5359 | "setMccCrdnl" }, |
| 5360 | |
| 5361 | /* handlers for sub ioctl */ |
| 5362 | { |
| 5363 | WE_MCC_CONFIG_PARAMS, |
| 5364 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 5365 | 0, |
| 5366 | "setMccConfig" }, |
| 5367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | /* handlers for main ioctl */ |
| 5369 | { QCSAP_IOCTL_MODIFY_ACL, |
| 5370 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 8, |
| 5371 | 0, |
| 5372 | "modify_acl" }, |
| 5373 | |
| 5374 | /* handlers for main ioctl */ |
| 5375 | { QCSAP_IOCTL_GET_CHANNEL_LIST, |
| 5376 | 0, |
| 5377 | IW_PRIV_TYPE_BYTE | sizeof(tChannelListInfo), |
| 5378 | "getChannelList" }, |
| 5379 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5380 | /* handlers for main ioctl */ |
| 5381 | { QCSAP_IOCTL_SET_TX_POWER, |
| 5382 | IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1, |
| 5383 | 0, |
Madan Mohan Koyyalamudi | d12bf05 | 2012-11-27 19:07:55 +0530 | [diff] [blame] | 5384 | "setTxPower" }, |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 5385 | |
| 5386 | /* handlers for main ioctl */ |
| 5387 | { QCSAP_IOCTL_SET_MAX_TX_POWER, |
| 5388 | IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1, |
| 5389 | 0, |
| 5390 | "setTxMaxPower" }, |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 5391 | |
| 5392 | { QCSAP_IOCTL_DATAPATH_SNAP_SHOT, |
| 5393 | IW_PRIV_TYPE_NONE | IW_PRIV_TYPE_NONE, |
| 5394 | 0, |
| 5395 | "dataSnapshot" }, |
| 5396 | |
| 5397 | /* handlers for main ioctl */ |
| 5398 | { QCSAP_IOCTL_SET_TRAFFIC_MONITOR, |
| 5399 | IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1, |
| 5400 | 0, |
| 5401 | "setTrafficMon" }, |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 5402 | /* handlers for main ioctl */ |
| 5403 | { QCSAP_IOCTL_SET_CHAR_GET_NONE, |
| 5404 | IW_PRIV_TYPE_CHAR| 512, |
| 5405 | 0, |
| 5406 | "" }, |
| 5407 | |
| 5408 | /* handlers for sub-ioctl */ |
| 5409 | { WE_WOWL_ADD_PTRN, |
| 5410 | IW_PRIV_TYPE_CHAR| 512, |
| 5411 | 0, |
| 5412 | "wowlAddPtrn" }, |
| 5413 | |
| 5414 | { WE_WOWL_DEL_PTRN, |
| 5415 | IW_PRIV_TYPE_CHAR| 512, |
| 5416 | 0, |
| 5417 | "wowlDelPtrn" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5418 | }; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | static const iw_handler hostapd_private[] = { |
| 5421 | [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam, //set priv ioctl |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 5422 | [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam, //get priv ioctl |
| 5423 | [QCSAP_IOCTL_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = |
| 5424 | iw_softap_setchar_getnone, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, //get station genIE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss, // stop bss |
| 5427 | [QCSAP_IOCTL_VERSION - SIOCIWFIRSTPRIV] = iw_softap_version, // get driver version |
| 5428 | [QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES - SIOCIWFIRSTPRIV] = iw_get_WPSPBCProbeReqIEs, |
| 5429 | [QCSAP_IOCTL_GET_CHANNEL - SIOCIWFIRSTPRIV] = iw_softap_getchannel, |
| 5430 | [QCSAP_IOCTL_ASSOC_STA_MACADDR - SIOCIWFIRSTPRIV] = iw_softap_getassoc_stamacaddr, |
| 5431 | [QCSAP_IOCTL_DISASSOC_STA - SIOCIWFIRSTPRIV] = iw_softap_disassoc_sta, |
| 5432 | [QCSAP_IOCTL_AP_STATS - SIOCIWFIRSTPRIV] = iw_softap_ap_stats, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 5433 | [QCSAP_IOCTL_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = iw_softap_get_three, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5434 | [QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5435 | [QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_var_ints_getnone, |
| 5436 | [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range, |
| 5437 | [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV] = iw_softap_modify_acl, |
| 5438 | [QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV] = iw_softap_get_channel_list, |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 5439 | [QCSAP_IOCTL_GET_STA_INFO - SIOCIWFIRSTPRIV] = iw_softap_get_sta_info, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5440 | [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_softap_linkspeed, |
| 5441 | [QCSAP_IOCTL_SET_TX_POWER - SIOCIWFIRSTPRIV] = iw_softap_set_tx_power, |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 5442 | [QCSAP_IOCTL_SET_MAX_TX_POWER - SIOCIWFIRSTPRIV] = iw_softap_set_max_tx_power, |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5443 | [QCSAP_IOCTL_DATAPATH_SNAP_SHOT - SIOCIWFIRSTPRIV] = iw_display_data_path_snapshot, |
Kiet Lam | bcf3852 | 2013-10-26 18:28:27 +0530 | [diff] [blame] | 5444 | [QCSAP_IOCTL_SET_TRAFFIC_MONITOR - SIOCIWFIRSTPRIV] = iw_softap_set_trafficmonitor, |
Bhargav Shah | 7f03b81 | 2015-08-21 11:17:32 +0530 | [diff] [blame] | 5445 | [QCSAP_IOCTL_GET_STATS - SIOCIWFIRSTPRIV] = iw_softap_get_stats, |
| 5446 | [QCSAP_IOCTL_CLR_STATS - SIOCIWFIRSTPRIV] = iw_softap_clear_stats, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5447 | }; |
| 5448 | const struct iw_handler_def hostapd_handler_def = { |
| 5449 | .num_standard = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]), |
| 5450 | .num_private = sizeof(hostapd_private) / sizeof(hostapd_private[0]), |
| 5451 | .num_private_args = sizeof(hostapd_private_args) / sizeof(hostapd_private_args[0]), |
| 5452 | .standard = (iw_handler *)hostapd_handler, |
| 5453 | .private = (iw_handler *)hostapd_private, |
| 5454 | .private_args = hostapd_private_args, |
| 5455 | .get_wireless_stats = NULL, |
| 5456 | }; |
| 5457 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) |
| 5458 | struct net_device_ops net_ops_struct = { |
| 5459 | .ndo_open = hdd_hostapd_open, |
| 5460 | .ndo_stop = hdd_hostapd_stop, |
| 5461 | .ndo_uninit = hdd_hostapd_uninit, |
| 5462 | .ndo_start_xmit = hdd_softap_hard_start_xmit, |
| 5463 | .ndo_tx_timeout = hdd_softap_tx_timeout, |
| 5464 | .ndo_get_stats = hdd_softap_stats, |
| 5465 | .ndo_set_mac_address = hdd_hostapd_set_mac_address, |
| 5466 | .ndo_do_ioctl = hdd_hostapd_ioctl, |
| 5467 | .ndo_change_mtu = hdd_hostapd_change_mtu, |
| 5468 | .ndo_select_queue = hdd_hostapd_select_queue, |
| 5469 | }; |
| 5470 | #endif |
| 5471 | |
| 5472 | int hdd_set_hostapd(hdd_adapter_t *pAdapter) |
| 5473 | { |
| 5474 | return VOS_STATUS_SUCCESS; |
| 5475 | } |
| 5476 | |
| 5477 | void hdd_set_ap_ops( struct net_device *pWlanHostapdDev ) |
| 5478 | { |
| 5479 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) |
| 5480 | pWlanHostapdDev->netdev_ops = &net_ops_struct; |
| 5481 | #else |
| 5482 | pWlanHostapdDev->open = hdd_hostapd_open; |
| 5483 | pWlanHostapdDev->stop = hdd_hostapd_stop; |
| 5484 | pWlanHostapdDev->uninit = hdd_hostapd_uninit; |
| 5485 | pWlanHostapdDev->hard_start_xmit = hdd_softap_hard_start_xmit; |
| 5486 | pWlanHostapdDev->tx_timeout = hdd_softap_tx_timeout; |
| 5487 | pWlanHostapdDev->get_stats = hdd_softap_stats; |
| 5488 | pWlanHostapdDev->set_mac_address = hdd_hostapd_set_mac_address; |
| 5489 | pWlanHostapdDev->do_ioctl = hdd_hostapd_ioctl; |
| 5490 | #endif |
| 5491 | } |
| 5492 | |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5493 | VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter, bool re_init) |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5494 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | hdd_hostapd_state_t * phostapdBuf; |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 5496 | #ifdef DHCP_SERVER_OFFLOAD |
| 5497 | hdd_dhcp_state_t *dhcp_status; |
| 5498 | #endif /* DHCP_SERVER_OFFLOAD */ |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 5499 | #ifdef MDNS_OFFLOAD |
| 5500 | hdd_mdns_state_t *mdns_status; |
| 5501 | #endif /* MDNS_OFFLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | struct net_device *dev = pAdapter->dev; |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 5503 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | VOS_STATUS status; |
Hanumanth Reddy Pothula | b37ce86 | 2017-02-03 21:42:08 +0530 | [diff] [blame] | 5505 | hdd_config_t *ini_cfg; |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 5506 | #ifdef FEATURE_WLAN_CH_AVOID |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 5507 | v_U16_t unsafeChannelList[NUM_20MHZ_RF_CHANNELS]; |
| 5508 | v_U16_t unsafeChannelCount; |
| 5509 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 5510 | |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5511 | if (pHddCtx->isLogpInProgress && !re_init) { |
Anand N Sunkad | 26d71b9 | 2014-12-24 18:08:22 +0530 | [diff] [blame] | 5512 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5513 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 5514 | status = VOS_STATUS_E_FAILURE; |
| 5515 | } |
| 5516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5517 | ENTER(); |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 5518 | |
| 5519 | #ifdef SAP_AUTH_OFFLOAD |
| 5520 | if (pHddCtx->cfg_ini->enable_sap_auth_offload) |
Agrawal Ashish | 6773c90 | 2017-01-06 19:45:03 +0530 | [diff] [blame] | 5521 | { |
| 5522 | if (!hdd_set_sap_auth_offload(pAdapter, TRUE)) |
| 5523 | { |
| 5524 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5525 | FL("SAP AUTH OFFLOAD is not enabled successfully, Don't start SAP")); |
| 5526 | return VOS_STATUS_E_FAILURE; |
| 5527 | } |
| 5528 | } |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 5529 | #endif |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 5530 | |
Agrawal Ashish | 17ef508 | 2016-10-17 18:33:21 +0530 | [diff] [blame] | 5531 | // Allocate the Wireless Extensions state structure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5532 | phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR( pAdapter ); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 5533 | #ifdef DHCP_SERVER_OFFLOAD |
| 5534 | dhcp_status = &pAdapter->dhcp_status; |
| 5535 | #endif /* DHCP_SERVER_OFFLOAD */ |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 5536 | #ifdef MDNS_OFFLOAD |
| 5537 | mdns_status = &pAdapter->mdns_status; |
| 5538 | #endif /* MDNS_OFFLOAD */ |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5539 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 5540 | spin_lock_init(&pAdapter->sta_hash_lock); |
| 5541 | pAdapter->is_sta_id_hash_initialized = VOS_FALSE; |
| 5542 | |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 5543 | sme_SetCurrDeviceMode(pHddCtx->hHal, pAdapter->device_mode); |
| 5544 | |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 5545 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5546 | /* Get unsafe cahnnel list from cached location */ |
| 5547 | wcnss_get_wlan_unsafe_channel(unsafeChannelList, |
| 5548 | sizeof(unsafeChannelList), |
| 5549 | &unsafeChannelCount); |
| 5550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5551 | "%s : Unsafe Channel count %d", |
| 5552 | __func__, unsafeChannelCount); |
Sushant Kaushik | 389e7f0 | 2014-06-11 19:56:10 +0530 | [diff] [blame] | 5553 | hdd_hostapd_update_unsafe_channel_list(pHddCtx, |
Leo Chang | 0b0e45a | 2013-12-15 15:18:55 -0800 | [diff] [blame] | 5554 | unsafeChannelList, |
| 5555 | unsafeChannelCount); |
| 5556 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 5557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5558 | // Zero the memory. This zeros the profile structure. |
| 5559 | memset(phostapdBuf, 0,sizeof(hdd_hostapd_state_t)); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 5560 | #ifdef DHCP_SERVER_OFFLOAD |
| 5561 | memset(dhcp_status, 0,sizeof(*dhcp_status)); |
| 5562 | #endif /* DHCP_SERVER_OFFLOAD */ |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 5563 | #ifdef MDNS_OFFLOAD |
| 5564 | memset(mdns_status, 0,sizeof(*mdns_status)); |
| 5565 | #endif /* MDNS_OFFLOAD */ |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 5566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5567 | // Set up the pointer to the Wireless Extensions state structure |
| 5568 | // NOP |
| 5569 | status = hdd_set_hostapd(pAdapter); |
| 5570 | if(!VOS_IS_STATUS_SUCCESS(status)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5571 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_hostapd failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5572 | return status; |
| 5573 | } |
| 5574 | |
| 5575 | status = vos_event_init(&phostapdBuf->vosEvent); |
| 5576 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 5577 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5578 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: Hostapd HDD vos event init failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5579 | return status; |
| 5580 | } |
Abhishek Singh | 1a9dbcf | 2019-09-06 12:50:03 +0530 | [diff] [blame] | 5581 | status = vos_event_init(&phostapdBuf->sta_discon_event); |
| 5582 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 5583 | { |
| 5584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "ERROR: Hostapd HDD sta disassoc event init failed!!"); |
| 5585 | return status; |
| 5586 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 5587 | #ifdef DHCP_SERVER_OFFLOAD |
| 5588 | status = vos_event_init(&dhcp_status->vos_event); |
| 5589 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 5590 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: Hostapd HDD vos event init failed!!")); |
| 5591 | return status; |
| 5592 | } |
| 5593 | #endif /* DHCP_SERVER_OFFLOAD */ |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 5594 | #ifdef MDNS_OFFLOAD |
| 5595 | status = vos_event_init(&mdns_status->vos_event); |
| 5596 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 5597 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5598 | ("Hostapd HDD vos event init failed!!")); |
| 5599 | return status; |
| 5600 | } |
| 5601 | #endif /* MDNS_OFFLOAD */ |
| 5602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5603 | sema_init(&(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->semWpsPBCOverlapInd, 1); |
| 5604 | |
| 5605 | // Register as a wireless device |
| 5606 | dev->wireless_handlers = (struct iw_handler_def *)& hostapd_handler_def; |
| 5607 | |
| 5608 | //Initialize the data path module |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5609 | status = hdd_softap_init_tx_rx(pAdapter, re_init); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5610 | if ( !VOS_IS_STATUS_SUCCESS( status )) |
| 5611 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5612 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: hdd_softap_init_tx_rx failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | } |
Madan Mohan Koyyalamudi | 8c6dec8 | 2013-09-26 15:56:13 +0530 | [diff] [blame] | 5614 | |
| 5615 | status = hdd_wmm_adapter_init( pAdapter ); |
| 5616 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 5617 | { |
| 5618 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5619 | "hdd_wmm_adapter_init() failed with status code %08d [x%08x]", |
Madan Mohan Koyyalamudi | 8c6dec8 | 2013-09-26 15:56:13 +0530 | [diff] [blame] | 5620 | status, status ); |
| 5621 | goto error_wmm_init; |
| 5622 | } |
| 5623 | |
| 5624 | set_bit(WMM_INIT_DONE, &pAdapter->event_flags); |
| 5625 | |
Hanumanth Reddy Pothula | b37ce86 | 2017-02-03 21:42:08 +0530 | [diff] [blame] | 5626 | ini_cfg = pHddCtx->cfg_ini; |
| 5627 | if (re_init && ini_cfg) { |
| 5628 | hddLog(VOS_TRACE_LEVEL_INFO, FL("start_ch: %d end_ch:%d op_band:%d"), |
| 5629 | ini_cfg->apStartChannelNum, ini_cfg->apEndChannelNum, |
| 5630 | ini_cfg->apOperatingBand); |
| 5631 | WLANSAP_SetChannelRange(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5632 | ini_cfg->apStartChannelNum, |
| 5633 | ini_cfg->apEndChannelNum, |
| 5634 | ini_cfg->apOperatingBand); |
| 5635 | } |
| 5636 | |
Madan Mohan Koyyalamudi | 8c6dec8 | 2013-09-26 15:56:13 +0530 | [diff] [blame] | 5637 | return status; |
| 5638 | |
| 5639 | error_wmm_init: |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5640 | hdd_softap_deinit_tx_rx(pAdapter, re_init); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5641 | EXIT(); |
| 5642 | return status; |
| 5643 | } |
| 5644 | |
| 5645 | hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *iface_name ) |
| 5646 | { |
| 5647 | struct net_device *pWlanHostapdDev = NULL; |
| 5648 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 5649 | v_CONTEXT_t pVosContext= NULL; |
| 5650 | |
Anand N Sunkad | c34abbd | 2015-07-29 09:52:59 +0530 | [diff] [blame] | 5651 | pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, |
| 5652 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 5653 | NET_NAME_UNKNOWN, |
| 5654 | #endif |
| 5655 | ether_setup, NUM_TX_QUEUES); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5656 | if (pWlanHostapdDev != NULL) |
| 5657 | { |
| 5658 | pHostapdAdapter = netdev_priv(pWlanHostapdDev); |
| 5659 | |
| 5660 | //Init the net_device structure |
| 5661 | ether_setup(pWlanHostapdDev); |
| 5662 | |
| 5663 | //Initialize the adapter context to zeros. |
| 5664 | vos_mem_zero(pHostapdAdapter, sizeof( hdd_adapter_t )); |
| 5665 | pHostapdAdapter->dev = pWlanHostapdDev; |
| 5666 | pHostapdAdapter->pHddCtx = pHddCtx; |
| 5667 | pHostapdAdapter->magic = WLAN_HDD_ADAPTER_MAGIC; |
| 5668 | |
| 5669 | //Get the Global VOSS context. |
| 5670 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 5671 | //Save the adapter context in global context for future. |
| 5672 | ((VosContextType*)(pVosContext))->pHDDSoftAPContext = (v_VOID_t*)pHostapdAdapter; |
| 5673 | |
| 5674 | //Init the net_device structure |
| 5675 | strlcpy(pWlanHostapdDev->name, (const char *)iface_name, IFNAMSIZ); |
| 5676 | |
| 5677 | hdd_set_ap_ops( pHostapdAdapter->dev ); |
| 5678 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5679 | pWlanHostapdDev->watchdog_timeo = HDD_TX_TIMEOUT; |
| 5680 | pWlanHostapdDev->mtu = HDD_DEFAULT_MTU; |
| 5681 | |
| 5682 | vos_mem_copy(pWlanHostapdDev->dev_addr, (void *)macAddr,sizeof(tSirMacAddr)); |
| 5683 | vos_mem_copy(pHostapdAdapter->macAddressCurrent.bytes, (void *)macAddr, sizeof(tSirMacAddr)); |
| 5684 | |
| 5685 | pWlanHostapdDev->destructor = free_netdev; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ; |
| 5687 | pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy; |
| 5688 | pHostapdAdapter->wdev.netdev = pWlanHostapdDev; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | SET_NETDEV_DEV(pWlanHostapdDev, pHddCtx->parent_dev); |
| 5691 | } |
| 5692 | return pHostapdAdapter; |
| 5693 | } |
| 5694 | |
| 5695 | VOS_STATUS hdd_register_hostapd( hdd_adapter_t *pAdapter, tANI_U8 rtnl_lock_held ) |
| 5696 | { |
| 5697 | struct net_device *dev = pAdapter->dev; |
| 5698 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 5699 | |
| 5700 | ENTER(); |
| 5701 | |
| 5702 | if( rtnl_lock_held ) |
| 5703 | { |
Madan Mohan Koyyalamudi | d8ac866 | 2012-11-06 19:04:56 -0800 | [diff] [blame] | 5704 | if (strnchr(dev->name, strlen(dev->name), '%')) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5705 | if( dev_alloc_name(dev, dev->name) < 0 ) |
| 5706 | { |
| 5707 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s:Failed:dev_alloc_name", __func__); |
| 5708 | return VOS_STATUS_E_FAILURE; |
| 5709 | } |
| 5710 | } |
| 5711 | if (register_netdevice(dev)) |
| 5712 | { |
| 5713 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5714 | "%s:Failed:register_netdevice", __func__); |
| 5715 | return VOS_STATUS_E_FAILURE; |
| 5716 | } |
| 5717 | } |
| 5718 | else |
| 5719 | { |
| 5720 | if (register_netdev(dev)) |
| 5721 | { |
| 5722 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed:register_netdev", __func__); |
| 5723 | return VOS_STATUS_E_FAILURE; |
| 5724 | } |
| 5725 | } |
| 5726 | set_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags); |
| 5727 | |
| 5728 | EXIT(); |
| 5729 | return status; |
| 5730 | } |
| 5731 | |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 5732 | VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | { |
| 5734 | ENTER(); |
| 5735 | |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5736 | hdd_softap_deinit_tx_rx(pAdapter, false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5737 | |
| 5738 | /* if we are being called during driver unload, then the dev has already |
| 5739 | been invalidated. if we are being called at other times, then we can |
| 5740 | detatch the wireless device handlers */ |
| 5741 | if (pAdapter->dev) |
| 5742 | { |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 5743 | if (TRUE == rtnl_held) |
| 5744 | { |
| 5745 | pAdapter->dev->wireless_handlers = NULL; |
| 5746 | } |
| 5747 | else |
| 5748 | { |
| 5749 | rtnl_lock(); |
| 5750 | pAdapter->dev->wireless_handlers = NULL; |
| 5751 | rtnl_unlock(); |
| 5752 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5753 | } |
| 5754 | EXIT(); |
| 5755 | return 0; |
| 5756 | } |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5757 | |
| 5758 | /** |
| 5759 | * hdd_sap_indicate_disconnect_for_sta() - Indicate disconnect indication |
| 5760 | * to supplicant, if there any clients connected to SAP interface. |
| 5761 | * @adapter: sap adapter context |
| 5762 | * |
| 5763 | * Return: nothing |
| 5764 | */ |
| 5765 | void hdd_sap_indicate_disconnect_for_sta(hdd_adapter_t *adapter) |
| 5766 | { |
| 5767 | tSap_Event sap_event; |
| 5768 | int staId; |
| 5769 | hdd_context_t *hdd_ctx; |
| 5770 | v_CONTEXT_t vos_ctx; |
| 5771 | ptSapContext sap_ctx; |
| 5772 | |
| 5773 | ENTER(); |
| 5774 | |
| 5775 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5776 | if (NULL == hdd_ctx || NULL == hdd_ctx->cfg_ini) { |
| 5777 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5778 | "%s: HDD context is Null", __func__); |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5779 | return; |
| 5780 | } |
| 5781 | |
| 5782 | vos_ctx = hdd_ctx->pvosContext; |
| 5783 | if (NULL == vos_ctx) { |
| 5784 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5785 | "%s: VOS context is not valid",__func__); |
| 5786 | return; |
| 5787 | } |
| 5788 | |
| 5789 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 5790 | if (!sap_ctx) { |
| 5791 | hddLog(LOGE, FL("invalid sap context")); |
| 5792 | return; |
| 5793 | } |
| 5794 | |
| 5795 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) { |
| 5796 | if (sap_ctx->aStaInfo[staId].isUsed) { |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 5797 | hddLog(LOG1, FL("staId: %d isUsed: %d %pK"), |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5798 | staId, sap_ctx->aStaInfo[staId].isUsed, |
| 5799 | sap_ctx); |
| 5800 | |
| 5801 | if (vos_is_macaddr_broadcast( |
| 5802 | &sap_ctx->aStaInfo[staId].macAddrSTA)) |
| 5803 | continue; |
| 5804 | |
| 5805 | sap_event.sapHddEventCode = eSAP_STA_DISASSOC_EVENT; |
| 5806 | vos_mem_copy( |
| 5807 | &sap_event.sapevt. |
| 5808 | sapStationDisassocCompleteEvent.staMac, |
| 5809 | &sap_ctx->aStaInfo[staId].macAddrSTA, |
| 5810 | sizeof(v_MACADDR_t)); |
| 5811 | sap_event.sapevt.sapStationDisassocCompleteEvent. |
| 5812 | reason = |
| 5813 | eSAP_MAC_INITATED_DISASSOC; |
| 5814 | sap_event.sapevt.sapStationDisassocCompleteEvent. |
| 5815 | statusCode = |
| 5816 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 5817 | hdd_hostapd_SAPEventCB(&sap_event, |
| 5818 | sap_ctx->pUsrContext); |
| 5819 | } |
| 5820 | } |
| 5821 | |
| 5822 | clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags); |
| 5823 | |
| 5824 | EXIT(); |
| 5825 | } |
| 5826 | |
| 5827 | /** |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5828 | * hdd_sap_destroy_timers() - Destroy sap timers |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5829 | * @adapter: sap adapter context |
| 5830 | * |
| 5831 | * Return: nothing |
| 5832 | */ |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5833 | void hdd_sap_destroy_timers(hdd_adapter_t *adapter) |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5834 | { |
| 5835 | hdd_context_t *hdd_ctx; |
| 5836 | v_CONTEXT_t vos_ctx; |
| 5837 | ptSapContext sap_ctx; |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5838 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5839 | |
| 5840 | ENTER(); |
| 5841 | |
| 5842 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5843 | if (NULL == hdd_ctx || NULL == hdd_ctx->cfg_ini) { |
| 5844 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5845 | "%s: HDD context is Null", __func__); |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5846 | return; |
| 5847 | } |
| 5848 | |
| 5849 | vos_ctx = hdd_ctx->pvosContext; |
| 5850 | if (NULL == vos_ctx) { |
| 5851 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5852 | "%s: VOS context is not valid",__func__); |
| 5853 | return; |
| 5854 | } |
| 5855 | |
| 5856 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 5857 | if (!sap_ctx) { |
| 5858 | hddLog(LOGE, FL("invalid sap context")); |
| 5859 | return; |
| 5860 | } |
| 5861 | |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 5862 | if (VOS_TIMER_STATE_RUNNING == sap_ctx->sap_HT2040_timer.state) { |
| 5863 | status = vos_timer_stop(&sap_ctx->sap_HT2040_timer); |
| 5864 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 5865 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 5866 | FL("Failed to Stop HT20/40 timer")); |
| 5867 | } |
| 5868 | |
| 5869 | status = vos_timer_destroy(&sap_ctx->sap_HT2040_timer); |
| 5870 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 5871 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 5872 | FL("Failed to Destroy HT20/40 timer")); |
| 5873 | |
Hanumanth Reddy Pothula | d864f31 | 2017-01-18 16:16:08 +0530 | [diff] [blame] | 5874 | } |
Agrawal Ashish | 574b3e6 | 2017-02-09 18:58:34 +0530 | [diff] [blame] | 5875 | |
| 5876 | /** |
| 5877 | * hdd_force_scc_restart_sap - restart sap to forcer SCC |
| 5878 | * @adapter: hdd ap adapter |
| 5879 | * |
| 5880 | * hdd_force_scc_restart_sap will choose station channel and will |
| 5881 | * schedule work to restart the sap. |
| 5882 | * |
| 5883 | * Return - none |
| 5884 | */ |
| 5885 | void hdd_force_scc_restart_sap(hdd_adapter_t *adapter, |
| 5886 | hdd_context_t *hdd_ctx, tANI_U8 channelId) |
| 5887 | { |
| 5888 | if (!(adapter && (WLAN_HDD_SOFTAP == adapter->device_mode))) { |
| 5889 | return; |
| 5890 | } |
| 5891 | |
| 5892 | hddLog(LOG1, FL("Current operation channel %d"), |
| 5893 | adapter->sessionCtx.ap.operatingChannel); |
| 5894 | hddLog(LOG1, FL("STA channel is %d"), |
| 5895 | channelId); |
| 5896 | |
| 5897 | vos_flush_work( |
| 5898 | &hdd_ctx->sap_start_work); |
| 5899 | |
| 5900 | hddLog(LOGE, |
| 5901 | FL("Restarting SAP for force SCC ")); |
| 5902 | |
| 5903 | adapter->sessionCtx.ap.sapConfig.channel = channelId; |
| 5904 | |
| 5905 | if (hdd_ctx->cfg_ini->sap_internal_restart) { |
| 5906 | netif_tx_disable(adapter->dev); |
| 5907 | schedule_work(&hdd_ctx->sap_start_work); |
| 5908 | } else { |
| 5909 | hdd_hostapd_stop(adapter->dev); |
| 5910 | } |
| 5911 | return; |
| 5912 | } |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 5913 | |
| 5914 | /** |
| 5915 | * hdd_get_cache_stainfo() - get stainfo for the specified peer |
| 5916 | * @stainfo: array of station info |
| 5917 | * @mac_addr: mac address of requested peer |
| 5918 | * |
| 5919 | * This function find the stainfo for the peer with mac_addr |
| 5920 | * |
| 5921 | * Return: stainfo if found, NULL if not found |
| 5922 | */ |
| 5923 | struct hdd_cache_sta_info *hdd_get_cache_stainfo( |
| 5924 | struct hdd_cache_sta_info *astainfo, |
| 5925 | u8 *mac_addr) |
| 5926 | { |
| 5927 | struct hdd_cache_sta_info *stainfo = NULL; |
| 5928 | int i; |
| 5929 | |
| 5930 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) { |
| 5931 | if (vos_mem_compare(&astainfo[i].macAddrSTA, |
| 5932 | mac_addr, |
| 5933 | HDD_MAC_ADDR_LEN)) { |
| 5934 | stainfo = &astainfo[i]; |
| 5935 | break; |
| 5936 | } |
| 5937 | } |
| 5938 | |
| 5939 | return stainfo; |
| 5940 | } |
| 5941 | |