Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 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 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /**======================================================================== |
| 43 | |
| 44 | \file wlan_hdd_hostapd.c |
| 45 | \brief WLAN Host Device Driver implementation |
| 46 | |
| 47 | Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved. |
| 48 | |
| 49 | Qualcomm Confidential and Proprietary. |
| 50 | |
| 51 | ========================================================================*/ |
| 52 | /**========================================================================= |
| 53 | EDIT HISTORY FOR FILE |
| 54 | |
| 55 | |
| 56 | This section contains comments describing changes made to the module. |
| 57 | Notice that changes are listed in reverse chronological order. |
| 58 | |
| 59 | $Header:$ $DateTime: $ $Author: $ |
| 60 | |
| 61 | |
| 62 | when who what, where, why |
| 63 | -------- --- -------------------------------------------------------- |
| 64 | 04/5/09 Shailender Created module. |
| 65 | 06/03/10 js - Added support to hostapd driven deauth/disassoc/mic failure |
| 66 | ==========================================================================*/ |
| 67 | /*-------------------------------------------------------------------------- |
| 68 | Include Files |
| 69 | ------------------------------------------------------------------------*/ |
| 70 | |
| 71 | #include <linux/version.h> |
| 72 | #include <linux/module.h> |
| 73 | #include <linux/kernel.h> |
| 74 | #include <linux/init.h> |
| 75 | #include <linux/wireless.h> |
| 76 | #include <linux/semaphore.h> |
| 77 | #include <vos_api.h> |
| 78 | #include <vos_sched.h> |
| 79 | #include <linux/etherdevice.h> |
| 80 | #include <wlan_hdd_includes.h> |
| 81 | #include <qc_sap_ioctl.h> |
| 82 | #include <wlan_hdd_hostapd.h> |
| 83 | #include <sapApi.h> |
| 84 | #include <sapInternal.h> |
| 85 | #include <wlan_qct_tl.h> |
| 86 | #include <wlan_hdd_softap_tx_rx.h> |
| 87 | #include <wlan_hdd_main.h> |
| 88 | #include <linux/netdevice.h> |
| 89 | #include <linux/mmc/sdio_func.h> |
| 90 | #include "wlan_nlink_common.h" |
| 91 | #include "wlan_btc_svc.h" |
| 92 | #include <bap_hdd_main.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | #include "wlan_hdd_p2p.h" |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 94 | #include "cfgApi.h" |
| 95 | #include "wniCfgAp.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | |
| 97 | #define IS_UP(_dev) \ |
| 98 | (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP)) |
| 99 | #define IS_UP_AUTO(_ic) \ |
| 100 | (IS_UP((_ic)->ic_dev) && (_ic)->ic_roaming == IEEE80211_ROAMING_AUTO) |
| 101 | #define WE_WLAN_VERSION 1 |
| 102 | #define STATS_CONTEXT_MAGIC 0x53544154 |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 103 | #define WE_GET_STA_INFO_SIZE 30 |
| 104 | /* WEXT limition: MAX allowed buf len for any * |
| 105 | * IW_PRIV_TYPE_CHAR is 2Kbytes * |
| 106 | */ |
| 107 | #define WE_SAP_MAX_STA_INFO 0x7FF |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | |
| 109 | struct statsContext |
| 110 | { |
| 111 | struct completion completion; |
| 112 | hdd_adapter_t *pAdapter; |
| 113 | unsigned int magic; |
| 114 | }; |
| 115 | #define SAP_24GHZ_CH_COUNT (14) |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 116 | |
| 117 | #define SAP_MAX_GET_ASSOC_STAS_TIMEOUT 500 |
| 118 | /* Max possible supported rate count |
| 119 | * Legacy 14 + 11N MCS 8 + 11AC MCS 10 */ |
| 120 | #define SAP_MAX_SUPPORTED_RATE_COUNT 32 |
| 121 | #define SAP_LEGACY_RATE_MASK 0x007F |
| 122 | #define SAP_GET_STAS_RATE_TIMEOUT 1000 |
| 123 | #define SAP_AC_MCS_MAP_MASK 0x03 |
| 124 | #define SAP_AC_MCS_MAP_OFFSET 7 |
| 125 | |
| 126 | #define SAP_LEGACY_RATE_COUNT SIR_NUM_11B_RATES + SIR_NUM_11A_RATES |
| 127 | #define SAP_11N_RATE_COUNT 8 |
| 128 | |
| 129 | #define SAP_RATE_SUPPORT_MAP_LEGACY_MASK 0x0001 |
| 130 | #define SAP_RATE_SUPPORT_MAP_N_MASK 0x001E |
| 131 | #define SAP_RATE_SUPPORT_MAP_AC_MASK 0x07E0 |
| 132 | |
| 133 | #define SAP_MAX_24_CHANNEL_NUMBER 14 |
| 134 | #define SAP_GET_STAS_COOKIE 0xC000C1EE |
| 135 | |
| 136 | /* Temp put here, will locate correct location |
| 137 | * work on progress with UMAC */ |
| 138 | /* Should syn with FW definition */ |
| 139 | typedef enum |
| 140 | { |
| 141 | WNI_CFG_FIXED_RATE_SAP_AUTO, |
| 142 | WNI_CFG_FIXED_RATE_11B_LONG_1_MBPS, |
| 143 | WNI_CFG_FIXED_RATE_11B_LONG_2_MBPS, |
| 144 | WNI_CFG_FIXED_RATE_11B_LONG_5_5_MBPS, |
| 145 | WNI_CFG_FIXED_RATE_11B_LONG_11_MBPS, |
| 146 | WNI_CFG_FIXED_RATE_11A_6_MBPS, |
| 147 | WNI_CFG_FIXED_RATE_11A_9_MBPS, |
| 148 | WNI_CFG_FIXED_RATE_11A_12_MBPS, |
| 149 | WNI_CFG_FIXED_RATE_11A_18_MBPS, |
| 150 | WNI_CFG_FIXED_RATE_11A_24_MBPS, |
| 151 | WNI_CFG_FIXED_RATE_11A_36_MBPS, |
| 152 | WNI_CFG_FIXED_RATE_11A_48_MBPS, |
| 153 | WNI_CFG_FIXED_RATE_11A_54_MBPS, |
| 154 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_6_5_MBPS, |
| 155 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_13_MBPS, |
| 156 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_19_5_MBPS, |
| 157 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_26_MBPS, |
| 158 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_39_MBPS, |
| 159 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_52_MBPS, |
| 160 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_58_5_MBPS, |
| 161 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_65_MBPS, |
| 162 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_7_2_MBPS, |
| 163 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_14_4_MBPS, |
| 164 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_21_7_MBPS, |
| 165 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_28_9_MBPS, |
| 166 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_43_3_MBPS, |
| 167 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_57_8_MBPS, |
| 168 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_65_MBPS, |
| 169 | WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_72_2_MBPS, |
| 170 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_13_5_MBPS, |
| 171 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_27_MBPS, /* 30 */ |
| 172 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_40_5_MBPS, |
| 173 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_54_MBPS, |
| 174 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_81_MBPS, |
| 175 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_108_MBPS, |
| 176 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_121_5_MBPS, |
| 177 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_135_MBPS, |
| 178 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_15_MBPS, |
| 179 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_30_MBPS, |
| 180 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_45_MBPS, |
| 181 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_60_MBPS, |
| 182 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_90_MBPS, |
| 183 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_120_MBPS, |
| 184 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_135_MBPS, |
| 185 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_150_MBPS, |
| 186 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_13_5_MBPS, |
| 187 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_27_MBPS, |
| 188 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_40_5_MBPS, |
| 189 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_54_MBPS, |
| 190 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_81_MBPS, |
| 191 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_108_MBPS, |
| 192 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_121_5_MBPS, |
| 193 | WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_GF_135_MBPS, |
| 194 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_6_5MBPS, |
| 195 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_13MBPS, |
| 196 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_19_5MBPS, |
| 197 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_26MBPS, |
| 198 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_39MBPS, |
| 199 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_52MBPS, |
| 200 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_58_5MBPS, |
| 201 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_65MBPS, /* 60 */ |
| 202 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_78MBPS, |
| 203 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_NGI_86_5_MBPS, |
| 204 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_21_667MBPS, |
| 205 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_28_889MBPS, |
| 206 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_43_333MBPS, |
| 207 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_57_778MBPS, |
| 208 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_65MBPS, |
| 209 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_72_222MBPS, |
| 210 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_86_667MBPS, |
| 211 | WNI_CFG_FIXED_RATE_VHT_SIMO_CB_SGI_96_1_MBPS, |
| 212 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_13_5MBPS, |
| 213 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_27MBPS, |
| 214 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_40_5MBPS, |
| 215 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_54MBPS, |
| 216 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_81MBPS, |
| 217 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_108MBPS, |
| 218 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_121_5MBPS, |
| 219 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_135MBPS, |
| 220 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_RESERVED, |
| 221 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_162MBPS, |
| 222 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_180MBPS, |
| 223 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_15MBPS, |
| 224 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_30MBPS, |
| 225 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_45MBPS, |
| 226 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_60MBPS, |
| 227 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_90MBPS, |
| 228 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_120MBPS, |
| 229 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_135MBPS, |
| 230 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_150MBPS, |
| 231 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_RESERVED, /* 90 */ |
| 232 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_180MBPS, |
| 233 | WNI_CFG_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_200MBPS, |
| 234 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_29_25MBPS, |
| 235 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_58_5MBPS, |
| 236 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_87_75MBPS, |
| 237 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_117MBPS, |
| 238 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_175_5MBPS, |
| 239 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_234MBPS, |
| 240 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_263_25MBPS, |
| 241 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_292_5MBPS, |
| 242 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_RESERVED, |
| 243 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_351MBPS, |
| 244 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_390MBPS, |
| 245 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_32_5MBPS, |
| 246 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_65MBPS, |
| 247 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_97_5MBPS, |
| 248 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_130MBPS, |
| 249 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_195MBPS, |
| 250 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_260MBPS, |
| 251 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_292_5MBPS, |
| 252 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_325MBPS, |
| 253 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_RESERVED, |
| 254 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_390MBPS, |
| 255 | WNI_CFG_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_433_33MBPS, |
| 256 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_6_5MBPS, |
| 257 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_13MBPS, |
| 258 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_19_5MBPS, |
| 259 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_26MBPS, |
| 260 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_39MBPS, |
| 261 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_52MBPS, /* 120 */ |
| 262 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_58_5MBPS, |
| 263 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_65MBPS, |
| 264 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_78MBPS, |
| 265 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_86_5_MBPS, |
| 266 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_7_2222MBPS, |
| 267 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_14_444MBPS, |
| 268 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_21_667MBPS, |
| 269 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_28_889MBPS, |
| 270 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_43_333MBPS, |
| 271 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_57_778MBPS, |
| 272 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_65MBPS, |
| 273 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_72_222MBPS, |
| 274 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_86_667MBPS, |
| 275 | WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_96_1_MBPS, |
| 276 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_13_5MBPS, |
| 277 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_27MBPS, |
| 278 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_40_5MBPS, |
| 279 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_54MBPS, |
| 280 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_81MBPS, |
| 281 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_108MBPS, |
| 282 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_121_5MBPS, |
| 283 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_135MBPS, |
| 284 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_RESERVED, |
| 285 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_162MBPS, |
| 286 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_180MBPS, |
| 287 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_15MBPS, |
| 288 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_30MBPS, |
| 289 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_45MBPS, |
| 290 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_60MBPS, |
| 291 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_90MBPS, /* 150 */ |
| 292 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_120MBPS, |
| 293 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_135MBPS, |
| 294 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_150MBPS, |
| 295 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_RESERVED, |
| 296 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_180MBPS, |
| 297 | WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_200MBPS, |
| 298 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_29_25MBPS, |
| 299 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_58_5MBPS, |
| 300 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_87_75MBPS, |
| 301 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_117MBPS, |
| 302 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_175_5MBPS, |
| 303 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_234MBPS, |
| 304 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_263_25MBPS, |
| 305 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_292_5MBPS, |
| 306 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_RESERVED, |
| 307 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_351MBPS, |
| 308 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_390MBPS, |
| 309 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_32_5MBPS, |
| 310 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_65MBPS, |
| 311 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_97_5MBPS, |
| 312 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_130MBPS, |
| 313 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_195MBPS, |
| 314 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_260MBPS, |
| 315 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_292_5MBPS, |
| 316 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_325MBPS, |
| 317 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_RESERVED, |
| 318 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_390MBPS, |
| 319 | WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_433_33MBPS, |
| 320 | WNI_CFG_FIXED_RATE_11A_DUP_6_MBPS, |
| 321 | WNI_CFG_FIXED_RATE_11A_DUP_9_MBPS, /* 180 */ |
| 322 | WNI_CFG_FIXED_RATE_11A_DUP_12_MBPS, |
| 323 | WNI_CFG_FIXED_RATE_11A_DUP_18_MBPS, |
| 324 | WNI_CFG_FIXED_RATE_11A_DUP_24_MBPS, |
| 325 | WNI_CFG_FIXED_RATE_11A_DUP_36_MBPS, |
| 326 | WNI_CFG_FIXED_RATE_11A_DUP_48_MBPS, |
| 327 | WNI_CFG_FIXED_RATE_11A_DUP_54_MBPS, |
| 328 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_6_MBPS, |
| 329 | WNI_CFG_FIXED_RATE_11A_80MHZDUP_9_MBPS, |
| 330 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_12_MBPS, |
| 331 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_18_MBPS, |
| 332 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_24_MBPS, |
| 333 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_36_MBPS, |
| 334 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_48_MBPS, |
| 335 | WNI_CFG_FIXED_RATE_11A_80MHZ_DUP_54_MBPS, |
| 336 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_6_5_MBPS, |
| 337 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_13_MBPS, |
| 338 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_19_5_MBPS, |
| 339 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_26_MBPS, |
| 340 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_39_MBPS, |
| 341 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_52_MBPS, |
| 342 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_58_5_MBPS, |
| 343 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_65_MBPS, |
| 344 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_7_2_MBPS, |
| 345 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_14_4_MBPS, |
| 346 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_21_7_MBPS, |
| 347 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_28_9_MBPS, |
| 348 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_43_3_MBPS, |
| 349 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_57_8_MBPS, |
| 350 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_65_MBPS, |
| 351 | WNI_CFG_LDPC_FIXED_RATE_MCS_1NSS_MM_SG_72_2_MBPS, /* 210 */ |
| 352 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_13_5_MBPS, |
| 353 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_27_MBPS, |
| 354 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_40_5_MBPS, |
| 355 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_54_MBPS, |
| 356 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_81_MBPS, |
| 357 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_108_MBPS, |
| 358 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_121_5_MBPS, |
| 359 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_135_MBPS, |
| 360 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_15_MBPS, |
| 361 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_30_MBPS, |
| 362 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_45_MBPS, |
| 363 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_60_MBPS, |
| 364 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_90_MBPS, |
| 365 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_120_MBPS, |
| 366 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_135_MBPS, |
| 367 | WNI_CFG_LDPC_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_150_MBPS |
| 368 | } eCfgFixedRateCfgType; |
| 369 | |
| 370 | /* Legacy IDX based rate table */ |
| 371 | typedef struct |
| 372 | { |
| 373 | v_U16_t legacy_rate_index; |
| 374 | v_U32_t legacy_rate; |
| 375 | } supported_legacy_rate_t; |
| 376 | static const supported_legacy_rate_t legacy_rate[] = |
| 377 | { |
| 378 | /* IDX Rate, 100kbps */ |
| 379 | {2, 10}, |
| 380 | {4, 20}, |
| 381 | {11, 55}, |
| 382 | {12, 60}, |
| 383 | {18, 90}, |
| 384 | {24, 120}, |
| 385 | {36, 180}, |
| 386 | {48, 240}, |
| 387 | {66, 330}, |
| 388 | {72, 360}, |
| 389 | {96, 480}, |
| 390 | {108, 540} |
| 391 | }; |
| 392 | |
| 393 | /* 11N MCS based rate table */ |
| 394 | typedef struct |
| 395 | { |
| 396 | v_U8_t mcs_index_11n; |
| 397 | v_U32_t rate_11n[4]; |
| 398 | } supported_11n_rate_t; |
| 399 | static const supported_11n_rate_t mcs_rate_11n[] = |
| 400 | { |
| 401 | /* MCS L20 L40 S20 S40 */ |
| 402 | {0, {65, 135, 72, 150}}, |
| 403 | {1, {130, 270, 144, 300}}, |
| 404 | {2, {195, 405, 217, 450}}, |
| 405 | {3, {260, 540, 289, 600}}, |
| 406 | {4, {390, 810, 433, 900}}, |
| 407 | {5, {520, 1080, 578, 1200}}, |
| 408 | {6, {585, 1215, 650, 1350}}, |
| 409 | {7, {650, 1350, 722, 1500}} |
| 410 | }; |
| 411 | |
| 412 | /* 11AC MCS based rate table */ |
| 413 | typedef struct |
| 414 | { |
| 415 | v_U8_t mcs_index_11ac; |
| 416 | v_U16_t cb80_rate_11ac[2]; |
| 417 | v_U16_t cb40_rate_11ac[2]; |
| 418 | v_U16_t cb20_rate_11ac[2]; |
| 419 | } supported_11ac_rate_t; |
| 420 | static const supported_11ac_rate_t mcs_rate_11ac[] = |
| 421 | { |
| 422 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 423 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 424 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 425 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 426 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 427 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 428 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 429 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 430 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 431 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 432 | {9, {3900, 4333}, {1800, 2000}, {860, 867}} |
| 433 | }; |
| 434 | |
| 435 | typedef struct |
| 436 | { |
| 437 | eCfgFixedRateCfgType eRateCfg; |
| 438 | v_U16_t rate; |
| 439 | } rate_cfg_item_mapping_t; |
| 440 | |
| 441 | static rate_cfg_item_mapping_t legacy_rate_mapping[] = |
| 442 | { |
| 443 | {WNI_CFG_FIXED_RATE_11B_LONG_1_MBPS, 10}, |
| 444 | {WNI_CFG_FIXED_RATE_11B_LONG_2_MBPS, 20}, |
| 445 | {WNI_CFG_FIXED_RATE_11B_LONG_5_5_MBPS, 55}, |
| 446 | {WNI_CFG_FIXED_RATE_11B_LONG_11_MBPS, 110}, |
| 447 | {WNI_CFG_FIXED_RATE_11A_6_MBPS, 60}, |
| 448 | {WNI_CFG_FIXED_RATE_11A_9_MBPS, 90}, |
| 449 | {WNI_CFG_FIXED_RATE_11A_12_MBPS, 120}, |
| 450 | {WNI_CFG_FIXED_RATE_11A_18_MBPS, 180}, |
| 451 | {WNI_CFG_FIXED_RATE_11A_24_MBPS, 240}, |
| 452 | {WNI_CFG_FIXED_RATE_11A_36_MBPS, 360}, |
| 453 | {WNI_CFG_FIXED_RATE_11A_48_MBPS, 480}, |
| 454 | {WNI_CFG_FIXED_RATE_11A_54_MBPS, 540} |
| 455 | }; |
| 456 | static rate_cfg_item_mapping_t n_l20_rate_mapping[] = |
| 457 | { |
| 458 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_6_5_MBPS, 65}, |
| 459 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_13_MBPS, 130}, |
| 460 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_19_5_MBPS, 195}, |
| 461 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_26_MBPS, 260}, |
| 462 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_39_MBPS, 390}, |
| 463 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_52_MBPS, 520}, |
| 464 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_58_5_MBPS, 585}, |
| 465 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_65_MBPS, 650} |
| 466 | }; |
| 467 | static rate_cfg_item_mapping_t n_s20_rate_mapping[] = |
| 468 | { |
| 469 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_7_2_MBPS, 72}, |
| 470 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_14_4_MBPS, 144}, |
| 471 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_21_7_MBPS, 217}, |
| 472 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_28_9_MBPS, 289}, |
| 473 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_43_3_MBPS, 433}, |
| 474 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_57_8_MBPS, 578}, |
| 475 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_65_MBPS, 650}, |
| 476 | {WNI_CFG_FIXED_RATE_MCS_1NSS_MM_SG_72_2_MBPS, 722} |
| 477 | }; |
| 478 | static rate_cfg_item_mapping_t n_l40_rate_mapping[] = |
| 479 | { |
| 480 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_13_5_MBPS, 135}, |
| 481 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_27_MBPS, 270}, |
| 482 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_40_5_MBPS, 405}, |
| 483 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_54_MBPS, 540}, |
| 484 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_81_MBPS, 810}, |
| 485 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_108_MBPS, 1080}, |
| 486 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_121_5_MBPS, 1215}, |
| 487 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_135_MBPS, 1350} |
| 488 | }; |
| 489 | static rate_cfg_item_mapping_t n_s40_rate_mapping[] = |
| 490 | { |
| 491 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_15_MBPS, 150}, |
| 492 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_30_MBPS, 300}, |
| 493 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_45_MBPS, 450}, |
| 494 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_60_MBPS, 600}, |
| 495 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_90_MBPS, 900}, |
| 496 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_120_MBPS, 1200}, |
| 497 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_135_MBPS, 1350}, |
| 498 | {WNI_CFG_FIXED_RATE_MCS_40MHZ_1NSS_MM_SG_150_MBPS, 1500} |
| 499 | }; |
| 500 | |
| 501 | #ifdef WLAN_FEATURE_11AC |
| 502 | static rate_cfg_item_mapping_t ac_l20_rate_mapping[] = |
| 503 | { |
| 504 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_6_5MBPS, 65}, |
| 505 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_13MBPS, 130}, |
| 506 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_19_5MBPS, 195}, |
| 507 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_26MBPS, 260}, |
| 508 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_39MBPS, 390}, |
| 509 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_52MBPS, 520}, |
| 510 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_58_5MBPS, 585}, |
| 511 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_65MBPS, 650}, |
| 512 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_78MBPS, 780}, |
| 513 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_NGI_86_5_MBPS, 865} |
| 514 | }; |
| 515 | static rate_cfg_item_mapping_t ac_s20_rate_mapping[] = |
| 516 | { |
| 517 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_7_2222MBPS, 72}, |
| 518 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_14_444MBPS, 144}, |
| 519 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_21_667MBPS, 217}, |
| 520 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_28_889MBPS, 289}, |
| 521 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_43_333MBPS, 433}, |
| 522 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_57_778MBPS, 578}, |
| 523 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_65MBPS, 650}, |
| 524 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_72_222MBPS, 722}, |
| 525 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_86_667MBPS, 867}, |
| 526 | {WNI_CFG_LDPC_FIXED_RATE_VHT_SIMO_CB_SGI_96_1_MBPS, 961} |
| 527 | }; |
| 528 | static rate_cfg_item_mapping_t ac_l40_rate_mapping[] = |
| 529 | { |
| 530 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_13_5MBPS, 135}, |
| 531 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_27MBPS, 270}, |
| 532 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_40_5MBPS, 405}, |
| 533 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_54MBPS, 540}, |
| 534 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_81MBPS, 810}, |
| 535 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_108MBPS, 1080}, |
| 536 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_121_5MBPS, 1215}, |
| 537 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_135MBPS, 1350}, |
| 538 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_162MBPS, 1620}, |
| 539 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_NGI_180MBPS, 1800} |
| 540 | }; |
| 541 | static rate_cfg_item_mapping_t ac_s40_rate_mapping[] = |
| 542 | { |
| 543 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_15MBPS, 150}, |
| 544 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_30MBPS, 300}, |
| 545 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_45MBPS, 450}, |
| 546 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_60MBPS, 600}, |
| 547 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_90MBPS, 900}, |
| 548 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_120MBPS, 1200}, |
| 549 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_135MBPS, 1350}, |
| 550 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_150MBPS, 1500}, |
| 551 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_180MBPS, 1800}, |
| 552 | {WNI_CFG_LDPC_FIXED_RATE_VHT_40MHZ_SIMO_CB_SGI_200MBPS, 2000} |
| 553 | }; |
| 554 | static rate_cfg_item_mapping_t ac_l80_rate_mapping[] = |
| 555 | { |
| 556 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_29_25MBPS, 293}, |
| 557 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_58_5MBPS, 585}, |
| 558 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_87_75MBPS, 878}, |
| 559 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_117MBPS, 1170}, |
| 560 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_175_5MBPS, 1755}, |
| 561 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_234MBPS, 2340}, |
| 562 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_263_25MBPS, 2633}, |
| 563 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_292_5MBPS, 2925}, |
| 564 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_351MBPS, 3510}, |
| 565 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_NGI_390MBPS, 3900} |
| 566 | }; |
| 567 | static rate_cfg_item_mapping_t ac_s80_rate_mapping[] = |
| 568 | { |
| 569 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_32_5MBPS, 325}, |
| 570 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_65MBPS, 650}, |
| 571 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_97_5MBPS, 975}, |
| 572 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_130MBPS, 1300}, |
| 573 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_195MBPS, 1950}, |
| 574 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_260MBPS, 2600}, |
| 575 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_292_5MBPS, 2925}, |
| 576 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_325MBPS, 3250}, |
| 577 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_390MBPS, 3900}, |
| 578 | {WNI_CFG_LDPC_FIXED_RATE_VHT_80MHZ_SIMO_CB_SGI_433_33MBPS, 4333} |
| 579 | }; |
| 580 | #endif /* WLAN_FEATURE_11AC */ |
| 581 | |
| 582 | typedef enum |
| 583 | { |
| 584 | RATE_CFG_RATE_LEGACY, |
| 585 | RATE_CFG_RATE_11N_MCS_LGI_20, |
| 586 | RATE_CFG_RATE_11N_MCS_SGI_20, |
| 587 | RATE_CFG_RATE_11N_MCS_LGI_40, |
| 588 | RATE_CFG_RATE_11N_MCS_SGI_40, |
| 589 | RATE_CFG_RATE_11AC_MCS_LGI_20, |
| 590 | RATE_CFG_RATE_11AC_MCS_SGI_20, |
| 591 | RATE_CFG_RATE_11AC_MCS_LGI_40, |
| 592 | RATE_CFG_RATE_11AC_MCS_SGI_40, |
| 593 | RATE_CFG_RATE_11AC_MCS_LGI_80, |
| 594 | RATE_CFG_RATE_11AC_MCS_SGI_80 |
| 595 | } rate_cfg_supported_rate_t; |
| 596 | |
| 597 | typedef enum |
| 598 | { |
| 599 | RATE_CFG_RATE_11AC_MAX_MCS_7, |
| 600 | RATE_CFG_RATE_11AC_MAX_MCS_8, |
| 601 | RATE_CFG_RATE_11AC_MAX_MCS_9 |
| 602 | } rate_cfg_11ac_max_mcs_t; |
| 603 | |
| 604 | typedef enum |
| 605 | { |
| 606 | RATE_CFG_RATE_BW_20, |
| 607 | RATE_CFG_RATE_BW_40, |
| 608 | RATE_CFG_RATE_BW_80 |
| 609 | } rate_cfg_supported_bw_t; |
| 610 | |
| 611 | typedef enum |
| 612 | { |
| 613 | RATE_CFG_RATE_GI_LONG, |
| 614 | RATE_CFG_RATE_GI_SHORT |
| 615 | } rate_cfg_gi_t; |
| 616 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | /*--------------------------------------------------------------------------- |
| 618 | * Function definitions |
| 619 | *-------------------------------------------------------------------------*/ |
| 620 | /**--------------------------------------------------------------------------- |
| 621 | |
| 622 | \brief hdd_hostapd_open() - HDD Open function for hostapd interface |
| 623 | |
| 624 | This is called in response to ifconfig up |
| 625 | |
| 626 | \param - dev Pointer to net_device structure |
| 627 | |
| 628 | \return - 0 for success non-zero for failure |
| 629 | |
| 630 | --------------------------------------------------------------------------*/ |
| 631 | int hdd_hostapd_open (struct net_device *dev) |
| 632 | { |
| 633 | ENTER(); |
| 634 | |
| 635 | //Turn ON carrier state |
| 636 | netif_carrier_on(dev); |
| 637 | //Enable all Tx queues |
| 638 | netif_tx_start_all_queues(dev); |
| 639 | |
| 640 | EXIT(); |
| 641 | return 0; |
| 642 | } |
| 643 | /**--------------------------------------------------------------------------- |
| 644 | |
| 645 | \brief hdd_hostapd_stop() - HDD stop function for hostapd interface |
| 646 | |
| 647 | This is called in response to ifconfig down |
| 648 | |
| 649 | \param - dev Pointer to net_device structure |
| 650 | |
| 651 | \return - 0 for success non-zero for failure |
| 652 | |
| 653 | --------------------------------------------------------------------------*/ |
| 654 | int hdd_hostapd_stop (struct net_device *dev) |
| 655 | { |
| 656 | ENTER(); |
| 657 | |
| 658 | //Stop all tx queues |
| 659 | netif_tx_disable(dev); |
| 660 | |
| 661 | //Turn OFF carrier state |
| 662 | netif_carrier_off(dev); |
| 663 | |
| 664 | EXIT(); |
| 665 | return 0; |
| 666 | } |
| 667 | /**--------------------------------------------------------------------------- |
| 668 | |
| 669 | \brief hdd_hostapd_uninit() - HDD uninit function |
| 670 | |
| 671 | This is called during the netdev unregister to uninitialize all data |
| 672 | associated with the device |
| 673 | |
| 674 | \param - dev Pointer to net_device structure |
| 675 | |
| 676 | \return - void |
| 677 | |
| 678 | --------------------------------------------------------------------------*/ |
| 679 | static void hdd_hostapd_uninit (struct net_device *dev) |
| 680 | { |
| 681 | hdd_adapter_t *pHostapdAdapter = netdev_priv(dev); |
| 682 | |
| 683 | ENTER(); |
| 684 | |
| 685 | if (pHostapdAdapter && pHostapdAdapter->pHddCtx) |
| 686 | { |
| 687 | hdd_deinit_adapter(pHostapdAdapter->pHddCtx, pHostapdAdapter); |
| 688 | |
| 689 | /* after uninit our adapter structure will no longer be valid */ |
| 690 | pHostapdAdapter->dev = NULL; |
| 691 | } |
| 692 | |
| 693 | EXIT(); |
| 694 | } |
| 695 | |
| 696 | |
| 697 | /**============================================================================ |
| 698 | @brief hdd_hostapd_hard_start_xmit() - Function registered with the Linux OS for |
| 699 | transmitting packets. There are 2 versions of this function. One that uses |
| 700 | locked queue and other that uses lockless queues. Both have been retained to |
| 701 | do some performance testing |
| 702 | @param skb : [in] pointer to OS packet (sk_buff) |
| 703 | @param dev : [in] pointer to Libra network device |
| 704 | |
| 705 | @return : NET_XMIT_DROP if packets are dropped |
| 706 | : NET_XMIT_SUCCESS if packet is enqueued succesfully |
| 707 | ===========================================================================*/ |
| 708 | int hdd_hostapd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 709 | { |
| 710 | return 0; |
| 711 | } |
| 712 | int hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu) |
| 713 | { |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | int hdd_hostapd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
| 718 | { |
| 719 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 720 | hdd_priv_data_t priv_data; |
| 721 | tANI_U8 *command = NULL; |
| 722 | int ret = 0; |
| 723 | |
| 724 | if (NULL == pAdapter) |
| 725 | { |
| 726 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 727 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | ret = -ENODEV; |
| 729 | goto exit; |
| 730 | } |
| 731 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 732 | if ((!ifr) || (!ifr->ifr_data)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 733 | { |
| 734 | ret = -EINVAL; |
| 735 | goto exit; |
| 736 | } |
| 737 | |
| 738 | if (copy_from_user(&priv_data, ifr->ifr_data, sizeof(hdd_priv_data_t))) |
| 739 | { |
| 740 | ret = -EFAULT; |
| 741 | goto exit; |
| 742 | } |
| 743 | |
| 744 | command = kmalloc(priv_data.total_len, GFP_KERNEL); |
| 745 | if (!command) |
| 746 | { |
| 747 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 748 | "%s: failed to allocate memory\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | ret = -ENOMEM; |
| 750 | goto exit; |
| 751 | } |
| 752 | |
| 753 | if (copy_from_user(command, priv_data.buf, priv_data.total_len)) |
| 754 | { |
| 755 | ret = -EFAULT; |
| 756 | goto exit; |
| 757 | } |
| 758 | |
| 759 | if ((SIOCDEVPRIVATE + 1) == cmd) |
| 760 | { |
| 761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 762 | "***HOSTAPD*** : Received %s cmd from Wi-Fi GUI***", command); |
| 763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | if(strncmp(command, "P2P_SET_NOA", 11) == 0 ) |
| 765 | { |
| 766 | hdd_setP2pNoa(dev, command); |
| 767 | } |
| 768 | else if( strncmp(command, "P2P_SET_PS", 10) == 0 ) |
| 769 | { |
| 770 | hdd_setP2pOpps(dev, command); |
| 771 | } |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 772 | |
| 773 | /* |
| 774 | command should be a string having format |
| 775 | SET_SAP_CHANNEL_LIST <num of channels> <the channels seperated by spaces> |
| 776 | */ |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 777 | if(strncmp(command, "SET_SAP_CHANNEL_LIST", 20) == 0) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 778 | { |
| 779 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 780 | " Received Command to Set Preferred Channels for SAP in %s", __func__); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 781 | |
Mahesh Kumar Kalikot Veetil | 2aad8d8 | 2013-02-07 12:31:28 -0800 | [diff] [blame] | 782 | ret = sapSetPreferredChannel(command); |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | } |
| 785 | exit: |
| 786 | if (command) |
| 787 | { |
| 788 | kfree(command); |
| 789 | } |
| 790 | return ret; |
| 791 | } |
| 792 | |
| 793 | /**--------------------------------------------------------------------------- |
| 794 | |
| 795 | \brief hdd_hostapd_set_mac_address() - |
| 796 | This function sets the user specified mac address using |
| 797 | the command ifconfig wlanX hw ether <mac adress>. |
| 798 | |
| 799 | \param - dev - Pointer to the net device. |
| 800 | - addr - Pointer to the sockaddr. |
| 801 | \return - 0 for success, non zero for failure |
| 802 | |
| 803 | --------------------------------------------------------------------------*/ |
| 804 | |
| 805 | static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) |
| 806 | { |
| 807 | struct sockaddr *psta_mac_addr = addr; |
| 808 | ENTER(); |
| 809 | memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN); |
| 810 | EXIT(); |
| 811 | return 0; |
| 812 | } |
| 813 | void hdd_hostapd_inactivity_timer_cb(v_PVOID_t usrDataForCallback) |
| 814 | { |
| 815 | struct net_device *dev = (struct net_device *)usrDataForCallback; |
| 816 | v_BYTE_t we_custom_event[64]; |
| 817 | union iwreq_data wrqu; |
| 818 | #ifdef DISABLE_CONCURRENCY_AUTOSAVE |
| 819 | VOS_STATUS vos_status; |
| 820 | hdd_adapter_t *pHostapdAdapter; |
| 821 | hdd_ap_ctx_t *pHddApCtx; |
| 822 | #endif /*DISABLE_CONCURRENCY_AUTOSAVE */ |
| 823 | |
| 824 | /* event_name space-delimiter driver_module_name */ |
| 825 | /* Format of the event is "AUTO-SHUT.indication" " " "module_name" */ |
| 826 | char * autoShutEvent = "AUTO-SHUT.indication" " " KBUILD_MODNAME; |
| 827 | int event_len = strlen(autoShutEvent) + 1; /* For the NULL at the end */ |
| 828 | |
| 829 | ENTER(); |
| 830 | |
| 831 | #ifdef DISABLE_CONCURRENCY_AUTOSAVE |
| 832 | if (vos_concurrent_sessions_running()) |
| 833 | { |
| 834 | /* |
| 835 | This timer routine is going to be called only when AP |
| 836 | persona is up. |
| 837 | If there are concurrent sessions running we do not want |
| 838 | to shut down the Bss.Instead we run the timer again so |
| 839 | that if Autosave is enabled next time and other session |
| 840 | was down only then we bring down AP |
| 841 | */ |
| 842 | pHostapdAdapter = netdev_priv(dev); |
| 843 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 844 | vos_status = vos_timer_start( |
| 845 | &pHddApCtx->hdd_ap_inactivity_timer, |
| 846 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff |
| 847 | * 1000); |
| 848 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 849 | { |
| 850 | hddLog(LOGE, FL("Failed to init AP inactivity timer")); |
| 851 | } |
| 852 | EXIT(); |
| 853 | return; |
| 854 | } |
| 855 | #endif /*DISABLE_CONCURRENCY_AUTOSAVE */ |
| 856 | memset(&we_custom_event, '\0', sizeof(we_custom_event)); |
| 857 | memcpy(&we_custom_event, autoShutEvent, event_len); |
| 858 | |
| 859 | memset(&wrqu, 0, sizeof(wrqu)); |
| 860 | wrqu.data.length = event_len; |
| 861 | |
| 862 | hddLog(LOG1, FL("Shutting down AP interface due to inactivity")); |
| 863 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, (char *)we_custom_event); |
| 864 | |
| 865 | EXIT(); |
| 866 | } |
| 867 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 868 | VOS_STATUS hdd_change_mcc_go_beacon_interval(hdd_adapter_t *pHostapdAdapter) |
| 869 | { |
| 870 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 871 | ptSapContext pSapCtx = NULL; |
| 872 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 873 | v_PVOID_t hHal = NULL; |
| 874 | |
| 875 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 876 | "%s: UPDATE Beacon Params", __func__); |
| 877 | |
| 878 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
| 879 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 880 | if ( NULL == pSapCtx ) |
| 881 | { |
| 882 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 883 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 884 | return VOS_STATUS_E_FAULT; |
| 885 | } |
| 886 | |
| 887 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 888 | if ( NULL == hHal ){ |
| 889 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 890 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
| 891 | return VOS_STATUS_E_FAULT; |
| 892 | } |
| 893 | halStatus = sme_ChangeMCCBeaconInterval(hHal, pSapCtx->sessionId); |
| 894 | if(halStatus == eHAL_STATUS_FAILURE ){ |
| 895 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 896 | "%s: Failed to update Beacon Params", __func__); |
| 897 | return VOS_STATUS_E_FAILURE; |
| 898 | } |
| 899 | } |
| 900 | return VOS_STATUS_SUCCESS; |
| 901 | } |
| 902 | |
| 903 | void hdd_clear_all_sta(hdd_adapter_t *pHostapdAdapter, v_PVOID_t usrDataForCallback) |
| 904 | { |
| 905 | v_U8_t staId = 0; |
| 906 | struct net_device *dev; |
| 907 | dev = (struct net_device *)usrDataForCallback; |
| 908 | |
| 909 | hddLog(LOGE, FL("Clearing all the STA entry....\n")); |
| 910 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 911 | { |
| 912 | if ( pHostapdAdapter->aStaInfo[staId].isUsed && |
| 913 | ( staId != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId)) |
| 914 | { |
| 915 | //Disconnect all the stations |
| 916 | hdd_softap_sta_disassoc(pHostapdAdapter, &pHostapdAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 917 | } |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | static int hdd_stop_p2p_link(hdd_adapter_t *pHostapdAdapter,v_PVOID_t usrDataForCallback) |
| 922 | { |
| 923 | struct net_device *dev; |
| 924 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 925 | dev = (struct net_device *)usrDataForCallback; |
| 926 | ENTER(); |
| 927 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
| 928 | { |
| 929 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) ) |
| 930 | { |
| 931 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("Deleting P2P link!!!!!!")); |
| 932 | } |
| 933 | clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 934 | } |
| 935 | EXIT(); |
| 936 | return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 937 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | |
| 939 | VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCallback) |
| 940 | { |
| 941 | hdd_adapter_t *pHostapdAdapter; |
| 942 | hdd_ap_ctx_t *pHddApCtx; |
| 943 | hdd_hostapd_state_t *pHostapdState; |
| 944 | struct net_device *dev; |
| 945 | eSapHddEvent sapEvent; |
| 946 | union iwreq_data wrqu; |
| 947 | v_BYTE_t *we_custom_event_generic = NULL; |
| 948 | int we_event = 0; |
| 949 | int i = 0; |
| 950 | v_U8_t staId; |
| 951 | VOS_STATUS vos_status; |
| 952 | v_BOOL_t bWPSState; |
| 953 | v_BOOL_t bApActive = FALSE; |
| 954 | v_BOOL_t bAuthRequired = TRUE; |
| 955 | tpSap_AssocMacAddr pAssocStasArray = NULL; |
| 956 | char unknownSTAEvent[IW_CUSTOM_MAX+1]; |
| 957 | char maxAssocExceededEvent[IW_CUSTOM_MAX+1]; |
| 958 | v_BYTE_t we_custom_start_event[64]; |
| 959 | char *startBssEvent; |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 960 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 961 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 5f12e90 | 2013-04-03 10:21:46 -0700 | [diff] [blame] | 962 | struct iw_michaelmicfailure msg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | |
| 964 | dev = (struct net_device *)usrDataForCallback; |
| 965 | pHostapdAdapter = netdev_priv(dev); |
Madan Mohan Koyyalamudi | e1b791f | 2013-07-24 12:53:33 +0530 | [diff] [blame] | 966 | |
| 967 | if ((NULL == pHostapdAdapter) || |
| 968 | (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic)) |
| 969 | { |
| 970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 971 | "invalid adapter or adapter has invalid magic"); |
| 972 | return eHAL_STATUS_FAILURE; |
| 973 | } |
| 974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 976 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 977 | sapEvent = pSapEvent->sapHddEventCode; |
| 978 | memset(&wrqu, '\0', sizeof(wrqu)); |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 979 | pHddCtx = (hdd_context_t*)(pHostapdAdapter->pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | |
| 981 | switch(sapEvent) |
| 982 | { |
| 983 | case eSAP_START_BSS_EVENT : |
| 984 | hddLog(LOG1, FL("BSS configured status = %s, channel = %lu, bc sta Id = %d\n"), |
| 985 | pSapEvent->sapevt.sapStartBssCompleteEvent.status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS", |
| 986 | pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel, |
| 987 | pSapEvent->sapevt.sapStartBssCompleteEvent.staId); |
| 988 | |
| 989 | pHostapdState->vosStatus = pSapEvent->sapevt.sapStartBssCompleteEvent.status; |
| 990 | vos_status = vos_event_set(&pHostapdState->vosEvent); |
| 991 | |
| 992 | if (!VOS_IS_STATUS_SUCCESS(vos_status) || pHostapdState->vosStatus) |
| 993 | { |
| 994 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: startbss event failed!!\n")); |
| 995 | goto stopbss; |
| 996 | } |
| 997 | else |
| 998 | { |
| 999 | pHddApCtx->uBCStaId = pSapEvent->sapevt.sapStartBssCompleteEvent.staId; |
| 1000 | //@@@ need wep logic here to set privacy bit |
| 1001 | hdd_softap_Register_BC_STA(pHostapdAdapter, pHddApCtx->uPrivacy); |
| 1002 | } |
| 1003 | |
| 1004 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1005 | { |
| 1006 | // AP Inactivity timer init and start |
| 1007 | vos_status = vos_timer_init( &pHddApCtx->hdd_ap_inactivity_timer, VOS_TIMER_TYPE_SW, |
| 1008 | hdd_hostapd_inactivity_timer_cb, (v_PVOID_t)dev ); |
| 1009 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1010 | hddLog(LOGE, FL("Failed to init AP inactivity timer\n")); |
| 1011 | |
| 1012 | vos_status = vos_timer_start( &pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000); |
| 1013 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1014 | hddLog(LOGE, FL("Failed to init AP inactivity timer\n")); |
| 1015 | |
| 1016 | } |
| 1017 | pHddApCtx->operatingChannel = pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel; |
| 1018 | pHostapdState->bssState = BSS_START; |
| 1019 | |
| 1020 | // Send current operating channel of SoftAP to BTC-ES |
| 1021 | send_btc_nlink_msg(WLAN_BTC_SOFTAP_BSS_START, 0); |
| 1022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1023 | //Check if there is any group key pending to set. |
| 1024 | if( pHddApCtx->groupKey.keyLength ) |
| 1025 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1026 | if( VOS_STATUS_SUCCESS != WLANSAP_SetKeySta( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1027 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, |
| 1028 | &pHddApCtx->groupKey ) ) |
| 1029 | { |
| 1030 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1031 | "%s: WLANSAP_SetKeySta failed", __func__); |
| 1032 | } |
| 1033 | pHddApCtx->groupKey.keyLength = 0; |
| 1034 | } |
| 1035 | else if ( pHddApCtx->wepKey[0].keyLength ) |
| 1036 | { |
| 1037 | int i=0; |
| 1038 | for ( i = 0; i < CSR_MAX_NUM_KEY; i++ ) |
| 1039 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1040 | if( VOS_STATUS_SUCCESS != WLANSAP_SetKeySta( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, |
| 1042 | &pHddApCtx->wepKey[i] ) ) |
| 1043 | { |
| 1044 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1045 | "%s: WLANSAP_SetKeySta failed idx %d", __func__, i); |
| 1046 | } |
| 1047 | pHddApCtx->wepKey[i].keyLength = 0; |
| 1048 | } |
| 1049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1050 | //Fill the params for sending IWEVCUSTOM Event with SOFTAP.enabled |
| 1051 | startBssEvent = "SOFTAP.enabled"; |
| 1052 | memset(&we_custom_start_event, '\0', sizeof(we_custom_start_event)); |
| 1053 | memcpy(&we_custom_start_event, startBssEvent, strlen(startBssEvent)); |
| 1054 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1055 | wrqu.data.length = strlen(startBssEvent); |
| 1056 | we_event = IWEVCUSTOM; |
| 1057 | we_custom_event_generic = we_custom_start_event; |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1058 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1059 | break; //Event will be sent after Switch-Case stmt |
| 1060 | |
| 1061 | case eSAP_STOP_BSS_EVENT: |
| 1062 | hddLog(LOG1, FL("BSS stop status = %s\n"),pSapEvent->sapevt.sapStopBssCompleteEvent.status ? |
| 1063 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1064 | |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 1065 | //Free up Channel List incase if it is set |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1066 | sapCleanupChannelList(); |
Madan Mohan Koyyalamudi | 5aef2af | 2012-10-05 11:56:27 -0700 | [diff] [blame] | 1067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1068 | pHddApCtx->operatingChannel = 0; //Invalidate the channel info. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | goto stopbss; |
| 1070 | case eSAP_STA_SET_KEY_EVENT: |
| 1071 | //TODO: forward the message to hostapd once implementtation is done for now just print |
| 1072 | hddLog(LOG1, FL("SET Key: configured status = %s\n"),pSapEvent->sapevt.sapStationSetKeyCompleteEvent.status ? |
| 1073 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1074 | return VOS_STATUS_SUCCESS; |
| 1075 | case eSAP_STA_DEL_KEY_EVENT: |
| 1076 | //TODO: forward the message to hostapd once implementtation is done for now just print |
| 1077 | hddLog(LOG1, FL("Event received %s\n"),"eSAP_STA_DEL_KEY_EVENT"); |
| 1078 | return VOS_STATUS_SUCCESS; |
| 1079 | case eSAP_STA_MIC_FAILURE_EVENT: |
| 1080 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | memset(&msg, '\0', sizeof(msg)); |
| 1082 | msg.src_addr.sa_family = ARPHRD_ETHER; |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1083 | memcpy(msg.src_addr.sa_data, &pSapEvent->sapevt.sapStationMICFailureEvent.staMac, sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1084 | hddLog(LOG1, "MIC MAC "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1085 | if(pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eSAP_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | msg.flags = IW_MICFAILURE_GROUP; |
| 1087 | else |
| 1088 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 1089 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1090 | wrqu.data.length = sizeof(msg); |
| 1091 | we_event = IWEVMICHAELMICFAILURE; |
| 1092 | we_custom_event_generic = (v_BYTE_t *)&msg; |
| 1093 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1094 | /* inform mic failure to nl80211 */ |
| 1095 | cfg80211_michael_mic_failure(dev, |
| 1096 | pSapEvent->sapevt. |
| 1097 | sapStationMICFailureEvent.staMac.bytes, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1098 | ((pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eSAP_TRUE) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | NL80211_KEYTYPE_GROUP : |
| 1100 | NL80211_KEYTYPE_PAIRWISE), |
| 1101 | pSapEvent->sapevt.sapStationMICFailureEvent.keyId, |
| 1102 | pSapEvent->sapevt.sapStationMICFailureEvent.TSC, |
| 1103 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | break; |
| 1105 | |
| 1106 | case eSAP_STA_ASSOC_EVENT: |
| 1107 | case eSAP_STA_REASSOC_EVENT: |
| 1108 | wrqu.addr.sa_family = ARPHRD_ETHER; |
| 1109 | memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac, |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1110 | sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | hddLog(LOG1, " associated "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
| 1112 | we_event = IWEVREGISTERED; |
| 1113 | |
| 1114 | WLANSAP_Get_WPS_State((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, &bWPSState); |
| 1115 | |
| 1116 | if ( (eCSR_ENCRYPT_TYPE_NONE == pHddApCtx->ucEncryptType) || |
| 1117 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddApCtx->ucEncryptType ) || |
| 1118 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddApCtx->ucEncryptType ) ) |
| 1119 | { |
| 1120 | bAuthRequired = FALSE; |
| 1121 | } |
| 1122 | |
| 1123 | if (bAuthRequired || bWPSState == eANI_BOOLEAN_TRUE ) |
| 1124 | { |
| 1125 | hdd_softap_RegisterSTA( pHostapdAdapter, |
| 1126 | TRUE, |
| 1127 | pHddApCtx->uPrivacy, |
| 1128 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId, |
| 1129 | 0, |
| 1130 | 0, |
| 1131 | (v_MACADDR_t *)wrqu.addr.sa_data, |
| 1132 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled); |
| 1133 | } |
| 1134 | else |
| 1135 | { |
| 1136 | hdd_softap_RegisterSTA( pHostapdAdapter, |
| 1137 | FALSE, |
| 1138 | pHddApCtx->uPrivacy, |
| 1139 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId, |
| 1140 | 0, |
| 1141 | 0, |
| 1142 | (v_MACADDR_t *)wrqu.addr.sa_data, |
| 1143 | pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled); |
Amar Singhal | 6144c00 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 1144 | } |
| 1145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1146 | // Stop AP inactivity timer |
| 1147 | if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_RUNNING) |
| 1148 | { |
| 1149 | vos_status = vos_timer_stop(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1150 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1151 | hddLog(LOGE, FL("Failed to start AP inactivity timer\n")); |
| 1152 | } |
Sameer Thalappil | 50dc009 | 2013-02-19 17:23:33 -0800 | [diff] [blame] | 1153 | #ifdef WLAN_OPEN_SOURCE |
Madan Mohan Koyyalamudi | 69fc3ad | 2012-11-28 16:04:56 -0800 | [diff] [blame] | 1154 | if (wake_lock_active(&pHddCtx->sap_wake_lock)) |
| 1155 | { |
| 1156 | wake_unlock(&pHddCtx->sap_wake_lock); |
| 1157 | } |
Amar Singhal | 6144c00 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 1158 | wake_lock_timeout(&pHddCtx->sap_wake_lock, msecs_to_jiffies(HDD_SAP_WAKE_LOCK_DURATION)); |
Sameer Thalappil | 50dc009 | 2013-02-19 17:23:33 -0800 | [diff] [blame] | 1159 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1160 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 1161 | { |
| 1162 | struct station_info staInfo; |
| 1163 | v_U16_t iesLen = pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.iesLen; |
| 1164 | |
| 1165 | memset(&staInfo, 0, sizeof(staInfo)); |
| 1166 | if (iesLen <= MAX_ASSOC_IND_IE_LEN ) |
| 1167 | { |
| 1168 | staInfo.assoc_req_ies = |
| 1169 | (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.ies[0]; |
| 1170 | staInfo.assoc_req_ies_len = iesLen; |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 1171 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,31)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1172 | staInfo.filled |= STATION_INFO_ASSOC_REQ_IES; |
| 1173 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1174 | cfg80211_new_sta(dev, |
| 1175 | (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac.bytes[0], |
| 1176 | &staInfo, GFP_KERNEL); |
| 1177 | } |
| 1178 | else |
| 1179 | { |
| 1180 | hddLog(LOGE, FL(" Assoc Ie length is too long \n")); |
| 1181 | } |
| 1182 | } |
| 1183 | #endif |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1184 | pScanInfo = &pHddCtx->scan_info; |
| 1185 | // Lets do abort scan to ensure smooth authentication for client |
| 1186 | if ((pScanInfo != NULL) && pScanInfo->mScanPending) |
| 1187 | { |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 1188 | hdd_abort_mac_scan(pHddCtx, pHostapdAdapter->sessionId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1190 | |
| 1191 | break; |
| 1192 | case eSAP_STA_DISASSOC_EVENT: |
| 1193 | memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, |
Kumar Pavan | 0cf0cf2 | 2012-12-13 15:13:41 -0800 | [diff] [blame] | 1194 | sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1195 | hddLog(LOG1, " disassociated "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(wrqu.addr.sa_data)); |
| 1196 | if (pSapEvent->sapevt.sapStationDisassocCompleteEvent.reason == eSAP_USR_INITATED_DISASSOC) |
| 1197 | hddLog(LOG1," User initiated disassociation"); |
| 1198 | else |
| 1199 | hddLog(LOG1," MAC initiated disassociation"); |
| 1200 | we_event = IWEVEXPIRED; |
| 1201 | vos_status = hdd_softap_GetStaId(pHostapdAdapter, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, &staId); |
| 1202 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1203 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1204 | 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] | 1205 | return VOS_STATUS_E_FAILURE; |
| 1206 | } |
| 1207 | hdd_softap_DeregisterSTA(pHostapdAdapter, staId); |
| 1208 | |
| 1209 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1210 | { |
| 1211 | spin_lock_bh( &pHostapdAdapter->staInfo_lock ); |
| 1212 | // Start AP inactivity timer if no stations associated with it |
| 1213 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 1214 | { |
| 1215 | if (pHostapdAdapter->aStaInfo[i].isUsed && i != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId) |
| 1216 | { |
| 1217 | bApActive = TRUE; |
| 1218 | break; |
| 1219 | } |
| 1220 | } |
| 1221 | spin_unlock_bh( &pHostapdAdapter->staInfo_lock ); |
| 1222 | |
| 1223 | if (bApActive == FALSE) |
| 1224 | { |
| 1225 | if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_STOPPED) |
| 1226 | { |
| 1227 | vos_status = vos_timer_start(&pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000); |
| 1228 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1229 | hddLog(LOGE, FL("Failed to init AP inactivity timer\n")); |
| 1230 | } |
| 1231 | else |
| 1232 | VOS_ASSERT(vos_timer_getCurrentState(&pHddApCtx->hdd_ap_inactivity_timer) == VOS_TIMER_STATE_STOPPED); |
| 1233 | } |
| 1234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 1236 | cfg80211_del_sta(dev, |
| 1237 | (const u8 *)&pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac.bytes[0], |
| 1238 | GFP_KERNEL); |
| 1239 | #endif |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1240 | //Update the beacon Interval if it is P2P GO |
| 1241 | hdd_change_mcc_go_beacon_interval(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | break; |
| 1243 | case eSAP_WPS_PBC_PROBE_REQ_EVENT: |
| 1244 | { |
| 1245 | static const char * message ="MLMEWPSPBCPROBEREQ.indication"; |
| 1246 | union iwreq_data wreq; |
| 1247 | |
| 1248 | down(&pHddApCtx->semWpsPBCOverlapInd); |
| 1249 | pHddApCtx->WPSPBCProbeReq.probeReqIELen = pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIELen; |
| 1250 | |
| 1251 | vos_mem_copy(pHddApCtx->WPSPBCProbeReq.probeReqIE, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIE, |
| 1252 | pHddApCtx->WPSPBCProbeReq.probeReqIELen); |
| 1253 | |
| 1254 | vos_mem_copy(pHddApCtx->WPSPBCProbeReq.peerMacAddr, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.peerMacAddr, sizeof(v_MACADDR_t)); |
| 1255 | hddLog(LOG1, "WPS PBC probe req "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(pHddApCtx->WPSPBCProbeReq.peerMacAddr)); |
| 1256 | memset(&wreq, 0, sizeof(wreq)); |
| 1257 | wreq.data.length = strlen(message); // This is length of message |
| 1258 | wireless_send_event(dev, IWEVCUSTOM, &wreq, (char *)message); |
| 1259 | |
| 1260 | return VOS_STATUS_SUCCESS; |
| 1261 | } |
| 1262 | case eSAP_ASSOC_STA_CALLBACK_EVENT: |
| 1263 | pAssocStasArray = pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas; |
| 1264 | if (pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta != 0) |
| 1265 | { // List of associated stations |
| 1266 | for (i = 0; i < pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta; i++) |
| 1267 | { |
| 1268 | hddLog(LOG1,"Associated Sta Num %d:assocId=%d, staId=%d, staMac="MAC_ADDRESS_STR, |
| 1269 | i+1, |
| 1270 | pAssocStasArray->assocId, |
| 1271 | pAssocStasArray->staId, |
| 1272 | MAC_ADDR_ARRAY(pAssocStasArray->staMac.bytes)); |
| 1273 | pAssocStasArray++; |
| 1274 | } |
| 1275 | } |
| 1276 | vos_mem_free(pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas);// Release caller allocated memory here |
| 1277 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | case eSAP_INDICATE_MGMT_FRAME: |
| 1279 | hdd_indicateMgmtFrame( pHostapdAdapter, |
| 1280 | pSapEvent->sapevt.sapManagementFrameInfo.nFrameLength, |
| 1281 | pSapEvent->sapevt.sapManagementFrameInfo.pbFrames, |
| 1282 | pSapEvent->sapevt.sapManagementFrameInfo.frameType, |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1283 | pSapEvent->sapevt.sapManagementFrameInfo.rxChan, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1284 | return VOS_STATUS_SUCCESS; |
| 1285 | case eSAP_REMAIN_CHAN_READY: |
| 1286 | hdd_remainChanReadyHandler( pHostapdAdapter ); |
| 1287 | return VOS_STATUS_SUCCESS; |
| 1288 | case eSAP_SEND_ACTION_CNF: |
| 1289 | hdd_sendActionCnf( pHostapdAdapter, |
| 1290 | ( eSAP_STATUS_SUCCESS == |
| 1291 | pSapEvent->sapevt.sapActionCnf.actionSendSuccess ) ? |
| 1292 | TRUE : FALSE ); |
| 1293 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1294 | case eSAP_UNKNOWN_STA_JOIN: |
| 1295 | snprintf(unknownSTAEvent, IW_CUSTOM_MAX, "JOIN_UNKNOWN_STA-%02x:%02x:%02x:%02x:%02x:%02x", |
| 1296 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[0], |
| 1297 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[1], |
| 1298 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[2], |
| 1299 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[3], |
| 1300 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[4], |
| 1301 | pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[5]); |
| 1302 | we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */ |
| 1303 | wrqu.data.pointer = unknownSTAEvent; |
| 1304 | wrqu.data.length = strlen(unknownSTAEvent); |
| 1305 | we_custom_event_generic = (v_BYTE_t *)unknownSTAEvent; |
| 1306 | hddLog(LOG1,"%s\n", unknownSTAEvent); |
| 1307 | break; |
| 1308 | |
| 1309 | case eSAP_MAX_ASSOC_EXCEEDED: |
| 1310 | snprintf(maxAssocExceededEvent, IW_CUSTOM_MAX, "Peer %02x:%02x:%02x:%02x:%02x:%02x denied" |
| 1311 | " assoc due to Maximum Mobile Hotspot connections reached. Please disconnect" |
| 1312 | " one or more devices to enable the new device connection", |
| 1313 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[0], |
| 1314 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[1], |
| 1315 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[2], |
| 1316 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[3], |
| 1317 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[4], |
| 1318 | pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[5]); |
| 1319 | we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */ |
| 1320 | wrqu.data.pointer = maxAssocExceededEvent; |
| 1321 | wrqu.data.length = strlen(maxAssocExceededEvent); |
| 1322 | we_custom_event_generic = (v_BYTE_t *)maxAssocExceededEvent; |
| 1323 | hddLog(LOG1,"%s\n", maxAssocExceededEvent); |
| 1324 | break; |
| 1325 | case eSAP_STA_ASSOC_IND: |
| 1326 | return VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 1327 | |
| 1328 | case eSAP_DISCONNECT_ALL_P2P_CLIENT: |
| 1329 | hddLog(LOG1, FL(" Disconnecting all the P2P Clients....\n")); |
| 1330 | hdd_clear_all_sta(pHostapdAdapter, usrDataForCallback); |
| 1331 | return VOS_STATUS_SUCCESS; |
| 1332 | |
| 1333 | case eSAP_MAC_TRIG_STOP_BSS_EVENT : |
| 1334 | hdd_stop_p2p_link(pHostapdAdapter, usrDataForCallback); |
| 1335 | return VOS_STATUS_SUCCESS; |
| 1336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1337 | default: |
| 1338 | hddLog(LOG1,"SAP message is not handled\n"); |
| 1339 | goto stopbss; |
| 1340 | return VOS_STATUS_SUCCESS; |
| 1341 | } |
| 1342 | wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic); |
| 1343 | return VOS_STATUS_SUCCESS; |
| 1344 | |
| 1345 | stopbss : |
| 1346 | { |
| 1347 | v_BYTE_t we_custom_event[64]; |
| 1348 | char *stopBssEvent = "STOP-BSS.response";//17 |
| 1349 | int event_len = strlen(stopBssEvent); |
| 1350 | |
| 1351 | hddLog(LOG1, FL("BSS stop status = %s"), |
| 1352 | pSapEvent->sapevt.sapStopBssCompleteEvent.status ? |
| 1353 | "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); |
| 1354 | |
| 1355 | /* Change the BSS state now since, as we are shutting things down, |
| 1356 | * we don't want interfaces to become re-enabled */ |
| 1357 | pHostapdState->bssState = BSS_STOP; |
| 1358 | |
Gopichand Nakkala | f8fe15d | 2013-05-27 13:55:40 +0530 | [diff] [blame] | 1359 | if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff) |
| 1360 | { |
| 1361 | if (VOS_TIMER_STATE_RUNNING == pHddApCtx->hdd_ap_inactivity_timer.state) |
| 1362 | { |
| 1363 | vos_status = vos_timer_stop(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1364 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1365 | hddLog(LOGE, FL("Failed to stop AP inactivity timer")); |
| 1366 | } |
| 1367 | |
| 1368 | vos_status = vos_timer_destroy(&pHddApCtx->hdd_ap_inactivity_timer); |
| 1369 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1370 | hddLog(LOGE, FL("Failed to Destroy AP inactivity timer")); |
| 1371 | } |
| 1372 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1373 | /* Stop the pkts from n/w stack as we are going to free all of |
| 1374 | * the TX WMM queues for all STAID's */ |
| 1375 | hdd_hostapd_stop(dev); |
| 1376 | |
| 1377 | /* reclaim all resources allocated to the BSS */ |
| 1378 | hdd_softap_stop_bss(pHostapdAdapter); |
| 1379 | |
Amar Singhal | 37e6f05 | 2013-03-05 16:16:54 -0800 | [diff] [blame] | 1380 | /* once the event is set, structure dev/pHostapdAdapter should |
| 1381 | * not be touched since they are now subject to being deleted |
| 1382 | * by another thread */ |
| 1383 | if (eSAP_STOP_BSS_EVENT == sapEvent) |
| 1384 | vos_event_set(&pHostapdState->vosEvent); |
| 1385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | /* notify userspace that the BSS has stopped */ |
| 1387 | memset(&we_custom_event, '\0', sizeof(we_custom_event)); |
| 1388 | memcpy(&we_custom_event, stopBssEvent, event_len); |
| 1389 | memset(&wrqu, 0, sizeof(wrqu)); |
| 1390 | wrqu.data.length = event_len; |
| 1391 | we_event = IWEVCUSTOM; |
| 1392 | we_custom_event_generic = we_custom_event; |
| 1393 | 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] | 1394 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1395 | } |
| 1396 | return VOS_STATUS_SUCCESS; |
| 1397 | } |
| 1398 | int hdd_softap_unpackIE( |
| 1399 | tHalHandle halHandle, |
| 1400 | eCsrEncryptionType *pEncryptType, |
| 1401 | eCsrEncryptionType *mcEncryptType, |
| 1402 | eCsrAuthType *pAuthType, |
| 1403 | u_int16_t gen_ie_len, |
| 1404 | u_int8_t *gen_ie ) |
| 1405 | { |
| 1406 | tDot11fIERSN dot11RSNIE; |
| 1407 | tDot11fIEWPA dot11WPAIE; |
| 1408 | |
| 1409 | tANI_U8 *pRsnIe; |
| 1410 | tANI_U16 RSNIeLen; |
| 1411 | |
| 1412 | if (NULL == halHandle) |
| 1413 | { |
| 1414 | hddLog(LOGE, FL("Error haHandle returned NULL\n")); |
| 1415 | return -EINVAL; |
| 1416 | } |
| 1417 | |
| 1418 | // Validity checks |
| 1419 | if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) || |
| 1420 | (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) |
| 1421 | return -EINVAL; |
| 1422 | // Type check |
| 1423 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 1424 | { |
| 1425 | // Validity checks |
| 1426 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
| 1427 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 1428 | { |
| 1429 | return VOS_STATUS_E_FAILURE; |
| 1430 | } |
| 1431 | // Skip past the EID byte and length byte |
| 1432 | pRsnIe = gen_ie + 2; |
| 1433 | RSNIeLen = gen_ie_len - 2; |
| 1434 | // Unpack the RSN IE |
| 1435 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 1436 | dot11fUnpackIeRSN((tpAniSirGlobal) halHandle, |
| 1437 | pRsnIe, |
| 1438 | RSNIeLen, |
| 1439 | &dot11RSNIE); |
| 1440 | // Copy out the encryption and authentication types |
| 1441 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1442 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1443 | hddLog(LOG1, FL("%s: authentication suite count: %d\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1444 | __func__, dot11RSNIE.akm_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1445 | /*Here we have followed the apple base code, |
| 1446 | but probably I suspect we can do something different*/ |
| 1447 | //dot11RSNIE.akm_suite_count |
| 1448 | // Just translate the FIRST one |
| 1449 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]); |
| 1450 | //dot11RSNIE.pwise_cipher_suite_count |
| 1451 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 1452 | //dot11RSNIE.gp_cipher_suite_count |
| 1453 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
| 1454 | // Set the PMKSA ID Cache for this interface |
| 1455 | |
| 1456 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
| 1457 | } else |
| 1458 | if (gen_ie[0] == DOT11F_EID_WPA) |
| 1459 | { |
| 1460 | // Validity checks |
| 1461 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 1462 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 1463 | { |
| 1464 | return VOS_STATUS_E_FAILURE; |
| 1465 | } |
| 1466 | // Skip past the EID byte and length byte - and four byte WiFi OUI |
| 1467 | pRsnIe = gen_ie + 2 + 4; |
| 1468 | RSNIeLen = gen_ie_len - (2 + 4); |
| 1469 | // Unpack the WPA IE |
| 1470 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 1471 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 1472 | pRsnIe, |
| 1473 | RSNIeLen, |
| 1474 | &dot11WPAIE); |
| 1475 | // Copy out the encryption and authentication types |
| 1476 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1477 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1478 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1479 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1480 | //dot11WPAIE.auth_suite_count |
| 1481 | // Just translate the FIRST one |
| 1482 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 1483 | //dot11WPAIE.unicast_cipher_count |
| 1484 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 1485 | //dot11WPAIE.unicast_cipher_count |
| 1486 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 1487 | } |
| 1488 | else |
| 1489 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1490 | hddLog(LOGW, FL("%s: gen_ie[0]: %d\n"), __func__, gen_ie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1491 | return VOS_STATUS_E_FAILURE; |
| 1492 | } |
| 1493 | return VOS_STATUS_SUCCESS; |
| 1494 | } |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 1495 | |
| 1496 | /**--------------------------------------------------------------------------- |
| 1497 | |
| 1498 | \brief hdd_hostapd_set_mc_rate_cb() - |
| 1499 | |
| 1500 | This is called to notify associated stas information ready |
| 1501 | |
| 1502 | \param - sapEvent Pointer to get associated stas event |
| 1503 | \param - apDriver SoftAP context |
| 1504 | |
| 1505 | \return - none |
| 1506 | |
| 1507 | --------------------------------------------------------------------------*/ |
| 1508 | void hdd_hostapd_set_mc_rate_cb |
| 1509 | ( |
| 1510 | tSap_Event *sapEvent, |
| 1511 | void *apDriver |
| 1512 | ) |
| 1513 | { |
| 1514 | hdd_ap_ctx_t *apCtxt; |
| 1515 | |
| 1516 | if ((NULL == apDriver) || (NULL == sapEvent)) |
| 1517 | { |
| 1518 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1519 | "%s : Invalid arguments", __func__); |
| 1520 | return; |
| 1521 | } |
| 1522 | |
| 1523 | apCtxt = (hdd_ap_ctx_t *)apDriver; |
| 1524 | |
| 1525 | /* there is a race condition that exists between this callback function |
| 1526 | and the caller since the caller could time out either before or |
| 1527 | while this code is executing. we'll assume the timeout hasn't |
| 1528 | occurred, but we'll verify that right before complete our work */ |
| 1529 | if (SAP_GET_STAS_COOKIE == apCtxt->getStasCookie) |
| 1530 | { |
| 1531 | vos_mem_copy((void *)&apCtxt->getStasEventBuffer, |
| 1532 | (void *)sapEvent, |
| 1533 | sizeof(tSap_Event)); |
| 1534 | complete(&apCtxt->sap_get_associated_stas_complete); |
| 1535 | } |
| 1536 | else |
| 1537 | { |
| 1538 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1539 | "%s : Invalid cookie", __func__); |
| 1540 | } |
| 1541 | return; |
| 1542 | } |
| 1543 | |
| 1544 | /**--------------------------------------------------------------------------- |
| 1545 | |
| 1546 | \brief hdd_hostapd_set_mc_rate_update |
| 1547 | |
| 1548 | This is called to find rate and send cfg command to FW |
| 1549 | |
| 1550 | \param - sapEvent Pointer to get associated stas event |
| 1551 | \param - pHostapdAdapter SoftAP Adapter Context |
| 1552 | |
| 1553 | \return - int, 0 success |
| 1554 | negative fail |
| 1555 | |
| 1556 | --------------------------------------------------------------------------*/ |
| 1557 | static int hdd_hostapd_set_mc_rate_update |
| 1558 | ( |
| 1559 | tSap_Event *sapEvent, |
| 1560 | hdd_adapter_t *pHostapdAdapter |
| 1561 | ) |
| 1562 | { |
| 1563 | tHalHandle hHal; |
| 1564 | hdd_ap_ctx_t *apCtxt; |
| 1565 | tSap_AssocMacAddr *assocSta; |
| 1566 | rate_cfg_11ac_max_mcs_t supportedAcMaxMcs = RATE_CFG_RATE_11AC_MAX_MCS_7; |
| 1567 | rate_cfg_supported_bw_t bandWidth; |
| 1568 | rate_cfg_gi_t gi; |
| 1569 | rate_cfg_item_mapping_t *nMappingTable = NULL; |
| 1570 | rate_cfg_item_mapping_t *acMappingTable = NULL; |
| 1571 | v_U8_t stasLoop, ratesLoop; |
| 1572 | v_U8_t rateArrayOrder; |
| 1573 | v_U8_t mcsTable11n; |
| 1574 | v_U16_t targetCfgId = 0; |
| 1575 | v_U16_t targetCfgValue = 0; |
| 1576 | v_U16_t currentRate; |
| 1577 | v_U16_t combinedSupportMap = 0xFFFF; |
| 1578 | v_U16_t supportMap = 0x0000; |
| 1579 | v_U16_t supportedChannelCount = 0; |
| 1580 | v_U32_t legacyRates[SAP_LEGACY_RATE_COUNT]; |
| 1581 | int rc = 0; |
| 1582 | tSirRetStatus cfdStat; |
| 1583 | |
| 1584 | if ((NULL == pHostapdAdapter) || (NULL == sapEvent)) |
| 1585 | { |
| 1586 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1587 | "%s : Invalid arguments", __func__); |
| 1588 | return -1; |
| 1589 | } |
| 1590 | |
| 1591 | apCtxt = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 1592 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 1593 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1594 | "setMcRateCB NUM SAT %d, targetMCRate %d, current channel %d", |
| 1595 | sapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta, |
| 1596 | apCtxt->targetMCRate, |
| 1597 | apCtxt->operatingChannel); |
| 1598 | |
| 1599 | if (!sapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta) |
| 1600 | { |
| 1601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1602 | "Not connected any STA yet"); |
| 1603 | return -1; |
| 1604 | } |
| 1605 | |
| 1606 | for (stasLoop = 0; |
| 1607 | stasLoop < sapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta; |
| 1608 | stasLoop++) |
| 1609 | { |
Leo Chang | 473d4e9 | 2013-09-13 16:12:33 -0700 | [diff] [blame] | 1610 | vos_mem_zero((v_U8_t *)legacyRates, sizeof(legacyRates)); |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 1611 | rateArrayOrder = 0; |
| 1612 | mcsTable11n = 0; |
| 1613 | supportedChannelCount = 0; |
| 1614 | assocSta = sapEvent->sapevt.sapAssocStaListEvent.pAssocStas++; |
| 1615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1616 | "ASSOSID %d, OPM %d, nBM %d, SGI40 %d, SGI20 %d, S40 %d", |
| 1617 | assocSta->assocId, |
| 1618 | assocSta->supportedRates.opRateMode, |
| 1619 | assocSta->supportedRates.aniEnhancedRateBitmap, |
| 1620 | assocSta->ShortGI40Mhz, |
| 1621 | assocSta->ShortGI20Mhz, |
| 1622 | assocSta->Support40Mhz); |
| 1623 | |
| 1624 | /* Legacy Rate */ |
| 1625 | for (ratesLoop = 0; ratesLoop < SIR_NUM_11B_RATES; ratesLoop++) |
| 1626 | { |
| 1627 | currentRate = assocSta->supportedRates.llbRates[ratesLoop] & |
| 1628 | SAP_LEGACY_RATE_MASK; |
| 1629 | |
| 1630 | /* To fix KW error report */ |
| 1631 | if (SAP_LEGACY_RATE_COUNT <= rateArrayOrder) |
| 1632 | { |
| 1633 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1634 | "%s, Invalid array Size, break", __func__); |
| 1635 | break; |
| 1636 | } |
| 1637 | |
| 1638 | /* Make 100kbps order */ |
| 1639 | legacyRates[rateArrayOrder] = (currentRate * 100) / 20; |
| 1640 | rateArrayOrder++; |
| 1641 | if (currentRate) |
| 1642 | { |
| 1643 | supportedChannelCount++; |
| 1644 | } |
| 1645 | } |
| 1646 | for (ratesLoop = 0; ratesLoop < SIR_NUM_11A_RATES; ratesLoop++) |
| 1647 | { |
| 1648 | currentRate = assocSta->supportedRates.llaRates[ratesLoop] & |
| 1649 | SAP_LEGACY_RATE_MASK; |
| 1650 | /* To fix KW error report */ |
| 1651 | if (SAP_LEGACY_RATE_COUNT <= rateArrayOrder) |
| 1652 | { |
| 1653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1654 | "%s, Invalid array Size, break", __func__); |
| 1655 | break; |
| 1656 | } |
| 1657 | |
| 1658 | /* Make 100kbps order */ |
| 1659 | legacyRates[rateArrayOrder] = (currentRate * 100) / 20; |
| 1660 | rateArrayOrder++; |
| 1661 | if (currentRate) |
| 1662 | { |
| 1663 | supportedChannelCount++; |
| 1664 | } |
| 1665 | } |
| 1666 | if (supportedChannelCount) |
| 1667 | { |
| 1668 | for (ratesLoop = 0; ratesLoop < SAP_LEGACY_RATE_COUNT; ratesLoop++) |
| 1669 | { |
| 1670 | if (legacyRates[ratesLoop] == apCtxt->targetMCRate) |
| 1671 | { |
| 1672 | supportMap |= (1 << RATE_CFG_RATE_LEGACY); |
| 1673 | break; |
| 1674 | } |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | /* 11N */ |
| 1679 | if (eSTA_11n <= assocSta->supportedRates.opRateMode) |
| 1680 | { |
| 1681 | if (assocSta->Support40Mhz) |
| 1682 | { |
| 1683 | mcsTable11n |= 0x01; |
| 1684 | if (assocSta->ShortGI40Mhz) |
| 1685 | { |
| 1686 | mcsTable11n |= 0x02; |
| 1687 | supportMap |= (1 << RATE_CFG_RATE_11N_MCS_SGI_40); |
| 1688 | nMappingTable = n_s40_rate_mapping; |
| 1689 | } |
| 1690 | else |
| 1691 | { |
| 1692 | supportMap |= (1 << RATE_CFG_RATE_11N_MCS_LGI_40); |
| 1693 | nMappingTable = n_l40_rate_mapping; |
| 1694 | } |
| 1695 | } |
| 1696 | else |
| 1697 | { |
| 1698 | if (assocSta->ShortGI20Mhz) |
| 1699 | { |
| 1700 | mcsTable11n |= 0x02; |
| 1701 | supportMap |= (1 << RATE_CFG_RATE_11N_MCS_SGI_20); |
| 1702 | nMappingTable = n_s20_rate_mapping; |
| 1703 | } |
| 1704 | else |
| 1705 | { |
| 1706 | supportMap |= (1 << RATE_CFG_RATE_11N_MCS_LGI_20); |
| 1707 | nMappingTable = n_l20_rate_mapping; |
| 1708 | } |
| 1709 | } |
| 1710 | } |
| 1711 | |
| 1712 | #ifdef WLAN_FEATURE_11AC |
| 1713 | /* 11AC */ |
| 1714 | if (eSTA_11ac <= assocSta->supportedRates.opRateMode) |
| 1715 | { |
| 1716 | /* Find supported MAX MCS */ |
| 1717 | supportedAcMaxMcs = assocSta->supportedRates.vhtRxMCSMap & |
| 1718 | SAP_AC_MCS_MAP_MASK; |
| 1719 | supportedAcMaxMcs += SAP_AC_MCS_MAP_OFFSET; |
| 1720 | /* Find channel characteristics from MAX rate */ |
| 1721 | if (mcs_rate_11ac[supportedAcMaxMcs].cb80_rate_11ac[0] == |
| 1722 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1723 | { |
| 1724 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_LGI_80); |
| 1725 | bandWidth = RATE_CFG_RATE_BW_80; |
| 1726 | gi = RATE_CFG_RATE_GI_LONG; |
| 1727 | acMappingTable = ac_l80_rate_mapping; |
| 1728 | } |
| 1729 | else if (mcs_rate_11ac[supportedAcMaxMcs].cb80_rate_11ac[1] == |
| 1730 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1731 | { |
| 1732 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_SGI_80); |
| 1733 | bandWidth = RATE_CFG_RATE_BW_80; |
| 1734 | gi = RATE_CFG_RATE_GI_SHORT; |
| 1735 | acMappingTable = ac_s80_rate_mapping; |
| 1736 | } |
| 1737 | else if (mcs_rate_11ac[supportedAcMaxMcs].cb40_rate_11ac[0] == |
| 1738 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1739 | { |
| 1740 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_LGI_40); |
| 1741 | bandWidth = RATE_CFG_RATE_BW_40; |
| 1742 | gi = RATE_CFG_RATE_GI_LONG; |
| 1743 | acMappingTable = ac_l40_rate_mapping; |
| 1744 | } |
| 1745 | else if (mcs_rate_11ac[supportedAcMaxMcs].cb40_rate_11ac[1] == |
| 1746 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1747 | { |
| 1748 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_SGI_40); |
| 1749 | bandWidth = RATE_CFG_RATE_BW_40; |
| 1750 | gi = RATE_CFG_RATE_GI_SHORT; |
| 1751 | acMappingTable = ac_s40_rate_mapping; |
| 1752 | } |
| 1753 | else if (mcs_rate_11ac[supportedAcMaxMcs].cb20_rate_11ac[0] == |
| 1754 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1755 | { |
| 1756 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_LGI_20); |
| 1757 | bandWidth = RATE_CFG_RATE_BW_20; |
| 1758 | gi = RATE_CFG_RATE_GI_LONG; |
| 1759 | acMappingTable = ac_l20_rate_mapping; |
| 1760 | } |
| 1761 | else if (mcs_rate_11ac[supportedAcMaxMcs].cb20_rate_11ac[1] == |
| 1762 | assocSta->supportedRates.vhtRxHighestDataRate) |
| 1763 | { |
| 1764 | supportMap |= (1 << RATE_CFG_RATE_11AC_MCS_SGI_20); |
| 1765 | bandWidth = RATE_CFG_RATE_BW_20; |
| 1766 | gi = RATE_CFG_RATE_GI_SHORT; |
| 1767 | acMappingTable = ac_s20_rate_mapping; |
| 1768 | } |
| 1769 | } |
| 1770 | #endif /* WLAN_FEATURE_11AC */ |
| 1771 | combinedSupportMap &= supportMap; |
| 1772 | } |
| 1773 | |
| 1774 | if ((!combinedSupportMap) && |
| 1775 | (!sapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta)) |
| 1776 | { |
| 1777 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1778 | "%s, No Common supported rate, discard", __func__); |
| 1779 | return -1; |
| 1780 | } |
| 1781 | |
| 1782 | /* Select target band */ |
| 1783 | if (apCtxt->operatingChannel <= |
| 1784 | SAP_MAX_24_CHANNEL_NUMBER) |
| 1785 | { |
| 1786 | targetCfgId = WNI_CFG_FIXED_RATE_MULTICAST_24GHZ; |
| 1787 | } |
| 1788 | else |
| 1789 | { |
| 1790 | targetCfgId = WNI_CFG_FIXED_RATE_MULTICAST_5GHZ; |
| 1791 | } |
| 1792 | |
| 1793 | /* First find from legacy */ |
| 1794 | if (combinedSupportMap & SAP_RATE_SUPPORT_MAP_LEGACY_MASK) |
| 1795 | { |
| 1796 | for (ratesLoop = 0; ratesLoop < SAP_LEGACY_RATE_COUNT; ratesLoop++) |
| 1797 | { |
| 1798 | if (apCtxt->targetMCRate == |
| 1799 | legacy_rate_mapping[ratesLoop].rate) |
| 1800 | { |
| 1801 | targetCfgValue = legacy_rate_mapping[ratesLoop].eRateCfg; |
| 1802 | break; |
| 1803 | } |
| 1804 | } |
| 1805 | } |
| 1806 | |
| 1807 | /* If available same on 11N, update target rate */ |
| 1808 | if ((combinedSupportMap & SAP_RATE_SUPPORT_MAP_N_MASK) && |
| 1809 | (NULL != nMappingTable)) |
| 1810 | { |
| 1811 | for (ratesLoop = 0; ratesLoop < SAP_11N_RATE_COUNT; ratesLoop++) |
| 1812 | { |
| 1813 | if (apCtxt->targetMCRate == nMappingTable[ratesLoop].rate) |
| 1814 | { |
| 1815 | targetCfgValue = nMappingTable[ratesLoop].eRateCfg; |
| 1816 | break; |
| 1817 | } |
| 1818 | } |
| 1819 | } |
| 1820 | |
| 1821 | #ifdef WLAN_FEATURE_11AC |
| 1822 | /* If available same on 11AC, update target rate */ |
| 1823 | if ((combinedSupportMap & SAP_RATE_SUPPORT_MAP_AC_MASK) && |
| 1824 | (NULL != acMappingTable)) |
| 1825 | { |
| 1826 | for (ratesLoop = 0; ratesLoop < supportedAcMaxMcs; ratesLoop++) |
| 1827 | { |
| 1828 | if (apCtxt->targetMCRate == acMappingTable[ratesLoop].rate) |
| 1829 | { |
| 1830 | targetCfgValue = acMappingTable[ratesLoop].eRateCfg; |
| 1831 | break; |
| 1832 | } |
| 1833 | } |
| 1834 | } |
| 1835 | #endif /* WLAN_FEATURE_11AC */ |
| 1836 | |
| 1837 | /* Finally send config to FW */ |
| 1838 | if (targetCfgId && targetCfgValue) |
| 1839 | { |
| 1840 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1841 | "%s, Target Band %d, cfg value %d", |
| 1842 | __func__, targetCfgId, targetCfgValue); |
| 1843 | cfdStat = cfgSetInt((tpAniSirGlobal)hHal, |
| 1844 | targetCfgId, |
| 1845 | targetCfgValue); |
| 1846 | if (eSIR_SUCCESS != cfdStat) |
| 1847 | { |
| 1848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1849 | "%s, CFG Fail %d", |
| 1850 | __func__, cfdStat); |
| 1851 | rc = -1; |
| 1852 | } |
| 1853 | } |
| 1854 | |
| 1855 | return rc; |
| 1856 | }; |
| 1857 | |
| 1858 | /**--------------------------------------------------------------------------- |
| 1859 | |
| 1860 | \brief hdd_hostapd_set_mc_rate() - |
| 1861 | |
| 1862 | This is called user application set forcefully MC rate |
| 1863 | |
| 1864 | \param - pHostapdAdapter Pointer to adapter structure |
| 1865 | \param - targetRateHkbps MC rate to set, hundreds kbps order |
| 1866 | |
| 1867 | \return - int, 0 success |
| 1868 | negative fail |
| 1869 | |
| 1870 | --------------------------------------------------------------------------*/ |
| 1871 | int hdd_hostapd_set_mc_rate |
| 1872 | ( |
| 1873 | hdd_adapter_t *pHostapdAdapter, |
| 1874 | int targetRateHkbps |
| 1875 | ) |
| 1876 | { |
| 1877 | tHalHandle hHal; |
| 1878 | hdd_ap_ctx_t *apCtxt; |
| 1879 | eHalStatus smeStatus; |
| 1880 | int rc; |
| 1881 | |
| 1882 | if ((NULL == pHostapdAdapter) || (0 == targetRateHkbps)) |
| 1883 | { |
| 1884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1885 | "%s : Invalid arguments", __func__); |
| 1886 | return -1; |
| 1887 | } |
| 1888 | |
| 1889 | apCtxt = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 1890 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 1891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1892 | "hdd_hostapd_setMcRate %d", targetRateHkbps); |
| 1893 | |
| 1894 | init_completion(&apCtxt->sap_get_associated_stas_complete); |
| 1895 | |
| 1896 | apCtxt->getStasCookie = SAP_GET_STAS_COOKIE; |
| 1897 | apCtxt->targetMCRate = targetRateHkbps; |
| 1898 | apCtxt->getStasEventBuffer.sapevt.sapAssocStaListEvent.noOfAssocSta = 0; |
| 1899 | apCtxt->assocStasBuffer = (tSap_AssocMacAddr *)vos_mem_malloc( |
| 1900 | sizeof(tSap_AssocMacAddr) * HAL_NUM_ASSOC_STA); |
| 1901 | if (NULL == apCtxt->assocStasBuffer) |
| 1902 | { |
| 1903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1904 | "%s : Buffer Alloc fail", __func__); |
| 1905 | return -1; |
| 1906 | } |
| 1907 | smeStatus = sme_RoamGetAssociatedStas(hHal, |
| 1908 | pHostapdAdapter->sessionId, |
| 1909 | VOS_MODULE_ID_HDD, |
| 1910 | (void *)apCtxt, |
| 1911 | hdd_hostapd_set_mc_rate_cb, |
| 1912 | (tANI_U8 *)apCtxt->assocStasBuffer); |
| 1913 | if (smeStatus) |
| 1914 | { |
| 1915 | apCtxt->getStasCookie = 0; |
| 1916 | vos_mem_free(apCtxt->assocStasBuffer); |
| 1917 | apCtxt->assocStasBuffer = NULL; |
| 1918 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1919 | "%s : SME Issue fail", __func__); |
| 1920 | return -1; |
| 1921 | } |
| 1922 | |
| 1923 | /* Wait for completion */ |
| 1924 | rc = wait_for_completion_interruptible_timeout( |
| 1925 | &apCtxt->sap_get_associated_stas_complete, |
| 1926 | msecs_to_jiffies(SAP_MAX_GET_ASSOC_STAS_TIMEOUT)); |
| 1927 | |
| 1928 | /* either we have a response or we timed out |
| 1929 | either way, first invalidate our cookie */ |
| 1930 | apCtxt->getStasCookie = 0; |
| 1931 | if (0 >= rc) |
| 1932 | { |
| 1933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1934 | "%s : Wait timeout or interrupted", __func__); |
| 1935 | |
| 1936 | /* there is a race condition such that the callback |
| 1937 | function could be executing at the same time we are. of |
| 1938 | primary concern is if the callback function had already |
| 1939 | verified the "magic" but hasn't yet set the completion |
| 1940 | variable. Since the completion variable is on our |
| 1941 | stack, we'll delay just a bit to make sure the data is |
| 1942 | still valid if that is the case */ |
| 1943 | vos_sleep(50); |
| 1944 | /* we'll now try to test memory */ |
| 1945 | } |
| 1946 | |
| 1947 | rc = hdd_hostapd_set_mc_rate_update( |
| 1948 | &apCtxt->getStasEventBuffer, |
| 1949 | pHostapdAdapter); |
| 1950 | vos_mem_free(apCtxt->assocStasBuffer); |
| 1951 | apCtxt->assocStasBuffer = NULL; |
| 1952 | |
| 1953 | return rc; |
| 1954 | } |
| 1955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | int |
| 1957 | static iw_softap_setparam(struct net_device *dev, |
| 1958 | struct iw_request_info *info, |
| 1959 | union iwreq_data *wrqu, char *extra) |
| 1960 | { |
| 1961 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 1962 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 1963 | int *value = (int *)extra; |
| 1964 | int sub_cmd = value[0]; |
| 1965 | int set_value = value[1]; |
| 1966 | eHalStatus status; |
| 1967 | int ret = 0; /* success */ |
| 1968 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 1969 | |
| 1970 | switch(sub_cmd) |
| 1971 | { |
| 1972 | |
| 1973 | case QCSAP_PARAM_CLR_ACL: |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1974 | if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1975 | { |
| 1976 | ret = -EIO; |
| 1977 | } |
| 1978 | break; |
| 1979 | |
| 1980 | case QCSAP_PARAM_ACL_MODE: |
| 1981 | if ((eSAP_ALLOW_ALL < (eSapMacAddrACL)set_value) || |
| 1982 | (eSAP_ACCEPT_UNLESS_DENIED > (eSapMacAddrACL)set_value)) |
| 1983 | { |
| 1984 | hddLog(LOGE, FL("Invalid ACL Mode value %d"), set_value); |
| 1985 | ret = -EINVAL; |
| 1986 | } |
| 1987 | else |
| 1988 | { |
| 1989 | WLANSAP_SetMode(pVosContext, set_value); |
| 1990 | } |
| 1991 | break; |
| 1992 | case QCSAP_PARAM_MAX_ASSOC: |
| 1993 | if (WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) |
| 1994 | { |
| 1995 | hddLog(LOGE, FL("Invalid setMaxAssoc value %d"), set_value); |
| 1996 | ret = -EINVAL; |
| 1997 | } |
| 1998 | else |
| 1999 | { |
| 2000 | if (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value) |
| 2001 | { |
| 2002 | hddLog(LOGW, FL("setMaxAssoc value %d higher than max allowed %d." |
| 2003 | "Setting it to max allowed and continuing"), |
| 2004 | set_value, WNI_CFG_ASSOC_STA_LIMIT_STAMAX); |
| 2005 | set_value = WNI_CFG_ASSOC_STA_LIMIT_STAMAX; |
| 2006 | } |
| 2007 | status = ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 2008 | set_value, NULL, eANI_BOOLEAN_FALSE); |
| 2009 | if ( status != eHAL_STATUS_SUCCESS ) |
| 2010 | { |
| 2011 | hddLog(LOGE, FL("setMaxAssoc failure, status %d"), |
| 2012 | status); |
| 2013 | ret = -EIO; |
| 2014 | } |
| 2015 | } |
| 2016 | break; |
| 2017 | |
| 2018 | case QCSAP_PARAM_HIDE_SSID: |
| 2019 | { |
| 2020 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2021 | status = sme_HideSSID(hHal, pHostapdAdapter->sessionId, set_value); |
| 2022 | if(eHAL_STATUS_SUCCESS != status) |
| 2023 | { |
| 2024 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2025 | "%s: QCSAP_PARAM_HIDE_SSID failed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2026 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2027 | return status; |
| 2028 | } |
| 2029 | break; |
| 2030 | } |
| 2031 | |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 2032 | case QCSAP_PARAM_SET_MC_RATE: |
| 2033 | { |
| 2034 | if (hdd_hostapd_set_mc_rate(pHostapdAdapter, set_value)) |
| 2035 | { |
| 2036 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2037 | "%s: SET_MC_RATE failed", __func__); |
| 2038 | } |
| 2039 | break; |
| 2040 | } |
| 2041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2042 | default: |
| 2043 | hddLog(LOGE, FL("Invalid setparam command %d value %d"), |
| 2044 | sub_cmd, set_value); |
| 2045 | ret = -EINVAL; |
| 2046 | break; |
| 2047 | } |
| 2048 | |
| 2049 | return ret; |
| 2050 | } |
| 2051 | |
| 2052 | |
| 2053 | int |
| 2054 | static iw_softap_getparam(struct net_device *dev, |
| 2055 | struct iw_request_info *info, |
| 2056 | union iwreq_data *wrqu, char *extra) |
| 2057 | { |
| 2058 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2059 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 2060 | int *value = (int *)extra; |
| 2061 | int sub_cmd = value[0]; |
| 2062 | eHalStatus status; |
| 2063 | int ret = 0; /* success */ |
| 2064 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2065 | |
| 2066 | switch (sub_cmd) |
| 2067 | { |
| 2068 | case QCSAP_PARAM_MAX_ASSOC: |
| 2069 | status = ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value); |
| 2070 | if (eHAL_STATUS_SUCCESS != status) |
| 2071 | { |
| 2072 | ret = -EIO; |
| 2073 | } |
| 2074 | break; |
| 2075 | |
| 2076 | case QCSAP_PARAM_CLR_ACL: |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2077 | if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2078 | { |
| 2079 | ret = -EIO; |
| 2080 | } |
| 2081 | *value = 0; |
| 2082 | break; |
| 2083 | |
| 2084 | case QCSAP_PARAM_MODULE_DOWN_IND: |
| 2085 | { |
| 2086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2087 | "%s: sending WLAN_MODULE_DOWN_IND", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2088 | send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); |
| 2089 | #ifdef WLAN_BTAMP_FEATURE |
| 2090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2091 | "%s: Take down AMP PAL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | BSL_Deinit(vos_get_global_context(VOS_MODULE_ID_HDD, NULL)); |
| 2093 | #endif |
| 2094 | *value = 0; |
| 2095 | break; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2096 | } |
| 2097 | |
| 2098 | case QCSAP_PARAM_GET_WLAN_DBG: |
| 2099 | { |
| 2100 | vos_trace_display(); |
| 2101 | *value = 0; |
| 2102 | break; |
| 2103 | } |
| 2104 | |
| 2105 | case QCSAP_PARAM_AUTO_CHANNEL: |
| 2106 | { |
| 2107 | *value = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apAutoChannelSelection; |
| 2108 | break; |
| 2109 | } |
| 2110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2111 | default: |
| 2112 | hddLog(LOGE, FL("Invalid getparam command %d"), sub_cmd); |
| 2113 | ret = -EINVAL; |
| 2114 | break; |
| 2115 | |
| 2116 | } |
| 2117 | |
| 2118 | return ret; |
| 2119 | } |
| 2120 | |
| 2121 | /* Usage: |
| 2122 | BLACK_LIST = 0 |
| 2123 | WHITE_LIST = 1 |
| 2124 | ADD MAC = 0 |
| 2125 | REMOVE MAC = 1 |
| 2126 | |
| 2127 | mac addr will be accepted as a 6 octet mac address with each octet inputted in hex |
| 2128 | for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 2129 | while using this ioctl |
| 2130 | |
| 2131 | Syntax: |
| 2132 | iwpriv softap.0 modify_acl |
| 2133 | <6 octet mac addr> <list type> <cmd type> |
| 2134 | |
| 2135 | Examples: |
| 2136 | eg 1. to add a mac addr 00:0a:f5:89:89:90 to the black list |
| 2137 | iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 0 0 |
| 2138 | eg 2. to delete a mac addr 00:0a:f5:89:89:90 from white list |
| 2139 | iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 1 1 |
| 2140 | */ |
| 2141 | int iw_softap_modify_acl(struct net_device *dev, struct iw_request_info *info, |
| 2142 | union iwreq_data *wrqu, char *extra) |
| 2143 | { |
| 2144 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2145 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2146 | v_BYTE_t *value = (v_BYTE_t*)extra; |
| 2147 | v_U8_t pPeerStaMac[VOS_MAC_ADDR_SIZE]; |
| 2148 | int listType, cmd, i; |
| 2149 | int ret = 0; /* success */ |
| 2150 | |
| 2151 | ENTER(); |
| 2152 | for (i=0; i<VOS_MAC_ADDR_SIZE; i++) |
| 2153 | { |
| 2154 | pPeerStaMac[i] = *(value+i); |
| 2155 | } |
| 2156 | listType = (int)(*(value+i)); |
| 2157 | i++; |
| 2158 | cmd = (int)(*(value+i)); |
| 2159 | |
| 2160 | hddLog(LOG1, "%s: SAP Modify ACL arg0 %02x:%02x:%02x:%02x:%02x:%02x arg1 %d arg2 %d\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2161 | __func__, pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2162 | pPeerStaMac[3], pPeerStaMac[4], pPeerStaMac[5], listType, cmd); |
| 2163 | |
| 2164 | if (WLANSAP_ModifyACL(pVosContext, pPeerStaMac,(eSapACLType)listType,(eSapACLCmdType)cmd) |
| 2165 | != VOS_STATUS_SUCCESS) |
| 2166 | { |
| 2167 | hddLog(LOGE, FL("Modify ACL failed\n")); |
| 2168 | ret = -EIO; |
| 2169 | } |
| 2170 | EXIT(); |
| 2171 | return ret; |
| 2172 | } |
| 2173 | |
| 2174 | int |
| 2175 | static iw_softap_getchannel(struct net_device *dev, |
| 2176 | struct iw_request_info *info, |
| 2177 | union iwreq_data *wrqu, char *extra) |
| 2178 | { |
| 2179 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2180 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2181 | int *value = (int *)extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2182 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2183 | *value = (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->operatingChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | return 0; |
| 2185 | } |
| 2186 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2187 | int |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2188 | static iw_softap_set_max_tx_power(struct net_device *dev, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2189 | struct iw_request_info *info, |
| 2190 | union iwreq_data *wrqu, char *extra) |
| 2191 | { |
| 2192 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2193 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2194 | int *value = (int *)extra; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2195 | int set_value; |
| 2196 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 2197 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 2198 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2199 | if (NULL == value) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2200 | return -ENOMEM; |
| 2201 | |
Leo Chang | d37675a | 2013-08-01 13:19:45 -0700 | [diff] [blame] | 2202 | /* Assign correct slef MAC address */ |
| 2203 | vos_mem_copy(bssid, pHostapdAdapter->macAddressCurrent.bytes, |
| 2204 | VOS_MAC_ADDR_SIZE); |
| 2205 | vos_mem_copy(selfMac, pHostapdAdapter->macAddressCurrent.bytes, |
| 2206 | VOS_MAC_ADDR_SIZE); |
| 2207 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2208 | set_value = value[0]; |
| 2209 | if (eHAL_STATUS_SUCCESS != sme_SetMaxTxPower(hHal, bssid, selfMac, set_value)) |
| 2210 | { |
| 2211 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2212 | __func__); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2213 | return -EIO; |
| 2214 | } |
| 2215 | |
| 2216 | return 0; |
| 2217 | } |
| 2218 | |
| 2219 | int |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 2220 | static iw_display_data_path_snapshot(struct net_device *dev, |
| 2221 | struct iw_request_info *info, |
| 2222 | union iwreq_data *wrqu, char *extra) |
| 2223 | { |
| 2224 | |
| 2225 | /* Function intitiating dumping states of |
| 2226 | * HDD(WMM Tx Queues) |
| 2227 | * TL State (with Per Client infor) |
| 2228 | * DXE Snapshot (Called at the end of TL Snapshot) |
| 2229 | */ |
| 2230 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2231 | hddLog(LOGE, "%s: called for SAP",__func__); |
| 2232 | hdd_wmm_tx_snapshot(pHostapdAdapter); |
| 2233 | WLANTL_TLDebugMessage(VOS_TRUE); |
| 2234 | return 0; |
| 2235 | } |
| 2236 | |
| 2237 | int |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2238 | static iw_softap_set_tx_power(struct net_device *dev, |
| 2239 | struct iw_request_info *info, |
| 2240 | union iwreq_data *wrqu, char *extra) |
| 2241 | { |
| 2242 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2243 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2244 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 2245 | int *value = (int *)extra; |
| 2246 | int set_value; |
| 2247 | ptSapContext pSapCtx = NULL; |
| 2248 | |
| 2249 | if (NULL == value) |
| 2250 | return -ENOMEM; |
| 2251 | |
| 2252 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 2253 | if (NULL == pSapCtx) |
| 2254 | { |
| 2255 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2256 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 2257 | return VOS_STATUS_E_FAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2258 | } |
| 2259 | |
| 2260 | set_value = value[0]; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2261 | if (eHAL_STATUS_SUCCESS != sme_SetTxPower(hHal, pSapCtx->sessionId, set_value)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2262 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 2263 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting tx power failed", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2264 | __func__); |
| 2265 | return -EIO; |
| 2266 | } |
| 2267 | |
| 2268 | return 0; |
| 2269 | } |
| 2270 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2271 | #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0) |
| 2272 | |
| 2273 | int |
| 2274 | static iw_softap_getassoc_stamacaddr(struct net_device *dev, |
| 2275 | struct iw_request_info *info, |
| 2276 | union iwreq_data *wrqu, char *extra) |
| 2277 | { |
| 2278 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2279 | unsigned char *pmaclist; |
| 2280 | hdd_station_info_t *pStaInfo = pHostapdAdapter->aStaInfo; |
| 2281 | int cnt = 0, len; |
| 2282 | |
| 2283 | |
| 2284 | pmaclist = wrqu->data.pointer + sizeof(unsigned long int); |
| 2285 | len = wrqu->data.length; |
| 2286 | |
| 2287 | spin_lock_bh( &pHostapdAdapter->staInfo_lock ); |
| 2288 | while((cnt < WLAN_MAX_STA_COUNT) && (len > (sizeof(v_MACADDR_t)+1))) { |
| 2289 | if (TRUE == pStaInfo[cnt].isUsed) { |
| 2290 | |
| 2291 | if(!IS_BROADCAST_MAC(pStaInfo[cnt].macAddrSTA.bytes)) { |
| 2292 | memcpy((void *)pmaclist, (void *)&(pStaInfo[cnt].macAddrSTA), sizeof(v_MACADDR_t)); |
| 2293 | pmaclist += sizeof(v_MACADDR_t); |
| 2294 | len -= sizeof(v_MACADDR_t); |
| 2295 | } |
| 2296 | } |
| 2297 | cnt++; |
| 2298 | } |
| 2299 | spin_unlock_bh( &pHostapdAdapter->staInfo_lock ); |
| 2300 | |
| 2301 | *pmaclist = '\0'; |
| 2302 | |
| 2303 | wrqu->data.length -= len; |
| 2304 | |
| 2305 | *(unsigned long int *)(wrqu->data.pointer) = wrqu->data.length; |
| 2306 | |
| 2307 | return 0; |
| 2308 | } |
| 2309 | |
| 2310 | /* Usage: |
| 2311 | mac addr will be accepted as a 6 octet mac address with each octet inputted in hex |
| 2312 | for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 2313 | while using this ioctl |
| 2314 | |
| 2315 | Syntax: |
| 2316 | iwpriv softap.0 disassoc_sta <6 octet mac address> |
| 2317 | |
| 2318 | e.g. |
| 2319 | disassociate sta with mac addr 00:0a:f5:11:22:33 from softap |
| 2320 | iwpriv softap.0 disassoc_sta 0x00 0x0a 0xf5 0x11 0x22 0x33 |
| 2321 | */ |
| 2322 | |
| 2323 | int |
| 2324 | static iw_softap_disassoc_sta(struct net_device *dev, |
| 2325 | struct iw_request_info *info, |
| 2326 | union iwreq_data *wrqu, char *extra) |
| 2327 | { |
| 2328 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2329 | v_U8_t *peerMacAddr; |
| 2330 | |
| 2331 | ENTER(); |
Gopichand Nakkala | 252c9ef | 2013-02-27 17:01:23 +0530 | [diff] [blame] | 2332 | /* iwpriv tool or framework calls this ioctl with |
| 2333 | * data passed in extra (less than 16 octets); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | */ |
Gopichand Nakkala | 252c9ef | 2013-02-27 17:01:23 +0530 | [diff] [blame] | 2335 | peerMacAddr = (v_U8_t *)(extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | |
| 2337 | hddLog(LOG1, "data %02x:%02x:%02x:%02x:%02x:%02x", |
| 2338 | peerMacAddr[0], peerMacAddr[1], peerMacAddr[2], |
| 2339 | peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]); |
| 2340 | hdd_softap_sta_disassoc(pHostapdAdapter, peerMacAddr); |
| 2341 | EXIT(); |
| 2342 | return 0; |
| 2343 | } |
| 2344 | |
| 2345 | int |
| 2346 | static iw_softap_ap_stats(struct net_device *dev, |
| 2347 | struct iw_request_info *info, |
| 2348 | union iwreq_data *wrqu, char *extra) |
| 2349 | { |
| 2350 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2351 | WLANTL_TRANSFER_STA_TYPE statBuffer; |
| 2352 | char *pstatbuf; |
| 2353 | int len = wrqu->data.length; |
| 2354 | pstatbuf = wrqu->data.pointer; |
| 2355 | |
| 2356 | WLANSAP_GetStatistics((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, &statBuffer, (v_BOOL_t)wrqu->data.flags); |
| 2357 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame^] | 2358 | len = scnprintf(pstatbuf, len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | "RUF=%d RMF=%d RBF=%d " |
| 2360 | "RUB=%d RMB=%d RBB=%d " |
| 2361 | "TUF=%d TMF=%d TBF=%d " |
| 2362 | "TUB=%d TMB=%d TBB=%d", |
| 2363 | (int)statBuffer.rxUCFcnt, (int)statBuffer.rxMCFcnt, (int)statBuffer.rxBCFcnt, |
| 2364 | (int)statBuffer.rxUCBcnt, (int)statBuffer.rxMCBcnt, (int)statBuffer.rxBCBcnt, |
| 2365 | (int)statBuffer.txUCFcnt, (int)statBuffer.txMCFcnt, (int)statBuffer.txBCFcnt, |
| 2366 | (int)statBuffer.txUCBcnt, (int)statBuffer.txMCBcnt, (int)statBuffer.txBCBcnt |
| 2367 | ); |
| 2368 | |
| 2369 | wrqu->data.length -= len; |
| 2370 | return 0; |
| 2371 | } |
| 2372 | |
| 2373 | int |
| 2374 | static iw_softap_commit(struct net_device *dev, |
| 2375 | struct iw_request_info *info, |
| 2376 | union iwreq_data *wrqu, char *extra) |
| 2377 | { |
| 2378 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 2379 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2380 | hdd_hostapd_state_t *pHostapdState; |
| 2381 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2382 | tpWLAN_SAPEventCB pSapEventCallback; |
| 2383 | tsap_Config_t *pConfig; |
| 2384 | s_CommitConfig_t *pCommitConfig; |
| 2385 | struct qc_mac_acl_entry *acl_entry = NULL; |
| 2386 | v_SINT_t i = 0, num_mac = 0; |
| 2387 | v_U32_t status = 0; |
| 2388 | eCsrAuthType RSNAuthType; |
| 2389 | eCsrEncryptionType RSNEncryptType; |
| 2390 | eCsrEncryptionType mcRSNEncryptType; |
| 2391 | |
| 2392 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 2393 | pCommitConfig = (s_CommitConfig_t *)extra; |
| 2394 | |
| 2395 | pConfig = kmalloc(sizeof(tsap_Config_t), GFP_KERNEL); |
| 2396 | if(NULL == pConfig) { |
| 2397 | hddLog(LOG1, "VOS unable to allocate memory\n"); |
| 2398 | return -ENOMEM; |
| 2399 | } |
| 2400 | pConfig->beacon_int = pCommitConfig->beacon_int; |
| 2401 | pConfig->channel = pCommitConfig->channel; |
| 2402 | |
| 2403 | /*Protection parameter to enable or disable*/ |
| 2404 | pConfig->protEnabled = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 2405 | pConfig->dtim_period = pCommitConfig->dtim_period; |
| 2406 | switch(pCommitConfig->hw_mode ) |
| 2407 | { |
| 2408 | case eQC_DOT11_MODE_11A: |
| 2409 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11a; |
| 2410 | break; |
| 2411 | case eQC_DOT11_MODE_11B: |
| 2412 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11b; |
| 2413 | break; |
| 2414 | case eQC_DOT11_MODE_11G: |
| 2415 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11g; |
| 2416 | break; |
| 2417 | |
| 2418 | case eQC_DOT11_MODE_11N: |
| 2419 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 2420 | break; |
| 2421 | case eQC_DOT11_MODE_11G_ONLY: |
| 2422 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 2423 | break; |
| 2424 | case eQC_DOT11_MODE_11N_ONLY: |
| 2425 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n_ONLY; |
| 2426 | break; |
| 2427 | default: |
| 2428 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 2429 | break; |
| 2430 | |
| 2431 | } |
| 2432 | |
| 2433 | pConfig->ieee80211d = pCommitConfig->qcsap80211d; |
| 2434 | vos_mem_copy(pConfig->countryCode, pCommitConfig->countryCode, 3); |
| 2435 | if(pCommitConfig->authType == eQC_AUTH_TYPE_SHARED_KEY) |
| 2436 | pConfig->authType = eSAP_SHARED_KEY; |
| 2437 | else if(pCommitConfig->authType == eQC_AUTH_TYPE_OPEN_SYSTEM) |
| 2438 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 2439 | else |
| 2440 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 2441 | |
| 2442 | pConfig->privacy = pCommitConfig->privacy; |
| 2443 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pCommitConfig->privacy; |
| 2444 | pConfig->wps_state = pCommitConfig->wps_state; |
| 2445 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
| 2446 | pConfig->RSNWPAReqIELength = pCommitConfig->RSNWPAReqIELength; |
| 2447 | if(pConfig->RSNWPAReqIELength){ |
| 2448 | pConfig->pRSNWPAReqIE = &pCommitConfig->RSNWPAReqIE[0]; |
| 2449 | if ((pConfig->pRSNWPAReqIE[0] == DOT11F_EID_RSN) || (pConfig->pRSNWPAReqIE[0] == DOT11F_EID_WPA)){ |
| 2450 | // The actual processing may eventually be more extensive than this. |
| 2451 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 2452 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | vos_get_context( VOS_MODULE_ID_PE, pVosContext), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2454 | &RSNEncryptType, |
| 2455 | &mcRSNEncryptType, |
| 2456 | &RSNAuthType, |
| 2457 | pConfig->pRSNWPAReqIE[1]+2, |
| 2458 | pConfig->pRSNWPAReqIE ); |
| 2459 | |
| 2460 | if( VOS_STATUS_SUCCESS == status ) |
| 2461 | { |
| 2462 | // Now copy over all the security attributes you have parsed out |
| 2463 | //TODO: Need to handle mixed mode |
| 2464 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 2465 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2466 | hddLog( LOG1, FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 2468 | } |
| 2469 | } |
| 2470 | } |
| 2471 | else |
| 2472 | { |
| 2473 | /* If no RSNIE, set encrypt type to NONE*/ |
| 2474 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 2475 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 2476 | hddLog( LOG1, FL("EncryptionType = %d mcEncryptionType = %d\n"), |
| 2477 | pConfig->RSNEncryptType, pConfig->mcRSNEncryptType); |
| 2478 | } |
| 2479 | |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 2480 | if (pConfig->RSNWPAReqIELength > QCSAP_MAX_OPT_IE) { |
| 2481 | hddLog(LOGE, FL("RSNWPAReqIELength: %d too large"), pConfig->RSNWPAReqIELength); |
| 2482 | kfree(pConfig); |
| 2483 | return -EIO; |
| 2484 | } |
| 2485 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | pConfig->SSIDinfo.ssidHidden = pCommitConfig->SSIDinfo.ssidHidden; |
| 2487 | pConfig->SSIDinfo.ssid.length = pCommitConfig->SSIDinfo.ssid.length; |
| 2488 | vos_mem_copy(pConfig->SSIDinfo.ssid.ssId, pCommitConfig->SSIDinfo.ssid.ssId, pConfig->SSIDinfo.ssid.length); |
| 2489 | vos_mem_copy(pConfig->self_macaddr.bytes, pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 2490 | |
| 2491 | pConfig->SapMacaddr_acl = pCommitConfig->qc_macaddr_acl; |
| 2492 | |
| 2493 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 2494 | pConfig->ht_capab = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 2495 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2496 | if (pCommitConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 2497 | num_mac = pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2498 | else |
| 2499 | num_mac = pConfig->num_accept_mac = pCommitConfig->num_accept_mac; |
| 2500 | acl_entry = pCommitConfig->accept_mac; |
| 2501 | for (i = 0; i < num_mac; i++) |
| 2502 | { |
| 2503 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(v_MACADDR_t)); |
| 2504 | acl_entry++; |
| 2505 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2506 | if (pCommitConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 2507 | num_mac = pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2508 | else |
| 2509 | num_mac = pConfig->num_deny_mac = pCommitConfig->num_deny_mac; |
| 2510 | acl_entry = pCommitConfig->deny_mac; |
| 2511 | for (i = 0; i < num_mac; i++) |
| 2512 | { |
| 2513 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(v_MACADDR_t)); |
| 2514 | acl_entry++; |
| 2515 | } |
| 2516 | //Uapsd Enabled Bit |
| 2517 | pConfig->UapsdEnable = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 2518 | //Enable OBSS protection |
| 2519 | pConfig->obssProtEnabled = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
| 2520 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->apDisableIntraBssFwd = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apDisableIntraBssFwd; |
| 2521 | |
| 2522 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR"\n"), MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
| 2523 | hddLog(LOGW,FL("ssid =%s\n"), pConfig->SSIDinfo.ssid.ssId); |
| 2524 | hddLog(LOGW,FL("beaconint=%d, channel=%d\n"), (int)pConfig->beacon_int, (int)pConfig->channel); |
| 2525 | hddLog(LOGW,FL("hw_mode=%x\n"), pConfig->SapHw_mode); |
| 2526 | hddLog(LOGW,FL("privacy=%d, authType=%d\n"), pConfig->privacy, pConfig->authType); |
| 2527 | hddLog(LOGW,FL("RSN/WPALen=%d, \n"),(int)pConfig->RSNWPAReqIELength); |
| 2528 | hddLog(LOGW,FL("Uapsd = %d\n"),pConfig->UapsdEnable); |
| 2529 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d\n"),pConfig->protEnabled, pConfig->obssProtEnabled); |
| 2530 | hddLog(LOGW,FL("DisableIntraBssFwd = %d\n"),(WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->apDisableIntraBssFwd); |
| 2531 | |
| 2532 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 2533 | pConfig->persona = pHostapdAdapter->device_mode; |
| 2534 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig,(v_PVOID_t)dev) != VOS_STATUS_SUCCESS) |
| 2535 | { |
| 2536 | hddLog(LOGE,FL("SAP Start Bss fail\n")); |
| 2537 | } |
| 2538 | |
| 2539 | kfree(pConfig); |
| 2540 | |
| 2541 | hddLog(LOG1, FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 2542 | vos_status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 2543 | |
| 2544 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 2545 | { |
| 2546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos wait for single_event failed!!\n")); |
| 2547 | VOS_ASSERT(0); |
| 2548 | } |
| 2549 | |
| 2550 | pHostapdState->bCommit = TRUE; |
| 2551 | if(pHostapdState->vosStatus) |
| 2552 | { |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 2553 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | } |
| 2555 | else |
| 2556 | { |
| 2557 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 2558 | WLANSAP_Update_WpsIe ( pVosContext ); |
| 2559 | return 0; |
| 2560 | } |
| 2561 | } |
| 2562 | static |
| 2563 | int iw_softap_setmlme(struct net_device *dev, |
| 2564 | struct iw_request_info *info, |
| 2565 | union iwreq_data *wrqu, char *extra) |
| 2566 | { |
| 2567 | struct sQcSapreq_mlme *pmlme; |
| 2568 | hdd_adapter_t *pHostapdAdapter = (hdd_adapter_t*)(netdev_priv(dev)); |
| 2569 | v_MACADDR_t destAddress; |
| 2570 | pmlme = (struct sQcSapreq_mlme *)(wrqu->name); |
| 2571 | /* NOTE: this address is not valid incase of TKIP failure, since not filled */ |
| 2572 | vos_mem_copy(&destAddress.bytes, pmlme->im_macaddr, sizeof(v_MACADDR_t)); |
| 2573 | switch(pmlme->im_op) |
| 2574 | { |
| 2575 | case QCSAP_MLME_AUTHORIZE: |
| 2576 | hdd_softap_change_STA_state( pHostapdAdapter, &destAddress, WLANTL_STA_AUTHENTICATED); |
| 2577 | break; |
| 2578 | case QCSAP_MLME_ASSOC: |
| 2579 | //TODO:inform to TL after associating (not needed as we do in sapCallback) |
| 2580 | break; |
| 2581 | case QCSAP_MLME_UNAUTHORIZE: |
| 2582 | //TODO: send the disassoc to station |
| 2583 | //hdd_softap_change_STA_state( pHostapdAdapter, pmlme->im_macaddr, WLANTL_STA_AUTHENTICATED); |
| 2584 | break; |
| 2585 | case QCSAP_MLME_DISASSOC: |
| 2586 | hdd_softap_sta_disassoc(pHostapdAdapter,pmlme->im_macaddr); |
| 2587 | break; |
| 2588 | case QCSAP_MLME_DEAUTH: |
| 2589 | hdd_softap_sta_deauth(pHostapdAdapter,pmlme->im_macaddr); |
| 2590 | break; |
| 2591 | case QCSAP_MLME_MICFAILURE: |
| 2592 | hdd_softap_tkip_mic_fail_counter_measure(pHostapdAdapter,pmlme->im_reason); |
| 2593 | break; |
| 2594 | default: |
| 2595 | break; |
| 2596 | } |
| 2597 | return 0; |
| 2598 | } |
| 2599 | |
| 2600 | static int iw_softap_set_channel_range(struct net_device *dev, |
| 2601 | struct iw_request_info *info, |
| 2602 | union iwreq_data *wrqu, char *extra) |
| 2603 | { |
| 2604 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2605 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 2606 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2607 | |
| 2608 | int *value = (int *)extra; |
| 2609 | int startChannel = value[0]; |
| 2610 | int endChannel = value[1]; |
| 2611 | int band = value[2]; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2612 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2613 | int ret = 0; /* success */ |
| 2614 | |
| 2615 | status = WLANSAP_SetChannelRange(hHal,startChannel,endChannel,band); |
| 2616 | if(status != VOS_STATUS_SUCCESS) |
| 2617 | { |
| 2618 | hddLog( LOGE, FL("iw_softap_set_channel_range: startChannel = %d, endChannel = %d band = %d\n"), |
| 2619 | startChannel,endChannel, band); |
| 2620 | ret = -EINVAL; |
| 2621 | } |
Gopichand Nakkala | f7e53c5 | 2013-01-07 14:52:52 -0800 | [diff] [blame] | 2622 | |
| 2623 | pHddCtx->is_dynamic_channel_range_set = 1; |
| 2624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2625 | return ret; |
| 2626 | } |
| 2627 | |
| 2628 | int iw_softap_get_channel_list(struct net_device *dev, |
| 2629 | struct iw_request_info *info, |
| 2630 | union iwreq_data *wrqu, char *extra) |
| 2631 | { |
| 2632 | v_U32_t num_channels = 0; |
| 2633 | v_U8_t i = 0; |
| 2634 | v_U8_t bandStartChannel = RF_CHAN_1; |
| 2635 | v_U8_t bandEndChannel = RF_CHAN_165; |
| 2636 | v_U32_t temp_num_channels = 0; |
| 2637 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2638 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 2639 | v_REGDOMAIN_t domainIdCurrentSoftap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | tpChannelListInfo channel_list = (tpChannelListInfo) extra; |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 2641 | eCsrBand curBand = eCSR_BAND_ALL; |
| 2642 | |
| 2643 | if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &curBand)) |
| 2644 | { |
| 2645 | hddLog(LOGE,FL("not able get the current frequency band\n")); |
| 2646 | return -EIO; |
| 2647 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2648 | wrqu->data.length = sizeof(tChannelListInfo); |
| 2649 | ENTER(); |
| 2650 | |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 2651 | if (eCSR_BAND_24 == curBand) |
| 2652 | { |
| 2653 | bandStartChannel = RF_CHAN_1; |
| 2654 | bandEndChannel = RF_CHAN_14; |
| 2655 | } |
| 2656 | else if (eCSR_BAND_5G == curBand) |
| 2657 | { |
| 2658 | bandStartChannel = RF_CHAN_36; |
| 2659 | bandEndChannel = RF_CHAN_165; |
| 2660 | } |
| 2661 | |
Gopichand Nakkala | 29d0019 | 2013-06-20 19:03:52 +0530 | [diff] [blame] | 2662 | hddLog(LOG1, FL("\n curBand = %d, bandStartChannel = %hu, " |
| 2663 | "bandEndChannel = %hu "), curBand, |
Madan Mohan Koyyalamudi | bb7b43a | 2012-10-11 14:55:09 -0700 | [diff] [blame] | 2664 | bandStartChannel, bandEndChannel ); |
| 2665 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2666 | for( i = bandStartChannel; i <= bandEndChannel; i++ ) |
| 2667 | { |
| 2668 | if( NV_CHANNEL_ENABLE == regChannels[i].enabled ) |
| 2669 | { |
| 2670 | channel_list->channels[num_channels] = rfChannels[i].channelNum; |
| 2671 | num_channels++; |
| 2672 | } |
| 2673 | } |
| 2674 | |
| 2675 | /* remove indoor channels if the domain is FCC, channels 36 - 48 */ |
| 2676 | |
| 2677 | temp_num_channels = num_channels; |
| 2678 | |
| 2679 | if(eHAL_STATUS_SUCCESS != sme_getSoftApDomain(hHal,(v_REGDOMAIN_t *) &domainIdCurrentSoftap)) |
| 2680 | { |
| 2681 | hddLog(LOG1,FL("Failed to get Domain ID, %d \n"),domainIdCurrentSoftap); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 2682 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | } |
| 2684 | |
| 2685 | if(REGDOMAIN_FCC == domainIdCurrentSoftap) |
| 2686 | { |
| 2687 | for(i = 0; i < temp_num_channels; i++) |
| 2688 | { |
| 2689 | |
| 2690 | if((channel_list->channels[i] > 35) && |
| 2691 | (channel_list->channels[i] < 49)) |
| 2692 | { |
| 2693 | vos_mem_move(&channel_list->channels[i], |
| 2694 | &channel_list->channels[i+1], |
| 2695 | temp_num_channels - (i-1)); |
| 2696 | num_channels--; |
| 2697 | temp_num_channels--; |
| 2698 | i--; |
| 2699 | } |
| 2700 | } |
| 2701 | } |
| 2702 | |
| 2703 | hddLog(LOG1,FL(" number of channels %d\n"), num_channels); |
| 2704 | |
| 2705 | if (num_channels > IW_MAX_FREQUENCIES) |
| 2706 | { |
| 2707 | num_channels = IW_MAX_FREQUENCIES; |
| 2708 | } |
| 2709 | |
| 2710 | channel_list->num_channels = num_channels; |
| 2711 | EXIT(); |
| 2712 | |
| 2713 | return 0; |
| 2714 | } |
| 2715 | |
| 2716 | static |
| 2717 | int iw_get_genie(struct net_device *dev, |
| 2718 | struct iw_request_info *info, |
| 2719 | union iwreq_data *wrqu, char *extra) |
| 2720 | { |
| 2721 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2722 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2723 | eHalStatus status; |
| 2724 | v_U32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 2725 | v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 2726 | ENTER(); |
| 2727 | hddLog(LOG1,FL("getGEN_IE ioctl\n")); |
| 2728 | // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.) |
| 2729 | status = WLANSap_getstationIE_information(pVosContext, |
| 2730 | &length, |
| 2731 | genIeBytes); |
| 2732 | wrqu->data.length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN); |
| 2733 | vos_mem_copy( wrqu->data.pointer, (v_VOID_t*)genIeBytes, wrqu->data.length); |
| 2734 | |
| 2735 | hddLog(LOG1,FL(" RSN IE of %d bytes returned\n"), wrqu->data.length ); |
| 2736 | |
| 2737 | |
| 2738 | EXIT(); |
| 2739 | return 0; |
| 2740 | } |
| 2741 | static |
| 2742 | int iw_get_WPSPBCProbeReqIEs(struct net_device *dev, |
| 2743 | struct iw_request_info *info, |
| 2744 | union iwreq_data *wrqu, char *extra) |
| 2745 | { |
| 2746 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2747 | sQcSapreq_WPSPBCProbeReqIES_t *pWPSPBCProbeReqIEs; |
| 2748 | hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
| 2749 | ENTER(); |
| 2750 | |
| 2751 | hddLog(LOG1,FL("get_WPSPBCProbeReqIEs ioctl\n")); |
| 2752 | |
| 2753 | pWPSPBCProbeReqIEs = (sQcSapreq_WPSPBCProbeReqIES_t *)(wrqu->data.pointer); |
| 2754 | pWPSPBCProbeReqIEs->probeReqIELen = pHddApCtx->WPSPBCProbeReq.probeReqIELen; |
| 2755 | vos_mem_copy(pWPSPBCProbeReqIEs->probeReqIE, pHddApCtx->WPSPBCProbeReq.probeReqIE, pWPSPBCProbeReqIEs->probeReqIELen); |
| 2756 | vos_mem_copy(pWPSPBCProbeReqIEs->macaddr, pHddApCtx->WPSPBCProbeReq.peerMacAddr, sizeof(v_MACADDR_t)); |
| 2757 | wrqu->data.length = 12 + pWPSPBCProbeReqIEs->probeReqIELen; |
| 2758 | hddLog(LOG1, FL("Macaddress : "MAC_ADDRESS_STR"\n"), MAC_ADDR_ARRAY(pWPSPBCProbeReqIEs->macaddr)); |
| 2759 | up(&pHddApCtx->semWpsPBCOverlapInd); |
| 2760 | EXIT(); |
| 2761 | return 0; |
| 2762 | } |
| 2763 | |
| 2764 | /**--------------------------------------------------------------------------- |
| 2765 | |
| 2766 | \brief iw_set_auth_hostap() - |
| 2767 | This function sets the auth type received from the wpa_supplicant. |
| 2768 | |
| 2769 | \param - dev - Pointer to the net device. |
| 2770 | - info - Pointer to the iw_request_info. |
| 2771 | - wrqu - Pointer to the iwreq_data. |
| 2772 | - extra - Pointer to the data. |
| 2773 | \return - 0 for success, non zero for failure |
| 2774 | |
| 2775 | --------------------------------------------------------------------------*/ |
| 2776 | int iw_set_auth_hostap(struct net_device *dev,struct iw_request_info *info, |
| 2777 | union iwreq_data *wrqu,char *extra) |
| 2778 | { |
| 2779 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2780 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2781 | |
| 2782 | ENTER(); |
| 2783 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 2784 | { |
| 2785 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 2786 | { |
| 2787 | if(wrqu->param.value) { |
| 2788 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 2789 | "Counter Measure started %d", wrqu->param.value); |
| 2790 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 2791 | } |
| 2792 | else { |
| 2793 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 2794 | "Counter Measure stopped=%d", wrqu->param.value); |
| 2795 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 2796 | } |
| 2797 | |
| 2798 | hdd_softap_tkip_mic_fail_counter_measure(pAdapter, |
| 2799 | wrqu->param.value); |
| 2800 | } |
| 2801 | break; |
| 2802 | |
| 2803 | default: |
| 2804 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2805 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2806 | wrqu->param.flags & IW_AUTH_INDEX); |
| 2807 | break; |
| 2808 | } |
| 2809 | |
| 2810 | EXIT(); |
| 2811 | return 0; |
| 2812 | } |
| 2813 | |
| 2814 | static int iw_set_ap_encodeext(struct net_device *dev, |
| 2815 | struct iw_request_info *info, |
| 2816 | union iwreq_data *wrqu, char *extra) |
| 2817 | { |
| 2818 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2819 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 2820 | hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2821 | int retval = 0; |
| 2822 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2823 | struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; |
| 2824 | v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 2825 | int key_index; |
| 2826 | struct iw_point *encoding = &wrqu->encoding; |
| 2827 | tCsrRoamSetKey setKey; |
| 2828 | // tCsrRoamRemoveKey RemoveKey; |
| 2829 | int i; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2831 | ENTER(); |
| 2832 | |
| 2833 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 2834 | |
| 2835 | if(key_index > 0) { |
| 2836 | |
| 2837 | /*Convert from 1-based to 0-based keying*/ |
| 2838 | key_index--; |
| 2839 | } |
| 2840 | if(!ext->key_len) { |
| 2841 | #if 0 |
| 2842 | /*Set the encrytion type to NONE*/ |
| 2843 | #if 0 |
| 2844 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 2845 | #endif |
| 2846 | |
| 2847 | RemoveKey.keyId = key_index; |
| 2848 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 2849 | /*Key direction for group is RX only*/ |
| 2850 | vos_mem_copy(RemoveKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 2851 | } |
| 2852 | else { |
| 2853 | vos_mem_copy(RemoveKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 2854 | } |
| 2855 | switch(ext->alg) |
| 2856 | { |
| 2857 | case IW_ENCODE_ALG_NONE: |
| 2858 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 2859 | break; |
| 2860 | case IW_ENCODE_ALG_WEP: |
| 2861 | RemoveKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 2862 | break; |
| 2863 | case IW_ENCODE_ALG_TKIP: |
| 2864 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2865 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2866 | case IW_ENCODE_ALG_CCMP: |
| 2867 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 2868 | break; |
| 2869 | default: |
| 2870 | RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 2871 | break; |
| 2872 | } |
| 2873 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Remove key cipher_alg:%d key_len%d *pEncryptionType :%d \n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2874 | __func__,(int)ext->alg,(int)ext->key_len,RemoveKey.encType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Peer Mac = "MAC_ADDRESS_STR"\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2876 | __func__, MAC_ADDR_ARRAY(RemoveKey.peerMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | ); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2878 | vstatus = WLANSAP_DelKeySta( pVosContext, &RemoveKey); |
| 2879 | if ( vstatus != VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | { |
| 2881 | 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] | 2882 | __LINE__, vstatus ); |
| 2883 | retval = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2884 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2885 | #endif |
| 2886 | return retval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2889 | |
| 2890 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 2891 | |
| 2892 | setKey.keyId = key_index; |
| 2893 | setKey.keyLength = ext->key_len; |
| 2894 | |
| 2895 | if(ext->key_len <= CSR_MAX_KEY_LEN) { |
| 2896 | vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len); |
| 2897 | } |
| 2898 | |
| 2899 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 2900 | /*Key direction for group is RX only*/ |
| 2901 | setKey.keyDirection = eSIR_RX_ONLY; |
| 2902 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 2903 | } |
| 2904 | else { |
| 2905 | |
| 2906 | setKey.keyDirection = eSIR_TX_RX; |
| 2907 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 2908 | } |
| 2909 | if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 2910 | { |
| 2911 | setKey.keyDirection = eSIR_TX_DEFAULT; |
| 2912 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 2913 | } |
| 2914 | |
| 2915 | /*For supplicant pae role is zero*/ |
| 2916 | setKey.paeRole = 0; |
| 2917 | |
| 2918 | switch(ext->alg) |
| 2919 | { |
| 2920 | case IW_ENCODE_ALG_NONE: |
| 2921 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 2922 | break; |
| 2923 | |
| 2924 | case IW_ENCODE_ALG_WEP: |
| 2925 | setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 2926 | pHddApCtx->uPrivacy = 1; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2927 | hddLog(LOG1, "(%s) uPrivacy=%d", __func__, pHddApCtx->uPrivacy); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2928 | break; |
| 2929 | |
| 2930 | case IW_ENCODE_ALG_TKIP: |
| 2931 | { |
| 2932 | v_U8_t *pKey = &setKey.Key[0]; |
| 2933 | |
| 2934 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 2935 | |
| 2936 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 2937 | |
| 2938 | /*Supplicant sends the 32bytes key in this order |
| 2939 | |
| 2940 | |--------------|----------|----------| |
| 2941 | | Tk1 |TX-MIC | RX Mic | |
| 2942 | |--------------|----------|----------| |
| 2943 | <---16bytes---><--8bytes--><--8bytes--> |
| 2944 | |
| 2945 | */ |
| 2946 | /*Sme expects the 32 bytes key to be in the below order |
| 2947 | |
| 2948 | |--------------|----------|----------| |
| 2949 | | Tk1 |RX-MIC | TX Mic | |
| 2950 | |--------------|----------|----------| |
| 2951 | <---16bytes---><--8bytes--><--8bytes--> |
| 2952 | */ |
| 2953 | /* Copy the Temporal Key 1 (TK1) */ |
| 2954 | vos_mem_copy(pKey,ext->key,16); |
| 2955 | |
| 2956 | /*Copy the rx mic first*/ |
| 2957 | vos_mem_copy(&pKey[16],&ext->key[24],8); |
| 2958 | |
| 2959 | /*Copy the tx mic */ |
| 2960 | vos_mem_copy(&pKey[24],&ext->key[16],8); |
| 2961 | |
| 2962 | } |
| 2963 | break; |
| 2964 | |
| 2965 | case IW_ENCODE_ALG_CCMP: |
| 2966 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 2967 | break; |
| 2968 | |
| 2969 | default: |
| 2970 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 2971 | break; |
| 2972 | } |
| 2973 | |
| 2974 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2975 | ("%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] | 2976 | setKey.keyId); |
| 2977 | for(i=0; i< ext->key_len; i++) |
| 2978 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2979 | ("%02x"), setKey.Key[i]); |
| 2980 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2981 | ("\n")); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2982 | |
| 2983 | vstatus = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 2984 | if ( vstatus != VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | { |
| 2986 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2987 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", __LINE__, vstatus ); |
| 2988 | retval = -EINVAL; |
| 2989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2990 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2991 | return retval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2992 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2993 | |
| 2994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2995 | static int iw_set_ap_mlme(struct net_device *dev, |
| 2996 | struct iw_request_info *info, |
| 2997 | union iwreq_data *wrqu, |
| 2998 | char *extra) |
| 2999 | { |
| 3000 | #if 0 |
| 3001 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 3002 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
| 3003 | |
| 3004 | ENTER(); |
| 3005 | |
| 3006 | //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 3007 | switch (mlme->cmd) { |
| 3008 | case IW_MLME_DISASSOC: |
| 3009 | case IW_MLME_DEAUTH: |
| 3010 | hddLog(LOG1, "Station disassociate"); |
| 3011 | if( pAdapter->conn_info.connState == eConnectionState_Associated ) |
| 3012 | { |
| 3013 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 3014 | |
| 3015 | if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE ) |
| 3016 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 3017 | |
| 3018 | status = sme_RoamDisconnect( pAdapter->hHal,pAdapter->sessionId, reason); |
| 3019 | |
| 3020 | //clear all the reason codes |
| 3021 | if (status != 0) |
| 3022 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3023 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d \n", __func__, (int)mlme->cmd, (int)status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3024 | } |
| 3025 | |
| 3026 | netif_stop_queue(dev); |
| 3027 | netif_carrier_off(dev); |
| 3028 | } |
| 3029 | else |
| 3030 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3031 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state \n", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3032 | } |
| 3033 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3034 | hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate \n", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | return -EINVAL; |
| 3036 | }//end of switch |
| 3037 | EXIT(); |
| 3038 | #endif |
| 3039 | return 0; |
| 3040 | // return status; |
| 3041 | } |
| 3042 | |
| 3043 | static int iw_get_ap_rts_threshold(struct net_device *dev, |
| 3044 | struct iw_request_info *info, |
| 3045 | union iwreq_data *wrqu, char *extra) |
| 3046 | { |
| 3047 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3048 | v_U32_t status = 0; |
| 3049 | |
| 3050 | status = hdd_wlan_get_rts_threshold(pHostapdAdapter, wrqu); |
| 3051 | |
| 3052 | return status; |
| 3053 | } |
| 3054 | |
| 3055 | static int iw_get_ap_frag_threshold(struct net_device *dev, |
| 3056 | struct iw_request_info *info, |
| 3057 | union iwreq_data *wrqu, char *extra) |
| 3058 | { |
| 3059 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3060 | v_U32_t status = 0; |
| 3061 | |
| 3062 | status = hdd_wlan_get_frag_threshold(pHostapdAdapter, wrqu); |
| 3063 | |
| 3064 | return status; |
| 3065 | } |
| 3066 | |
| 3067 | static int iw_get_ap_freq(struct net_device *dev, struct iw_request_info *info, |
| 3068 | struct iw_freq *fwrq, char *extra) |
| 3069 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3070 | v_U32_t status = FALSE, channel = 0, freq = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3072 | tHalHandle hHal; |
| 3073 | hdd_hostapd_state_t *pHostapdState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3074 | hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3075 | |
| 3076 | ENTER(); |
| 3077 | |
| 3078 | if ((WLAN_HDD_GET_CTX(pHostapdAdapter))->isLogpInProgress) { |
| 3079 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3080 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3081 | return status; |
| 3082 | } |
| 3083 | |
| 3084 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 3085 | hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
| 3086 | |
| 3087 | if(pHostapdState->bssState == BSS_STOP ) |
| 3088 | { |
| 3089 | if (ccmCfgGetInt(hHal, WNI_CFG_CURRENT_CHANNEL, &channel) |
| 3090 | != eHAL_STATUS_SUCCESS) |
| 3091 | { |
| 3092 | return -EIO; |
| 3093 | } |
| 3094 | else |
| 3095 | { |
| 3096 | status = hdd_wlan_get_freq(channel, &freq); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3097 | if( TRUE == status) |
| 3098 | { |
| 3099 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 3100 | * iwlist & iwconfig command shows frequency into proper |
| 3101 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 3102 | fwrq->m = freq; |
| 3103 | fwrq->e = MHZ; |
| 3104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3105 | } |
| 3106 | } |
| 3107 | else |
| 3108 | { |
| 3109 | channel = pHddApCtx->operatingChannel; |
| 3110 | status = hdd_wlan_get_freq(channel, &freq); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3111 | if( TRUE == status) |
| 3112 | { |
| 3113 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 3114 | * iwlist & iwconfig command shows frequency into proper |
| 3115 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 3116 | fwrq->m = freq; |
| 3117 | fwrq->e = MHZ; |
| 3118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3120 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3121 | } |
| 3122 | |
| 3123 | static int iw_softap_setwpsie(struct net_device *dev, |
| 3124 | struct iw_request_info *info, |
| 3125 | union iwreq_data *wrqu, |
| 3126 | char *extra) |
| 3127 | { |
| 3128 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3129 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 3130 | hdd_hostapd_state_t *pHostapdState; |
| 3131 | eHalStatus halStatus= eHAL_STATUS_SUCCESS; |
| 3132 | u_int8_t *wps_genie = wrqu->data.pointer; |
| 3133 | u_int8_t *pos; |
| 3134 | tpSap_WPSIE pSap_WPSIe; |
| 3135 | u_int8_t WPSIeType; |
| 3136 | u_int16_t length; |
| 3137 | ENTER(); |
| 3138 | |
| 3139 | if(!wrqu->data.length) |
| 3140 | return 0; |
| 3141 | |
| 3142 | pSap_WPSIe = vos_mem_malloc(sizeof(tSap_WPSIE)); |
| 3143 | if (NULL == pSap_WPSIe) |
| 3144 | { |
| 3145 | hddLog(LOGE, "VOS unable to allocate memory\n"); |
| 3146 | return -ENOMEM; |
| 3147 | } |
| 3148 | vos_mem_zero(pSap_WPSIe, sizeof(tSap_WPSIE)); |
| 3149 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3150 | hddLog(LOG1,"%s WPS IE type[0x%X] IE[0x%X], LEN[%d]\n", __func__, wps_genie[0], wps_genie[1], wps_genie[2]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3151 | WPSIeType = wps_genie[0]; |
| 3152 | if ( wps_genie[0] == eQC_WPS_BEACON_IE) |
| 3153 | { |
| 3154 | pSap_WPSIe->sapWPSIECode = eSAP_WPS_BEACON_IE; |
| 3155 | wps_genie = wps_genie + 1; |
| 3156 | switch ( wps_genie[0] ) |
| 3157 | { |
| 3158 | case DOT11F_EID_WPA: |
| 3159 | if (wps_genie[1] < 2 + 4) |
| 3160 | { |
| 3161 | vos_mem_free(pSap_WPSIe); |
| 3162 | return -EINVAL; |
| 3163 | } |
| 3164 | else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) |
| 3165 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3166 | hddLog (LOG1, "%s Set WPS BEACON IE(len %d)",__func__, wps_genie[1]+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3167 | pos = &wps_genie[6]; |
| 3168 | while (((size_t)pos - (size_t)&wps_genie[6]) < (wps_genie[1] - 4) ) |
| 3169 | { |
| 3170 | switch((u_int16_t)(*pos<<8) | *(pos+1)) |
| 3171 | { |
| 3172 | case HDD_WPS_ELEM_VERSION: |
| 3173 | pos += 4; |
| 3174 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version = *pos; |
| 3175 | hddLog(LOG1, "WPS version %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version); |
| 3176 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_VER_PRESENT; |
| 3177 | pos += 1; |
| 3178 | break; |
| 3179 | |
| 3180 | case HDD_WPS_ELEM_WPS_STATE: |
| 3181 | pos +=4; |
| 3182 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState = *pos; |
| 3183 | hddLog(LOG1, "WPS State %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState); |
| 3184 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_STATE_PRESENT; |
| 3185 | pos += 1; |
| 3186 | break; |
| 3187 | case HDD_WPS_ELEM_APSETUPLOCK: |
| 3188 | pos += 4; |
| 3189 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked = *pos; |
| 3190 | hddLog(LOG1, "AP setup lock %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked); |
| 3191 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_APSETUPLOCK_PRESENT; |
| 3192 | pos += 1; |
| 3193 | break; |
| 3194 | case HDD_WPS_ELEM_SELECTEDREGISTRA: |
| 3195 | pos += 4; |
| 3196 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra = *pos; |
| 3197 | hddLog(LOG1, "Selected Registra %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra); |
| 3198 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRA_PRESENT; |
| 3199 | pos += 1; |
| 3200 | break; |
| 3201 | case HDD_WPS_ELEM_DEVICE_PASSWORD_ID: |
| 3202 | pos += 4; |
| 3203 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID = (*pos<<8) | *(pos+1); |
| 3204 | hddLog(LOG1, "Password ID: %x\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID); |
| 3205 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_DEVICEPASSWORDID_PRESENT; |
| 3206 | pos += 2; |
| 3207 | break; |
| 3208 | case HDD_WPS_ELEM_REGISTRA_CONF_METHODS: |
| 3209 | pos += 4; |
| 3210 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1); |
| 3211 | hddLog(LOG1, "Select Registra Config Methods: %x\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod); |
| 3212 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT; |
| 3213 | pos += 2; |
| 3214 | break; |
| 3215 | |
| 3216 | case HDD_WPS_ELEM_UUID_E: |
| 3217 | pos += 2; |
| 3218 | length = *pos<<8 | *(pos+1); |
| 3219 | pos += 2; |
| 3220 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSBeaconIE.UUID_E, pos, length); |
| 3221 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_UUIDE_PRESENT; |
| 3222 | pos += length; |
| 3223 | break; |
| 3224 | case HDD_WPS_ELEM_RF_BANDS: |
| 3225 | pos += 4; |
| 3226 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand = *pos; |
| 3227 | hddLog(LOG1, "RF band: %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand); |
| 3228 | pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_RF_BANDS_PRESENT; |
| 3229 | pos += 1; |
| 3230 | break; |
| 3231 | |
| 3232 | default: |
| 3233 | hddLog (LOGW, "UNKNOWN TLV in WPS IE(%x)\n", (*pos<<8 | *(pos+1))); |
| 3234 | vos_mem_free(pSap_WPSIe); |
| 3235 | return -EINVAL; |
| 3236 | } |
| 3237 | } |
| 3238 | } |
| 3239 | else { |
| 3240 | hddLog (LOGE, "%s WPS IE Mismatch %X", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3241 | __func__, wps_genie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3242 | } |
| 3243 | break; |
| 3244 | |
| 3245 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3246 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, wps_genie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3247 | vos_mem_free(pSap_WPSIe); |
| 3248 | return 0; |
| 3249 | } |
| 3250 | } |
| 3251 | else if( wps_genie[0] == eQC_WPS_PROBE_RSP_IE) |
| 3252 | { |
| 3253 | pSap_WPSIe->sapWPSIECode = eSAP_WPS_PROBE_RSP_IE; |
| 3254 | wps_genie = wps_genie + 1; |
| 3255 | switch ( wps_genie[0] ) |
| 3256 | { |
| 3257 | case DOT11F_EID_WPA: |
| 3258 | if (wps_genie[1] < 2 + 4) |
| 3259 | { |
| 3260 | vos_mem_free(pSap_WPSIe); |
| 3261 | return -EINVAL; |
| 3262 | } |
| 3263 | else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) |
| 3264 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3265 | hddLog (LOG1, "%s Set WPS PROBE RSP IE(len %d)",__func__, wps_genie[1]+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | pos = &wps_genie[6]; |
| 3267 | while (((size_t)pos - (size_t)&wps_genie[6]) < (wps_genie[1] - 4) ) |
| 3268 | { |
| 3269 | switch((u_int16_t)(*pos<<8) | *(pos+1)) |
| 3270 | { |
| 3271 | case HDD_WPS_ELEM_VERSION: |
| 3272 | pos += 4; |
| 3273 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version = *pos; |
| 3274 | hddLog(LOG1, "WPS version %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version); |
| 3275 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_VER_PRESENT; |
| 3276 | pos += 1; |
| 3277 | break; |
| 3278 | |
| 3279 | case HDD_WPS_ELEM_WPS_STATE: |
| 3280 | pos +=4; |
| 3281 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState = *pos; |
| 3282 | hddLog(LOG1, "WPS State %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState); |
| 3283 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_STATE_PRESENT; |
| 3284 | pos += 1; |
| 3285 | break; |
| 3286 | case HDD_WPS_ELEM_APSETUPLOCK: |
| 3287 | pos += 4; |
| 3288 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked = *pos; |
| 3289 | hddLog(LOG1, "AP setup lock %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked); |
| 3290 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_APSETUPLOCK_PRESENT; |
| 3291 | pos += 1; |
| 3292 | break; |
| 3293 | case HDD_WPS_ELEM_SELECTEDREGISTRA: |
| 3294 | pos += 4; |
| 3295 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra = *pos; |
| 3296 | hddLog(LOG1, "Selected Registra %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra); |
| 3297 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRA_PRESENT; |
| 3298 | pos += 1; |
| 3299 | break; |
| 3300 | case HDD_WPS_ELEM_DEVICE_PASSWORD_ID: |
| 3301 | pos += 4; |
| 3302 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID = (*pos<<8) | *(pos+1); |
| 3303 | hddLog(LOG1, "Password ID: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID); |
| 3304 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICEPASSWORDID_PRESENT; |
| 3305 | pos += 2; |
| 3306 | break; |
| 3307 | case HDD_WPS_ELEM_REGISTRA_CONF_METHODS: |
| 3308 | pos += 4; |
| 3309 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1); |
| 3310 | hddLog(LOG1, "Select Registra Config Methods: %x\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod); |
| 3311 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT; |
| 3312 | pos += 2; |
| 3313 | break; |
| 3314 | case HDD_WPS_ELEM_RSP_TYPE: |
| 3315 | pos += 4; |
| 3316 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType = *pos; |
| 3317 | hddLog(LOG1, "Config Methods: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType); |
| 3318 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RESPONSETYPE_PRESENT; |
| 3319 | pos += 1; |
| 3320 | break; |
| 3321 | case HDD_WPS_ELEM_UUID_E: |
| 3322 | pos += 2; |
| 3323 | length = *pos<<8 | *(pos+1); |
| 3324 | pos += 2; |
| 3325 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.UUID_E, pos, length); |
| 3326 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_UUIDE_PRESENT; |
| 3327 | pos += length; |
| 3328 | break; |
| 3329 | |
| 3330 | case HDD_WPS_ELEM_MANUFACTURER: |
| 3331 | pos += 2; |
| 3332 | length = *pos<<8 | *(pos+1); |
| 3333 | pos += 2; |
| 3334 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.num_name = length; |
| 3335 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.name, pos, length); |
| 3336 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MANUFACTURE_PRESENT; |
| 3337 | pos += length; |
| 3338 | break; |
| 3339 | |
| 3340 | case HDD_WPS_ELEM_MODEL_NAME: |
| 3341 | pos += 2; |
| 3342 | length = *pos<<8 | *(pos+1); |
| 3343 | pos += 2; |
| 3344 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.num_text = length; |
| 3345 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.text, pos, length); |
| 3346 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNAME_PRESENT; |
| 3347 | pos += length; |
| 3348 | break; |
| 3349 | case HDD_WPS_ELEM_MODEL_NUM: |
| 3350 | pos += 2; |
| 3351 | length = *pos<<8 | *(pos+1); |
| 3352 | pos += 2; |
| 3353 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.num_text = length; |
| 3354 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.text, pos, length); |
| 3355 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNUMBER_PRESENT; |
| 3356 | pos += length; |
| 3357 | break; |
| 3358 | case HDD_WPS_ELEM_SERIAL_NUM: |
| 3359 | pos += 2; |
| 3360 | length = *pos<<8 | *(pos+1); |
| 3361 | pos += 2; |
| 3362 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.num_text = length; |
| 3363 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.text, pos, length); |
| 3364 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SERIALNUMBER_PRESENT; |
| 3365 | pos += length; |
| 3366 | break; |
| 3367 | case HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE: |
| 3368 | pos += 4; |
| 3369 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory = (*pos<<8 | *(pos+1)); |
| 3370 | hddLog(LOG1, "primary dev category: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory); |
| 3371 | pos += 2; |
| 3372 | |
| 3373 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceOUI, pos, HDD_WPS_DEVICE_OUI_LEN); |
| 3374 | hddLog(LOG1, "primary dev oui: %02x, %02x, %02x, %02x\n", pos[0], pos[1], pos[2], pos[3]); |
| 3375 | pos += 4; |
| 3376 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory = (*pos<<8 | *(pos+1)); |
| 3377 | hddLog(LOG1, "primary dev sub category: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory); |
| 3378 | pos += 2; |
| 3379 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT; |
| 3380 | break; |
| 3381 | case HDD_WPS_ELEM_DEVICE_NAME: |
| 3382 | pos += 2; |
| 3383 | length = *pos<<8 | *(pos+1); |
| 3384 | pos += 2; |
| 3385 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.num_text = length; |
| 3386 | vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.text, pos, length); |
| 3387 | pos += length; |
| 3388 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICENAME_PRESENT; |
| 3389 | break; |
| 3390 | case HDD_WPS_ELEM_CONFIG_METHODS: |
| 3391 | pos += 4; |
| 3392 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ConfigMethod = (*pos<<8) | *(pos+1); |
| 3393 | hddLog(LOG1, "Config Methods: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod); |
| 3394 | pos += 2; |
| 3395 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_CONFIGMETHODS_PRESENT; |
| 3396 | break; |
| 3397 | |
| 3398 | case HDD_WPS_ELEM_RF_BANDS: |
| 3399 | pos += 4; |
| 3400 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand = *pos; |
| 3401 | hddLog(LOG1, "RF band: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand); |
| 3402 | pos += 1; |
| 3403 | pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RF_BANDS_PRESENT; |
| 3404 | break; |
| 3405 | } // switch |
| 3406 | } |
| 3407 | } |
| 3408 | else |
| 3409 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3410 | hddLog (LOGE, "%s WPS IE Mismatch %X",__func__, wps_genie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3411 | } |
| 3412 | |
| 3413 | } // switch |
| 3414 | } |
| 3415 | halStatus = WLANSAP_Set_WpsIe(pVosContext, pSap_WPSIe); |
| 3416 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 3417 | if( pHostapdState->bCommit && WPSIeType == eQC_WPS_PROBE_RSP_IE) |
| 3418 | { |
| 3419 | //hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3420 | //v_CONTEXT_t pVosContext = pHostapdAdapter->pvosContext; |
| 3421 | WLANSAP_Update_WpsIe ( pVosContext ); |
| 3422 | } |
| 3423 | |
| 3424 | vos_mem_free(pSap_WPSIe); |
| 3425 | EXIT(); |
| 3426 | return halStatus; |
| 3427 | } |
| 3428 | |
| 3429 | static int iw_softap_stopbss(struct net_device *dev, |
| 3430 | struct iw_request_info *info, |
| 3431 | union iwreq_data *wrqu, |
| 3432 | char *extra) |
| 3433 | { |
| 3434 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3435 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 3436 | ENTER(); |
| 3437 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
| 3438 | { |
| 3439 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) ) |
| 3440 | { |
| 3441 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 3442 | |
| 3443 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 3444 | |
| 3445 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 3446 | { |
| 3447 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3448 | ("ERROR: HDD vos wait for single_event failed!!\n")); |
| 3449 | VOS_ASSERT(0); |
| 3450 | } |
| 3451 | } |
| 3452 | clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 3453 | } |
| 3454 | EXIT(); |
| 3455 | return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 3456 | } |
| 3457 | |
| 3458 | static int iw_softap_version(struct net_device *dev, |
| 3459 | struct iw_request_info *info, |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 3460 | union iwreq_data *wrqu, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3461 | char *extra) |
| 3462 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3463 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 3464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3465 | ENTER(); |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 3466 | hdd_wlan_get_version(pHostapdAdapter, wrqu, extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | return 0; |
| 3469 | } |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3470 | |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 3471 | VOS_STATUS 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] | 3472 | { |
| 3473 | v_U8_t i; |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 3474 | int len = 0; |
| 3475 | const char sta_info_header[] = "staId staAddress\n"; |
| 3476 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame^] | 3477 | len = scnprintf(pBuf, buf_len, sta_info_header); |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 3478 | pBuf += len; |
| 3479 | buf_len -= len; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3480 | |
| 3481 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 3482 | { |
| 3483 | if(pAdapter->aStaInfo[i].isUsed) |
| 3484 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame^] | 3485 | len = scnprintf(pBuf, buf_len, "%*d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 3486 | strlen("staId"), |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3487 | pAdapter->aStaInfo[i].ucSTAId, |
| 3488 | pAdapter->aStaInfo[i].macAddrSTA.bytes[0], |
| 3489 | pAdapter->aStaInfo[i].macAddrSTA.bytes[1], |
| 3490 | pAdapter->aStaInfo[i].macAddrSTA.bytes[2], |
| 3491 | pAdapter->aStaInfo[i].macAddrSTA.bytes[3], |
| 3492 | pAdapter->aStaInfo[i].macAddrSTA.bytes[4], |
| 3493 | pAdapter->aStaInfo[i].macAddrSTA.bytes[5]); |
Yathish Hanumapuradoddi Shivanna | 7b65940 | 2013-03-25 14:12:32 -0700 | [diff] [blame] | 3494 | pBuf += len; |
| 3495 | buf_len -= len; |
| 3496 | } |
| 3497 | if(WE_GET_STA_INFO_SIZE > buf_len) |
| 3498 | { |
| 3499 | break; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3500 | } |
| 3501 | } |
| 3502 | return VOS_STATUS_SUCCESS; |
| 3503 | } |
| 3504 | |
| 3505 | static int iw_softap_get_sta_info(struct net_device *dev, |
| 3506 | struct iw_request_info *info, |
| 3507 | union iwreq_data *wrqu, |
| 3508 | char *extra) |
| 3509 | { |
| 3510 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3511 | VOS_STATUS status; |
| 3512 | ENTER(); |
Yathish Hanumapuradoddi Shivanna | 4171f7d | 2013-04-08 20:05:56 -0700 | [diff] [blame] | 3513 | status = hdd_softap_get_sta_info(pHostapdAdapter, extra, WE_SAP_MAX_STA_INFO); |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3514 | if ( !VOS_IS_STATUS_SUCCESS( status ) ) { |
| 3515 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!\n",__func__); |
| 3516 | return -EINVAL; |
| 3517 | } |
| 3518 | wrqu->data.length = strlen(extra); |
| 3519 | EXIT(); |
| 3520 | return 0; |
| 3521 | } |
| 3522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3523 | static int iw_set_ap_genie(struct net_device *dev, |
| 3524 | struct iw_request_info *info, |
| 3525 | union iwreq_data *wrqu, |
| 3526 | char *extra) |
| 3527 | { |
| 3528 | |
| 3529 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3530 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
| 3531 | eHalStatus halStatus= eHAL_STATUS_SUCCESS; |
| 3532 | u_int8_t *genie = wrqu->data.pointer; |
| 3533 | |
| 3534 | ENTER(); |
| 3535 | |
| 3536 | if(!wrqu->data.length) |
| 3537 | { |
| 3538 | EXIT(); |
| 3539 | return 0; |
| 3540 | } |
| 3541 | |
| 3542 | switch (genie[0]) |
| 3543 | { |
| 3544 | case DOT11F_EID_WPA: |
| 3545 | case DOT11F_EID_RSN: |
| 3546 | if((WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy == 0) |
| 3547 | { |
| 3548 | hdd_softap_Deregister_BC_STA(pHostapdAdapter); |
| 3549 | hdd_softap_Register_BC_STA(pHostapdAdapter, 1); |
| 3550 | } |
| 3551 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = 1; |
| 3552 | halStatus = WLANSAP_Set_WPARSNIes(pVosContext, wrqu->data.pointer, wrqu->data.length); |
| 3553 | break; |
| 3554 | |
| 3555 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3556 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, genie[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3557 | halStatus = 0; |
| 3558 | } |
| 3559 | |
| 3560 | EXIT(); |
| 3561 | return halStatus; |
| 3562 | } |
| 3563 | |
| 3564 | static VOS_STATUS wlan_hdd_get_classAstats_for_station(hdd_adapter_t *pAdapter, u8 staid) |
| 3565 | { |
| 3566 | eHalStatus hstatus; |
| 3567 | long lrc; |
| 3568 | struct statsContext context; |
| 3569 | |
| 3570 | if (NULL == pAdapter) |
| 3571 | { |
| 3572 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Padapter is NULL", __func__); |
| 3573 | return VOS_STATUS_E_FAULT; |
| 3574 | } |
| 3575 | |
| 3576 | init_completion(&context.completion); |
| 3577 | context.pAdapter = pAdapter; |
| 3578 | context.magic = STATS_CONTEXT_MAGIC; |
| 3579 | hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3580 | eCSR_HDD, |
| 3581 | SME_GLOBAL_CLASSA_STATS, |
| 3582 | hdd_GetClassA_statisticsCB, |
| 3583 | 0, // not periodic |
| 3584 | FALSE, //non-cached results |
| 3585 | staid, |
| 3586 | &context); |
| 3587 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 3588 | { |
| 3589 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3590 | "%s: Unable to retrieve statistics for link speed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3591 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3592 | } |
| 3593 | else |
| 3594 | { |
| 3595 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 3596 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 3597 | context.magic = 0; |
| 3598 | if (lrc <= 0) |
| 3599 | { |
| 3600 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3601 | "%s: SME %s while retrieving link speed", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3602 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3603 | msleep(50); |
| 3604 | } |
| 3605 | } |
| 3606 | return VOS_STATUS_SUCCESS; |
| 3607 | } |
| 3608 | |
| 3609 | int iw_get_softap_linkspeed(struct net_device *dev, |
| 3610 | struct iw_request_info *info, |
| 3611 | union iwreq_data *wrqu, |
| 3612 | char *extra) |
| 3613 | |
| 3614 | { |
| 3615 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3616 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3617 | char *pLinkSpeed = (char*)extra; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3618 | v_U32_t link_speed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3619 | unsigned short staId; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3620 | int len = sizeof(v_U32_t)+1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | v_BYTE_t macAddress[VOS_MAC_ADDR_SIZE]; |
| 3622 | VOS_STATUS status; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3623 | int rc, valid; |
| 3624 | |
| 3625 | pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3626 | |
| 3627 | valid = wlan_hdd_validate_context(pHddCtx); |
| 3628 | |
| 3629 | if (0 != valid) |
| 3630 | { |
| 3631 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context not valid")); |
| 3632 | return valid; |
| 3633 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3634 | |
Madan Mohan Koyyalamudi | e68989b | 2013-09-10 01:15:19 +0530 | [diff] [blame] | 3635 | hddLog(VOS_TRACE_LEVEL_INFO, "%s wrqu->data.length= %d\n", __func__, wrqu->data.length); |
| 3636 | status = hdd_string_to_hex ((char *)wrqu->data.pointer, wrqu->data.length, macAddress ); |
| 3637 | |
| 3638 | if (!VOS_IS_STATUS_SUCCESS(status )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3639 | { |
Madan Mohan Koyyalamudi | e68989b | 2013-09-10 01:15:19 +0530 | [diff] [blame] | 3640 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("String to Hex conversion Failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3641 | } |
| 3642 | |
Madan Mohan Koyyalamudi | e68989b | 2013-09-10 01:15:19 +0530 | [diff] [blame] | 3643 | /* If no mac address is passed and/or its length is less than 18, |
| 3644 | * link speed for first connected client will be returned. |
| 3645 | */ |
| 3646 | if (!VOS_IS_STATUS_SUCCESS(status ) || wrqu->data.length < 18) |
| 3647 | { |
| 3648 | status = hdd_softap_GetConnectedStaId(pHostapdAdapter, (void *)(&staId)); |
| 3649 | } |
| 3650 | else |
| 3651 | { |
| 3652 | status = hdd_softap_GetStaId(pHostapdAdapter, |
| 3653 | (v_MACADDR_t *)macAddress, (void *)(&staId)); |
| 3654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3656 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3658 | 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] | 3659 | link_speed = 0; |
| 3660 | } |
| 3661 | else |
| 3662 | { |
| 3663 | status = wlan_hdd_get_classAstats_for_station(pHostapdAdapter , staId); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | if (!VOS_IS_STATUS_SUCCESS(status )) |
| 3666 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to retrieve SME statistics")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | return -EINVAL; |
| 3669 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3670 | |
| 3671 | WLANTL_GetSTALinkCapacity(pHddCtx->pvosContext, |
| 3672 | staId, &link_speed); |
| 3673 | |
| 3674 | link_speed = link_speed / 10; |
| 3675 | |
| 3676 | if (0 == link_speed) |
| 3677 | { |
| 3678 | /* The linkspeed returned by HAL is in units of 500kbps. |
| 3679 | * converting it to mbps. |
| 3680 | * This is required to support legacy firmware which does |
| 3681 | * not return link capacity. |
| 3682 | */ |
| 3683 | link_speed =(int)pHostapdAdapter->hdd_stats.ClassA_stat.tx_rate/2; |
| 3684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3685 | } |
| 3686 | |
| 3687 | wrqu->data.length = len; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3688 | rc = snprintf(pLinkSpeed, len, "%lu", link_speed); |
| 3689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3690 | if ((rc < 0) || (rc >= len)) |
| 3691 | { |
| 3692 | // encoding or length error? |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3693 | hddLog(VOS_TRACE_LEVEL_ERROR,FL( "Unable to encode link speed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3694 | return -EIO; |
| 3695 | } |
| 3696 | |
| 3697 | return 0; |
| 3698 | } |
| 3699 | |
| 3700 | static const iw_handler hostapd_handler[] = |
| 3701 | { |
| 3702 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
| 3703 | (iw_handler) NULL, /* SIOCGIWNAME */ |
| 3704 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 3705 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 3706 | (iw_handler) NULL, /* SIOCSIWFREQ */ |
| 3707 | (iw_handler) iw_get_ap_freq, /* SIOCGIWFREQ */ |
| 3708 | (iw_handler) NULL, /* SIOCSIWMODE */ |
| 3709 | (iw_handler) NULL, /* SIOCGIWMODE */ |
| 3710 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 3711 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 3712 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 3713 | (iw_handler) NULL, /* SIOCGIWRANGE */ |
| 3714 | (iw_handler) NULL, /* SIOCSIWPRIV */ |
| 3715 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 3716 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 3717 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 3718 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 3719 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 3720 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 3721 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 3722 | (iw_handler) NULL, /* SIOCSIWAP */ |
| 3723 | (iw_handler) NULL, /* SIOCGIWAP */ |
| 3724 | (iw_handler) iw_set_ap_mlme, /* SIOCSIWMLME */ |
| 3725 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 3726 | (iw_handler) NULL, /* SIOCSIWSCAN */ |
| 3727 | (iw_handler) NULL, /* SIOCGIWSCAN */ |
| 3728 | (iw_handler) NULL, /* SIOCSIWESSID */ |
| 3729 | (iw_handler) NULL, /* SIOCGIWESSID */ |
| 3730 | (iw_handler) NULL, /* SIOCSIWNICKN */ |
| 3731 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
| 3732 | (iw_handler) NULL, /* -- hole -- */ |
| 3733 | (iw_handler) NULL, /* -- hole -- */ |
| 3734 | (iw_handler) NULL, /* SIOCSIWRATE */ |
| 3735 | (iw_handler) NULL, /* SIOCGIWRATE */ |
| 3736 | (iw_handler) NULL, /* SIOCSIWRTS */ |
| 3737 | (iw_handler) iw_get_ap_rts_threshold, /* SIOCGIWRTS */ |
| 3738 | (iw_handler) NULL, /* SIOCSIWFRAG */ |
| 3739 | (iw_handler) iw_get_ap_frag_threshold, /* SIOCGIWFRAG */ |
| 3740 | (iw_handler) NULL, /* SIOCSIWTXPOW */ |
| 3741 | (iw_handler) NULL, /* SIOCGIWTXPOW */ |
| 3742 | (iw_handler) NULL, /* SIOCSIWRETRY */ |
| 3743 | (iw_handler) NULL, /* SIOCGIWRETRY */ |
| 3744 | (iw_handler) NULL, /* SIOCSIWENCODE */ |
| 3745 | (iw_handler) NULL, /* SIOCGIWENCODE */ |
| 3746 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
| 3747 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
| 3748 | (iw_handler) NULL, /* -- hole -- */ |
| 3749 | (iw_handler) NULL, /* -- hole -- */ |
| 3750 | (iw_handler) iw_set_ap_genie, /* SIOCSIWGENIE */ |
| 3751 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
| 3752 | (iw_handler) iw_set_auth_hostap, /* SIOCSIWAUTH */ |
| 3753 | (iw_handler) NULL, /* SIOCGIWAUTH */ |
| 3754 | (iw_handler) iw_set_ap_encodeext, /* SIOCSIWENCODEEXT */ |
| 3755 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
| 3756 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 3757 | }; |
| 3758 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 3759 | #define IW_PRIV_TYPE_OPTIE (IW_PRIV_TYPE_BYTE | QCSAP_MAX_OPT_IE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3760 | #define IW_PRIV_TYPE_MLME \ |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 3761 | (IW_PRIV_TYPE_BYTE | sizeof(struct ieee80211req_mlme)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3762 | |
| 3763 | static const struct iw_priv_args hostapd_private_args[] = { |
| 3764 | { QCSAP_IOCTL_SETPARAM, |
| 3765 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" }, |
| 3766 | { QCSAP_IOCTL_SETPARAM, |
| 3767 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" }, |
| 3768 | { QCSAP_PARAM_MAX_ASSOC, |
| 3769 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMaxAssoc" }, |
| 3770 | { QCSAP_PARAM_HIDE_SSID, |
| 3771 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "hideSSID" }, |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 3772 | { QCSAP_PARAM_SET_MC_RATE, |
| 3773 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMcRate" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3774 | { QCSAP_IOCTL_GETPARAM, |
| 3775 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 3776 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getparam" }, |
| 3777 | { QCSAP_IOCTL_GETPARAM, 0, |
| 3778 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "" }, |
| 3779 | { QCSAP_PARAM_MAX_ASSOC, 0, |
| 3780 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getMaxAssoc" }, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3781 | { QCSAP_PARAM_GET_WLAN_DBG, 0, |
| 3782 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getwlandbg" }, |
| 3783 | { QCSAP_PARAM_AUTO_CHANNEL, 0, |
| 3784 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getAutoChannel" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3785 | { QCSAP_PARAM_MODULE_DOWN_IND, 0, |
| 3786 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "moduleDownInd" }, |
| 3787 | { QCSAP_PARAM_CLR_ACL, 0, |
| 3788 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "setClearAcl" }, |
| 3789 | { QCSAP_PARAM_ACL_MODE, |
| 3790 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAclMode" }, |
| 3791 | { QCSAP_IOCTL_COMMIT, |
| 3792 | IW_PRIV_TYPE_BYTE | sizeof(struct s_CommitConfig) | IW_PRIV_SIZE_FIXED, 0, "commit" }, |
| 3793 | { QCSAP_IOCTL_SETMLME, |
| 3794 | IW_PRIV_TYPE_BYTE | sizeof(struct sQcSapreq_mlme)| IW_PRIV_SIZE_FIXED, 0, "setmlme" }, |
| 3795 | { QCSAP_IOCTL_GET_STAWPAIE, |
| 3796 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "get_staWPAIE" }, |
| 3797 | { QCSAP_IOCTL_SETWPAIE, |
| 3798 | IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE | IW_PRIV_SIZE_FIXED, 0, "setwpaie" }, |
| 3799 | { QCSAP_IOCTL_STOPBSS, |
| 3800 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED, 0, "stopbss" }, |
| 3801 | { QCSAP_IOCTL_VERSION, 0, |
| 3802 | IW_PRIV_TYPE_CHAR | QCSAP_MAX_WSC_IE, "version" }, |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3803 | { QCSAP_IOCTL_GET_STA_INFO, 0, |
| 3804 | IW_PRIV_TYPE_CHAR | WE_SAP_MAX_STA_INFO, "get_sta_info" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3805 | { QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES, |
| 3806 | IW_PRIV_TYPE_BYTE | sizeof(sQcSapreq_WPSPBCProbeReqIES_t) | IW_PRIV_SIZE_FIXED | 1, 0, "getProbeReqIEs" }, |
| 3807 | { QCSAP_IOCTL_GET_CHANNEL, 0, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3808 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getchannel" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3809 | { QCSAP_IOCTL_ASSOC_STA_MACADDR, 0, |
| 3810 | IW_PRIV_TYPE_BYTE | /*((WLAN_MAX_STA_COUNT*6)+100)*/1 , "get_assoc_stamac" }, |
| 3811 | { QCSAP_IOCTL_DISASSOC_STA, |
| 3812 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 6 , 0, "disassoc_sta" }, |
| 3813 | { QCSAP_IOCTL_AP_STATS, |
| 3814 | IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE, 0, "ap_stats" }, |
| 3815 | { QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED, |
| 3816 | IW_PRIV_TYPE_CHAR | 18, |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3817 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3818 | |
| 3819 | { QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE, |
| 3820 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "" }, |
| 3821 | /* handlers for sub-ioctl */ |
| 3822 | { WE_SET_WLAN_DBG, |
| 3823 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 3824 | 0, |
| 3825 | "setwlandbg" }, |
| 3826 | |
| 3827 | /* handlers for main ioctl */ |
| 3828 | { QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE, |
| 3829 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 3830 | 0, |
| 3831 | "" }, |
| 3832 | |
| 3833 | /* handlers for sub-ioctl */ |
| 3834 | { WE_LOG_DUMP_CMD, |
| 3835 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 3836 | 0, |
| 3837 | "dump" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3838 | { WE_P2P_NOA_CMD, |
| 3839 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 3840 | 0, |
| 3841 | "SetP2pPs" }, |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 3842 | /* handlers for sub ioctl */ |
| 3843 | { |
| 3844 | WE_MCC_CONFIG_CREDENTIAL, |
| 3845 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 3846 | 0, |
| 3847 | "setMccCrdnl" }, |
| 3848 | |
| 3849 | /* handlers for sub ioctl */ |
| 3850 | { |
| 3851 | WE_MCC_CONFIG_PARAMS, |
| 3852 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 3853 | 0, |
| 3854 | "setMccConfig" }, |
| 3855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3856 | /* handlers for main ioctl */ |
| 3857 | { QCSAP_IOCTL_MODIFY_ACL, |
| 3858 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 8, |
| 3859 | 0, |
| 3860 | "modify_acl" }, |
| 3861 | |
| 3862 | /* handlers for main ioctl */ |
| 3863 | { QCSAP_IOCTL_GET_CHANNEL_LIST, |
| 3864 | 0, |
| 3865 | IW_PRIV_TYPE_BYTE | sizeof(tChannelListInfo), |
| 3866 | "getChannelList" }, |
| 3867 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3868 | /* handlers for main ioctl */ |
| 3869 | { QCSAP_IOCTL_SET_TX_POWER, |
| 3870 | IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1, |
| 3871 | 0, |
Madan Mohan Koyyalamudi | d12bf05 | 2012-11-27 19:07:55 +0530 | [diff] [blame] | 3872 | "setTxPower" }, |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3873 | |
| 3874 | /* handlers for main ioctl */ |
| 3875 | { QCSAP_IOCTL_SET_MAX_TX_POWER, |
| 3876 | IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1, |
| 3877 | 0, |
| 3878 | "setTxMaxPower" }, |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 3879 | { QCSAP_IOCTL_DATAPATH_SNAP_SHOT, |
| 3880 | IW_PRIV_TYPE_NONE | IW_PRIV_TYPE_NONE, 0, "dataSnapshot" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3881 | }; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3883 | static const iw_handler hostapd_private[] = { |
| 3884 | [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam, //set priv ioctl |
| 3885 | [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam, //get priv ioctl |
| 3886 | [QCSAP_IOCTL_COMMIT - SIOCIWFIRSTPRIV] = iw_softap_commit, //get priv ioctl |
| 3887 | [QCSAP_IOCTL_SETMLME - SIOCIWFIRSTPRIV] = iw_softap_setmlme, |
| 3888 | [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, //get station genIE |
| 3889 | [QCSAP_IOCTL_SETWPAIE - SIOCIWFIRSTPRIV] = iw_softap_setwpsie, |
| 3890 | [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss, // stop bss |
| 3891 | [QCSAP_IOCTL_VERSION - SIOCIWFIRSTPRIV] = iw_softap_version, // get driver version |
| 3892 | [QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES - SIOCIWFIRSTPRIV] = iw_get_WPSPBCProbeReqIEs, |
| 3893 | [QCSAP_IOCTL_GET_CHANNEL - SIOCIWFIRSTPRIV] = iw_softap_getchannel, |
| 3894 | [QCSAP_IOCTL_ASSOC_STA_MACADDR - SIOCIWFIRSTPRIV] = iw_softap_getassoc_stamacaddr, |
| 3895 | [QCSAP_IOCTL_DISASSOC_STA - SIOCIWFIRSTPRIV] = iw_softap_disassoc_sta, |
| 3896 | [QCSAP_IOCTL_AP_STATS - SIOCIWFIRSTPRIV] = iw_softap_ap_stats, |
| 3897 | [QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone, |
| 3898 | [QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_var_ints_getnone, |
| 3899 | [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range, |
| 3900 | [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV] = iw_softap_modify_acl, |
| 3901 | [QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV] = iw_softap_get_channel_list, |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 3902 | [QCSAP_IOCTL_GET_STA_INFO - SIOCIWFIRSTPRIV] = iw_softap_get_sta_info, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3903 | [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_softap_linkspeed, |
| 3904 | [QCSAP_IOCTL_SET_TX_POWER - SIOCIWFIRSTPRIV] = iw_softap_set_tx_power, |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 3905 | [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] | 3906 | [QCSAP_IOCTL_DATAPATH_SNAP_SHOT - SIOCIWFIRSTPRIV] = iw_display_data_path_snapshot, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3907 | }; |
| 3908 | const struct iw_handler_def hostapd_handler_def = { |
| 3909 | .num_standard = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]), |
| 3910 | .num_private = sizeof(hostapd_private) / sizeof(hostapd_private[0]), |
| 3911 | .num_private_args = sizeof(hostapd_private_args) / sizeof(hostapd_private_args[0]), |
| 3912 | .standard = (iw_handler *)hostapd_handler, |
| 3913 | .private = (iw_handler *)hostapd_private, |
| 3914 | .private_args = hostapd_private_args, |
| 3915 | .get_wireless_stats = NULL, |
| 3916 | }; |
| 3917 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) |
| 3918 | struct net_device_ops net_ops_struct = { |
| 3919 | .ndo_open = hdd_hostapd_open, |
| 3920 | .ndo_stop = hdd_hostapd_stop, |
| 3921 | .ndo_uninit = hdd_hostapd_uninit, |
| 3922 | .ndo_start_xmit = hdd_softap_hard_start_xmit, |
| 3923 | .ndo_tx_timeout = hdd_softap_tx_timeout, |
| 3924 | .ndo_get_stats = hdd_softap_stats, |
| 3925 | .ndo_set_mac_address = hdd_hostapd_set_mac_address, |
| 3926 | .ndo_do_ioctl = hdd_hostapd_ioctl, |
| 3927 | .ndo_change_mtu = hdd_hostapd_change_mtu, |
| 3928 | .ndo_select_queue = hdd_hostapd_select_queue, |
| 3929 | }; |
| 3930 | #endif |
| 3931 | |
| 3932 | int hdd_set_hostapd(hdd_adapter_t *pAdapter) |
| 3933 | { |
| 3934 | return VOS_STATUS_SUCCESS; |
| 3935 | } |
| 3936 | |
| 3937 | void hdd_set_ap_ops( struct net_device *pWlanHostapdDev ) |
| 3938 | { |
| 3939 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) |
| 3940 | pWlanHostapdDev->netdev_ops = &net_ops_struct; |
| 3941 | #else |
| 3942 | pWlanHostapdDev->open = hdd_hostapd_open; |
| 3943 | pWlanHostapdDev->stop = hdd_hostapd_stop; |
| 3944 | pWlanHostapdDev->uninit = hdd_hostapd_uninit; |
| 3945 | pWlanHostapdDev->hard_start_xmit = hdd_softap_hard_start_xmit; |
| 3946 | pWlanHostapdDev->tx_timeout = hdd_softap_tx_timeout; |
| 3947 | pWlanHostapdDev->get_stats = hdd_softap_stats; |
| 3948 | pWlanHostapdDev->set_mac_address = hdd_hostapd_set_mac_address; |
| 3949 | pWlanHostapdDev->do_ioctl = hdd_hostapd_ioctl; |
| 3950 | #endif |
| 3951 | } |
| 3952 | |
| 3953 | VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter ) |
| 3954 | { |
| 3955 | hdd_hostapd_state_t * phostapdBuf; |
| 3956 | struct net_device *dev = pAdapter->dev; |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 3957 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3958 | VOS_STATUS status; |
| 3959 | ENTER(); |
| 3960 | // Allocate the Wireless Extensions state structure |
| 3961 | phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR( pAdapter ); |
| 3962 | |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 3963 | sme_SetCurrDeviceMode(pHddCtx->hHal, pAdapter->device_mode); |
| 3964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3965 | // Zero the memory. This zeros the profile structure. |
| 3966 | memset(phostapdBuf, 0,sizeof(hdd_hostapd_state_t)); |
| 3967 | |
| 3968 | // Set up the pointer to the Wireless Extensions state structure |
| 3969 | // NOP |
| 3970 | status = hdd_set_hostapd(pAdapter); |
| 3971 | if(!VOS_IS_STATUS_SUCCESS(status)) { |
| 3972 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_hostapd failed!!\n")); |
| 3973 | return status; |
| 3974 | } |
| 3975 | |
| 3976 | status = vos_event_init(&phostapdBuf->vosEvent); |
| 3977 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 3978 | { |
| 3979 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: Hostapd HDD vos event init failed!!\n")); |
| 3980 | return status; |
| 3981 | } |
| 3982 | |
| 3983 | init_completion(&pAdapter->session_close_comp_var); |
| 3984 | init_completion(&pAdapter->session_open_comp_var); |
| 3985 | |
| 3986 | sema_init(&(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->semWpsPBCOverlapInd, 1); |
| 3987 | |
| 3988 | // Register as a wireless device |
| 3989 | dev->wireless_handlers = (struct iw_handler_def *)& hostapd_handler_def; |
| 3990 | |
| 3991 | //Initialize the data path module |
| 3992 | status = hdd_softap_init_tx_rx(pAdapter); |
| 3993 | if ( !VOS_IS_STATUS_SUCCESS( status )) |
| 3994 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3995 | 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] | 3996 | } |
Madan Mohan Koyyalamudi | 8c6dec8 | 2013-09-26 15:56:13 +0530 | [diff] [blame] | 3997 | |
| 3998 | status = hdd_wmm_adapter_init( pAdapter ); |
| 3999 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 4000 | { |
| 4001 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4002 | "hdd_wmm_adapter_init() failed with status code %08d [x%08lx]", |
| 4003 | status, status ); |
| 4004 | goto error_wmm_init; |
| 4005 | } |
| 4006 | |
| 4007 | set_bit(WMM_INIT_DONE, &pAdapter->event_flags); |
| 4008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4009 | wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), pAdapter ); |
Madan Mohan Koyyalamudi | 8c6dec8 | 2013-09-26 15:56:13 +0530 | [diff] [blame] | 4010 | |
| 4011 | return status; |
| 4012 | |
| 4013 | error_wmm_init: |
| 4014 | hdd_softap_deinit_tx_rx( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4015 | EXIT(); |
| 4016 | return status; |
| 4017 | } |
| 4018 | |
| 4019 | hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *iface_name ) |
| 4020 | { |
| 4021 | struct net_device *pWlanHostapdDev = NULL; |
| 4022 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 4023 | v_CONTEXT_t pVosContext= NULL; |
| 4024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4025 | pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4026 | |
| 4027 | if (pWlanHostapdDev != NULL) |
| 4028 | { |
| 4029 | pHostapdAdapter = netdev_priv(pWlanHostapdDev); |
| 4030 | |
| 4031 | //Init the net_device structure |
| 4032 | ether_setup(pWlanHostapdDev); |
| 4033 | |
| 4034 | //Initialize the adapter context to zeros. |
| 4035 | vos_mem_zero(pHostapdAdapter, sizeof( hdd_adapter_t )); |
| 4036 | pHostapdAdapter->dev = pWlanHostapdDev; |
| 4037 | pHostapdAdapter->pHddCtx = pHddCtx; |
| 4038 | pHostapdAdapter->magic = WLAN_HDD_ADAPTER_MAGIC; |
| 4039 | |
| 4040 | //Get the Global VOSS context. |
| 4041 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 4042 | //Save the adapter context in global context for future. |
| 4043 | ((VosContextType*)(pVosContext))->pHDDSoftAPContext = (v_VOID_t*)pHostapdAdapter; |
| 4044 | |
| 4045 | //Init the net_device structure |
| 4046 | strlcpy(pWlanHostapdDev->name, (const char *)iface_name, IFNAMSIZ); |
| 4047 | |
| 4048 | hdd_set_ap_ops( pHostapdAdapter->dev ); |
| 4049 | |
| 4050 | pWlanHostapdDev->tx_queue_len = NET_DEV_TX_QUEUE_LEN; |
| 4051 | pWlanHostapdDev->watchdog_timeo = HDD_TX_TIMEOUT; |
| 4052 | pWlanHostapdDev->mtu = HDD_DEFAULT_MTU; |
| 4053 | |
| 4054 | vos_mem_copy(pWlanHostapdDev->dev_addr, (void *)macAddr,sizeof(tSirMacAddr)); |
| 4055 | vos_mem_copy(pHostapdAdapter->macAddressCurrent.bytes, (void *)macAddr, sizeof(tSirMacAddr)); |
| 4056 | |
| 4057 | pWlanHostapdDev->destructor = free_netdev; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4058 | pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ; |
| 4059 | pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy; |
| 4060 | pHostapdAdapter->wdev.netdev = pWlanHostapdDev; |
| 4061 | init_completion(&pHostapdAdapter->tx_action_cnf_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | init_completion(&pHostapdAdapter->cancel_rem_on_chan_var); |
| 4063 | init_completion(&pHostapdAdapter->rem_on_chan_ready_event); |
| 4064 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 4065 | init_completion(&pHostapdAdapter->offchannel_tx_event); |
| 4066 | #endif |
| 4067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | SET_NETDEV_DEV(pWlanHostapdDev, pHddCtx->parent_dev); |
| 4069 | } |
| 4070 | return pHostapdAdapter; |
| 4071 | } |
| 4072 | |
| 4073 | VOS_STATUS hdd_register_hostapd( hdd_adapter_t *pAdapter, tANI_U8 rtnl_lock_held ) |
| 4074 | { |
| 4075 | struct net_device *dev = pAdapter->dev; |
| 4076 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4077 | |
| 4078 | ENTER(); |
| 4079 | |
| 4080 | if( rtnl_lock_held ) |
| 4081 | { |
Madan Mohan Koyyalamudi | d8ac866 | 2012-11-06 19:04:56 -0800 | [diff] [blame] | 4082 | if (strnchr(dev->name, strlen(dev->name), '%')) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4083 | if( dev_alloc_name(dev, dev->name) < 0 ) |
| 4084 | { |
| 4085 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s:Failed:dev_alloc_name", __func__); |
| 4086 | return VOS_STATUS_E_FAILURE; |
| 4087 | } |
| 4088 | } |
| 4089 | if (register_netdevice(dev)) |
| 4090 | { |
| 4091 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 4092 | "%s:Failed:register_netdevice", __func__); |
| 4093 | return VOS_STATUS_E_FAILURE; |
| 4094 | } |
| 4095 | } |
| 4096 | else |
| 4097 | { |
| 4098 | if (register_netdev(dev)) |
| 4099 | { |
| 4100 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed:register_netdev", __func__); |
| 4101 | return VOS_STATUS_E_FAILURE; |
| 4102 | } |
| 4103 | } |
| 4104 | set_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags); |
| 4105 | |
| 4106 | EXIT(); |
| 4107 | return status; |
| 4108 | } |
| 4109 | |
| 4110 | VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter) |
| 4111 | { |
| 4112 | ENTER(); |
| 4113 | |
| 4114 | hdd_softap_deinit_tx_rx(pAdapter); |
| 4115 | |
| 4116 | /* if we are being called during driver unload, then the dev has already |
| 4117 | been invalidated. if we are being called at other times, then we can |
| 4118 | detatch the wireless device handlers */ |
| 4119 | if (pAdapter->dev) |
| 4120 | { |
| 4121 | pAdapter->dev->wireless_handlers = NULL; |
| 4122 | } |
| 4123 | EXIT(); |
| 4124 | return 0; |
| 4125 | } |