Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [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 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 21 | |
| 22 | /**======================================================================== |
| 23 | |
| 24 | \file wlan_hdd_cfg80211.c |
| 25 | |
| 26 | \brief WLAN Host Device Driver implementation |
| 27 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 28 | Copyright 2008 (c) Qualcomm Technologies, Inc. All Rights Reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 30 | Qualcomm Technologies Confidential and Proprietary. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | |
| 32 | ========================================================================*/ |
| 33 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 34 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 35 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 36 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 37 | |
| 38 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 39 | This section contains comments describing changes made to the module. |
| 40 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
| 42 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 43 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | |
| 45 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 46 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | -------- --- -------------------------------------------------------- |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 48 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | |
| 50 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 51 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 52 | ==========================================================================*/ |
| 53 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | |
| 55 | #include <linux/version.h> |
| 56 | #include <linux/module.h> |
| 57 | #include <linux/kernel.h> |
| 58 | #include <linux/init.h> |
| 59 | #include <linux/wireless.h> |
| 60 | #include <wlan_hdd_includes.h> |
| 61 | #include <net/arp.h> |
| 62 | #include <net/cfg80211.h> |
| 63 | #include <linux/wireless.h> |
| 64 | #include <wlan_hdd_wowl.h> |
| 65 | #include <aniGlobal.h> |
| 66 | #include "ccmApi.h" |
| 67 | #include "sirParams.h" |
| 68 | #include "dot11f.h" |
| 69 | #include "wlan_hdd_assoc.h" |
| 70 | #include "wlan_hdd_wext.h" |
| 71 | #include "sme_Api.h" |
| 72 | #include "wlan_hdd_p2p.h" |
| 73 | #include "wlan_hdd_cfg80211.h" |
| 74 | #include "wlan_hdd_hostapd.h" |
| 75 | #include "sapInternal.h" |
| 76 | #include "wlan_hdd_softap_tx_rx.h" |
| 77 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 78 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 42fcd22 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 79 | #include "wlan_hdd_power.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | #ifdef WLAN_BTAMP_FEATURE |
| 81 | #include "bap_hdd_misc.h" |
| 82 | #endif |
| 83 | #include <qc_sap_ioctl.h> |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 84 | #ifdef FEATURE_WLAN_TDLS |
| 85 | #include "wlan_hdd_tdls.h" |
| 86 | #endif |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 87 | #include "wlan_nv.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 88 | |
| 89 | #define g_mode_rates_size (12) |
| 90 | #define a_mode_rates_size (8) |
| 91 | #define FREQ_BASE_80211G (2407) |
| 92 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 93 | #define MAX_SCAN_SSID 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 94 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
| 95 | ((int) OFFSET_OF( tSirBssDescription, ieFields))) |
| 96 | |
| 97 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 98 | .band = IEEE80211_BAND_2GHZ, \ |
| 99 | .center_freq = (freq), \ |
| 100 | .hw_value = (chan),\ |
| 101 | .flags = (flag), \ |
| 102 | .max_antenna_gain = 0 ,\ |
| 103 | .max_power = 30, \ |
| 104 | } |
| 105 | |
| 106 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 107 | .band = IEEE80211_BAND_5GHZ, \ |
| 108 | .center_freq = (freq), \ |
| 109 | .hw_value = (chan),\ |
| 110 | .flags = (flag), \ |
| 111 | .max_antenna_gain = 0 ,\ |
| 112 | .max_power = 30, \ |
| 113 | } |
| 114 | |
| 115 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 116 | {\ |
| 117 | .bitrate = rate, \ |
| 118 | .hw_value = rate_id, \ |
| 119 | .flags = flag, \ |
| 120 | } |
| 121 | |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 122 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 123 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 124 | #else |
| 125 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 126 | #endif |
| 127 | |
Gopichand Nakkala | 9e906c9 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 128 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 129 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 130 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 131 | #endif |
| 132 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 133 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | { |
| 135 | WLAN_CIPHER_SUITE_WEP40, |
| 136 | WLAN_CIPHER_SUITE_WEP104, |
| 137 | WLAN_CIPHER_SUITE_TKIP, |
| 138 | #ifdef FEATURE_WLAN_CCX |
| 139 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 140 | WLAN_CIPHER_SUITE_KRK, |
| 141 | WLAN_CIPHER_SUITE_CCMP, |
| 142 | #else |
| 143 | WLAN_CIPHER_SUITE_CCMP, |
| 144 | #endif |
| 145 | #ifdef FEATURE_WLAN_WAPI |
| 146 | WLAN_CIPHER_SUITE_SMS4, |
| 147 | #endif |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 148 | #ifdef WLAN_FEATURE_11W |
| 149 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 150 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | }; |
| 152 | |
| 153 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 154 | { |
| 155 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 156 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 157 | } |
| 158 | |
| 159 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 160 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | HDD2GHZCHAN(2412, 1, 0) , |
| 162 | HDD2GHZCHAN(2417, 2, 0) , |
| 163 | HDD2GHZCHAN(2422, 3, 0) , |
| 164 | HDD2GHZCHAN(2427, 4, 0) , |
| 165 | HDD2GHZCHAN(2432, 5, 0) , |
| 166 | HDD2GHZCHAN(2437, 6, 0) , |
| 167 | HDD2GHZCHAN(2442, 7, 0) , |
| 168 | HDD2GHZCHAN(2447, 8, 0) , |
| 169 | HDD2GHZCHAN(2452, 9, 0) , |
| 170 | HDD2GHZCHAN(2457, 10, 0) , |
| 171 | HDD2GHZCHAN(2462, 11, 0) , |
| 172 | HDD2GHZCHAN(2467, 12, 0) , |
| 173 | HDD2GHZCHAN(2472, 13, 0) , |
| 174 | HDD2GHZCHAN(2484, 14, 0) , |
| 175 | }; |
| 176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 178 | { |
| 179 | HDD2GHZCHAN(2412, 1, 0) , |
| 180 | HDD2GHZCHAN(2437, 6, 0) , |
| 181 | HDD2GHZCHAN(2462, 11, 0) , |
| 182 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | |
| 184 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 185 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 186 | HDD5GHZCHAN(4920, 240, 0) , |
| 187 | HDD5GHZCHAN(4940, 244, 0) , |
| 188 | HDD5GHZCHAN(4960, 248, 0) , |
| 189 | HDD5GHZCHAN(4980, 252, 0) , |
| 190 | HDD5GHZCHAN(5040, 208, 0) , |
| 191 | HDD5GHZCHAN(5060, 212, 0) , |
| 192 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | HDD5GHZCHAN(5180, 36, 0) , |
| 194 | HDD5GHZCHAN(5200, 40, 0) , |
| 195 | HDD5GHZCHAN(5220, 44, 0) , |
| 196 | HDD5GHZCHAN(5240, 48, 0) , |
| 197 | HDD5GHZCHAN(5260, 52, 0) , |
| 198 | HDD5GHZCHAN(5280, 56, 0) , |
| 199 | HDD5GHZCHAN(5300, 60, 0) , |
| 200 | HDD5GHZCHAN(5320, 64, 0) , |
| 201 | HDD5GHZCHAN(5500,100, 0) , |
| 202 | HDD5GHZCHAN(5520,104, 0) , |
| 203 | HDD5GHZCHAN(5540,108, 0) , |
| 204 | HDD5GHZCHAN(5560,112, 0) , |
| 205 | HDD5GHZCHAN(5580,116, 0) , |
| 206 | HDD5GHZCHAN(5600,120, 0) , |
| 207 | HDD5GHZCHAN(5620,124, 0) , |
| 208 | HDD5GHZCHAN(5640,128, 0) , |
| 209 | HDD5GHZCHAN(5660,132, 0) , |
| 210 | HDD5GHZCHAN(5680,136, 0) , |
| 211 | HDD5GHZCHAN(5700,140, 0) , |
| 212 | HDD5GHZCHAN(5745,149, 0) , |
| 213 | HDD5GHZCHAN(5765,153, 0) , |
| 214 | HDD5GHZCHAN(5785,157, 0) , |
| 215 | HDD5GHZCHAN(5805,161, 0) , |
| 216 | HDD5GHZCHAN(5825,165, 0) , |
| 217 | }; |
| 218 | |
| 219 | static struct ieee80211_rate g_mode_rates[] = |
| 220 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 221 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 222 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 223 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 224 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 225 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 226 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 227 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 228 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 229 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 230 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 231 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 232 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 233 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 234 | |
| 235 | static struct ieee80211_rate a_mode_rates[] = |
| 236 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 237 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 238 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 239 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 240 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 241 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 242 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 243 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 245 | }; |
| 246 | |
| 247 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 248 | { |
| 249 | .channels = hdd_channels_2_4_GHZ, |
| 250 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 251 | .band = IEEE80211_BAND_2GHZ, |
| 252 | .bitrates = g_mode_rates, |
| 253 | .n_bitrates = g_mode_rates_size, |
| 254 | .ht_cap.ht_supported = 1, |
| 255 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 256 | | IEEE80211_HT_CAP_GRN_FLD |
| 257 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 258 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 259 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 260 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 261 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 262 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 263 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 264 | }; |
| 265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 267 | { |
| 268 | .channels = hdd_social_channels_2_4_GHZ, |
| 269 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 270 | .band = IEEE80211_BAND_2GHZ, |
| 271 | .bitrates = g_mode_rates, |
| 272 | .n_bitrates = g_mode_rates_size, |
| 273 | .ht_cap.ht_supported = 1, |
| 274 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 275 | | IEEE80211_HT_CAP_GRN_FLD |
| 276 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 277 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 278 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 279 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 280 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 281 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 282 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 283 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | |
| 285 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 286 | { |
| 287 | .channels = hdd_channels_5_GHZ, |
| 288 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 289 | .band = IEEE80211_BAND_5GHZ, |
| 290 | .bitrates = a_mode_rates, |
| 291 | .n_bitrates = a_mode_rates_size, |
| 292 | .ht_cap.ht_supported = 1, |
| 293 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 294 | | IEEE80211_HT_CAP_GRN_FLD |
| 295 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 296 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 297 | | IEEE80211_HT_CAP_SGI_40 |
| 298 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 299 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 300 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 301 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 302 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 303 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 304 | }; |
| 305 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 306 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | TX/RX direction for each kind of interface */ |
| 308 | static const struct ieee80211_txrx_stypes |
| 309 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 310 | [NL80211_IFTYPE_STATION] = { |
| 311 | .tx = 0xffff, |
| 312 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 313 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 314 | }, |
| 315 | [NL80211_IFTYPE_AP] = { |
| 316 | .tx = 0xffff, |
| 317 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 318 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 319 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 320 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 321 | BIT(SIR_MAC_MGMT_AUTH) | |
| 322 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 323 | BIT(SIR_MAC_MGMT_ACTION), |
| 324 | }, |
Jeff Johnson | ded591b | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 325 | [NL80211_IFTYPE_ADHOC] = { |
| 326 | .tx = 0xffff, |
| 327 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 328 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 329 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 330 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 331 | BIT(SIR_MAC_MGMT_AUTH) | |
| 332 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 333 | BIT(SIR_MAC_MGMT_ACTION), |
| 334 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 336 | .tx = 0xffff, |
| 337 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 338 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 339 | }, |
| 340 | [NL80211_IFTYPE_P2P_GO] = { |
| 341 | /* This is also same as for SoftAP */ |
| 342 | .tx = 0xffff, |
| 343 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 344 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 345 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 346 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 347 | BIT(SIR_MAC_MGMT_AUTH) | |
| 348 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 349 | BIT(SIR_MAC_MGMT_ACTION), |
| 350 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | }; |
| 352 | |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 353 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 354 | static const struct ieee80211_iface_limit |
| 355 | wlan_hdd_iface_limit[] = { |
| 356 | { |
Sunil Ravi | ce1c00c | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 357 | /* max = 3 ; Our driver create two interfaces during driver init |
| 358 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 359 | * interface until a group is formed. In JB architecture, once the |
| 360 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 361 | * Client. |
| 362 | * When supplicant remove the group, it first issue a set interface |
| 363 | * cmd to change the mode back to Station. In JB this works fine as |
| 364 | * we advertize two station type interface during driver init. |
| 365 | * Some vendors create separate interface for P2P GO/Client, |
| 366 | * after group formation(Third one). But while group remove |
| 367 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 368 | * But as we advertized only two sta type interfaces nl80211 was |
| 369 | * returning error for the third one which was leading to failure in |
| 370 | * delete interface. Ideally while removing the group, supplicant |
| 371 | * should not try to change the 3rd interface mode to Station type. |
| 372 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 373 | * interface type to 3 |
| 374 | */ |
| 375 | .max = 3, |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 376 | .types = BIT(NL80211_IFTYPE_STATION), |
| 377 | }, |
| 378 | { |
| 379 | .max = 1, |
Jeff Johnson | ded591b | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 380 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 381 | }, |
| 382 | { |
| 383 | .max = 1, |
| 384 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 385 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 386 | }, |
| 387 | }; |
| 388 | |
| 389 | /* By default, only single channel concurrency is allowed */ |
| 390 | static struct ieee80211_iface_combination |
| 391 | wlan_hdd_iface_combination = { |
| 392 | .limits = wlan_hdd_iface_limit, |
| 393 | .num_different_channels = 1, |
Sunil Ravi | ce1c00c | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 394 | /* |
| 395 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 396 | * and p2p0 interfaces during driver init |
| 397 | * Some vendors create separate interface for P2P operations. |
| 398 | * wlan0: STA interface |
| 399 | * p2p0: P2P Device interface, action frames goes |
| 400 | * through this interface. |
| 401 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 402 | * created for p2p operations(GO/CLIENT interface). |
| 403 | */ |
| 404 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 405 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 406 | .beacon_int_infra_match = false, |
| 407 | }; |
| 408 | #endif |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 410 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 411 | |
| 412 | /* Data rate 100KBPS based on IE Index */ |
| 413 | struct index_data_rate_type |
| 414 | { |
| 415 | v_U8_t beacon_rate_index; |
| 416 | v_U16_t supported_rate[4]; |
| 417 | }; |
| 418 | |
| 419 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 420 | The IDX field is the rate index |
| 421 | The HI field is the rate when RSSI is strong or being ignored |
| 422 | (in this case we report actual rate) |
| 423 | The MID field is the rate when RSSI is moderate |
| 424 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 425 | The LO field is the rate when RSSI is low |
| 426 | (in this case we don't report rates, actual current rate used) |
| 427 | */ |
| 428 | static const struct |
| 429 | { |
| 430 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 431 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | } supported_data_rate[] = |
| 433 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 434 | /* IDX HI HM LM LO (RSSI-based index */ |
| 435 | {2, { 10, 10, 10, 0}}, |
| 436 | {4, { 20, 20, 10, 0}}, |
| 437 | {11, { 55, 20, 10, 0}}, |
| 438 | {12, { 60, 55, 20, 0}}, |
| 439 | {18, { 90, 55, 20, 0}}, |
| 440 | {22, {110, 55, 20, 0}}, |
| 441 | {24, {120, 90, 60, 0}}, |
| 442 | {36, {180, 120, 60, 0}}, |
| 443 | {44, {220, 180, 60, 0}}, |
| 444 | {48, {240, 180, 90, 0}}, |
| 445 | {66, {330, 180, 90, 0}}, |
| 446 | {72, {360, 240, 90, 0}}, |
| 447 | {96, {480, 240, 120, 0}}, |
| 448 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 449 | }; |
| 450 | |
| 451 | /* MCS Based rate table */ |
| 452 | static struct index_data_rate_type supported_mcs_rate[] = |
| 453 | { |
| 454 | /* MCS L20 L40 S20 S40 */ |
| 455 | {0, {65, 135, 72, 150}}, |
| 456 | {1, {130, 270, 144, 300}}, |
| 457 | {2, {195, 405, 217, 450}}, |
| 458 | {3, {260, 540, 289, 600}}, |
| 459 | {4, {390, 810, 433, 900}}, |
| 460 | {5, {520, 1080, 578, 1200}}, |
| 461 | {6, {585, 1215, 650, 1350}}, |
| 462 | {7, {650, 1350, 722, 1500}} |
| 463 | }; |
| 464 | |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 465 | #ifdef WLAN_FEATURE_11AC |
| 466 | |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 467 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 468 | |
| 469 | struct index_vht_data_rate_type |
| 470 | { |
| 471 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 472 | v_U16_t supported_VHT80_rate[2]; |
| 473 | v_U16_t supported_VHT40_rate[2]; |
| 474 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 475 | }; |
| 476 | |
| 477 | typedef enum |
| 478 | { |
| 479 | DATA_RATE_11AC_MAX_MCS_7, |
| 480 | DATA_RATE_11AC_MAX_MCS_8, |
| 481 | DATA_RATE_11AC_MAX_MCS_9, |
| 482 | DATA_RATE_11AC_MAX_MCS_NA |
| 483 | } eDataRate11ACMaxMcs; |
| 484 | |
| 485 | /* MCS Based VHT rate table */ |
| 486 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 487 | { |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 488 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 489 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 490 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 491 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 492 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 493 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 494 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 495 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 496 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 497 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 498 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 499 | }; |
| 500 | #endif /* WLAN_FEATURE_11AC */ |
| 501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | extern struct net_device_ops net_ops_struct; |
| 503 | |
| 504 | /* |
| 505 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 506 | * This function is called by hdd_wlan_startup() |
| 507 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | * This function is used to initialize and register wiphy structure. |
| 509 | */ |
| 510 | struct wiphy *wlan_hdd_cfg80211_init(int priv_size) |
| 511 | { |
| 512 | struct wiphy *wiphy; |
| 513 | ENTER(); |
| 514 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 515 | /* |
| 516 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 517 | */ |
| 518 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 519 | |
| 520 | if (!wiphy) |
| 521 | { |
| 522 | /* Print error and jump into err label and free the memory */ |
| 523 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 524 | return NULL; |
| 525 | } |
| 526 | |
| 527 | return wiphy; |
| 528 | } |
| 529 | |
| 530 | /* |
| 531 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 532 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | * private ioctl to change the band value |
| 534 | */ |
| 535 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 536 | { |
Gopichand Nakkala | 6850476 | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 537 | int i, j; |
| 538 | eNVChannelEnabledType channelEnabledState; |
| 539 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 540 | ENTER(); |
Gopichand Nakkala | 6850476 | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 541 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | { |
Gopichand Nakkala | 6850476 | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 543 | |
| 544 | if (NULL == wiphy->bands[i]) |
| 545 | { |
| 546 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 547 | __func__, i); |
| 548 | continue; |
| 549 | } |
| 550 | |
| 551 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 552 | { |
| 553 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 554 | |
| 555 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 556 | band->channels[j].hw_value); |
| 557 | |
| 558 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 559 | { |
| 560 | // Enable Social channels for P2P |
| 561 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 562 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 563 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 564 | else |
| 565 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 566 | continue; |
| 567 | } |
| 568 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 569 | { |
| 570 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 571 | continue; |
| 572 | } |
| 573 | |
| 574 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 575 | NV_CHANNEL_INVALID == channelEnabledState) |
| 576 | { |
| 577 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 578 | } |
| 579 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 580 | { |
| 581 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 582 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 583 | } |
| 584 | else |
| 585 | { |
| 586 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 587 | |IEEE80211_CHAN_RADAR); |
| 588 | } |
| 589 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 590 | } |
| 591 | return 0; |
| 592 | } |
| 593 | /* |
| 594 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 595 | * This function is called by hdd_wlan_startup() |
| 596 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 597 | * This function is used to initialize and register wiphy structure. |
| 598 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 599 | int wlan_hdd_cfg80211_register(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | struct wiphy *wiphy, |
| 601 | hdd_config_t *pCfg |
| 602 | ) |
| 603 | { |
Gopichand Nakkala | 6850476 | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 604 | |
| 605 | int i, j; |
| 606 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 607 | ENTER(); |
| 608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | /* Now bind the underlying wlan device with wiphy */ |
| 610 | set_wiphy_dev(wiphy, dev); |
| 611 | |
| 612 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
| 613 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 614 | wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 615 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 616 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 617 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 618 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 619 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 620 | | WIPHY_FLAG_OFFCHAN_TX; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 621 | #endif |
Srinivas Girigowda | 63ed707 | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 622 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 623 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 1b61772 | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 624 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 63ed707 | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 625 | || pCfg->isFastRoamIniFeatureEnabled |
| 626 | #endif |
| 627 | #ifdef FEATURE_WLAN_CCX |
| 628 | || pCfg->isCcxIniFeatureEnabled |
| 629 | #endif |
| 630 | ) |
| 631 | { |
| 632 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 633 | } |
James Zmuda | 1b61772 | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 634 | #endif |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 635 | #ifdef FEATURE_WLAN_TDLS |
| 636 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 637 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 638 | #endif |
Gopichand Nakkala | 3b34fa8 | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 639 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 640 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 641 | wiphy->max_sched_scan_ssids = MAX_SCAN_SSID; |
| 642 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 643 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 644 | |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 645 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 646 | driver can still register regulatory callback and |
| 647 | it will get CRDA setting in wiphy->band[], but |
| 648 | driver need to determine what to do with both |
| 649 | regulatory settings */ |
| 650 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 651 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 652 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | wiphy->max_scan_ie_len = 200 ; //TODO: define a macro |
| 655 | |
| 656 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 657 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 658 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 660 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | | BIT(NL80211_IFTYPE_AP); |
| 662 | |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 663 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 664 | if( pCfg->enableMCC ) |
| 665 | { |
| 666 | /* Currently, supports up to two channels */ |
| 667 | wlan_hdd_iface_combination.num_different_channels = 2; |
| 668 | |
| 669 | if( !pCfg->allowMCCGODiffBI ) |
| 670 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
| 671 | |
| 672 | } |
| 673 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 674 | wiphy->n_iface_combinations = 1; |
| 675 | #endif |
Sudhir Sattayappa Kohalli | 0c7606f | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 677 | /* Before registering we need to update the ht capabilitied based |
| 678 | * on ini values*/ |
| 679 | if( !pCfg->ShortGI20MhzEnable ) |
| 680 | { |
| 681 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 682 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 683 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 684 | } |
| 685 | |
| 686 | if( !pCfg->ShortGI40MhzEnable ) |
| 687 | { |
| 688 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 689 | } |
| 690 | |
| 691 | if( !pCfg->nChannelBondingMode5GHz ) |
| 692 | { |
| 693 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 694 | } |
| 695 | |
Gopichand Nakkala | 6850476 | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 696 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 697 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 698 | |
| 699 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 700 | { |
| 701 | |
| 702 | if (NULL == wiphy->bands[i]) |
| 703 | { |
| 704 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 705 | __func__, i); |
| 706 | continue; |
| 707 | } |
| 708 | |
| 709 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 710 | { |
| 711 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 712 | |
| 713 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 714 | { |
| 715 | // Enable social channels for P2P |
| 716 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 717 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 718 | else |
| 719 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 720 | continue; |
| 721 | } |
| 722 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 723 | { |
| 724 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 725 | continue; |
| 726 | } |
| 727 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | } |
| 729 | /*Initialise the supported cipher suite details*/ |
| 730 | wiphy->cipher_suites = hdd_cipher_suites; |
| 731 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 732 | |
| 733 | /*signal strength in mBm (100*dBm) */ |
| 734 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 735 | |
| 736 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | wiphy->max_remain_on_channel_duration = 1000; |
| 738 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | |
| 740 | /* Register our wiphy dev with cfg80211 */ |
| 741 | if (0 > wiphy_register(wiphy)) |
| 742 | { |
| 743 | /* print eror */ |
| 744 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 745 | return -EIO; |
| 746 | } |
| 747 | |
| 748 | EXIT(); |
| 749 | return 0; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 750 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 751 | |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 752 | /* In this function we will try to get default country code from crda. |
| 753 | If the gCrdaDefaultCountryCode is configured in ini file, |
| 754 | we will try to call user space crda to get the regulatory settings for |
| 755 | that country. We will timeout if we can't get it from crda. |
| 756 | It's called by hdd_wlan_startup() after wlan_hdd_cfg80211_register. |
| 757 | */ |
| 758 | int wlan_hdd_get_crda_regd_entry(struct wiphy *wiphy, hdd_config_t *pCfg) |
| 759 | { |
| 760 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 761 | if (memcmp(pCfg->crdaDefaultCountryCode, |
| 762 | CFG_CRDA_DEFAULT_COUNTRY_CODE_DEFAULT , 2) != 0) |
| 763 | { |
| 764 | init_completion(&pHddCtx->driver_crda_req); |
| 765 | regulatory_hint(wiphy, pCfg->crdaDefaultCountryCode); |
| 766 | wait_for_completion_interruptible_timeout(&pHddCtx->driver_crda_req, |
| 767 | CRDA_WAIT_TIME); |
Yunsen Wang | 73baad3 | 2013-04-05 15:04:43 -0700 | [diff] [blame] | 768 | /* if the country is not found from current regulatory.bin, |
| 769 | fall back to world domain */ |
| 770 | if (is_crda_regulatory_entry_valid() == VOS_FALSE) |
| 771 | crda_regulatory_entry_default(pCfg->crdaDefaultCountryCode, NUM_REG_DOMAINS-1); |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 772 | } |
| 773 | return 0; |
| 774 | } |
| 775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | /* In this function we will do all post VOS start initialization. |
| 777 | In this function we will register for all frame in which supplicant |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 778 | is interested. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | */ |
| 780 | void wlan_hdd_cfg80211_post_voss_start(hdd_adapter_t* pAdapter) |
| 781 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 783 | /* Register for all P2P action, public action etc frames */ |
| 784 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 785 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 786 | ENTER(); |
| 787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | /* Right now we are registering these frame when driver is getting |
| 789 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 790 | frame register ops, we will move this code as a part of that */ |
| 791 | /* GAS Initial Request */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 792 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 794 | |
| 795 | /* GAS Initial Response */ |
| 796 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 797 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 799 | /* GAS Comeback Request */ |
| 800 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 801 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 802 | |
| 803 | /* GAS Comeback Response */ |
| 804 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 805 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 806 | |
| 807 | /* P2P Public Action */ |
| 808 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 809 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 811 | |
| 812 | /* P2P Action */ |
| 813 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 814 | (v_U8_t*)P2P_ACTION_FRAME, |
| 815 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 816 | |
Gopichand Nakkala | 792669b | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 817 | /* WNM BSS Transition Request frame */ |
| 818 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 819 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 820 | WNM_BSS_ACTION_FRAME_SIZE ); |
| 821 | |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 822 | #ifdef WLAN_FEATURE_11W |
| 823 | /* SA Query Response Action Frame */ |
| 824 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 825 | (v_U8_t*)SA_QUERY_FRAME_RSP, |
| 826 | SA_QUERY_FRAME_RSP_SIZE ); |
| 827 | #endif /* WLAN_FEATURE_11W */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | } |
| 829 | |
| 830 | void wlan_hdd_cfg80211_pre_voss_stop(hdd_adapter_t* pAdapter) |
| 831 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 833 | /* Register for all P2P action, public action etc frames */ |
| 834 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 835 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 836 | ENTER(); |
| 837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 838 | /* Right now we are registering these frame when driver is getting |
| 839 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 840 | frame register ops, we will move this code as a part of that */ |
| 841 | /* GAS Initial Request */ |
| 842 | |
| 843 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 844 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 845 | |
| 846 | /* GAS Initial Response */ |
| 847 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 848 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 850 | /* GAS Comeback Request */ |
| 851 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 852 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 853 | |
| 854 | /* GAS Comeback Response */ |
| 855 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 856 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 857 | |
| 858 | /* P2P Public Action */ |
| 859 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 860 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 862 | |
| 863 | /* P2P Action */ |
| 864 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 865 | (v_U8_t*)P2P_ACTION_FRAME, |
| 866 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 867 | |
| 868 | #ifdef WLAN_FEATURE_11W |
| 869 | /* SA Query Response Action Frame */ |
| 870 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 871 | (v_U8_t*)SA_QUERY_FRAME_RSP, |
| 872 | SA_QUERY_FRAME_RSP_SIZE ); |
| 873 | #endif /* WLAN_FEATURE_11W */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 874 | } |
| 875 | |
| 876 | #ifdef FEATURE_WLAN_WAPI |
| 877 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 878 | const u8 *mac_addr, u8 *key , int key_Len) |
| 879 | { |
| 880 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 881 | tCsrRoamSetKey setKey; |
| 882 | v_BOOL_t isConnected = TRUE; |
| 883 | int status = 0; |
| 884 | v_U32_t roamId= 0xFF; |
| 885 | tANI_U8 *pKeyPtr = NULL; |
| 886 | int n = 0; |
| 887 | |
| 888 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 889 | __func__,pAdapter->device_mode); |
| 890 | |
Gopichand Nakkala | f383670 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 891 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 892 | setKey.keyId = key_index; // Store Key ID |
| 893 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 894 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 895 | setKey.paeRole = 0 ; // the PAE role |
| 896 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 897 | { |
| 898 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 899 | } |
| 900 | else |
| 901 | { |
| 902 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 903 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 904 | } |
| 905 | setKey.keyLength = key_Len; |
| 906 | pKeyPtr = setKey.Key; |
| 907 | memcpy( pKeyPtr, key, key_Len); |
| 908 | |
| 909 | hddLog(VOS_TRACE_LEVEL_INFO,"\n%s: WAPI KEY LENGTH:0x%04x", |
| 910 | __func__, key_Len); |
| 911 | for (n = 0 ; n < key_Len; n++) |
| 912 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 913 | __func__,n,setKey.Key[n]); |
| 914 | |
| 915 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 916 | if ( isConnected ) |
| 917 | { |
| 918 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 919 | pAdapter->sessionId, &setKey, &roamId ); |
| 920 | } |
| 921 | if ( status != 0 ) |
| 922 | { |
| 923 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 924 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 925 | __LINE__, status ); |
| 926 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 927 | } |
| 928 | } |
| 929 | #endif /* FEATURE_WLAN_WAPI*/ |
| 930 | |
| 931 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 932 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | beacon_data_t **ppBeacon, |
| 934 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 935 | #else |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 936 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 937 | beacon_data_t **ppBeacon, |
| 938 | struct cfg80211_beacon_data *params, |
| 939 | int dtim_period) |
| 940 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 941 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | int size; |
| 943 | beacon_data_t *beacon = NULL; |
| 944 | beacon_data_t *old = NULL; |
| 945 | int head_len,tail_len; |
| 946 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 947 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 948 | if (params->head && !params->head_len) |
| 949 | return -EINVAL; |
| 950 | |
| 951 | old = pAdapter->sessionCtx.ap.beacon; |
| 952 | |
| 953 | if (!params->head && !old) |
| 954 | return -EINVAL; |
| 955 | |
| 956 | if (params->tail && !params->tail_len) |
| 957 | return -EINVAL; |
| 958 | |
| 959 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 960 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 961 | if (!params->dtim_period) |
| 962 | return -EINVAL; |
| 963 | #endif |
| 964 | |
| 965 | if(params->head) |
| 966 | head_len = params->head_len; |
| 967 | else |
| 968 | head_len = old->head_len; |
| 969 | |
| 970 | if(params->tail || !old) |
| 971 | tail_len = params->tail_len; |
| 972 | else |
| 973 | tail_len = old->tail_len; |
| 974 | |
| 975 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 976 | |
| 977 | beacon = kzalloc(size, GFP_KERNEL); |
| 978 | |
| 979 | if( beacon == NULL ) |
| 980 | return -ENOMEM; |
| 981 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 982 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | if(params->dtim_period || !old ) |
| 984 | beacon->dtim_period = params->dtim_period; |
| 985 | else |
| 986 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 987 | #else |
| 988 | if(dtim_period || !old ) |
| 989 | beacon->dtim_period = dtim_period; |
| 990 | else |
| 991 | beacon->dtim_period = old->dtim_period; |
| 992 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 995 | beacon->tail = beacon->head + head_len; |
| 996 | beacon->head_len = head_len; |
| 997 | beacon->tail_len = tail_len; |
| 998 | |
| 999 | if(params->head) { |
| 1000 | memcpy (beacon->head,params->head,beacon->head_len); |
| 1001 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1002 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1003 | if(old) |
| 1004 | memcpy (beacon->head,old->head,beacon->head_len); |
| 1005 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1007 | if(params->tail) { |
| 1008 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 1009 | } |
| 1010 | else { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1011 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1012 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 1013 | } |
| 1014 | |
| 1015 | *ppBeacon = beacon; |
| 1016 | |
| 1017 | kfree(old); |
| 1018 | |
| 1019 | return 0; |
| 1020 | |
| 1021 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1022 | |
| 1023 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 1024 | { |
| 1025 | int left = length; |
| 1026 | v_U8_t *ptr = pIes; |
| 1027 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1029 | while(left >= 2) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1030 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1031 | elem_id = ptr[0]; |
| 1032 | elem_len = ptr[1]; |
| 1033 | left -= 2; |
| 1034 | if(elem_len > left) |
| 1035 | { |
| 1036 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1037 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | eid,elem_len,left); |
| 1039 | return NULL; |
| 1040 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1041 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1042 | { |
| 1043 | return ptr; |
| 1044 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1046 | left -= elem_len; |
| 1047 | ptr += (elem_len + 2); |
| 1048 | } |
| 1049 | return NULL; |
| 1050 | } |
| 1051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1052 | /* Check if rate is 11g rate or not */ |
| 1053 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 1054 | { |
| 1055 | u8 gRateArray[8] = {12, 18, 24, 36, 48, 72, 96, 104}; /* actual rate * 2 */ |
| 1056 | u8 i; |
| 1057 | for (i = 0; i < 8; i++) |
| 1058 | { |
| 1059 | if(rate == gRateArray[i]) |
| 1060 | return TRUE; |
| 1061 | } |
| 1062 | return FALSE; |
| 1063 | } |
| 1064 | |
| 1065 | /* Check for 11g rate and set proper 11g only mode */ |
| 1066 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 1067 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 1068 | { |
| 1069 | u8 i, num_rates = pIe[0]; |
| 1070 | |
| 1071 | pIe += 1; |
| 1072 | for ( i = 0; i < num_rates; i++) |
| 1073 | { |
| 1074 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 1075 | { |
| 1076 | /* If rate set have 11g rate than change the mode to 11G */ |
| 1077 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 1078 | if (pIe[i] & BASIC_RATE_MASK) |
| 1079 | { |
| 1080 | /* If we have 11g rate as basic rate, it means mode |
| 1081 | is 11g only mode. |
| 1082 | */ |
| 1083 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 1084 | *pCheckRatesfor11g = FALSE; |
| 1085 | } |
| 1086 | } |
| 1087 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 1088 | { |
| 1089 | *require_ht = TRUE; |
| 1090 | } |
| 1091 | } |
| 1092 | return; |
| 1093 | } |
| 1094 | |
| 1095 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 1096 | { |
| 1097 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1098 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1099 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1100 | u8 checkRatesfor11g = TRUE; |
| 1101 | u8 require_ht = FALSE; |
| 1102 | u8 *pIe=NULL; |
| 1103 | |
| 1104 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 1105 | |
| 1106 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 1107 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 1108 | if (pIe != NULL) |
| 1109 | { |
| 1110 | pIe += 1; |
| 1111 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1112 | &pConfig->SapHw_mode); |
| 1113 | } |
| 1114 | |
| 1115 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1116 | WLAN_EID_EXT_SUPP_RATES); |
| 1117 | if (pIe != NULL) |
| 1118 | { |
| 1119 | |
| 1120 | pIe += 1; |
| 1121 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1122 | &pConfig->SapHw_mode); |
| 1123 | } |
| 1124 | |
| 1125 | if( pConfig->channel > 14 ) |
| 1126 | { |
| 1127 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 1128 | } |
| 1129 | |
| 1130 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1131 | WLAN_EID_HT_CAPABILITY); |
| 1132 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1133 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | { |
| 1135 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 1136 | if(require_ht) |
| 1137 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 1138 | } |
| 1139 | } |
| 1140 | |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1141 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 1142 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 1143 | { |
| 1144 | v_U8_t ielen = 0; |
| 1145 | v_U8_t *pIe = NULL; |
| 1146 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1147 | |
| 1148 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 1149 | pBeacon->tail, pBeacon->tail_len); |
| 1150 | |
| 1151 | if (pIe) |
| 1152 | { |
| 1153 | ielen = pIe[1] + 2; |
| 1154 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 1155 | { |
| 1156 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 1157 | } |
| 1158 | else |
| 1159 | { |
| 1160 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 1161 | return -EINVAL; |
| 1162 | } |
| 1163 | *total_ielen += ielen; |
| 1164 | } |
| 1165 | return 0; |
| 1166 | } |
| 1167 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1168 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1169 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1170 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1171 | #else |
| 1172 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1173 | struct cfg80211_beacon_data *params) |
| 1174 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | { |
| 1176 | v_U8_t *genie; |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1177 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1178 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1179 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1180 | |
| 1181 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 1182 | |
| 1183 | if(genie == NULL) { |
| 1184 | |
| 1185 | return -ENOMEM; |
| 1186 | } |
| 1187 | |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1188 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1189 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1190 | { |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1191 | ret = -EINVAL; |
| 1192 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1193 | } |
| 1194 | |
| 1195 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1196 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1197 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 1198 | { |
| 1199 | ret = -EINVAL; |
| 1200 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | } |
| 1202 | #endif |
| 1203 | |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1204 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1205 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1206 | { |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1207 | ret = -EINVAL; |
| 1208 | goto done; |
| 1209 | } |
| 1210 | |
| 1211 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 1212 | { |
| 1213 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1214 | &total_ielen, SS_OUI_TYPE, SS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | { |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1216 | ret = -EINVAL; |
| 1217 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1219 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1220 | |
| 1221 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1222 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 1223 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1224 | { |
| 1225 | hddLog(LOGE, |
| 1226 | "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1227 | ret = -EINVAL; |
| 1228 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | } |
| 1230 | |
| 1231 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1232 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 1233 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1234 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1235 | ==eHAL_STATUS_FAILURE) |
| 1236 | { |
| 1237 | hddLog(LOGE, |
| 1238 | "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1239 | ret = -EINVAL; |
| 1240 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | } |
| 1242 | |
| 1243 | // Added for ProResp IE |
| 1244 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 1245 | { |
| 1246 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 1247 | u8 probe_rsp_ie_len[3] = {0}; |
| 1248 | u8 counter = 0; |
| 1249 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 1250 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 1251 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 1252 | Store More then 255 bytes into One Variable. |
| 1253 | */ |
| 1254 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 1255 | { |
| 1256 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 1257 | { |
| 1258 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 1259 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 1260 | } |
| 1261 | else |
| 1262 | { |
| 1263 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 1264 | rem_probe_resp_ie_len = 0; |
| 1265 | } |
| 1266 | } |
| 1267 | |
| 1268 | rem_probe_resp_ie_len = 0; |
| 1269 | |
| 1270 | if (probe_rsp_ie_len[0] > 0) |
| 1271 | { |
| 1272 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1273 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 1274 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1275 | probe_rsp_ie_len[0], NULL, |
| 1276 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1277 | { |
| 1278 | hddLog(LOGE, |
| 1279 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1280 | ret = -EINVAL; |
| 1281 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | } |
| 1283 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 1284 | } |
| 1285 | |
| 1286 | if (probe_rsp_ie_len[1] > 0) |
| 1287 | { |
| 1288 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1289 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 1290 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1291 | probe_rsp_ie_len[1], NULL, |
| 1292 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1293 | { |
| 1294 | hddLog(LOGE, |
| 1295 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1296 | ret = -EINVAL; |
| 1297 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1298 | } |
| 1299 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 1300 | } |
| 1301 | |
| 1302 | if (probe_rsp_ie_len[2] > 0) |
| 1303 | { |
| 1304 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1305 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 1306 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1307 | probe_rsp_ie_len[2], NULL, |
| 1308 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1309 | { |
| 1310 | hddLog(LOGE, |
| 1311 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1312 | ret = -EINVAL; |
| 1313 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1314 | } |
| 1315 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 1316 | } |
| 1317 | |
| 1318 | if (probe_rsp_ie_len[1] == 0 ) |
| 1319 | { |
| 1320 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1321 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 1322 | eANI_BOOLEAN_FALSE) ) |
| 1323 | { |
| 1324 | hddLog(LOGE, |
| 1325 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM\n"); |
| 1326 | } |
| 1327 | } |
| 1328 | |
| 1329 | if (probe_rsp_ie_len[2] == 0 ) |
| 1330 | { |
| 1331 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1332 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 1333 | eANI_BOOLEAN_FALSE) ) |
| 1334 | { |
| 1335 | hddLog(LOGE, |
| 1336 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM\n"); |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1341 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 1342 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1343 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1344 | == eHAL_STATUS_FAILURE) |
| 1345 | { |
| 1346 | hddLog(LOGE, |
| 1347 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1348 | ret = -EINVAL; |
| 1349 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1350 | } |
| 1351 | } |
| 1352 | else |
| 1353 | { |
| 1354 | // Reset WNI_CFG_PROBE_RSP Flags |
| 1355 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 1356 | |
| 1357 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1358 | "%s: No Probe Response IE received in set beacon", |
| 1359 | __func__); |
| 1360 | } |
| 1361 | |
| 1362 | // Added for AssocResp IE |
| 1363 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 1364 | { |
| 1365 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1366 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 1367 | params->assocresp_ies_len, NULL, |
| 1368 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1369 | { |
| 1370 | hddLog(LOGE, |
| 1371 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1372 | ret = -EINVAL; |
| 1373 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1374 | } |
| 1375 | |
| 1376 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1377 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 1378 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1379 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1380 | == eHAL_STATUS_FAILURE) |
| 1381 | { |
| 1382 | hddLog(LOGE, |
| 1383 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1384 | ret = -EINVAL; |
| 1385 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | } |
| 1387 | } |
| 1388 | else |
| 1389 | { |
| 1390 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1391 | "%s: No Assoc Response IE received in set beacon", |
| 1392 | __func__); |
| 1393 | |
| 1394 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1395 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 1396 | eANI_BOOLEAN_FALSE) ) |
| 1397 | { |
| 1398 | hddLog(LOGE, |
| 1399 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM\n"); |
| 1400 | } |
| 1401 | } |
| 1402 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1403 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | vos_mem_free(genie); |
Gopichand Nakkala | 3f106a0 | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1405 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1406 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1407 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1408 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1409 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 1410 | * called by wlan_hdd_cfg80211_start_bss() and |
| 1411 | * wlan_hdd_cfg80211_set_channel() |
| 1412 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1413 | * channel list. |
| 1414 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1415 | static VOS_STATUS wlan_hdd_validate_operation_channel(hdd_adapter_t *pAdapter,int channel) |
| 1416 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | v_U32_t num_ch = 0; |
| 1419 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1420 | u32 indx = 0; |
| 1421 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1422 | v_U8_t fValidChannel = FALSE, count = 0; |
| 1423 | hdd_config_t *hdd_pConfig_ini= (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1425 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1426 | |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1427 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1428 | { |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1429 | /* Validate the channel */ |
| 1430 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | { |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1432 | if ( channel == rfChannels[count].channelNum ) |
| 1433 | { |
| 1434 | fValidChannel = TRUE; |
| 1435 | break; |
| 1436 | } |
| 1437 | } |
| 1438 | if (fValidChannel != TRUE) |
| 1439 | { |
| 1440 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1441 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1442 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1443 | } |
| 1444 | } |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1445 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1446 | { |
Madan Mohan Koyylamudi | 1803cd7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1447 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1448 | valid_ch, &num_ch)) |
| 1449 | { |
| 1450 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1451 | "%s: failed to get valid channel list", __func__); |
| 1452 | return VOS_STATUS_E_FAILURE; |
| 1453 | } |
| 1454 | for (indx = 0; indx < num_ch; indx++) |
| 1455 | { |
| 1456 | if (channel == valid_ch[indx]) |
| 1457 | { |
| 1458 | break; |
| 1459 | } |
| 1460 | } |
| 1461 | |
| 1462 | if (indx >= num_ch) |
| 1463 | { |
| 1464 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1465 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1466 | return VOS_STATUS_E_FAILURE; |
| 1467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1468 | } |
| 1469 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1471 | } |
| 1472 | |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1473 | /** |
| 1474 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 1475 | * This function is used to set the channel number |
| 1476 | */ |
| 1477 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 1478 | struct ieee80211_channel *chan, |
| 1479 | enum nl80211_channel_type channel_type |
| 1480 | ) |
| 1481 | { |
| 1482 | v_U32_t num_ch = 0; |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1483 | int channel = 0; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1484 | hdd_adapter_t *pAdapter = NULL; |
| 1485 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 1486 | hdd_context_t *pHddCtx; |
| 1487 | int status; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1488 | |
| 1489 | ENTER(); |
| 1490 | |
| 1491 | if( NULL == dev ) |
| 1492 | { |
| 1493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1494 | "%s: Called with dev = NULL.\n", __func__); |
| 1495 | return -ENODEV; |
| 1496 | } |
| 1497 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 1498 | |
| 1499 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1500 | "%s: device_mode = %d freq = %d \n",__func__, |
| 1501 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 1502 | |
| 1503 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1504 | status = wlan_hdd_validate_context(pHddCtx); |
| 1505 | |
| 1506 | if (0 != status) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1507 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 1508 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1509 | "%s: HDD context is not valid", __func__); |
| 1510 | return status; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1511 | } |
| 1512 | |
| 1513 | /* |
| 1514 | * Do freq to chan conversion |
| 1515 | * TODO: for 11a |
| 1516 | */ |
| 1517 | |
| 1518 | channel = ieee80211_frequency_to_channel(freq); |
| 1519 | |
| 1520 | /* Check freq range */ |
| 1521 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 1522 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 1523 | { |
| 1524 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1525 | "%s: Channel [%d] is outside valid range from %d to %d\n", |
| 1526 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 1527 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1528 | return -EINVAL; |
| 1529 | } |
| 1530 | |
| 1531 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1532 | |
Gopichand Nakkala | a21af40 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 1533 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 1534 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1535 | { |
| 1536 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1537 | { |
| 1538 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1539 | "%s: Invalid Channel [%d] \n", __func__, channel); |
| 1540 | return -EINVAL; |
| 1541 | } |
| 1542 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1543 | "%s: set channel to [%d] for device mode =%d", |
| 1544 | __func__, channel,pAdapter->device_mode); |
| 1545 | } |
| 1546 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1547 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1548 | ) |
| 1549 | { |
| 1550 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1551 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 1552 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1553 | |
| 1554 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 1555 | { |
| 1556 | /* Link is up then return cant set channel*/ |
| 1557 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 1558 | "%s: IBSS Associated, can't set the channel\n", __func__); |
| 1559 | return -EINVAL; |
| 1560 | } |
| 1561 | |
| 1562 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1563 | pHddStaCtx->conn_info.operationChannel = channel; |
| 1564 | pRoamProfile->ChannelInfo.ChannelList = |
| 1565 | &pHddStaCtx->conn_info.operationChannel; |
| 1566 | } |
| 1567 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1568 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1569 | ) |
| 1570 | { |
Gopichand Nakkala | 22c3c84 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1571 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 1572 | { |
| 1573 | if(VOS_STATUS_SUCCESS != |
| 1574 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1575 | { |
| 1576 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1577 | "%s: Invalid Channel [%d] \n", __func__, channel); |
| 1578 | return -EINVAL; |
| 1579 | } |
| 1580 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1581 | } |
| 1582 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1583 | { |
| 1584 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 1585 | |
| 1586 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 1587 | channel set by supplicant |
| 1588 | */ |
| 1589 | if ( cfg_param->apAutoChannelSelection ) |
| 1590 | { |
Gopichand Nakkala | 22c3c84 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1591 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 1592 | AUTO_CHANNEL_SELECT; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1593 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1594 | "%s: set channel to auto channel (0) for device mode =%d", |
| 1595 | __func__, pAdapter->device_mode); |
| 1596 | } |
Gopichand Nakkala | 22c3c84 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1597 | else |
| 1598 | { |
| 1599 | if(VOS_STATUS_SUCCESS != |
| 1600 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1601 | { |
| 1602 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1603 | "%s: Invalid Channel [%d] \n", __func__, channel); |
| 1604 | return -EINVAL; |
| 1605 | } |
| 1606 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1607 | } |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1608 | } |
| 1609 | } |
| 1610 | else |
| 1611 | { |
| 1612 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1613 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 1614 | return -EINVAL; |
| 1615 | } |
| 1616 | EXIT(); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 1617 | return status; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1618 | } |
| 1619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1620 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 1621 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1622 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1623 | #else |
| 1624 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1625 | struct cfg80211_beacon_data *params, |
| 1626 | const u8 *ssid, size_t ssid_len, |
| 1627 | enum nl80211_hidden_ssid hidden_ssid) |
| 1628 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | { |
| 1630 | tsap_Config_t *pConfig; |
| 1631 | beacon_data_t *pBeacon = NULL; |
| 1632 | struct ieee80211_mgmt *pMgmt_frame; |
| 1633 | v_U8_t *pIe=NULL; |
| 1634 | v_U16_t capab_info; |
| 1635 | eCsrAuthType RSNAuthType; |
| 1636 | eCsrEncryptionType RSNEncryptType; |
| 1637 | eCsrEncryptionType mcRSNEncryptType; |
| 1638 | int status = VOS_STATUS_SUCCESS; |
| 1639 | tpWLAN_SAPEventCB pSapEventCallback; |
| 1640 | hdd_hostapd_state_t *pHostapdState; |
| 1641 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 1642 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | 1546203 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1643 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1644 | struct qc_mac_acl_entry *acl_entry = NULL; |
| 1645 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 8bca2fd | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 1646 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | |
| 1648 | ENTER(); |
| 1649 | |
| 1650 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 1651 | |
| 1652 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1653 | |
| 1654 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1655 | |
| 1656 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1657 | |
| 1658 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 1659 | |
| 1660 | //channel is already set in the set_channel Call back |
| 1661 | //pConfig->channel = pCommitConfig->channel; |
| 1662 | |
| 1663 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1664 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 1666 | |
| 1667 | pConfig->dtim_period = pBeacon->dtim_period; |
| 1668 | |
| 1669 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***\n", |
| 1670 | pConfig->dtim_period); |
| 1671 | |
| 1672 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 1673 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1674 | { |
| 1675 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1676 | WLAN_EID_COUNTRY); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1677 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1679 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1680 | pConfig->ieee80211d = 1; |
| 1681 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 1682 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 1683 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1684 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1685 | else |
| 1686 | { |
| 1687 | pConfig->ieee80211d = 0; |
| 1688 | } |
Madan Mohan Koyylamudi | 1546203 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1689 | /* |
| 1690 | * If auto channel is configured i.e. channel is 0, |
| 1691 | * so skip channel validation. |
| 1692 | */ |
| 1693 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 1694 | { |
| 1695 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 1696 | { |
| 1697 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1698 | "%s: Invalid Channel [%d] \n", __func__, pConfig->channel); |
| 1699 | return -EINVAL; |
| 1700 | } |
| 1701 | } |
| 1702 | else |
| 1703 | { |
| 1704 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 1705 | { |
| 1706 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 1707 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 1708 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 1709 | } |
| 1710 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 1711 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1713 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | { |
| 1715 | pConfig->ieee80211d = 0; |
| 1716 | } |
| 1717 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 1718 | |
| 1719 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1720 | |
| 1721 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 1723 | |
| 1724 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 1725 | |
| 1726 | /*Set wps station to configured*/ |
| 1727 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 1728 | |
| 1729 | if(pIe) |
| 1730 | { |
| 1731 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 1732 | { |
| 1733 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***\n"); |
| 1734 | return -EINVAL; |
| 1735 | } |
| 1736 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 1737 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1738 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 1740 | * WPS state |
| 1741 | */ |
| 1742 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 1743 | { |
| 1744 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 1745 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 1746 | { |
| 1747 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 1748 | } |
| 1749 | } |
| 1750 | } |
| 1751 | else |
| 1752 | { |
| 1753 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 1754 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1755 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1756 | |
| 1757 | pConfig->RSNWPAReqIELength = 0; |
| 1758 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1759 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | WLAN_EID_RSN); |
| 1761 | if(pIe && pIe[1]) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1762 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1763 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 1764 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 1765 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1766 | /* The actual processing may eventually be more extensive than |
| 1767 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1768 | * by the app. |
| 1769 | * */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1770 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1771 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 1772 | &RSNEncryptType, |
| 1773 | &mcRSNEncryptType, |
| 1774 | &RSNAuthType, |
| 1775 | pConfig->pRSNWPAReqIE[1]+2, |
| 1776 | pConfig->pRSNWPAReqIE ); |
| 1777 | |
| 1778 | if( VOS_STATUS_SUCCESS == status ) |
| 1779 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1780 | /* Now copy over all the security attributes you have |
| 1781 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1782 | * */ |
| 1783 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 1784 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 1785 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 1786 | = RSNEncryptType; |
Gopichand Nakkala | e8997bd | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1787 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1788 | "EncryptionType = %d mcEncryptionType = %d\n"), |
| 1789 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 1790 | } |
| 1791 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1793 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 1794 | pBeacon->tail, pBeacon->tail_len); |
| 1795 | |
| 1796 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 1797 | { |
| 1798 | if (pConfig->pRSNWPAReqIE) |
| 1799 | { |
| 1800 | /*Mixed mode WPA/WPA2*/ |
| 1801 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 1802 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 1803 | } |
| 1804 | else |
| 1805 | { |
| 1806 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 1807 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 1808 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1809 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 1811 | &RSNEncryptType, |
| 1812 | &mcRSNEncryptType, |
| 1813 | &RSNAuthType, |
| 1814 | pConfig->pRSNWPAReqIE[1]+2, |
| 1815 | pConfig->pRSNWPAReqIE ); |
| 1816 | |
| 1817 | if( VOS_STATUS_SUCCESS == status ) |
| 1818 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1819 | /* Now copy over all the security attributes you have |
| 1820 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1821 | * */ |
| 1822 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 1823 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 1824 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 1825 | = RSNEncryptType; |
Gopichand Nakkala | e8997bd | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1826 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1827 | "EncryptionType = %d mcEncryptionType = %d\n"), |
| 1828 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 1829 | } |
| 1830 | } |
| 1831 | } |
| 1832 | |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1833 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 1834 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 1835 | return -EINVAL; |
| 1836 | } |
| 1837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1838 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 1839 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1840 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1841 | if (params->ssid != NULL) |
| 1842 | { |
| 1843 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 1844 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 1845 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 1846 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 1847 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1848 | #else |
| 1849 | if (ssid != NULL) |
| 1850 | { |
| 1851 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 1852 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 1853 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 1854 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 1855 | } |
| 1856 | #endif |
| 1857 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1858 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1859 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | /* default value */ |
| 1862 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 1863 | pConfig->num_accept_mac = 0; |
| 1864 | pConfig->num_deny_mac = 0; |
| 1865 | |
| 1866 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 1867 | pBeacon->tail, pBeacon->tail_len); |
| 1868 | |
| 1869 | /* pIe for black list is following form: |
| 1870 | type : 1 byte |
| 1871 | length : 1 byte |
| 1872 | OUI : 4 bytes |
| 1873 | acl type : 1 byte |
| 1874 | no of mac addr in black list: 1 byte |
| 1875 | list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1876 | */ |
| 1877 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1878 | { |
| 1879 | pConfig->SapMacaddr_acl = pIe[6]; |
| 1880 | pConfig->num_deny_mac = pIe[7]; |
| 1881 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d\n", |
| 1882 | pIe[6], pIe[7]); |
| 1883 | if (pConfig->num_deny_mac > MAX_MAC_ADDRESS_DENIED) |
| 1884 | pConfig->num_deny_mac = MAX_MAC_ADDRESS_DENIED; |
| 1885 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 1886 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 1887 | { |
| 1888 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 1889 | acl_entry++; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1891 | } |
| 1892 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 1893 | pBeacon->tail, pBeacon->tail_len); |
| 1894 | |
| 1895 | /* pIe for white list is following form: |
| 1896 | type : 1 byte |
| 1897 | length : 1 byte |
| 1898 | OUI : 4 bytes |
| 1899 | acl type : 1 byte |
| 1900 | no of mac addr in white list: 1 byte |
| 1901 | list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1902 | */ |
| 1903 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1904 | { |
| 1905 | pConfig->SapMacaddr_acl = pIe[6]; |
| 1906 | pConfig->num_accept_mac = pIe[7]; |
| 1907 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d\n", |
| 1908 | pIe[6], pIe[7]); |
| 1909 | if (pConfig->num_accept_mac > MAX_MAC_ADDRESS_ACCEPTED) |
| 1910 | pConfig->num_accept_mac = MAX_MAC_ADDRESS_ACCEPTED; |
| 1911 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 1912 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 1913 | { |
| 1914 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 1915 | acl_entry++; |
| 1916 | } |
| 1917 | } |
| 1918 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 1919 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1920 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | 40e89bd | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 1921 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
| 1922 | * This is valid only if mode is set to 11n in hostapd and either AUTO or 11ac in .ini . |
| 1923 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) */ |
| 1924 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 1925 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1926 | (((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_AUTO) || |
Ravi Kumar Vaishnav | 40e89bd | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 1927 | ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac) || |
| 1928 | ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1929 | { |
| 1930 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
| 1931 | } |
| 1932 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1933 | |
Ravi Joshi | 2bd6f15 | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 1934 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 1935 | { |
| 1936 | sme_SelectCBMode(hHal, |
| 1937 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 1938 | pConfig->channel); |
| 1939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 1941 | pConfig->ht_capab = |
| 1942 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 1943 | |
| 1944 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 1945 | { |
| 1946 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 1947 | return -EINVAL; |
| 1948 | } |
| 1949 | |
| 1950 | //Uapsd Enabled Bit |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1951 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1952 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 1953 | //Enable OBSS protection |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1954 | pConfig->obssProtEnabled = |
| 1955 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1957 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR"\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1959 | hddLog(LOGW,FL("ssid =%s\n"), pConfig->SSIDinfo.ssid.ssId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1960 | hddLog(LOGW,FL("beaconint=%d, channel=%d\n"), (int)pConfig->beacon_int, |
| 1961 | (int)pConfig->channel); |
| 1962 | hddLog(LOGW,FL("hw_mode=%x\n"), pConfig->SapHw_mode); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1963 | hddLog(LOGW,FL("privacy=%d, authType=%d\n"), pConfig->privacy, |
| 1964 | pConfig->authType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | hddLog(LOGW,FL("RSN/WPALen=%d, \n"),(int)pConfig->RSNWPAReqIELength); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1966 | hddLog(LOGW,FL("Uapsd = %d\n"),pConfig->UapsdEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1967 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d\n"), |
| 1968 | pConfig->protEnabled, pConfig->obssProtEnabled); |
| 1969 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1970 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | { |
| 1972 | //Bss already started. just return. |
| 1973 | //TODO Probably it should update some beacon params. |
| 1974 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 1975 | EXIT(); |
| 1976 | return 0; |
| 1977 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1978 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1979 | pConfig->persona = pHostapdAdapter->device_mode; |
| 1980 | |
| 1981 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 1982 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 1983 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 1984 | { |
| 1985 | hddLog(LOGE,FL("SAP Start Bss fail\n")); |
| 1986 | return -EINVAL; |
| 1987 | } |
| 1988 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1989 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1990 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 1991 | |
| 1992 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1994 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1995 | { |
| 1996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1997 | ("ERROR: HDD vos wait for single_event failed!!\n")); |
| 1998 | VOS_ASSERT(0); |
| 1999 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | //Succesfully started Bss update the state bit. |
| 2002 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 2003 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2004 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2005 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 2006 | { |
| 2007 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 2008 | { |
| 2009 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2010 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 3d710ea | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2011 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2012 | } |
| 2013 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 2014 | { |
| 2015 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2016 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 3d710ea | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2017 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2018 | } |
| 2019 | } |
| 2020 | #endif |
| 2021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2022 | pHostapdState->bCommit = TRUE; |
| 2023 | EXIT(); |
| 2024 | |
| 2025 | return 0; |
| 2026 | } |
| 2027 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2028 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2029 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 2030 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2031 | struct beacon_parameters *params) |
| 2032 | { |
| 2033 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2034 | hdd_context_t *pHddCtx; |
| 2035 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | |
| 2037 | ENTER(); |
| 2038 | |
| 2039 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d\n",pAdapter->device_mode); |
| 2040 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2041 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2042 | status = wlan_hdd_validate_context(pHddCtx); |
| 2043 | |
| 2044 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2045 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2046 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2047 | "%s: HDD context is not valid", __func__); |
| 2048 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2049 | } |
| 2050 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2051 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2052 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | ) |
| 2054 | { |
| 2055 | beacon_data_t *old,*new; |
| 2056 | |
| 2057 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2058 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2059 | if (old) |
| 2060 | return -EALREADY; |
| 2061 | |
| 2062 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2063 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2064 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2065 | { |
| 2066 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2067 | "%s:Error!!! Allocating the new beacon\n",__func__); |
| 2068 | return -EINVAL; |
| 2069 | } |
| 2070 | |
| 2071 | pAdapter->sessionCtx.ap.beacon = new; |
| 2072 | |
| 2073 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2074 | } |
| 2075 | |
| 2076 | EXIT(); |
| 2077 | return status; |
| 2078 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2079 | |
| 2080 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | struct net_device *dev, |
| 2082 | struct beacon_parameters *params) |
| 2083 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2084 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2085 | hdd_context_t *pHddCtx; |
| 2086 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2087 | |
| 2088 | ENTER(); |
| 2089 | |
| 2090 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 2091 | __func__,pAdapter->device_mode); |
| 2092 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2093 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2094 | status = wlan_hdd_validate_context(pHddCtx); |
| 2095 | |
| 2096 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2097 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2098 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2099 | "%s: HDD context is not valid", __func__); |
| 2100 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2101 | } |
| 2102 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2103 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2104 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2105 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2106 | { |
| 2107 | beacon_data_t *old,*new; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2111 | if (!old) |
| 2112 | return -ENOENT; |
| 2113 | |
| 2114 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2115 | |
| 2116 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2117 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | "%s: Error!!! Allocating the new beacon\n",__func__); |
| 2119 | return -EINVAL; |
| 2120 | } |
| 2121 | |
| 2122 | pAdapter->sessionCtx.ap.beacon = new; |
| 2123 | |
| 2124 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2125 | } |
| 2126 | |
| 2127 | EXIT(); |
| 2128 | return status; |
| 2129 | } |
| 2130 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2131 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 2132 | |
| 2133 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 2135 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2136 | #else |
| 2137 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 2138 | struct net_device *dev) |
| 2139 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | { |
| 2141 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2142 | hdd_context_t *pHddCtx = NULL; |
| 2143 | hdd_scaninfo_t *pScanInfo = NULL; |
| 2144 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2145 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | |
| 2147 | ENTER(); |
| 2148 | |
| 2149 | if (NULL == pAdapter) |
| 2150 | { |
| 2151 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2152 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2153 | return -ENODEV; |
| 2154 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2155 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2156 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2157 | status = wlan_hdd_validate_context(pHddCtx); |
| 2158 | |
| 2159 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2160 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2161 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2162 | "%s: HDD context is not valid", __func__); |
| 2163 | return status; |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2164 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2165 | |
| 2166 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2167 | if (NULL == staAdapter) |
| 2168 | { |
| 2169 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 2170 | if (NULL == staAdapter) |
| 2171 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2172 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2173 | "%s: HDD adapter context is Null", __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2174 | return -ENODEV; |
| 2175 | } |
| 2176 | } |
| 2177 | |
| 2178 | pScanInfo = &pHddCtx->scan_info; |
| 2179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2180 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 2181 | __func__,pAdapter->device_mode); |
| 2182 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2183 | if ((pScanInfo != NULL) && pScanInfo->mScanPending) |
| 2184 | { |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2185 | INIT_COMPLETION(pScanInfo->abortscan_event_var); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2186 | hdd_abort_mac_scan(staAdapter->pHddCtx); |
| 2187 | status = wait_for_completion_interruptible_timeout( |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2188 | &pScanInfo->abortscan_event_var, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2189 | msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN)); |
| 2190 | if (!status) |
| 2191 | { |
| 2192 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 2193 | "%s: Timeout occurred while waiting for abortscan" , |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2194 | __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2195 | VOS_ASSERT(pScanInfo->mScanPending); |
| 2196 | return 0; |
| 2197 | } |
| 2198 | } |
| 2199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2201 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | ) |
| 2203 | { |
| 2204 | beacon_data_t *old; |
| 2205 | |
| 2206 | old = pAdapter->sessionCtx.ap.beacon; |
| 2207 | |
| 2208 | if (!old) |
| 2209 | return -ENOENT; |
| 2210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | |
| 2213 | mutex_lock(&pHddCtx->sap_lock); |
| 2214 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 2215 | { |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2216 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | { |
| 2218 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 2219 | |
| 2220 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 2221 | |
| 2222 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2223 | { |
| 2224 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2225 | ("ERROR: HDD vos wait for single_event failed!!\n")); |
| 2226 | VOS_ASSERT(0); |
| 2227 | } |
| 2228 | } |
| 2229 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
| 2230 | } |
| 2231 | mutex_unlock(&pHddCtx->sap_lock); |
| 2232 | |
| 2233 | if(status != VOS_STATUS_SUCCESS) |
| 2234 | { |
| 2235 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2236 | "%s:Error!!! Stopping the BSS\n",__func__); |
| 2237 | return -EINVAL; |
| 2238 | } |
| 2239 | |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2240 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2241 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 2242 | ==eHAL_STATUS_FAILURE) |
| 2243 | { |
| 2244 | hddLog(LOGE, |
| 2245 | "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM\n"); |
| 2246 | } |
| 2247 | |
Jeff Johnson | 7202f27 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2248 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2249 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 2250 | eANI_BOOLEAN_FALSE) ) |
| 2251 | { |
| 2252 | hddLog(LOGE, |
| 2253 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM\n"); |
| 2254 | } |
| 2255 | |
| 2256 | // Reset WNI_CFG_PROBE_RSP Flags |
| 2257 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 2258 | |
| 2259 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 2260 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2261 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2262 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 2263 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 2264 | { |
| 2265 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 2266 | "GO got removed"); |
| 2267 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 2268 | } |
| 2269 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2270 | } |
| 2271 | EXIT(); |
| 2272 | return status; |
| 2273 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2274 | |
| 2275 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2276 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2277 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 2278 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2279 | struct cfg80211_ap_settings *params) |
| 2280 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2281 | hdd_adapter_t *pAdapter; |
| 2282 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2283 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2284 | |
| 2285 | ENTER(); |
| 2286 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2287 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2288 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2289 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2290 | "%s: Device is Null", __func__); |
| 2291 | return -ENODEV; |
| 2292 | } |
| 2293 | |
| 2294 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2295 | if (NULL == pAdapter) |
| 2296 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2297 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2298 | "%s: HDD adapter is Null", __func__); |
| 2299 | return -ENODEV; |
| 2300 | } |
| 2301 | |
| 2302 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 2303 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2304 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2305 | "%s: HDD adapter magic is invalid", __func__); |
| 2306 | return -ENODEV; |
| 2307 | } |
| 2308 | |
| 2309 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2310 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2311 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2312 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2313 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2314 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2315 | "%s: HDD context is not valid", __func__); |
| 2316 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2317 | } |
| 2318 | |
| 2319 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %d", |
| 2320 | __func__, pAdapter->device_mode); |
| 2321 | |
| 2322 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2323 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2324 | ) |
| 2325 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2326 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2327 | |
| 2328 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2329 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2330 | if (old) |
| 2331 | return -EALREADY; |
| 2332 | |
| 2333 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 2334 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2335 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2336 | { |
| 2337 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2338 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2339 | return -EINVAL; |
| 2340 | } |
| 2341 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 7e58d19 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 2342 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 2343 | wlan_hdd_cfg80211_set_channel(wiphy, dev, params->channel, params->channel_type); |
| 2344 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2345 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 2346 | params->ssid_len, params->hidden_ssid); |
| 2347 | } |
| 2348 | |
| 2349 | EXIT(); |
| 2350 | return status; |
| 2351 | } |
| 2352 | |
| 2353 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2354 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2355 | struct net_device *dev, |
| 2356 | struct cfg80211_beacon_data *params) |
| 2357 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2358 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2359 | hdd_context_t *pHddCtx; |
| 2360 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2361 | |
| 2362 | ENTER(); |
| 2363 | |
| 2364 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 2365 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2366 | |
| 2367 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2368 | status = wlan_hdd_validate_context(pHddCtx); |
| 2369 | |
| 2370 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2371 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2372 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2373 | "%s: HDD context is not valid", __func__); |
| 2374 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2375 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2376 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2377 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2378 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2379 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2380 | { |
| 2381 | beacon_data_t *old,*new; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2382 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2383 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2384 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2385 | if (!old) |
| 2386 | return -ENOENT; |
| 2387 | |
| 2388 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 2389 | |
| 2390 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2391 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2392 | "%s: Error!!! Allocating the new beacon\n",__func__); |
| 2393 | return -EINVAL; |
| 2394 | } |
| 2395 | |
| 2396 | pAdapter->sessionCtx.ap.beacon = new; |
| 2397 | |
| 2398 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 2399 | } |
| 2400 | |
| 2401 | EXIT(); |
| 2402 | return status; |
| 2403 | } |
| 2404 | |
| 2405 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2407 | |
| 2408 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 2409 | struct net_device *dev, |
| 2410 | struct bss_parameters *params) |
| 2411 | { |
| 2412 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2413 | |
| 2414 | ENTER(); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2416 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 2417 | __func__,pAdapter->device_mode); |
| 2418 | |
| 2419 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2420 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2421 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2422 | { |
| 2423 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 2424 | * want to update this parameter */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2425 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2426 | { |
| 2427 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2429 | } |
| 2430 | |
| 2431 | EXIT(); |
| 2432 | return 0; |
| 2433 | } |
| 2434 | |
| 2435 | /* |
| 2436 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 2437 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 2438 | */ |
| 2439 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 2440 | struct net_device *ndev, |
| 2441 | enum nl80211_iftype type, |
| 2442 | u32 *flags, |
| 2443 | struct vif_params *params |
| 2444 | ) |
| 2445 | { |
| 2446 | struct wireless_dev *wdev; |
| 2447 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 2448 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2449 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | tCsrRoamProfile *pRoamProfile = NULL; |
| 2451 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2452 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | eMib_dot11DesiredBssType connectedBssType; |
| 2454 | VOS_STATUS status; |
| 2455 | |
| 2456 | ENTER(); |
| 2457 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2458 | status = wlan_hdd_validate_context(pHddCtx); |
| 2459 | |
| 2460 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2461 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2462 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2463 | "%s: HDD context is not valid", __func__); |
| 2464 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | } |
| 2466 | |
| 2467 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 2468 | __func__, pAdapter->device_mode); |
| 2469 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 2470 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2471 | wdev = ndev->ieee80211_ptr; |
| 2472 | |
| 2473 | #ifdef WLAN_BTAMP_FEATURE |
| 2474 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 2475 | (NL80211_IFTYPE_ADHOC == type)|| |
| 2476 | (NL80211_IFTYPE_AP == type)|| |
| 2477 | (NL80211_IFTYPE_P2P_GO == type)) |
| 2478 | { |
| 2479 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 2480 | // stop AMP traffic |
| 2481 | status = WLANBAP_StopAmp(); |
| 2482 | if(VOS_STATUS_SUCCESS != status ) |
| 2483 | { |
| 2484 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2485 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2486 | "%s: Failed to stop AMP", __func__); |
| 2487 | return -EINVAL; |
| 2488 | } |
| 2489 | } |
| 2490 | #endif //WLAN_BTAMP_FEATURE |
| 2491 | /* Reset the current device mode bit mask*/ |
| 2492 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 2493 | |
| 2494 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2495 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2496 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2497 | ) |
| 2498 | { |
| 2499 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2500 | pRoamProfile = &pWextState->roamProfile; |
| 2501 | LastBSSType = pRoamProfile->BSSType; |
| 2502 | |
| 2503 | switch (type) |
| 2504 | { |
| 2505 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2506 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2507 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2508 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 2509 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2510 | #ifdef WLAN_FEATURE_11AC |
| 2511 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 2512 | { |
| 2513 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 2514 | } |
| 2515 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2516 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2517 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2518 | wdev->iftype = type; |
Gopichand Nakkala | 310362f | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2519 | //Check for sub-string p2p to confirm its a p2p interface |
| 2520 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2521 | { |
Gopichand Nakkala | ad9ed1a | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2522 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 2523 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 2524 | } |
| 2525 | else |
| 2526 | { |
| 2527 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | ad9ed1a | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2530 | break; |
| 2531 | case NL80211_IFTYPE_ADHOC: |
| 2532 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2533 | "%s: setting interface Type to ADHOC", __func__); |
| 2534 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 2535 | pRoamProfile->phyMode = |
| 2536 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | d58f791 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2537 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2538 | wdev->iftype = type; |
| 2539 | break; |
| 2540 | |
| 2541 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2542 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2543 | { |
| 2544 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 2545 | "%s: setting interface Type to %s", __func__, |
| 2546 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 2547 | |
Gopichand Nakkala | 310362f | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2548 | //Cancel any remain on channel for GO mode |
| 2549 | if (NL80211_IFTYPE_P2P_GO == type) |
| 2550 | { |
| 2551 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 2552 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2553 | if (NL80211_IFTYPE_AP == type) |
| 2554 | { |
| 2555 | /* As Loading WLAN Driver one interface being created for p2p device |
| 2556 | * address. This will take one HW STA and the max number of clients |
| 2557 | * that can connect to softAP will be reduced by one. so while changing |
| 2558 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 2559 | * interface as it is not required in SoftAP mode. |
| 2560 | */ |
| 2561 | |
| 2562 | // Get P2P Adapter |
| 2563 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 2564 | |
| 2565 | if (pP2pAdapter) |
| 2566 | { |
| 2567 | hdd_stop_adapter(pHddCtx, pP2pAdapter); |
| 2568 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 2569 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 2570 | } |
| 2571 | } |
| 2572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | //De-init the adapter. |
| 2574 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 2575 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 2576 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 2578 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2579 | |
| 2580 | //Disable BMPS and IMPS if enabled |
| 2581 | //before starting Go |
| 2582 | if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 2583 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2584 | if(VOS_STATUS_E_FAILURE == |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2585 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 2586 | { |
| 2587 | //Fail to Exit BMPS |
| 2588 | VOS_ASSERT(0); |
| 2589 | } |
| 2590 | } |
| 2591 | |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 2592 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 2593 | (pConfig->apRandomBssidEnabled)) |
| 2594 | { |
| 2595 | /* To meet Android requirements create a randomized |
| 2596 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 2597 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 2598 | ndev->dev_addr[0] = 0x02; |
| 2599 | ndev->dev_addr[1] = 0x1A; |
| 2600 | ndev->dev_addr[2] = 0x11; |
| 2601 | ndev->dev_addr[3] |= 0xF0; |
| 2602 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 2603 | VOS_MAC_ADDR_SIZE); |
| 2604 | pr_info("wlan: Generated HotSpot BSSID " |
| 2605 | "%02x:%02x:%02x:%02x:%02x:%02x\n", |
| 2606 | ndev->dev_addr[0], |
| 2607 | ndev->dev_addr[1], |
| 2608 | ndev->dev_addr[2], |
| 2609 | ndev->dev_addr[3], |
| 2610 | ndev->dev_addr[4], |
| 2611 | ndev->dev_addr[5]); |
| 2612 | } |
| 2613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | hdd_set_ap_ops( pAdapter->dev ); |
| 2615 | |
| 2616 | status = hdd_init_ap_mode(pAdapter); |
| 2617 | if(status != VOS_STATUS_SUCCESS) |
| 2618 | { |
| 2619 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2620 | "%s: Error initializing the ap mode", __func__); |
| 2621 | return -EINVAL; |
| 2622 | } |
| 2623 | hdd_set_conparam(1); |
| 2624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2625 | /*interface type changed update in wiphy structure*/ |
| 2626 | if(wdev) |
| 2627 | { |
| 2628 | wdev->iftype = type; |
| 2629 | pHddCtx->change_iface = type; |
| 2630 | } |
| 2631 | else |
| 2632 | { |
| 2633 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2634 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 2635 | return -EINVAL; |
| 2636 | } |
| 2637 | goto done; |
| 2638 | } |
| 2639 | |
| 2640 | default: |
| 2641 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 2642 | __func__); |
| 2643 | return -EOPNOTSUPP; |
| 2644 | } |
| 2645 | } |
| 2646 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2647 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2648 | ) |
| 2649 | { |
| 2650 | switch(type) |
| 2651 | { |
| 2652 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2653 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2654 | case NL80211_IFTYPE_ADHOC: |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2655 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 2656 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2657 | wdev->iftype = type; |
Gopichand Nakkala | 310362f | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2658 | //Check for sub-string p2p to confirm its a p2p interface |
| 2659 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | ad9ed1a | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2660 | { |
| 2661 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 2662 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 2663 | } |
| 2664 | else |
| 2665 | { |
| 2666 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2667 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | ad9ed1a | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2668 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2669 | hdd_set_conparam(0); |
| 2670 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2671 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 2672 | hdd_set_station_ops( pAdapter->dev ); |
| 2673 | status = hdd_init_station_mode( pAdapter ); |
| 2674 | if( VOS_STATUS_SUCCESS != status ) |
| 2675 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2676 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 2677 | * This is the right place to enable back bmps_imps() |
| 2678 | */ |
| 2679 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2680 | goto done; |
| 2681 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2682 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2684 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 2685 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | goto done; |
| 2687 | default: |
| 2688 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 2689 | __func__); |
| 2690 | return -EOPNOTSUPP; |
| 2691 | |
| 2692 | } |
| 2693 | |
| 2694 | } |
| 2695 | else |
| 2696 | { |
| 2697 | return -EOPNOTSUPP; |
| 2698 | } |
| 2699 | |
| 2700 | |
| 2701 | if(pRoamProfile) |
| 2702 | { |
| 2703 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 2704 | { |
| 2705 | /*interface type changed update in wiphy structure*/ |
| 2706 | wdev->iftype = type; |
| 2707 | |
| 2708 | /*the BSS mode changed, We need to issue disconnect |
| 2709 | if connected or in IBSS disconnect state*/ |
| 2710 | if ( hdd_connGetConnectedBssType( |
| 2711 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 2712 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 2713 | { |
| 2714 | /*need to issue a disconnect to CSR.*/ |
| 2715 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 2716 | if( eHAL_STATUS_SUCCESS == |
| 2717 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2718 | pAdapter->sessionId, |
| 2719 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 2720 | { |
| 2721 | wait_for_completion_interruptible_timeout( |
| 2722 | &pAdapter->disconnect_comp_var, |
| 2723 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 2724 | } |
| 2725 | } |
| 2726 | } |
| 2727 | } |
| 2728 | |
| 2729 | done: |
| 2730 | /*set bitmask based on updated value*/ |
| 2731 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 2732 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2733 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2734 | (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 2735 | { |
| 2736 | //we are ok to do AMP |
| 2737 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2738 | } |
| 2739 | #endif //WLAN_BTAMP_FEATURE |
| 2740 | EXIT(); |
| 2741 | return 0; |
| 2742 | } |
| 2743 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2744 | #ifdef FEATURE_WLAN_TDLS |
| 2745 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 2746 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 2747 | { |
| 2748 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2749 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2750 | VOS_STATUS status; |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2751 | hddTdlsPeer_t *pTdlsPeer; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2752 | |
| 2753 | ENTER(); |
| 2754 | |
Gopichand Nakkala | fbbd34a | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 2755 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2756 | { |
| 2757 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2758 | "Invalid arguments"); |
| 2759 | return -EINVAL; |
| 2760 | } |
Hoonki Lee | 8c368e9 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2761 | |
| 2762 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 2763 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 2764 | { |
| 2765 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2766 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 2767 | MAC_ADDRESS_STR " Request declined.", |
| 2768 | __func__, MAC_ADDR_ARRAY(mac)); |
| 2769 | return -ENOTSUPP; |
| 2770 | } |
| 2771 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2772 | if (pHddCtx->isLogpInProgress) |
| 2773 | { |
| 2774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2775 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 2776 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2777 | return -EBUSY; |
| 2778 | } |
| 2779 | |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2780 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac); |
| 2781 | |
| 2782 | if ( NULL == pTdlsPeer ) { |
| 2783 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2784 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 2785 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 2786 | return -EINVAL; |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2787 | } |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2788 | |
| 2789 | /* in add station, we accept existing valid staId if there is */ |
| 2790 | if ((0 == update) && |
| 2791 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 2792 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2793 | { |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2794 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2795 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2796 | " link_status %d. staId %d. add station ignored.", |
| 2797 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 2798 | return 0; |
| 2799 | } |
| 2800 | /* in change station, we accept only when staId is valid */ |
| 2801 | if ((1 == update) && |
| 2802 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 2803 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 2804 | { |
| 2805 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2806 | "%s: " MAC_ADDRESS_STR |
| 2807 | " link status %d. staId %d. change station %s.", |
| 2808 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 2809 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 2810 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2811 | } |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2812 | |
| 2813 | /* when others are on-going, we want to change link_status to idle */ |
Hoonki Lee | 39d2ece | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2814 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2815 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2816 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2817 | "%s: " MAC_ADDRESS_STR |
| 2818 | " TDLS setup is ongoing. Request declined.", |
| 2819 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 2820 | goto error; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2821 | } |
| 2822 | |
| 2823 | /* first to check if we reached to maximum supported TDLS peer. |
| 2824 | TODO: for now, return -EPERM looks working fine, |
| 2825 | but need to check if any other errno fit into this category.*/ |
| 2826 | if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter)) |
| 2827 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2828 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2829 | "%s: " MAC_ADDRESS_STR |
| 2830 | " TDLS Max peer already connected. Request declined.", |
| 2831 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 2832 | goto error; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2833 | } |
| 2834 | else |
| 2835 | { |
| 2836 | hddTdlsPeer_t *pTdlsPeer; |
| 2837 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2838 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2839 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2840 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2841 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 2842 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2843 | return -EPERM; |
| 2844 | } |
| 2845 | } |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2846 | if (0 == update) |
| 2847 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_CONNECTING); |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2848 | |
Jeff Johnson | 0d9dfdf | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 2849 | /* debug code */ |
Gopichand Nakkala | fbbd34a | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 2850 | if (NULL != StaParams) |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2851 | { |
| 2852 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2853 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2854 | if(StaParams->htcap_present) |
| 2855 | { |
| 2856 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2857 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 2858 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2859 | "ht_capa->extended_capabilities: %0x", |
| 2860 | StaParams->HTCap.extendedHtCapInfo); |
| 2861 | } |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2862 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2863 | "params->capability: %0x",StaParams->capability); |
| 2864 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2865 | "params->ext_capab_len: %0x",StaParams->extn_capability); |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2866 | if(StaParams->vhtcap_present) |
| 2867 | { |
| 2868 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2869 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 2870 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 2871 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 2872 | } |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2873 | { |
| 2874 | int i = 0; |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 2875 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2876 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 2877 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2878 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 2879 | } |
Jeff Johnson | 0d9dfdf | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 2880 | } /* end debug code */ |
Gopichand Nakkala | fbbd34a | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 2881 | else if ((1 == update) && (NULL == StaParams)) |
| 2882 | { |
| 2883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2884 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 2885 | return -EPERM; |
| 2886 | } |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2887 | |
| 2888 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 2889 | |
| 2890 | if (!update) |
| 2891 | { |
| 2892 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2893 | pAdapter->sessionId, mac); |
| 2894 | } |
| 2895 | else |
| 2896 | { |
| 2897 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2898 | pAdapter->sessionId, mac, StaParams); |
| 2899 | } |
| 2900 | |
| 2901 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
| 2902 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 2903 | |
| 2904 | if (!status) |
| 2905 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2906 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2907 | "%s: timeout waiting for tdls add station indication", |
| 2908 | __func__); |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2909 | return -EPERM; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2910 | } |
| 2911 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 2912 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2913 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2914 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2915 | return -EPERM; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2916 | } |
| 2917 | |
| 2918 | return 0; |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 2919 | |
| 2920 | error: |
| 2921 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
| 2922 | return -EPERM; |
| 2923 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2924 | } |
| 2925 | #endif |
| 2926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 2928 | struct net_device *dev, |
| 2929 | u8 *mac, |
| 2930 | struct station_parameters *params) |
| 2931 | { |
| 2932 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 2933 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2934 | hdd_context_t *pHddCtx; |
| 2935 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2936 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | 87ea064 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 2937 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2938 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2939 | tANI_U8 isBufSta = 0; |
Gopichand Nakkala | 87ea064 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 2940 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2941 | ENTER(); |
| 2942 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2943 | if ((NULL == pAdapter)) |
| 2944 | { |
| 2945 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2946 | "invalid adapter "); |
| 2947 | return -EINVAL; |
| 2948 | } |
| 2949 | |
| 2950 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2951 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2952 | |
| 2953 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 2954 | { |
| 2955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2956 | "invalid HDD state or HDD station context"); |
| 2957 | return -EINVAL; |
| 2958 | } |
| 2959 | |
| 2960 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2961 | { |
| 2962 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2963 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 2964 | return -EAGAIN; |
| 2965 | } |
| 2966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2967 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 2968 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2969 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 2970 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | { |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2972 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2973 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2974 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2975 | WLANTL_STA_AUTHENTICATED); |
| 2976 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2977 | if (status != VOS_STATUS_SUCCESS) |
| 2978 | { |
| 2979 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2980 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 2981 | return -EINVAL; |
| 2982 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | } |
| 2984 | } |
Hoonki Lee | 2235155 | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2985 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 2986 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2987 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2988 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 2989 | StaParams.capability = params->capability; |
| 2990 | StaParams.uapsd_queues = params->uapsd_queues; |
| 2991 | StaParams.max_sp = params->max_sp; |
| 2992 | |
| 2993 | if (0 != params->ext_capab_len) |
| 2994 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 2995 | sizeof(StaParams.extn_capability)); |
| 2996 | |
| 2997 | if (NULL != params->ht_capa) |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2998 | { |
| 2999 | StaParams.htcap_present = 1; |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3000 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3001 | } |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3002 | |
| 3003 | StaParams.supported_rates_len = params->supported_rates_len; |
| 3004 | |
| 3005 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 3006 | * The supported_rates array , for all the structures propogating till Add Sta |
| 3007 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 3008 | * modified to send more rates. |
| 3009 | */ |
| 3010 | |
| 3011 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 3012 | */ |
| 3013 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 3014 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 3015 | |
| 3016 | if (0 != StaParams.supported_rates_len) { |
| 3017 | int i = 0; |
| 3018 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 3019 | StaParams.supported_rates_len); |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3020 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3021 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 3022 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3023 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3024 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 3025 | } |
| 3026 | |
| 3027 | if (NULL != params->vht_capa) |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3028 | { |
| 3029 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3030 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | d91a98f | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3031 | } |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3032 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3033 | if (0 != params->ext_capab_len ) { |
| 3034 | /*Define A Macro : TODO Sunil*/ |
| 3035 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 3036 | isBufSta = 1; |
| 3037 | } |
| 3038 | } |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3039 | //status = wlan_hdd_tdls_set_peer_caps( mac, params->uapsd_queues, |
| 3040 | // params->max_sp, isBufSta); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3041 | //if (VOS_STATUS_SUCCESS != status) { |
| 3042 | // VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3043 | // "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 3044 | // return -EINVAL; |
| 3045 | //} |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3046 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 3047 | |
| 3048 | if (VOS_STATUS_SUCCESS != status) { |
| 3049 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3050 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 3051 | return -EINVAL; |
| 3052 | } |
| 3053 | } |
Gopichand Nakkala | 87ea064 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3054 | #endif |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3055 | if(params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
| 3056 | { |
| 3057 | status = WLANTL_ChangeSTAState(pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], |
| 3058 | WLANTL_STA_AUTHENTICATED); |
| 3059 | if (status != VOS_STATUS_SUCCESS) |
| 3060 | { |
| 3061 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3062 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 3063 | return -EINVAL; |
| 3064 | } |
| 3065 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 3066 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3067 | "%s: TL Moving to Authenticated state", __func__); |
| 3068 | } |
| 3069 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3070 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3071 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3072 | return status; |
| 3073 | } |
| 3074 | |
| 3075 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | * FUNCTION: wlan_hdd_cfg80211_add_key |
| 3077 | * This function is used to initialize the key information |
| 3078 | */ |
| 3079 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3080 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3081 | struct net_device *ndev, |
| 3082 | u8 key_index, bool pairwise, |
| 3083 | const u8 *mac_addr, |
| 3084 | struct key_params *params |
| 3085 | ) |
| 3086 | #else |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3087 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | struct net_device *ndev, |
| 3089 | u8 key_index, const u8 *mac_addr, |
| 3090 | struct key_params *params |
| 3091 | ) |
| 3092 | #endif |
| 3093 | { |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3094 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3095 | tCsrRoamSetKey setKey; |
| 3096 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3097 | int status; |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3098 | v_U32_t roamId= 0xFF; |
| 3099 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3100 | hdd_hostapd_state_t *pHostapdState; |
| 3101 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3102 | eHalStatus halStatus; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3103 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3104 | |
| 3105 | ENTER(); |
| 3106 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3107 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3108 | status = wlan_hdd_validate_context(pHddCtx); |
| 3109 | |
| 3110 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3111 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3113 | "%s: HDD context is not valid", __func__); |
| 3114 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3115 | } |
| 3116 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3117 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 3118 | __func__, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | |
| 3120 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3121 | { |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3122 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3123 | key_index); |
| 3124 | |
| 3125 | return -EINVAL; |
| 3126 | } |
| 3127 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3128 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 3129 | { |
| 3130 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 3131 | params->key_len); |
| 3132 | |
| 3133 | return -EINVAL; |
| 3134 | } |
| 3135 | |
| 3136 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3137 | "%s: called with key index = %d & key length %d", |
| 3138 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | |
| 3140 | /*extract key idx, key len and key*/ |
| 3141 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3142 | setKey.keyId = key_index; |
| 3143 | setKey.keyLength = params->key_len; |
| 3144 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 3145 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3146 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3147 | { |
| 3148 | case WLAN_CIPHER_SUITE_WEP40: |
| 3149 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3150 | break; |
| 3151 | |
| 3152 | case WLAN_CIPHER_SUITE_WEP104: |
| 3153 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3154 | break; |
| 3155 | |
| 3156 | case WLAN_CIPHER_SUITE_TKIP: |
| 3157 | { |
| 3158 | u8 *pKey = &setKey.Key[0]; |
| 3159 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3160 | |
| 3161 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 3162 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3163 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3164 | |
| 3165 | |--------------|----------|----------| |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3166 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3167 | |--------------|----------|----------| |
| 3168 | <---16bytes---><--8bytes--><--8bytes--> |
| 3169 | |
| 3170 | */ |
| 3171 | /*Sme expects the 32 bytes key to be in the below order |
| 3172 | |
| 3173 | |--------------|----------|----------| |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3174 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3175 | |--------------|----------|----------| |
| 3176 | <---16bytes---><--8bytes--><--8bytes--> |
| 3177 | */ |
| 3178 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3179 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3180 | |
| 3181 | /*Copy the rx mic first*/ |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3182 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3183 | |
| 3184 | /*Copy the tx mic */ |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3185 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | |
| 3187 | |
| 3188 | break; |
| 3189 | } |
| 3190 | |
| 3191 | case WLAN_CIPHER_SUITE_CCMP: |
| 3192 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 3193 | break; |
| 3194 | |
| 3195 | #ifdef FEATURE_WLAN_WAPI |
| 3196 | case WLAN_CIPHER_SUITE_SMS4: |
| 3197 | { |
| 3198 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3199 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 3200 | params->key, params->key_len); |
| 3201 | return 0; |
| 3202 | } |
| 3203 | #endif |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3205 | #ifdef FEATURE_WLAN_CCX |
| 3206 | case WLAN_CIPHER_SUITE_KRK: |
| 3207 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 3208 | break; |
| 3209 | #endif |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3210 | |
| 3211 | #ifdef WLAN_FEATURE_11W |
| 3212 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 3213 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 7ba6024 | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 3214 | break; |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3215 | #endif |
| 3216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3217 | default: |
| 3218 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %lu", |
| 3219 | __func__, params->cipher); |
| 3220 | return -EOPNOTSUPP; |
| 3221 | } |
| 3222 | |
| 3223 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 3224 | __func__, setKey.encType); |
| 3225 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3226 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3227 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3228 | (!pairwise) |
| 3229 | #else |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3230 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | #endif |
| 3232 | ) |
| 3233 | { |
| 3234 | /* set group key*/ |
| 3235 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 3d710ea | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3236 | "%s- %d: setting Broadcast key", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3237 | __func__, __LINE__); |
| 3238 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3239 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3240 | } |
| 3241 | else |
| 3242 | { |
| 3243 | /* set pairwise key*/ |
| 3244 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3245 | "%s- %d: setting pairwise key", |
| 3246 | __func__, __LINE__); |
| 3247 | setKey.keyDirection = eSIR_TX_RX; |
| 3248 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 3249 | } |
| 3250 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3251 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 3252 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 3253 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3254 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3255 | if( pHostapdState->bssState == BSS_START ) |
| 3256 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3257 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 3258 | |
| 3259 | if ( status != eHAL_STATUS_SUCCESS ) |
| 3260 | { |
| 3261 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3262 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 3263 | __LINE__, status ); |
| 3264 | } |
| 3265 | } |
| 3266 | |
| 3267 | /* Saving WEP keys */ |
| 3268 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 3269 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 3270 | { |
| 3271 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 3272 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3273 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 3274 | } |
| 3275 | else |
| 3276 | { |
| 3277 | //Save the key in ap context. Issue setkey after the BSS is started. |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3278 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3279 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 3280 | } |
| 3281 | } |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3282 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 3283 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3284 | { |
| 3285 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3286 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3287 | |
Gopichand Nakkala | edddbd9 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3288 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3289 | if (!pairwise) |
| 3290 | #else |
| 3291 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 3292 | #endif |
| 3293 | { |
| 3294 | /* set group key*/ |
| 3295 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 3296 | { |
| 3297 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3298 | "%s- %d: Perform Set key Complete", |
| 3299 | __func__, __LINE__); |
| 3300 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 3301 | } |
| 3302 | } |
| 3303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3304 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 3305 | |
Venkata Prathyusha Kuntupalli | 584507e | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 3306 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 3307 | |
| 3308 | |
Jeff Johnson | ec7e9cb | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3309 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3310 | params->key, params->key_len); |
| 3311 | |
Gopichand Nakkala | edddbd9 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3313 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3314 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3315 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3316 | "%s: set key for peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3317 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3318 | setKey.peerMac[2], setKey.peerMac[3], |
| 3319 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3320 | setKey.keyDirection); |
| 3321 | |
| 3322 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 3323 | |
| 3324 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 3325 | { |
| 3326 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3327 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 3328 | __LINE__, vos_status ); |
| 3329 | |
| 3330 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3331 | |
| 3332 | return -EINVAL; |
| 3333 | |
| 3334 | } |
| 3335 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3336 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | edddbd9 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3337 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 3338 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 3339 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3340 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | edddbd9 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3341 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3342 | { |
Gopichand Nakkala | edddbd9 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3343 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 3344 | "%s: Update PreAuth Key success", __func__); |
| 3345 | return 0; |
| 3346 | } |
| 3347 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 3348 | { |
| 3349 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3350 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | f92687a | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 3351 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3352 | } |
| 3353 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3354 | |
| 3355 | /* issue set key request to SME*/ |
| 3356 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3357 | pAdapter->sessionId, &setKey, &roamId ); |
| 3358 | |
| 3359 | if ( 0 != status ) |
| 3360 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3361 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3362 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 3363 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3364 | return -EINVAL; |
| 3365 | } |
| 3366 | |
| 3367 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3368 | /* in case of IBSS as there was no information available about WEP keys during |
| 3369 | * IBSS join, group key intialized with NULL key, so re-initialize group key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3370 | * with correct value*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3371 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 3372 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 3373 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3374 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 3375 | ) |
| 3376 | && |
| 3377 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 3378 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 3379 | ) |
| 3380 | ) |
| 3381 | { |
| 3382 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3383 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3384 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3385 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3387 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3388 | setKey.peerMac[2], setKey.peerMac[3], |
| 3389 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3390 | setKey.keyDirection); |
| 3391 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3392 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3393 | pAdapter->sessionId, &setKey, &roamId ); |
| 3394 | |
| 3395 | if ( 0 != status ) |
| 3396 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3398 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | __func__, status); |
| 3400 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3401 | return -EINVAL; |
| 3402 | } |
| 3403 | } |
| 3404 | } |
| 3405 | |
| 3406 | return 0; |
| 3407 | } |
| 3408 | |
| 3409 | /* |
| 3410 | * FUNCTION: wlan_hdd_cfg80211_get_key |
| 3411 | * This function is used to get the key information |
| 3412 | */ |
| 3413 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3414 | static int wlan_hdd_cfg80211_get_key( |
| 3415 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | struct net_device *ndev, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3417 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3418 | const u8 *mac_addr, void *cookie, |
| 3419 | void (*callback)(void *cookie, struct key_params*) |
| 3420 | ) |
| 3421 | #else |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3422 | static int wlan_hdd_cfg80211_get_key( |
| 3423 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3424 | struct net_device *ndev, |
| 3425 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 3426 | void (*callback)(void *cookie, struct key_params*) |
| 3427 | ) |
| 3428 | #endif |
| 3429 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3430 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3431 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3432 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3433 | struct key_params params; |
| 3434 | |
| 3435 | ENTER(); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 3438 | __func__,pAdapter->device_mode); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3440 | memset(¶ms, 0, sizeof(params)); |
| 3441 | |
| 3442 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3443 | { |
| 3444 | return -EINVAL; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3445 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3446 | |
| 3447 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 3448 | { |
| 3449 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3450 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3451 | break; |
| 3452 | |
| 3453 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3454 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3455 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 3456 | break; |
| 3457 | |
| 3458 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3459 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3460 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 3461 | break; |
| 3462 | |
| 3463 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3464 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 3465 | break; |
| 3466 | |
| 3467 | case eCSR_ENCRYPT_TYPE_AES: |
| 3468 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 3469 | break; |
| 3470 | |
| 3471 | default: |
| 3472 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3473 | break; |
| 3474 | } |
| 3475 | |
| 3476 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 3477 | params.seq_len = 0; |
| 3478 | params.seq = NULL; |
| 3479 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 3480 | callback(cookie, ¶ms); |
| 3481 | return 0; |
| 3482 | } |
| 3483 | |
| 3484 | /* |
| 3485 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 3486 | * This function is used to delete the key information |
| 3487 | */ |
| 3488 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3489 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | struct net_device *ndev, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3491 | u8 key_index, |
| 3492 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3493 | const u8 *mac_addr |
| 3494 | ) |
| 3495 | #else |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3496 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3497 | struct net_device *ndev, |
| 3498 | u8 key_index, |
| 3499 | const u8 *mac_addr |
| 3500 | ) |
| 3501 | #endif |
| 3502 | { |
| 3503 | int status = 0; |
| 3504 | |
| 3505 | //This code needs to be revisited. There is sme_removeKey API, we should |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3506 | //plan to use that. After the change to use correct index in setkey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3507 | //it is observed that this is invalidating peer |
| 3508 | //key index whenever re-key is done. This is affecting data link. |
| 3509 | //It should be ok to ignore del_key. |
| 3510 | #if 0 |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3511 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 3512 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3513 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3514 | tCsrRoamSetKey setKey; |
| 3515 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3517 | ENTER(); |
| 3518 | |
| 3519 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 3520 | __func__,pAdapter->device_mode); |
| 3521 | |
| 3522 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3523 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3524 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3525 | key_index); |
| 3526 | |
| 3527 | return -EINVAL; |
| 3528 | } |
| 3529 | |
| 3530 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3531 | setKey.keyId = key_index; |
| 3532 | |
| 3533 | if (mac_addr) |
| 3534 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 3535 | else |
| 3536 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 3537 | |
| 3538 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 3539 | |
| 3540 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3541 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3542 | ) |
| 3543 | { |
| 3544 | |
| 3545 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3546 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 3547 | if( pHostapdState->bssState == BSS_START) |
| 3548 | { |
| 3549 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3550 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3551 | if ( status != eHAL_STATUS_SUCCESS ) |
| 3552 | { |
| 3553 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3554 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 3555 | __LINE__, status ); |
| 3556 | } |
| 3557 | } |
| 3558 | } |
| 3559 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3560 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3561 | ) |
| 3562 | { |
| 3563 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3564 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3565 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3566 | |
| 3567 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3568 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3569 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3570 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3572 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 3573 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3574 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3575 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3578 | if ( 0 != status ) |
| 3579 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3580 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3581 | "%s: sme_RoamSetKey failure, returned %d", |
| 3582 | __func__, status); |
| 3583 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3584 | return -EINVAL; |
| 3585 | } |
| 3586 | } |
| 3587 | } |
| 3588 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3589 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3590 | return status; |
| 3591 | } |
| 3592 | |
| 3593 | /* |
| 3594 | * FUNCTION: wlan_hdd_cfg80211_set_default_key |
| 3595 | * This function is used to set the default tx key index |
| 3596 | */ |
| 3597 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3598 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 3599 | struct net_device *ndev, |
| 3600 | u8 key_index, |
| 3601 | bool unicast, bool multicast) |
| 3602 | #else |
| 3603 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 3604 | struct net_device *ndev, |
| 3605 | u8 key_index) |
| 3606 | #endif |
| 3607 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3608 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3609 | int status; |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3610 | hdd_wext_state_t *pWextState; |
| 3611 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3612 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3613 | |
| 3614 | ENTER(); |
| 3615 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3616 | if ((NULL == pAdapter)) |
| 3617 | { |
| 3618 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3619 | "invalid adapter"); |
| 3620 | return -EINVAL; |
| 3621 | } |
| 3622 | |
| 3623 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3624 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3625 | |
| 3626 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 3627 | { |
| 3628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3629 | "invalid Wext state or HDD context"); |
| 3630 | return -EINVAL; |
| 3631 | } |
| 3632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3633 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d \n", |
| 3634 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3636 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3637 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3638 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3639 | key_index); |
| 3640 | |
| 3641 | return -EINVAL; |
| 3642 | } |
| 3643 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3644 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3645 | status = wlan_hdd_validate_context(pHddCtx); |
| 3646 | |
| 3647 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3648 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 3649 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3650 | "%s: HDD context is not valid", __func__); |
| 3651 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3652 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3656 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | { |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3658 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3659 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3660 | (eCSR_ENCRYPT_TYPE_AES != |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 3662 | ) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3663 | { |
| 3664 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | * then update the default key index */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3666 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3667 | tCsrRoamSetKey setKey; |
| 3668 | v_U32_t roamId= 0xFF; |
| 3669 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3670 | |
| 3671 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3672 | __func__, key_index); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3674 | Keys->defaultIndex = (u8)key_index; |
| 3675 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3676 | setKey.keyId = key_index; |
| 3677 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3678 | |
| 3679 | vos_mem_copy(&setKey.Key[0], |
| 3680 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3681 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3682 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3683 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3684 | |
| 3685 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3686 | &pHddStaCtx->conn_info.bssId[0], |
| 3687 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3688 | |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3689 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 3690 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 3691 | eCSR_ENCRYPT_TYPE_WEP104) |
| 3692 | { |
| 3693 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 3694 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 3695 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 3696 | type(104) and switching encryption type to 40*/ |
| 3697 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 3698 | eCSR_ENCRYPT_TYPE_WEP40; |
| 3699 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 3700 | eCSR_ENCRYPT_TYPE_WEP40; |
| 3701 | } |
| 3702 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3703 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3706 | /* issue set key request */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3707 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3708 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3709 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3710 | if ( 0 != status ) |
| 3711 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3712 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3713 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3714 | status); |
| 3715 | return -EINVAL; |
| 3716 | } |
| 3717 | } |
| 3718 | } |
| 3719 | |
| 3720 | /* In SoftAp mode setting key direction for default mode */ |
| 3721 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 3722 | { |
| 3723 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 3724 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 3725 | (eCSR_ENCRYPT_TYPE_AES != |
| 3726 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 3727 | ) |
| 3728 | { |
| 3729 | /* Saving key direction for default key index to TX default */ |
| 3730 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3731 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 3732 | } |
| 3733 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3735 | return status; |
| 3736 | } |
| 3737 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | /* |
| 3739 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 3740 | * This function is used to inform the BSS details to nl80211 interface. |
| 3741 | */ |
| 3742 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 3743 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 3744 | { |
| 3745 | struct net_device *dev = pAdapter->dev; |
| 3746 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 3747 | struct wiphy *wiphy = wdev->wiphy; |
| 3748 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 3749 | int chan_no; |
| 3750 | int ie_length; |
| 3751 | const char *ie; |
| 3752 | unsigned int freq; |
| 3753 | struct ieee80211_channel *chan; |
| 3754 | int rssi = 0; |
| 3755 | struct cfg80211_bss *bss = NULL; |
| 3756 | |
| 3757 | ENTER(); |
| 3758 | |
| 3759 | if( NULL == pBssDesc ) |
| 3760 | { |
| 3761 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL\n", __func__); |
| 3762 | return bss; |
| 3763 | } |
| 3764 | |
| 3765 | chan_no = pBssDesc->channelId; |
| 3766 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 3767 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 3768 | |
| 3769 | if( NULL == ie ) |
| 3770 | { |
| 3771 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: IE of BSS descriptor is NULL\n", __func__); |
| 3772 | return bss; |
| 3773 | } |
| 3774 | |
| 3775 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 3776 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 3777 | { |
| 3778 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 3779 | } |
| 3780 | else |
| 3781 | { |
| 3782 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 3783 | } |
| 3784 | #else |
| 3785 | freq = ieee80211_channel_to_frequency(chan_no); |
| 3786 | #endif |
| 3787 | |
| 3788 | chan = __ieee80211_get_channel(wiphy, freq); |
| 3789 | |
| 3790 | bss = cfg80211_get_bss(wiphy, chan, pBssDesc->bssId, |
| 3791 | &roamProfile->SSID.ssId[0], roamProfile->SSID.length, |
| 3792 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
| 3793 | if (bss == NULL) |
| 3794 | { |
| 3795 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
| 3796 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3797 | return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
| 3798 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3799 | pBssDesc->capabilityInfo, |
| 3800 | pBssDesc->beaconInterval, ie, ie_length, |
| 3801 | rssi, GFP_KERNEL )); |
| 3802 | } |
| 3803 | else |
| 3804 | { |
| 3805 | return bss; |
| 3806 | } |
| 3807 | } |
| 3808 | |
| 3809 | |
| 3810 | |
| 3811 | /* |
| 3812 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 3813 | * This function is used to inform the BSS details to nl80211 interface. |
| 3814 | */ |
| 3815 | struct cfg80211_bss* |
| 3816 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 3817 | tSirBssDescription *bss_desc |
| 3818 | ) |
| 3819 | { |
| 3820 | /* |
| 3821 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 3822 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 3823 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 3824 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 3825 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 3826 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 3827 | cfg80211_inform_bss_frame. |
| 3828 | */ |
| 3829 | struct net_device *dev = pAdapter->dev; |
| 3830 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 3831 | struct wiphy *wiphy = wdev->wiphy; |
| 3832 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 3833 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 3834 | qcom_ie_age *qie_age = NULL; |
| 3835 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 3836 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3837 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ); |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 3838 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3839 | const char *ie = |
| 3840 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 3841 | unsigned int freq; |
| 3842 | struct ieee80211_channel *chan; |
| 3843 | struct ieee80211_mgmt *mgmt = |
| 3844 | kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
| 3845 | struct cfg80211_bss *bss_status = NULL; |
| 3846 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 3847 | int rssi = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3848 | #ifdef WLAN_OPEN_SOURCE |
| 3849 | struct timespec ts; |
| 3850 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3851 | |
| 3852 | ENTER(); |
| 3853 | |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 3854 | if (!mgmt) |
| 3855 | return NULL; |
| 3856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3857 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3858 | |
| 3859 | #ifdef WLAN_OPEN_SOURCE |
| 3860 | /* Android does not want the timestamp from the frame. |
| 3861 | Instead it wants a monotonic increasing value */ |
| 3862 | get_monotonic_boottime(&ts); |
| 3863 | mgmt->u.probe_resp.timestamp = |
| 3864 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 3865 | #else |
| 3866 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3867 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 3868 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3869 | |
| 3870 | #endif |
| 3871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3872 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 3873 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 3874 | |
| 3875 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 3876 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 3877 | /* Assuming this is the last IE, copy at the end */ |
| 3878 | ie_length -=sizeof(qcom_ie_age); |
| 3879 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 3880 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 3881 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 3882 | qie_age->oui_1 = QCOM_OUI1; |
| 3883 | qie_age->oui_2 = QCOM_OUI2; |
| 3884 | qie_age->oui_3 = QCOM_OUI3; |
| 3885 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 3886 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 3887 | #endif |
| 3888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3889 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | 9424869 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 3890 | if (bss_desc->fProbeRsp) |
| 3891 | { |
| 3892 | mgmt->frame_control |= |
| 3893 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 3894 | } |
| 3895 | else |
| 3896 | { |
| 3897 | mgmt->frame_control |= |
| 3898 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 3899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3900 | |
| 3901 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3902 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3903 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 3904 | { |
| 3905 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 3906 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3907 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3908 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 3909 | |
| 3910 | { |
| 3911 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 3912 | } |
| 3913 | else |
| 3914 | { |
| 3915 | kfree(mgmt); |
| 3916 | return NULL; |
| 3917 | } |
| 3918 | #else |
| 3919 | freq = ieee80211_channel_to_frequency(chan_no); |
| 3920 | #endif |
| 3921 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 47f0ff2 | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 3922 | /*when the band is changed on the fly using the GUI, three things are done |
| 3923 | * 1. scan abort 2.flush scan results from cache 3.update the band with the new band user specified(refer to the hdd_setBand_helper function) |
| 3924 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 3925 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 3926 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 3927 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 3928 | * but if the time between band update and scan done callback is very small then band change will not reflect in SME and SME reports to HDD |
| 3929 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 3930 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 3931 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 3932 | * So drop the bss and continue to next bss. |
| 3933 | */ |
| 3934 | if(chan == NULL) |
| 3935 | { |
| 3936 | hddLog(VOS_TRACE_LEVEL_INFO, "%s chan pointer is NULL", __func__); |
Chilam Ng | 20b2cb9 | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 3937 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 47f0ff2 | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 3938 | return NULL; |
| 3939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3940 | /*To keep the rssi icon of the connected AP in the scan window |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3941 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3942 | * */ |
| 3943 | if (( eConnectionState_Associated == |
| 3944 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 3945 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 3946 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 3947 | WNI_CFG_BSSID_LEN))) |
| 3948 | { |
| 3949 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 3950 | rssi = (pAdapter->rssi * 100); |
| 3951 | } |
| 3952 | else |
| 3953 | { |
| 3954 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 3955 | } |
| 3956 | |
| 3957 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 3958 | frame_len, rssi, GFP_KERNEL); |
| 3959 | kfree(mgmt); |
| 3960 | return bss_status; |
| 3961 | } |
| 3962 | |
| 3963 | /* |
| 3964 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 3965 | * This function is used to update the BSS data base of CFG8011 |
| 3966 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3967 | struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3968 | tCsrRoamInfo *pRoamInfo |
| 3969 | ) |
| 3970 | { |
| 3971 | tCsrRoamConnectedProfile roamProfile; |
| 3972 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3973 | struct cfg80211_bss *bss = NULL; |
| 3974 | |
| 3975 | ENTER(); |
| 3976 | |
| 3977 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 3978 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 3979 | |
| 3980 | if (NULL != roamProfile.pBssDesc) |
| 3981 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3982 | bss = wlan_hdd_cfg80211_inform_bss(pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3983 | &roamProfile); |
| 3984 | |
| 3985 | if (NULL == bss) |
| 3986 | { |
| 3987 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 3988 | __func__); |
| 3989 | } |
| 3990 | |
| 3991 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 3992 | } |
| 3993 | else |
| 3994 | { |
| 3995 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 3996 | __func__); |
| 3997 | } |
| 3998 | return bss; |
| 3999 | } |
| 4000 | |
| 4001 | /* |
| 4002 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 4003 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4004 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 4005 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4006 | ) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4007 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4008 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4009 | tCsrScanResultInfo *pScanResult; |
| 4010 | eHalStatus status = 0; |
| 4011 | tScanResultHandle pResult; |
| 4012 | struct cfg80211_bss *bss_status = NULL; |
| 4013 | |
| 4014 | ENTER(); |
| 4015 | |
| 4016 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4017 | { |
| 4018 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 4019 | return -EAGAIN; |
| 4020 | } |
| 4021 | |
| 4022 | /* |
| 4023 | * start getting scan results and populate cgf80211 BSS database |
| 4024 | */ |
| 4025 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 4026 | |
| 4027 | /* no scan results */ |
| 4028 | if (NULL == pResult) |
| 4029 | { |
| 4030 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result\n", __func__); |
| 4031 | return status; |
| 4032 | } |
| 4033 | |
| 4034 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 4035 | |
| 4036 | while (pScanResult) |
| 4037 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4038 | /* |
| 4039 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 4040 | * entry already exists in bss data base of cfg80211 for that |
| 4041 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 4042 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 4043 | * mgmt packet as input. As of now there is no possibility to get |
| 4044 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | * ieee80211_mgmt(probe response) and passing to c |
| 4046 | * fg80211_inform_bss_frame. |
| 4047 | * */ |
| 4048 | |
| 4049 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4050 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | |
| 4053 | if (NULL == bss_status) |
| 4054 | { |
| 4055 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4056 | "%s: NULL returned by cfg80211_inform_bss\n", __func__); |
| 4057 | } |
| 4058 | else |
| 4059 | { |
| 4060 | cfg80211_put_bss(bss_status); |
| 4061 | } |
| 4062 | |
| 4063 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 4064 | } |
| 4065 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4066 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4067 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4068 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4069 | } |
| 4070 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4071 | void |
| 4072 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 4073 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4074 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4075 | "%02X:%02X:%02X:%02X:%02X:%02X\n", |
| 4076 | macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], |
| 4077 | macAddr[5]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4078 | } /****** end hddPrintMacAddr() ******/ |
| 4079 | |
| 4080 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4081 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4082 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4083 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4084 | "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", |
| 4085 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 4086 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 4087 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4088 | } /****** end hddPrintPmkId() ******/ |
| 4089 | |
| 4090 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 4091 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 4092 | |
| 4093 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 4094 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 4095 | |
| 4096 | #define dump_bssid(bssid) \ |
| 4097 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4098 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 4099 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
| 4100 | hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4101 | } |
| 4102 | |
| 4103 | #define dump_pmkid(pMac, pmkid) \ |
| 4104 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4105 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 4106 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
| 4107 | hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4108 | } |
| 4109 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4110 | #if defined(FEATURE_WLAN_LFR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4111 | /* |
| 4112 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 4113 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 4114 | */ |
| 4115 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4116 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4117 | int index, bool preauth ) |
| 4118 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4119 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4120 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | 9a1c4ce | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4121 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4122 | |
| 4123 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4124 | hddLog(VOS_TRACE_LEVEL_INFO, "%s is going to notify supplicant of:", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4125 | |
| 4126 | if( NULL == pRoamInfo ) |
| 4127 | { |
| 4128 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL\n", __func__); |
| 4129 | return -EINVAL; |
| 4130 | } |
| 4131 | |
Srinivas Girigowda | 9a1c4ce | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4132 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 4133 | { |
| 4134 | dump_bssid(pRoamInfo->bssid); |
| 4135 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4136 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | 9a1c4ce | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4137 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4138 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4139 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4140 | } |
| 4141 | #endif //FEATURE_WLAN_LFR |
| 4142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4143 | /* |
| 4144 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 4145 | * scanning callback function, called after finishing scan |
| 4146 | * |
| 4147 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4148 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4149 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 4150 | { |
| 4151 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4152 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4153 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4154 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4155 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4156 | struct cfg80211_scan_request *req = NULL; |
| 4157 | int ret = 0; |
| 4158 | |
| 4159 | ENTER(); |
| 4160 | |
| 4161 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4162 | "%s called with halHandle = %p, pContext = %p," |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4163 | "scanID = %d, returned status = %d\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4164 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 4165 | |
| 4166 | //Block on scan req completion variable. Can't wait forever though. |
| 4167 | ret = wait_for_completion_interruptible_timeout( |
| 4168 | &pScanInfo->scan_req_completion_event, |
| 4169 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
| 4170 | if (!ret) |
| 4171 | { |
| 4172 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4173 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4174 | } |
| 4175 | |
| 4176 | if(pScanInfo->mScanPending != VOS_TRUE) |
| 4177 | { |
| 4178 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4179 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4180 | } |
| 4181 | |
| 4182 | /* Check the scanId */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4183 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | { |
| 4185 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4186 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4187 | "scanId = %d \n", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4188 | (int) scanId); |
| 4189 | } |
| 4190 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4191 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | pAdapter); |
| 4193 | |
| 4194 | if (0 > ret) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4195 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4196 | |
| 4197 | |
| 4198 | /* If any client wait scan result through WEXT |
| 4199 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4200 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4201 | { |
| 4202 | /* The other scan request waiting for current scan finish |
| 4203 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4204 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4205 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4206 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4207 | } |
| 4208 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4209 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4210 | { |
| 4211 | struct net_device *dev = pAdapter->dev; |
| 4212 | union iwreq_data wrqu; |
| 4213 | int we_event; |
| 4214 | char *msg; |
| 4215 | |
| 4216 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4217 | we_event = SIOCGIWSCAN; |
| 4218 | msg = NULL; |
| 4219 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 4220 | } |
| 4221 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4222 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4223 | |
| 4224 | /* Get the Scan Req */ |
| 4225 | req = pAdapter->request; |
| 4226 | |
| 4227 | if (!req) |
| 4228 | { |
| 4229 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4230 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4231 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4232 | } |
| 4233 | |
| 4234 | /* |
| 4235 | * setting up 0, just in case. |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4236 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4237 | req->n_ssids = 0; |
| 4238 | req->n_channels = 0; |
| 4239 | req->ie = 0; |
| 4240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4241 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4242 | /* Scan is no longer pending */ |
| 4243 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4244 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 4245 | /* |
| 4246 | * cfg80211_scan_done informing NL80211 about completion |
| 4247 | * of scanning |
| 4248 | */ |
| 4249 | cfg80211_scan_done(req, false); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 4250 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4251 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4252 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4253 | /* release the wake lock at the end of the scan*/ |
| 4254 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4255 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4256 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 4257 | * immediatly after the driver gets connect request(i.e after scan) |
| 4258 | * from supplicant, this result in app's is suspending and not able |
| 4259 | * to process the connect request to AP */ |
Amar Singhal | 28cd9c1 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 4260 | hdd_allow_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4261 | |
Gopichand Nakkala | 78f2d73 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4262 | #ifdef FEATURE_WLAN_TDLS |
| 4263 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 4264 | #endif |
| 4265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4266 | EXIT(); |
| 4267 | return 0; |
| 4268 | } |
| 4269 | |
| 4270 | /* |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4271 | * FUNCTION: hdd_isScanAllowed |
| 4272 | * Go through each adapter and check if scan allowed |
| 4273 | * |
| 4274 | */ |
| 4275 | v_BOOL_t hdd_isScanAllowed( hdd_context_t *pHddCtx ) |
| 4276 | { |
| 4277 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 4278 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 4279 | hdd_adapter_t *pAdapter = NULL; |
| 4280 | VOS_STATUS status = 0; |
| 4281 | v_U8_t staId = 0; |
| 4282 | v_U8_t *staMac = NULL; |
| 4283 | |
| 4284 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 4285 | |
| 4286 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 4287 | { |
| 4288 | pAdapter = pAdapterNode->pAdapter; |
| 4289 | |
| 4290 | if( pAdapter ) |
| 4291 | { |
| 4292 | hddLog(VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4293 | "%s: Adapter with device mode %d exists", |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4294 | __func__, pAdapter->device_mode); |
| 4295 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 4296 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 4297 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
| 4298 | { |
| 4299 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4300 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 4301 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 4302 | { |
| 4303 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 4304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4305 | "%s: client %02x:%02x:%02x:%02x:%02x:%02x is in the " |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4306 | "middle of WPS/EAPOL exchange.", __func__, |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4307 | staMac[0], staMac[1], staMac[2], |
| 4308 | staMac[3], staMac[4], staMac[5]); |
| 4309 | return VOS_FALSE; |
| 4310 | } |
| 4311 | } |
| 4312 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 4313 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 4314 | { |
| 4315 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 4316 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4317 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4318 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 4319 | { |
| 4320 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 4321 | |
| 4322 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4323 | "%s: client %02x:%02x:%02x:%02x:%02x:%02x of SoftAP/P2P-GO is in the " |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4324 | "middle of WPS/EAPOL exchange.", __func__, |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4325 | staMac[0], staMac[1], staMac[2], |
| 4326 | staMac[3], staMac[4], staMac[5]); |
| 4327 | return VOS_FALSE; |
| 4328 | } |
| 4329 | } |
| 4330 | } |
| 4331 | } |
| 4332 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 4333 | pAdapterNode = pNext; |
| 4334 | } |
| 4335 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4336 | "%s: Scan allowed", __func__); |
| 4337 | return VOS_TRUE; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4338 | } |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4339 | |
| 4340 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4341 | * FUNCTION: wlan_hdd_cfg80211_scan |
| 4342 | * this scan respond to scan trigger and update cfg80211 scan database |
| 4343 | * later, scan dump command can be used to recieve scan results |
| 4344 | */ |
Jeff Johnson | cab8ddc | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 4345 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 4346 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 4347 | struct net_device *dev, |
| 4348 | #endif |
| 4349 | struct cfg80211_scan_request *request) |
| 4350 | { |
| 4351 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 4352 | struct net_device *dev = request->wdev->netdev; |
| 4353 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4354 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4355 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 4356 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 4357 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4358 | tCsrScanRequest scanRequest; |
| 4359 | tANI_U8 *channelList = NULL, i; |
| 4360 | v_U32_t scanId = 0; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 4361 | int status; |
| 4362 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4363 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4364 | |
| 4365 | ENTER(); |
| 4366 | |
| 4367 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
| 4368 | __func__,pAdapter->device_mode); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4369 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 4370 | status = wlan_hdd_validate_context(pHddCtx); |
| 4371 | |
| 4372 | if (0 != status) |
| 4373 | { |
| 4374 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4375 | "%s: HDD context is not valid", __func__); |
| 4376 | return status; |
| 4377 | } |
| 4378 | |
| 4379 | cfg_param = pHddCtx->cfg_ini; |
| 4380 | pScanInfo = &pHddCtx->scan_info; |
| 4381 | |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4382 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4383 | (eConnectionState_Connecting == |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4384 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4385 | { |
| 4386 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4387 | "%s: %p(%d) Connection in progress: Scan request denied (EBUSY)", __func__, \ |
| 4388 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4389 | return -EBUSY; |
| 4390 | } |
| 4391 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | #ifdef WLAN_BTAMP_FEATURE |
| 4393 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4394 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4395 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | "%s: No scanning when AMP is on", __func__); |
| 4398 | return -EOPNOTSUPP; |
| 4399 | } |
| 4400 | #endif |
| 4401 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4402 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4403 | { |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4404 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4405 | "%s: Not scanning on device_mode = %d", |
| 4406 | __func__, pAdapter->device_mode); |
| 4407 | return -EOPNOTSUPP; |
| 4408 | } |
| 4409 | |
| 4410 | if (TRUE == pScanInfo->mScanPending) |
| 4411 | { |
| 4412 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: mScanPending is TRUE", __func__); |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4413 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | } |
| 4415 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4416 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4417 | //Channel and action frame is pending |
| 4418 | //Otherwise Cancel Remain On Channel and allow Scan |
| 4419 | //If no action frame pending |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4420 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4421 | { |
| 4422 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Remain On Channel Pending", __func__); |
| 4423 | return -EBUSY; |
| 4424 | } |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4425 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 78f2d73 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4426 | /* if tdls disagree scan right now, return immediately. |
| 4427 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 4428 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 4429 | */ |
| 4430 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 4431 | wiphy, |
| 4432 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 4433 | dev, |
Gopichand Nakkala | 1bf268b | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 4434 | #endif |
Gopichand Nakkala | 78f2d73 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4435 | request); |
| 4436 | if(status <= 0) |
| 4437 | { |
| 4438 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: TDLS Pending %d", __func__, status); |
| 4439 | return status; |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4440 | } |
| 4441 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4443 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 4444 | { |
| 4445 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3d710ea | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 4446 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4447 | return -EAGAIN; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4448 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4449 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 4450 | { |
| 4451 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 4452 | "%s: MAX TM Level Scan not allowed", __func__); |
| 4453 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4454 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4455 | } |
| 4456 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 4457 | |
Madan Mohan Koyyalamudi | 023964b | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4458 | /* Check if scan is allowed at this point of time. |
| 4459 | */ |
| 4460 | if (!hdd_isScanAllowed(pHddCtx)) |
| 4461 | { |
| 4462 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 4463 | return -EBUSY; |
| 4464 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4465 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4466 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 4467 | |
| 4468 | if (NULL != request) |
| 4469 | { |
| 4470 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4471 | (int)request->n_ssids); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4472 | |
| 4473 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 4474 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 4475 | * is not aging out the scan results. |
| 4476 | */ |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4477 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4478 | { |
| 4479 | request->n_ssids = 0; |
| 4480 | } |
| 4481 | |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4482 | if ((request->ssids) && (0 < request->n_ssids)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | { |
| 4484 | tCsrSSIDInfo *SsidInfo; |
| 4485 | int j; |
| 4486 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 4487 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 4488 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 4489 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 4490 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 4491 | |
| 4492 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 4493 | { |
| 4494 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4495 | "memory alloc failed SSIDInfo buffer"); |
| 4496 | return -ENOMEM; |
| 4497 | } |
| 4498 | |
| 4499 | /* copy all the ssid's and their length */ |
| 4500 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 4501 | { |
| 4502 | /* get the ssid length */ |
| 4503 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 4504 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 4505 | SsidInfo->SSID.length); |
| 4506 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 4507 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d: %s", |
| 4508 | j, SsidInfo->SSID.ssId); |
| 4509 | } |
| 4510 | /* set the scan type to active */ |
| 4511 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4512 | } |
| 4513 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 4514 | { |
| 4515 | /* set the scan type to active */ |
| 4516 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4517 | } |
| 4518 | else |
| 4519 | { |
| 4520 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 4521 | scanRequest.scanType = pScanInfo->scan_mode; |
| 4522 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4523 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
| 4525 | } |
| 4526 | else |
| 4527 | { |
| 4528 | /* set the scan type to active */ |
| 4529 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4530 | vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); |
| 4531 | |
| 4532 | /* set min and max channel time to zero */ |
| 4533 | scanRequest.minChnTime = 0; |
| 4534 | scanRequest.maxChnTime = 0; |
| 4535 | } |
| 4536 | |
| 4537 | /* set BSSType to default type */ |
| 4538 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 4539 | |
| 4540 | /*TODO: scan the requested channels only*/ |
| 4541 | |
| 4542 | /*Right now scanning all the channels */ |
| 4543 | if( request ) |
| 4544 | { |
| 4545 | if( request->n_channels ) |
| 4546 | { |
| 4547 | channelList = vos_mem_malloc( request->n_channels ); |
| 4548 | if( NULL == channelList ) |
| 4549 | { |
| 4550 | status = -ENOMEM; |
| 4551 | goto free_mem; |
| 4552 | } |
| 4553 | |
| 4554 | for( i = 0 ; i < request->n_channels ; i++ ) |
| 4555 | channelList[i] = request->channels[i]->hw_value; |
| 4556 | } |
| 4557 | |
| 4558 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 4559 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 4560 | |
| 4561 | /* set requestType to full scan */ |
| 4562 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4563 | |
| 4564 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 4565 | * search (Flush on both full scan and social scan but not on single |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4566 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 4567 | */ |
| 4568 | |
| 4569 | /* Supplicant does single channel scan after 8-way handshake |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4570 | * and in that case driver shoudnt flush scan results. If |
| 4571 | * driver flushes the scan results here and unfortunately if |
| 4572 | * the AP doesnt respond to our probe req then association |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 4573 | * fails which is not desired |
| 4574 | */ |
| 4575 | |
| 4576 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 4577 | { |
| 4578 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4579 | pAdapter->sessionId ); |
| 4580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4581 | |
| 4582 | if( request->ie_len ) |
| 4583 | { |
| 4584 | /* save this for future association (join requires this) */ |
| 4585 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 4586 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 4587 | pScanInfo->scanAddIE.length = request->ie_len; |
| 4588 | |
| 4589 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4590 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 4591 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4592 | ) |
| 4593 | { |
| 4594 | pwextBuf->roamProfile.pAddIEScan = pScanInfo->scanAddIE.addIEdata; |
| 4595 | pwextBuf->roamProfile.nAddIEScanLength = pScanInfo->scanAddIE.length; |
| 4596 | } |
| 4597 | |
| 4598 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 4599 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 4600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 4602 | request->ie_len); |
| 4603 | if (pP2pIe != NULL) |
| 4604 | { |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 4605 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 4606 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 4607 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 4608 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 4609 | { |
| 4610 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 4611 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 4612 | "Go nego completed to Connection is started"); |
| 4613 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 4614 | "for 8way Handshake"); |
| 4615 | } |
| 4616 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 4617 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 4618 | { |
| 4619 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 4620 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 4621 | "Disconnected state to Connection is started"); |
| 4622 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 4623 | "for 4way Handshake"); |
| 4624 | } |
| 4625 | #endif |
| 4626 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4627 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 4628 | if(TRUE == request->no_cck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4629 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4630 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4631 | "%s: This is a P2P Search", __func__); |
| 4632 | scanRequest.p2pSearch = 1; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4633 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4634 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
| 4635 | { |
Madan Mohan Koyyalamudi | 1b1d9e8 | 2012-10-21 11:38:33 -0700 | [diff] [blame] | 4636 | /* set requestType to P2P Discovery */ |
| 4637 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4638 | } |
| 4639 | |
| 4640 | /* |
| 4641 | Skip Dfs Channel in case of P2P Search |
| 4642 | if it is set in ini file |
| 4643 | */ |
| 4644 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 4645 | { |
| 4646 | scanRequest.skipDfsChnlInP2pSearch = 1; |
| 4647 | } |
| 4648 | else |
| 4649 | { |
| 4650 | scanRequest.skipDfsChnlInP2pSearch = 0; |
| 4651 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4653 | } |
| 4654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4655 | } |
| 4656 | } |
| 4657 | |
| 4658 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 4659 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4660 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 4661 | * address the following issues. |
| 4662 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 4663 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 4664 | * for long time, this result in apps running at full power for long time. |
| 4665 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 4666 | * be stuck in full power because of resume BMPS |
| 4667 | */ |
| 4668 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4669 | |
| 4670 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4671 | pAdapter->sessionId, &scanRequest, &scanId, |
| 4672 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4674 | if (eHAL_STATUS_SUCCESS != status) |
| 4675 | { |
| 4676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4677 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 4678 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 4679 | if(eHAL_STATUS_RESOURCES == status) |
| 4680 | { |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 4681 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: HO is in progress.So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 4682 | status = -EBUSY; |
| 4683 | } else { |
| 4684 | status = -EIO; |
| 4685 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4686 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4687 | goto free_mem; |
| 4688 | } |
| 4689 | |
| 4690 | pScanInfo->mScanPending = TRUE; |
| 4691 | pAdapter->request = request; |
| 4692 | pScanInfo->scanId = scanId; |
| 4693 | |
| 4694 | complete(&pScanInfo->scan_req_completion_event); |
| 4695 | |
| 4696 | free_mem: |
| 4697 | if( scanRequest.SSIDs.SSIDList ) |
| 4698 | { |
| 4699 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 4700 | } |
| 4701 | |
| 4702 | if( channelList ) |
| 4703 | vos_mem_free( channelList ); |
| 4704 | |
| 4705 | EXIT(); |
| 4706 | |
| 4707 | return status; |
| 4708 | } |
| 4709 | |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 4710 | |
| 4711 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 4712 | { |
| 4713 | v_U8_t iniDot11Mode = |
| 4714 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 4715 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 4716 | |
| 4717 | switch ( iniDot11Mode ) |
| 4718 | { |
| 4719 | case eHDD_DOT11_MODE_AUTO: |
| 4720 | case eHDD_DOT11_MODE_11ac: |
| 4721 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 4722 | #ifdef WLAN_FEATURE_11AC |
| 4723 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 4724 | #else |
| 4725 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 4726 | #endif |
| 4727 | break; |
| 4728 | case eHDD_DOT11_MODE_11n: |
| 4729 | case eHDD_DOT11_MODE_11n_ONLY: |
| 4730 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 4731 | break; |
| 4732 | default: |
| 4733 | hddDot11Mode = iniDot11Mode; |
| 4734 | break; |
| 4735 | } |
| 4736 | /* This call decides required channel bonding mode */ |
| 4737 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 4738 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 4739 | operationChannel); |
| 4740 | } |
| 4741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4742 | /* |
| 4743 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4744 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4745 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4746 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4747 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4748 | { |
| 4749 | int status = 0; |
| 4750 | hdd_wext_state_t *pWextState; |
| 4751 | v_U32_t roamId; |
| 4752 | tCsrRoamProfile *pRoamProfile; |
| 4753 | eMib_dot11DesiredBssType connectedBssType; |
| 4754 | eCsrAuthType RSNAuthType; |
| 4755 | |
| 4756 | ENTER(); |
| 4757 | |
| 4758 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4760 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 4761 | { |
| 4762 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 4763 | return -EINVAL; |
| 4764 | } |
| 4765 | |
| 4766 | pRoamProfile = &pWextState->roamProfile; |
| 4767 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4768 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4769 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4770 | int ret = 0; |
| 4771 | hdd_station_ctx_t *pHddStaCtx; |
| 4772 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4773 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 4774 | |
| 4775 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 4776 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 4777 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4778 | { |
| 4779 | /* Issue disconnect to CSR */ |
| 4780 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4781 | if( eHAL_STATUS_SUCCESS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4782 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4783 | pAdapter->sessionId, |
| 4784 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 4785 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4786 | ret = wait_for_completion_interruptible_timeout( |
| 4787 | &pAdapter->disconnect_comp_var, |
| 4788 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 4789 | if (0 == ret) |
| 4790 | { |
| 4791 | VOS_ASSERT(0); |
| 4792 | } |
| 4793 | } |
| 4794 | } |
| 4795 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 4796 | { |
| 4797 | ret = wait_for_completion_interruptible_timeout( |
| 4798 | &pAdapter->disconnect_comp_var, |
| 4799 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 4800 | if (0 == ret) |
| 4801 | { |
| 4802 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | } |
| 4804 | } |
| 4805 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4806 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4807 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 4808 | { |
| 4809 | /*QoS not enabled in cfg file*/ |
| 4810 | pRoamProfile->uapsd_mask = 0; |
| 4811 | } |
| 4812 | else |
| 4813 | { |
| 4814 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4815 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4816 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 4817 | } |
| 4818 | |
| 4819 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 4820 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 4821 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4822 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4823 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 4824 | ssid, ssid_len); |
| 4825 | |
| 4826 | if (bssid) |
| 4827 | { |
| 4828 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 4829 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 4830 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4831 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 4832 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4833 | case of join failure we should send valid BSSID to supplicant |
| 4834 | */ |
| 4835 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 4836 | WNI_CFG_BSSID_LEN); |
| 4837 | } |
| 4838 | |
| 4839 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 4840 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4841 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | /*set gen ie*/ |
| 4843 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 4844 | /*set auth*/ |
| 4845 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 4846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | #ifdef FEATURE_WLAN_WAPI |
| 4848 | if (pAdapter->wapi_info.nWapiMode) |
| 4849 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4850 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4851 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 4852 | { |
| 4853 | case WAPI_AUTH_MODE_PSK: |
| 4854 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4855 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4856 | pAdapter->wapi_info.wapiAuthMode); |
| 4857 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 4858 | break; |
| 4859 | } |
| 4860 | case WAPI_AUTH_MODE_CERT: |
| 4861 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4862 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | pAdapter->wapi_info.wapiAuthMode); |
| 4864 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 4865 | break; |
| 4866 | } |
| 4867 | } // End of switch |
| 4868 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 4869 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 4870 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4871 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4872 | pRoamProfile->AuthType.numEntries = 1; |
| 4873 | pRoamProfile->EncryptionType.numEntries = 1; |
| 4874 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 4875 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 4876 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 4877 | } |
| 4878 | } |
| 4879 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 4880 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 4881 | /* Initializing gtkOffloadRequestParams */ |
| 4882 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 4883 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 4884 | { |
| 4885 | pHddStaCtx->gtkOffloadRequestParams.requested = FALSE; |
| 4886 | memset(&pHddStaCtx->gtkOffloadRequestParams.gtkOffloadReqParams, |
| 4887 | 0, sizeof (tSirGtkOffloadParams)); |
| 4888 | } |
| 4889 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4890 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 4891 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4892 | if( operatingChannel ) |
| 4893 | { |
| 4894 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 4895 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 4896 | } |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4897 | else |
| 4898 | { |
| 4899 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 4900 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 4901 | } |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 4902 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 4903 | { |
| 4904 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 4905 | } |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4906 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 4907 | * has a direct path to call hdd_smeRoamCallback(), which will change the conn_state |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4908 | * If direct path, conn_state will be accordingly changed to NotConnected or Associated |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4909 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | f357acc | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 4910 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 4911 | */ |
| 4912 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) |
| 4913 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 4914 | eConnectionState_Connecting); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4915 | |
| 4916 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4917 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 4918 | |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4919 | if( (eHAL_STATUS_SUCCESS != status) && |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 4920 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 4921 | |
| 4922 | { |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4923 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 4924 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 4925 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 4926 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 6bd84fa | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4927 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 4928 | } |
Madan Mohan Koyyalamudi | f357acc | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 4929 | |
| 4930 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 4931 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 4932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4933 | } |
| 4934 | else |
| 4935 | { |
| 4936 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 4937 | return -EINVAL; |
| 4938 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4939 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4940 | return status; |
| 4941 | } |
| 4942 | |
| 4943 | /* |
| 4944 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 4945 | * This function is used to set the authentication type (OPEN/SHARED). |
| 4946 | * |
| 4947 | */ |
| 4948 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 4949 | enum nl80211_auth_type auth_type) |
| 4950 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4951 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4952 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4953 | |
| 4954 | ENTER(); |
| 4955 | |
| 4956 | /*set authentication type*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4957 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4959 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4960 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4961 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 4962 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 4963 | break; |
| 4964 | |
| 4965 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 4966 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4967 | case NL80211_AUTHTYPE_FT: |
| 4968 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4969 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4970 | "%s: set authentication type to OPEN", __func__); |
| 4971 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4972 | break; |
| 4973 | |
| 4974 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4975 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4976 | "%s: set authentication type to SHARED", __func__); |
| 4977 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 4978 | break; |
| 4979 | #ifdef FEATURE_WLAN_CCX |
| 4980 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4981 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | "%s: set authentication type to CCKM WPA", __func__); |
| 4983 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 4984 | break; |
| 4985 | #endif |
| 4986 | |
| 4987 | |
| 4988 | default: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4989 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4990 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | auth_type); |
| 4992 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 4993 | return -EINVAL; |
| 4994 | } |
| 4995 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4996 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | pHddStaCtx->conn_info.authType; |
| 4998 | return 0; |
| 4999 | } |
| 5000 | |
| 5001 | /* |
| 5002 | * FUNCTION: wlan_hdd_set_akm_suite |
| 5003 | * This function is used to set the key mgmt type(PSK/8021x). |
| 5004 | * |
| 5005 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5006 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5007 | u32 key_mgmt |
| 5008 | ) |
| 5009 | { |
| 5010 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5011 | ENTER(); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5013 | /*set key mgmt type*/ |
| 5014 | switch(key_mgmt) |
| 5015 | { |
| 5016 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 9e906c9 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5017 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5018 | case WLAN_AKM_SUITE_FT_PSK: |
| 5019 | #endif |
| 5020 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5021 | __func__); |
| 5022 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5023 | break; |
| 5024 | |
| 5025 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 9e906c9 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5026 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5027 | case WLAN_AKM_SUITE_FT_8021X: |
| 5028 | #endif |
| 5029 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5030 | __func__); |
| 5031 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5032 | break; |
| 5033 | #ifdef FEATURE_WLAN_CCX |
| 5034 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 5035 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5036 | case WLAN_AKM_SUITE_CCKM: |
| 5037 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 5038 | __func__); |
| 5039 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5040 | break; |
| 5041 | #endif |
| 5042 | |
| 5043 | default: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5044 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5045 | __func__, key_mgmt); |
| 5046 | return -EINVAL; |
| 5047 | |
| 5048 | } |
| 5049 | return 0; |
| 5050 | } |
| 5051 | |
| 5052 | /* |
| 5053 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5054 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5055 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 5056 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5057 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 5058 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5059 | bool ucast |
| 5060 | ) |
| 5061 | { |
| 5062 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5063 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5064 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5065 | |
| 5066 | ENTER(); |
| 5067 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5068 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5069 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5071 | __func__, cipher); |
| 5072 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5073 | } |
| 5074 | else |
| 5075 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5077 | /*set encryption method*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5078 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5079 | { |
| 5080 | case IW_AUTH_CIPHER_NONE: |
| 5081 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5082 | break; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5085 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5086 | break; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5087 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5088 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 80aac4a | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5089 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5090 | break; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5092 | case WLAN_CIPHER_SUITE_TKIP: |
| 5093 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5094 | break; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | case WLAN_CIPHER_SUITE_CCMP: |
| 5097 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5098 | break; |
| 5099 | #ifdef FEATURE_WLAN_WAPI |
| 5100 | case WLAN_CIPHER_SUITE_SMS4: |
| 5101 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 5102 | break; |
| 5103 | #endif |
| 5104 | |
| 5105 | #ifdef FEATURE_WLAN_CCX |
| 5106 | case WLAN_CIPHER_SUITE_KRK: |
| 5107 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 5108 | break; |
| 5109 | #endif |
| 5110 | default: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5111 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5112 | __func__, cipher); |
| 5113 | return -EOPNOTSUPP; |
| 5114 | } |
| 5115 | } |
| 5116 | |
| 5117 | if (ucast) |
| 5118 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5119 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5120 | __func__, encryptionType); |
| 5121 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 5122 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5123 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5124 | encryptionType; |
| 5125 | } |
| 5126 | else |
| 5127 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5128 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5129 | __func__, encryptionType); |
| 5130 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 5131 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5132 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 5133 | } |
| 5134 | |
| 5135 | return 0; |
| 5136 | } |
| 5137 | |
| 5138 | |
| 5139 | /* |
| 5140 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 5141 | * This function is used to parse WPA/RSN IE's. |
| 5142 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5143 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 5144 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5145 | size_t ie_len |
| 5146 | ) |
| 5147 | { |
| 5148 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5149 | u8 *genie = ie; |
| 5150 | v_U16_t remLen = ie_len; |
| 5151 | #ifdef FEATURE_WLAN_WAPI |
| 5152 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 5153 | u16 *tmp; |
| 5154 | v_U16_t akmsuiteCount; |
| 5155 | int *akmlist; |
| 5156 | #endif |
| 5157 | ENTER(); |
| 5158 | |
| 5159 | /* clear previous assocAddIE */ |
| 5160 | pWextState->assocAddIE.length = 0; |
| 5161 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
| 5162 | |
| 5163 | while (remLen >= 2) |
| 5164 | { |
| 5165 | v_U16_t eLen = 0; |
| 5166 | v_U8_t elementId; |
| 5167 | elementId = *genie++; |
| 5168 | eLen = *genie++; |
| 5169 | remLen -= 2; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5170 | |
| 5171 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5172 | __func__, elementId, eLen); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5173 | |
| 5174 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5175 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5176 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5177 | if (4 > eLen) /* should have at least OUI which is 4 bytes so extra 2 bytes not needed */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5178 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5179 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5180 | "%s: Invalid WPA IE", __func__); |
| 5181 | return -EINVAL; |
| 5182 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5183 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | { |
| 5185 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5186 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5187 | __func__, eLen + 2); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5189 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5190 | { |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5191 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 5192 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | VOS_ASSERT(0); |
| 5194 | return -ENOMEM; |
| 5195 | } |
| 5196 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5197 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5198 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5200 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 5201 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5202 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5203 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5204 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 5205 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 5207 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 5208 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 5209 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 5210 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 5211 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5212 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
| 5213 | P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5214 | /*Consider P2P IE, only for P2P Client */ |
| 5215 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 5216 | { |
| 5217 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5218 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5219 | __func__, eLen + 2); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5221 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5222 | { |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5223 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5224 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5225 | VOS_ASSERT(0); |
| 5226 | return -ENOMEM; |
| 5227 | } |
| 5228 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5229 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5230 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5232 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5233 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5235 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5236 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 5237 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | /*Consider WFD IE, only for P2P Client */ |
| 5239 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 5240 | { |
| 5241 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5242 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | __func__, eLen + 2); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5245 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5246 | { |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5247 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5248 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5249 | VOS_ASSERT(0); |
| 5250 | return -ENOMEM; |
| 5251 | } |
| 5252 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 5253 | // WPS IE + P2P IE + WFD IE |
| 5254 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5255 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5257 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5258 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5259 | } |
| 5260 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5261 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5262 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5263 | HS20_OUI_TYPE_SIZE)) ) |
| 5264 | { |
| 5265 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5266 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5267 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5268 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5269 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5270 | { |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5271 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5272 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5273 | VOS_ASSERT(0); |
| 5274 | return -ENOMEM; |
| 5275 | } |
| 5276 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5277 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5278 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5279 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5280 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5281 | } |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | break; |
| 5284 | case DOT11F_EID_RSN: |
| 5285 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 5286 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 5287 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 5288 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 5289 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 5290 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5291 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 5292 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5293 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5294 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5295 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set Extended CAPS IE(len %d)", |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5296 | __func__, eLen + 2); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5297 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5298 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5299 | { |
Jeff Johnson | 1920a72 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5300 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5301 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5302 | VOS_ASSERT(0); |
| 5303 | return -ENOMEM; |
| 5304 | } |
| 5305 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5306 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5307 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5308 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5309 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5310 | break; |
| 5311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5312 | #ifdef FEATURE_WLAN_WAPI |
| 5313 | case WLAN_EID_WAPI: |
| 5314 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
| 5315 | hddLog(VOS_TRACE_LEVEL_INFO,"WAPI MODE IS %lu \n", |
| 5316 | pAdapter->wapi_info.nWapiMode); |
| 5317 | tmp = (u16 *)ie; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5318 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 5320 | tmp = tmp + 1; |
| 5321 | akmlist = (int *)(tmp); |
| 5322 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 5323 | { |
| 5324 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 5325 | } |
| 5326 | else |
| 5327 | { |
| 5328 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count\n"); |
| 5329 | VOS_ASSERT(0); |
| 5330 | return -EINVAL; |
| 5331 | } |
| 5332 | |
| 5333 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 5334 | { |
| 5335 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WAPI AUTH MODE SET TO PSK", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5336 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5337 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5339 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5340 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5341 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WAPI AUTH MODE SET TO CERTIFICATE", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5342 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5343 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 5344 | } |
| 5345 | break; |
| 5346 | #endif |
| 5347 | default: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5348 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5349 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5350 | /* when Unknown IE is received we should break and continue |
| 5351 | * to the next IE in the buffer instead we were returning |
| 5352 | * so changing this to break */ |
| 5353 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5354 | } |
| 5355 | genie += eLen; |
| 5356 | remLen -= eLen; |
| 5357 | } |
| 5358 | EXIT(); |
| 5359 | return 0; |
| 5360 | } |
| 5361 | |
| 5362 | /* |
Gopichand Nakkala | f8452ad | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 5363 | * FUNCTION: hdd_isWPAIEPresent |
| 5364 | * Parse the received IE to find the WPA IE |
| 5365 | * |
| 5366 | */ |
| 5367 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 5368 | { |
| 5369 | v_U8_t eLen = 0; |
| 5370 | v_U16_t remLen = ie_len; |
| 5371 | v_U8_t elementId = 0; |
| 5372 | |
| 5373 | while (remLen >= 2) |
| 5374 | { |
| 5375 | elementId = *ie++; |
| 5376 | eLen = *ie++; |
| 5377 | remLen -= 2; |
| 5378 | if (eLen > remLen) |
| 5379 | { |
| 5380 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5381 | "%s: IE length is wrong %d", __func__, eLen); |
| 5382 | return FALSE; |
| 5383 | } |
| 5384 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 5385 | { |
| 5386 | /* OUI - 0x00 0X50 0XF2 |
| 5387 | WPA Information Element - 0x01 |
| 5388 | WPA version - 0x01*/ |
| 5389 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 5390 | return TRUE; |
| 5391 | } |
| 5392 | ie += eLen; |
| 5393 | remLen -= eLen; |
| 5394 | } |
| 5395 | return FALSE; |
| 5396 | } |
| 5397 | |
| 5398 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5399 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5400 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5401 | * parameters during connect operation. |
| 5402 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5403 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5404 | struct cfg80211_connect_params *req |
| 5405 | ) |
| 5406 | { |
| 5407 | int status = 0; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5408 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5409 | ENTER(); |
| 5410 | |
| 5411 | /*set wpa version*/ |
| 5412 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 5413 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5414 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | { |
| 5416 | if ( (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5417 | && ( (req->ie_len) |
Gopichand Nakkala | f8452ad | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 5418 | && (hdd_isWPAIEPresent(req->ie, req->ie_len) ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5419 | // Make sure that it is including a WPA IE. |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5420 | /* Currently NL is putting WPA version 1 even for open, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5421 | * since p2p ie is also put in same buffer. |
| 5422 | * */ |
| 5423 | { |
| 5424 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 5425 | } |
| 5426 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 5427 | { |
| 5428 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 5429 | } |
| 5430 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5431 | |
| 5432 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5433 | pWextState->wpaVersion); |
| 5434 | |
| 5435 | /*set authentication type*/ |
| 5436 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 5437 | |
| 5438 | if (0 > status) |
| 5439 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5440 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5441 | "%s: failed to set authentication type ", __func__); |
| 5442 | return status; |
| 5443 | } |
| 5444 | |
| 5445 | /*set key mgmt type*/ |
| 5446 | if (req->crypto.n_akm_suites) |
| 5447 | { |
| 5448 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 5449 | if (0 > status) |
| 5450 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5451 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5452 | __func__); |
| 5453 | return status; |
| 5454 | } |
| 5455 | } |
| 5456 | |
| 5457 | /*set pairwise cipher type*/ |
| 5458 | if (req->crypto.n_ciphers_pairwise) |
| 5459 | { |
| 5460 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 5461 | req->crypto.ciphers_pairwise[0], true); |
| 5462 | if (0 > status) |
| 5463 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5464 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5465 | "%s: failed to set unicast cipher type", __func__); |
| 5466 | return status; |
| 5467 | } |
| 5468 | } |
| 5469 | else |
| 5470 | { |
| 5471 | /*Reset previous cipher suite to none*/ |
| 5472 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 5473 | if (0 > status) |
| 5474 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5475 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | "%s: failed to set unicast cipher type", __func__); |
| 5477 | return status; |
| 5478 | } |
| 5479 | } |
| 5480 | |
| 5481 | /*set group cipher type*/ |
| 5482 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 5483 | false); |
| 5484 | |
| 5485 | if (0 > status) |
| 5486 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5487 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5488 | __func__); |
| 5489 | return status; |
| 5490 | } |
| 5491 | |
Chet Lanctot | a96bb43 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5492 | #ifdef WLAN_FEATURE_11W |
| 5493 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 5494 | #endif |
| 5495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5496 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 5497 | if (req->ie_len) |
| 5498 | { |
| 5499 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 5500 | if ( 0 > status) |
| 5501 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5502 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse the WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | __func__); |
| 5504 | return status; |
| 5505 | } |
| 5506 | } |
| 5507 | |
| 5508 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5509 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | { |
| 5511 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 5512 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 5513 | ) |
| 5514 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5515 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5516 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 5517 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5518 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5519 | __func__); |
| 5520 | return -EOPNOTSUPP; |
| 5521 | } |
| 5522 | else |
| 5523 | { |
| 5524 | u8 key_len = req->key_len; |
| 5525 | u8 key_idx = req->key_idx; |
| 5526 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5527 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5528 | && (CSR_MAX_NUM_KEY > key_idx) |
| 5529 | ) |
| 5530 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5531 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5532 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | __func__, key_idx, key_len); |
| 5534 | vos_mem_copy( |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5535 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | req->key, key_len); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5537 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5538 | (u8)key_len; |
| 5539 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 5540 | } |
| 5541 | } |
| 5542 | } |
| 5543 | } |
| 5544 | |
| 5545 | return status; |
| 5546 | } |
| 5547 | |
| 5548 | /* |
| 5549 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5550 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5551 | * parameters during connect operation. |
| 5552 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5553 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5554 | struct net_device *ndev, |
| 5555 | struct cfg80211_connect_params *req |
| 5556 | ) |
| 5557 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5558 | int status; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5559 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5560 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
| 5561 | hdd_context_t *pHddCtx = NULL; |
| 5562 | |
| 5563 | ENTER(); |
| 5564 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5565 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | "%s: device_mode = %d\n",__func__,pAdapter->device_mode); |
| 5567 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5568 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5569 | status = wlan_hdd_validate_context(pHddCtx); |
| 5570 | |
| 5571 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5572 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5573 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5574 | "%s: HDD context is not valid", __func__); |
| 5575 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5576 | } |
| 5577 | |
| 5578 | #ifdef WLAN_BTAMP_FEATURE |
| 5579 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5580 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5581 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5582 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5583 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 5584 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5585 | } |
| 5586 | #endif |
| 5587 | /*initialise security parameters*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5588 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5589 | |
| 5590 | if ( 0 > status) |
| 5591 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5592 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | __func__); |
| 5594 | return status; |
| 5595 | } |
| 5596 | |
| 5597 | //If Device Mode is Station Concurrent Sessions Exit BMps |
Madan Mohan Koyyalamudi | c1275fc | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 5598 | //P2P Mode will be taken care in Open/close adapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5599 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 5600 | (vos_concurrent_sessions_running())) |
| 5601 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5602 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5603 | } |
| 5604 | |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 5605 | if ( req->channel ) |
| 5606 | { |
| 5607 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 5608 | req->ssid_len, req->bssid, |
| 5609 | req->channel->hw_value); |
| 5610 | } |
| 5611 | else |
| 5612 | { |
| 5613 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5614 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 5615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5616 | |
| 5617 | if (0 > status) |
| 5618 | { |
| 5619 | //ReEnable BMPS if disabled |
| 5620 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 5621 | (NULL != pHddCtx)) |
| 5622 | { |
| 5623 | //ReEnable Bmps and Imps back |
| 5624 | hdd_enable_bmps_imps(pHddCtx); |
| 5625 | } |
| 5626 | |
| 5627 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 5628 | return status; |
| 5629 | } |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5630 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5631 | EXIT(); |
| 5632 | return status; |
| 5633 | } |
| 5634 | |
| 5635 | |
| 5636 | /* |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5637 | * FUNCTION: wlan_hdd_disconnect |
| 5638 | * This function is used to issue a disconnect request to SME |
| 5639 | */ |
| 5640 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 5641 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5642 | int status; |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5643 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5644 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5645 | |
| 5646 | status = wlan_hdd_validate_context(pHddCtx); |
| 5647 | |
| 5648 | if (0 != status) |
| 5649 | { |
| 5650 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5651 | "%s: HDD context is not valid", __func__); |
| 5652 | return status; |
| 5653 | } |
| 5654 | |
| 5655 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5656 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5657 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5658 | |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5659 | /*issue disconnect*/ |
| 5660 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5661 | pAdapter->sessionId, reason); |
| 5662 | |
| 5663 | if ( 0 != status ) |
| 5664 | { |
| 5665 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5666 | "%s csrRoamDisconnect failure, returned %d \n", |
| 5667 | __func__, (int)status ); |
| 5668 | return -EINVAL; |
| 5669 | } |
| 5670 | wait_for_completion_interruptible_timeout( |
| 5671 | &pAdapter->disconnect_comp_var, |
| 5672 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 5673 | /*stop tx queues*/ |
| 5674 | netif_tx_disable(pAdapter->dev); |
| 5675 | netif_carrier_off(pAdapter->dev); |
| 5676 | return status; |
| 5677 | } |
| 5678 | |
| 5679 | |
| 5680 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5681 | * FUNCTION: wlan_hdd_cfg80211_disconnect |
| 5682 | * This function is used to issue a disconnect request to SME |
| 5683 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5684 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5685 | struct net_device *dev, |
| 5686 | u16 reason |
| 5687 | ) |
| 5688 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5689 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 5690 | tCsrRoamProfile *pRoamProfile = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5691 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5692 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5693 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5694 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 7afef6e | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 5695 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5696 | tANI_U8 staIdx; |
| 5697 | #endif |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5698 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5699 | ENTER(); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5700 | |
| 5701 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5702 | __func__,pAdapter->device_mode); |
| 5703 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5704 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 5705 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5706 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5707 | status = wlan_hdd_validate_context(pHddCtx); |
| 5708 | |
| 5709 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5710 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5711 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5712 | "%s: HDD context is not valid", __func__); |
| 5713 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | } |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5716 | if (NULL != pRoamProfile) |
| 5717 | { |
| 5718 | /*issue disconnect request to SME, if station is in connected state*/ |
| 5719 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated) |
| 5720 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5721 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | 7afef6e | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 5723 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | switch(reason) |
| 5725 | { |
| 5726 | case WLAN_REASON_MIC_FAILURE: |
| 5727 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 5728 | break; |
| 5729 | |
| 5730 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 5731 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 5732 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 5733 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 5734 | break; |
| 5735 | |
| 5736 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 5737 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
| 5738 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 5739 | break; |
| 5740 | |
| 5741 | case WLAN_REASON_DEAUTH_LEAVING: |
| 5742 | default: |
| 5743 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 5744 | break; |
| 5745 | } |
Gopichand Nakkala | 7afef6e | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 5746 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 5747 | pScanInfo = &pHddCtx->scan_info; |
| 5748 | if (pScanInfo->mScanPending) |
| 5749 | { |
| 5750 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
| 5751 | "Aborting Scan"); |
| 5752 | hdd_abort_mac_scan(pHddCtx); |
| 5753 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5754 | |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5755 | #ifdef FEATURE_WLAN_TDLS |
| 5756 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5757 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5758 | { |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5759 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 5760 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5761 | { |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 5762 | uint8 *mac; |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5763 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 5764 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 5765 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5766 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 5767 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5768 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5769 | pAdapter->sessionId, |
| 5770 | mac); |
Gopichand Nakkala | 55182be | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5771 | } |
| 5772 | } |
| 5773 | #endif |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5774 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 5775 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5776 | { |
| 5777 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5778 | "%s wlan_hdd_disconnect failure, returned %d \n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5779 | __func__, (int)status ); |
| 5780 | return -EINVAL; |
| 5781 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5782 | } |
| 5783 | } |
| 5784 | else |
| 5785 | { |
| 5786 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 5787 | } |
| 5788 | |
| 5789 | return status; |
| 5790 | } |
| 5791 | |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 5792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5793 | /* |
| 5794 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5795 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | * settings in IBSS mode. |
| 5797 | */ |
| 5798 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5799 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5800 | struct cfg80211_ibss_params *params |
| 5801 | ) |
| 5802 | { |
| 5803 | int status = 0; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5804 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5805 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5806 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5808 | ENTER(); |
| 5809 | |
| 5810 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 5811 | |
| 5812 | if (params->ie_len && ( NULL != params->ie) ) |
| 5813 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5814 | if (WLAN_EID_RSN == params->ie[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5815 | { |
| 5816 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 5817 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5818 | } |
| 5819 | else |
| 5820 | { |
| 5821 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 5822 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5823 | } |
| 5824 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 5825 | |
| 5826 | if (0 > status) |
| 5827 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5828 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | __func__); |
| 5830 | return status; |
| 5831 | } |
| 5832 | } |
| 5833 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5834 | pWextState->roamProfile.AuthType.authType[0] = |
| 5835 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5836 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5837 | |
| 5838 | if (params->privacy) |
| 5839 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5840 | /* Security enabled IBSS, At this time there is no information available |
| 5841 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5842 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5843 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5844 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5845 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | *enable privacy bit in beacons */ |
| 5847 | |
| 5848 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5849 | } |
| 5850 | |
| 5851 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 5852 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5853 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
| 5854 | |
| 5855 | return status; |
| 5856 | } |
| 5857 | |
| 5858 | /* |
| 5859 | * FUNCTION: wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5860 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5862 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5863 | struct net_device *dev, |
| 5864 | struct cfg80211_ibss_params *params |
| 5865 | ) |
| 5866 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5867 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5869 | tCsrRoamProfile *pRoamProfile; |
| 5870 | int status; |
| 5871 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5872 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5873 | |
| 5874 | ENTER(); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5875 | |
| 5876 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5877 | "%s: device_mode = %d\n",__func__,pAdapter->device_mode); |
| 5878 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5879 | status = wlan_hdd_validate_context(pHddCtx); |
| 5880 | |
| 5881 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5882 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5884 | "%s: HDD context is not valid", __func__); |
| 5885 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5886 | } |
| 5887 | |
| 5888 | if (NULL == pWextState) |
| 5889 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5890 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5891 | __func__); |
| 5892 | return -EIO; |
| 5893 | } |
| 5894 | |
| 5895 | pRoamProfile = &pWextState->roamProfile; |
| 5896 | |
| 5897 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 5898 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5899 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5900 | "%s Interface type is not set to IBSS \n", __func__); |
| 5901 | return -EINVAL; |
| 5902 | } |
| 5903 | |
| 5904 | /* Set Channel */ |
| 5905 | if (NULL != params->channel) |
| 5906 | { |
| 5907 | u8 channelNum; |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5908 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5909 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5910 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5911 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5912 | |
| 5913 | /* Get channel number */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5914 | channelNum = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | ieee80211_frequency_to_channel(params->channel->center_freq); |
| 5916 | |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5917 | |
| 5918 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 5919 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | { |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5921 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 5922 | __func__); |
| 5923 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | } |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5925 | |
| 5926 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5927 | { |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5928 | if (channelNum == validChan[indx]) |
| 5929 | { |
| 5930 | break; |
| 5931 | } |
| 5932 | } |
| 5933 | if (indx >= numChans) |
| 5934 | { |
| 5935 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5936 | __func__, channelNum); |
| 5937 | return -EINVAL; |
| 5938 | } |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5939 | /* Set the Operational Channel */ |
| 5940 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 5941 | channelNum); |
| 5942 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5943 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 5944 | pRoamProfile->ChannelInfo.ChannelList = |
| 5945 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5946 | } |
| 5947 | |
| 5948 | /* Initialize security parameters */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5949 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | if (status < 0) |
| 5951 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5952 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5953 | __func__); |
| 5954 | return status; |
| 5955 | } |
| 5956 | |
| 5957 | /* Issue connect start */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5958 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | bd2b0b4 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5959 | params->ssid_len, params->bssid, |
| 5960 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5961 | |
| 5962 | if (0 > status) |
| 5963 | { |
| 5964 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 5965 | return status; |
| 5966 | } |
| 5967 | |
| 5968 | return 0; |
| 5969 | } |
| 5970 | |
| 5971 | /* |
| 5972 | * FUNCTION: wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5973 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5974 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5975 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | struct net_device *dev |
| 5977 | ) |
| 5978 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5979 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5981 | tCsrRoamProfile *pRoamProfile; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5982 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5983 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5984 | |
| 5985 | ENTER(); |
| 5986 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5987 | status = wlan_hdd_validate_context(pHddCtx); |
| 5988 | |
| 5989 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5990 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 5991 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5992 | "%s: HDD context is not valid", __func__); |
| 5993 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5994 | } |
| 5995 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5996 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",__func__,pAdapter->device_mode); |
| 5997 | if (NULL == pWextState) |
| 5998 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5999 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6000 | __func__); |
| 6001 | return -EIO; |
| 6002 | } |
| 6003 | |
| 6004 | pRoamProfile = &pWextState->roamProfile; |
| 6005 | |
| 6006 | /* Issue disconnect only if interface type is set to IBSS */ |
| 6007 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 6008 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6009 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s: BSS Type is not set to IBSS", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6010 | __func__); |
| 6011 | return -EINVAL; |
| 6012 | } |
| 6013 | |
| 6014 | /* Issue Disconnect request */ |
| 6015 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 6016 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 6017 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 6018 | |
| 6019 | return 0; |
| 6020 | } |
| 6021 | |
| 6022 | /* |
| 6023 | * FUNCTION: wlan_hdd_cfg80211_set_wiphy_params |
| 6024 | * This function is used to set the phy parameters |
| 6025 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 6026 | */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6027 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6028 | u32 changed) |
| 6029 | { |
| 6030 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6031 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6032 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6033 | |
| 6034 | ENTER(); |
| 6035 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6036 | status = wlan_hdd_validate_context(pHddCtx); |
| 6037 | |
| 6038 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6039 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6040 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6041 | "%s: HDD context is not valid", __func__); |
| 6042 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6043 | } |
| 6044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6045 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 6046 | { |
| 6047 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 6048 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 6049 | wiphy->rts_threshold; |
| 6050 | |
| 6051 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6052 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6053 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6054 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6055 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6056 | __func__, rts_threshold); |
| 6057 | return -EINVAL; |
| 6058 | } |
| 6059 | |
| 6060 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 6061 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6062 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6063 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6064 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6065 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6066 | __func__, rts_threshold); |
| 6067 | return -EIO; |
| 6068 | } |
| 6069 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6070 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6071 | rts_threshold); |
| 6072 | } |
| 6073 | |
| 6074 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 6075 | { |
| 6076 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 6077 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 6078 | wiphy->frag_threshold; |
| 6079 | |
| 6080 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6081 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6082 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6083 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6084 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6085 | frag_threshold); |
| 6086 | return -EINVAL; |
| 6087 | } |
| 6088 | |
| 6089 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 6090 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6091 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6092 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6093 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6094 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | __func__, frag_threshold); |
| 6096 | return -EIO; |
| 6097 | } |
| 6098 | |
| 6099 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 6100 | frag_threshold); |
| 6101 | } |
| 6102 | |
| 6103 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 6104 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 6105 | { |
| 6106 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 6107 | wiphy->retry_short : |
| 6108 | wiphy->retry_long; |
| 6109 | |
| 6110 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 6111 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 6112 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6113 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | __func__, retry_value); |
| 6115 | return -EINVAL; |
| 6116 | } |
| 6117 | |
| 6118 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 6119 | { |
| 6120 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 6121 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6122 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6123 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6124 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6125 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6126 | __func__, retry_value); |
| 6127 | return -EIO; |
| 6128 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6129 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | __func__, retry_value); |
| 6131 | } |
| 6132 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 6133 | { |
| 6134 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 6135 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6136 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6137 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6138 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6139 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | __func__, retry_value); |
| 6141 | return -EIO; |
| 6142 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6143 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6144 | __func__, retry_value); |
| 6145 | } |
| 6146 | } |
| 6147 | |
| 6148 | return 0; |
| 6149 | } |
| 6150 | |
| 6151 | /* |
| 6152 | * FUNCTION: wlan_hdd_cfg80211_set_txpower |
| 6153 | * This function is used to set the txpower |
| 6154 | */ |
| 6155 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 6156 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6157 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6158 | #else |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6159 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6160 | #endif |
| 6161 | int dbm) |
| 6162 | { |
| 6163 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6164 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6165 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 6166 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6167 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6168 | |
| 6169 | ENTER(); |
| 6170 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6171 | status = wlan_hdd_validate_context(pHddCtx); |
| 6172 | |
| 6173 | if (0 != status) |
| 6174 | { |
| 6175 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6176 | "%s: HDD context is not valid", __func__); |
| 6177 | return status; |
| 6178 | } |
| 6179 | |
| 6180 | hHal = pHddCtx->hHal; |
| 6181 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6182 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 6183 | dbm, ccmCfgSetCallback, |
| 6184 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6185 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6186 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 6188 | return -EIO; |
| 6189 | } |
| 6190 | |
| 6191 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 6192 | dbm); |
| 6193 | |
| 6194 | switch(type) |
| 6195 | { |
| 6196 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 6197 | /* Fall through */ |
| 6198 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 6199 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 6200 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6201 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 6202 | __func__); |
| 6203 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6204 | } |
| 6205 | break; |
| 6206 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6207 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6208 | __func__); |
| 6209 | return -EOPNOTSUPP; |
| 6210 | break; |
| 6211 | default: |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6212 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 6213 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | return -EIO; |
| 6215 | } |
| 6216 | |
| 6217 | return 0; |
| 6218 | } |
| 6219 | |
| 6220 | /* |
| 6221 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 6222 | * This function is used to read the txpower |
| 6223 | */ |
| 6224 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) |
| 6225 | { |
| 6226 | |
| 6227 | hdd_adapter_t *pAdapter; |
| 6228 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6229 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6230 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6231 | ENTER(); |
| 6232 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6233 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6234 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6235 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6236 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6237 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6238 | "%s: HDD context is not valid", __func__); |
| 6239 | *dbm = 0; |
| 6240 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6241 | } |
| 6242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6244 | if (NULL == pAdapter) |
| 6245 | { |
| 6246 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 6247 | return -ENOENT; |
| 6248 | } |
| 6249 | |
| 6250 | wlan_hdd_get_classAstats(pAdapter); |
| 6251 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 6252 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6253 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6254 | return 0; |
| 6255 | } |
| 6256 | |
| 6257 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 6258 | u8* mac, struct station_info *sinfo) |
| 6259 | { |
| 6260 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 6261 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6262 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 6263 | tANI_U8 rate_flags; |
| 6264 | |
| 6265 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 6266 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6267 | |
| 6268 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 6269 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 6270 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 6271 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 6272 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 6273 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 6274 | tANI_U16 maxRate = 0; |
| 6275 | tANI_U16 myRate; |
| 6276 | tANI_U16 currentRate = 0; |
| 6277 | tANI_U8 maxSpeedMCS = 0; |
| 6278 | tANI_U8 maxMCSIdx = 0; |
| 6279 | tANI_U8 rateFlag = 1; |
| 6280 | tANI_U8 i, j, rssidx; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 6281 | tANI_U16 temp; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6282 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6283 | |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6284 | #ifdef WLAN_FEATURE_11AC |
| 6285 | tANI_U32 vht_mcs_map; |
| 6286 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 6287 | #endif /* WLAN_FEATURE_11AC */ |
| 6288 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6289 | ENTER(); |
| 6290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6291 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 6292 | (0 == ssidlen)) |
| 6293 | { |
| 6294 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 6295 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 6296 | /*To keep GUI happy*/ |
| 6297 | return 0; |
| 6298 | } |
| 6299 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6300 | status = wlan_hdd_validate_context(pHddCtx); |
| 6301 | |
| 6302 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6303 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6304 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6305 | "%s: HDD context is not valid", __func__); |
| 6306 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6307 | } |
| 6308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6309 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 6310 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 6311 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 6312 | wlan_hdd_get_station_stats(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 6314 | |
| 6315 | //convert to the UI units of 100kbps |
| 6316 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 6317 | |
| 6318 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6319 | pr_info("RSSI %d, RLMS %u, rate %d, rssi high %d, rssi mid %d, rssi low %d, rate_flags 0x%x, MCS %d\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6320 | sinfo->signal, |
| 6321 | pCfg->reportMaxLinkSpeed, |
| 6322 | myRate, |
| 6323 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6324 | (int) pCfg->linkSpeedRssiMid, |
| 6325 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6326 | (int) rate_flags, |
| 6327 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6328 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6329 | |
| 6330 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 6331 | { |
| 6332 | // we do not want to necessarily report the current speed |
| 6333 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 6334 | { |
| 6335 | // report the max possible speed |
| 6336 | rssidx = 0; |
| 6337 | } |
| 6338 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 6339 | { |
| 6340 | // report the max possible speed with RSSI scaling |
| 6341 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 6342 | { |
| 6343 | // report the max possible speed |
| 6344 | rssidx = 0; |
| 6345 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6346 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6347 | { |
| 6348 | // report middle speed |
| 6349 | rssidx = 1; |
| 6350 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6351 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 6352 | { |
| 6353 | // report middle speed |
| 6354 | rssidx = 2; |
| 6355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | else |
| 6357 | { |
| 6358 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6359 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | } |
| 6361 | } |
| 6362 | else |
| 6363 | { |
| 6364 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 6365 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6366 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 6367 | __func__, pCfg->reportMaxLinkSpeed); |
| 6368 | rssidx = 0; |
| 6369 | } |
| 6370 | |
| 6371 | maxRate = 0; |
| 6372 | |
| 6373 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 7bd4af8 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 6374 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 6375 | OperationalRates, &ORLeng)) |
| 6376 | { |
| 6377 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 6378 | /*To keep GUI happy*/ |
| 6379 | return 0; |
| 6380 | } |
| 6381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | for (i = 0; i < ORLeng; i++) |
| 6383 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6384 | for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | { |
| 6386 | /* Validate Rate Set */ |
| 6387 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 6388 | { |
| 6389 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 6390 | break; |
| 6391 | } |
| 6392 | } |
| 6393 | /* Update MAX rate */ |
| 6394 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 6395 | } |
| 6396 | |
| 6397 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 7bd4af8 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 6398 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 6399 | ExtendedRates, &ERLeng)) |
| 6400 | { |
| 6401 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 6402 | /*To keep GUI happy*/ |
| 6403 | return 0; |
| 6404 | } |
| 6405 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6406 | for (i = 0; i < ERLeng; i++) |
| 6407 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6408 | for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6409 | { |
| 6410 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 6411 | { |
| 6412 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 6413 | break; |
| 6414 | } |
| 6415 | } |
| 6416 | /* Update MAX rate */ |
| 6417 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 6418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | /* Get MCS Rate Set -- but only if we are connected at MCS |
| 6420 | rates or if we are always reporting max speed or if we have |
| 6421 | good rssi */ |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6422 | if ((0 == rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | { |
Gopichand Nakkala | 7bd4af8 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 6424 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 6425 | MCSRates, &MCSLeng)) |
| 6426 | { |
| 6427 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 6428 | /*To keep GUI happy*/ |
| 6429 | return 0; |
| 6430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6431 | rateFlag = 0; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6432 | #ifdef WLAN_FEATURE_11AC |
| 6433 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6434 | if (rate_flags & (eHAL_TX_RATE_VHT20|eHAL_TX_RATE_VHT40|eHAL_TX_RATE_VHT80)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6435 | { |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6436 | ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_VHT_TX_MCS_MAP, &vht_mcs_map); |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6437 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6438 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6439 | { |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6440 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6441 | } |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6442 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6443 | { |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6444 | maxMCSIdx = 7; |
| 6445 | } |
| 6446 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 6447 | { |
| 6448 | maxMCSIdx = 8; |
| 6449 | } |
| 6450 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 6451 | { |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6452 | //VHT20 is supporting 0~8 |
| 6453 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 6454 | maxMCSIdx = 8; |
| 6455 | else |
| 6456 | maxMCSIdx = 9; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6457 | } |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6458 | |
| 6459 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 6460 | { |
| 6461 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 6462 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 6463 | } |
| 6464 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 6465 | { |
| 6466 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 6467 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 6468 | } |
| 6469 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 6470 | { |
| 6471 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 6472 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 6473 | } |
| 6474 | |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6475 | maxSpeedMCS = 1; |
| 6476 | if (currentRate > maxRate) |
| 6477 | { |
| 6478 | maxRate = currentRate; |
| 6479 | } |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6480 | |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6481 | } |
| 6482 | else |
| 6483 | #endif /* WLAN_FEATURE_11AC */ |
| 6484 | { |
| 6485 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 6486 | { |
| 6487 | rateFlag |= 1; |
| 6488 | } |
| 6489 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 6490 | { |
| 6491 | rateFlag |= 2; |
| 6492 | } |
| 6493 | |
| 6494 | for (i = 0; i < MCSLeng; i++) |
| 6495 | { |
| 6496 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
| 6497 | for (j = 0; j < temp; j++) |
| 6498 | { |
| 6499 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 6500 | { |
| 6501 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 6502 | break; |
| 6503 | } |
| 6504 | } |
| 6505 | if ((j < temp) && (currentRate > maxRate)) |
| 6506 | { |
| 6507 | maxRate = currentRate; |
| 6508 | maxSpeedMCS = 1; |
| 6509 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 6510 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6511 | } |
| 6512 | } |
| 6513 | } |
| 6514 | |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6515 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 6516 | { |
| 6517 | maxRate = myRate; |
| 6518 | maxSpeedMCS = 1; |
| 6519 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 6520 | } |
| 6521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6522 | // make sure we report a value at least as big as our current rate |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6523 | if (((maxRate < myRate) && (0 == rssidx)) || |
| 6524 | (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6525 | { |
| 6526 | maxRate = myRate; |
| 6527 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 6528 | { |
| 6529 | maxSpeedMCS = 0; |
| 6530 | } |
| 6531 | else |
| 6532 | { |
| 6533 | maxSpeedMCS = 1; |
| 6534 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 6535 | } |
| 6536 | } |
| 6537 | |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6538 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6539 | { |
| 6540 | sinfo->txrate.legacy = maxRate; |
| 6541 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 6542 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 6543 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6544 | } |
| 6545 | else |
| 6546 | { |
| 6547 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6548 | #ifdef WLAN_FEATURE_11AC |
| 6549 | sinfo->txrate.nss = 1; |
| 6550 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 6551 | { |
| 6552 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6553 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6554 | } |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6555 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6556 | { |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6557 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 6558 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 6559 | } |
| 6560 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 6561 | { |
| 6562 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 6563 | } |
| 6564 | #endif /* WLAN_FEATURE_11AC */ |
| 6565 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 6566 | { |
| 6567 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 6568 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 6569 | { |
| 6570 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 6571 | } |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 6574 | { |
| 6575 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 6576 | } |
Gopichand Nakkala | 0e73dec | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 6577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6578 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 6579 | pr_info("Reporting MCS rate %d flags %x\n", |
| 6580 | sinfo->txrate.mcs, |
| 6581 | sinfo->txrate.flags ); |
| 6582 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6583 | } |
| 6584 | } |
| 6585 | else |
| 6586 | { |
| 6587 | // report current rate instead of max rate |
| 6588 | |
| 6589 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 6590 | { |
| 6591 | //provide to the UI in units of 100kbps |
| 6592 | sinfo->txrate.legacy = myRate; |
| 6593 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 6594 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 6595 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6596 | } |
| 6597 | else |
| 6598 | { |
| 6599 | //must be MCS |
| 6600 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6601 | #ifdef WLAN_FEATURE_11AC |
| 6602 | sinfo->txrate.nss = 1; |
| 6603 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 6604 | { |
| 6605 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 6606 | } |
| 6607 | else |
| 6608 | #endif /* WLAN_FEATURE_11AC */ |
| 6609 | { |
| 6610 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 6611 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6612 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 6613 | { |
| 6614 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 6615 | } |
| 6616 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 6617 | { |
| 6618 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 6619 | } |
Leo Chang | 1e17d2f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6620 | #ifdef WLAN_FEATURE_11AC |
| 6621 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 6622 | { |
| 6623 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 6624 | } |
| 6625 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 6627 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 6628 | sinfo->txrate.mcs, |
| 6629 | sinfo->txrate.flags ); |
| 6630 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6631 | } |
| 6632 | } |
| 6633 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 6634 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 6635 | sinfo->tx_packets = |
| 6636 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 6637 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 6638 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 6639 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 6640 | |
| 6641 | sinfo->tx_retries = |
| 6642 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 6643 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 6644 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 6645 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 6646 | |
| 6647 | sinfo->tx_failed = |
| 6648 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 6649 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 6650 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 6651 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 6652 | |
| 6653 | sinfo->filled |= |
| 6654 | STATION_INFO_TX_PACKETS | |
| 6655 | STATION_INFO_TX_RETRIES | |
| 6656 | STATION_INFO_TX_FAILED; |
| 6657 | |
| 6658 | EXIT(); |
| 6659 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | } |
| 6661 | |
| 6662 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 6663 | struct net_device *dev, bool mode, v_SINT_t timeout) |
| 6664 | { |
| 6665 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 42fcd22 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 6666 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | VOS_STATUS vos_status; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6668 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6669 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6670 | ENTER(); |
| 6671 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6672 | if (NULL == pAdapter) |
| 6673 | { |
| 6674 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__); |
| 6675 | return -ENODEV; |
| 6676 | } |
| 6677 | |
Gopichand Nakkala | 42fcd22 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 6678 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6679 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 42fcd22 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 6680 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6681 | if (0 != status) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6682 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6683 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6684 | "%s: HDD context is not valid", __func__); |
| 6685 | return status; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6686 | } |
| 6687 | |
Gopichand Nakkala | 42fcd22 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 6688 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 6689 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 6690 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 6691 | (eConnectionState_Associated == |
| 6692 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 6693 | { |
| 6694 | vos_status = hdd_conf_hostarpoffload(pAdapter, TRUE); |
| 6695 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 6696 | { |
| 6697 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6698 | "%s:Failed to enable ARPOFFLOAD Feature %d\n", |
| 6699 | __func__, vos_status); |
| 6700 | } |
| 6701 | } |
| 6702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6703 | /**The get power cmd from the supplicant gets updated by the nl only |
| 6704 | *on successful execution of the function call |
| 6705 | *we are oppositely mapped w.r.t mode in the driver |
| 6706 | **/ |
| 6707 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 6708 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6709 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6710 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 6711 | { |
| 6712 | return -EINVAL; |
| 6713 | } |
| 6714 | return 0; |
| 6715 | } |
| 6716 | |
| 6717 | |
| 6718 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 6719 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 6720 | struct net_device *netdev, |
| 6721 | u8 key_index) |
| 6722 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6723 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6724 | return 0; |
| 6725 | } |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6726 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6727 | |
| 6728 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 6729 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 6730 | struct net_device *dev, |
| 6731 | struct ieee80211_txq_params *params) |
| 6732 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6733 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6734 | return 0; |
| 6735 | } |
| 6736 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 6737 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 6738 | struct ieee80211_txq_params *params) |
| 6739 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6740 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6741 | return 0; |
| 6742 | } |
| 6743 | #endif //LINUX_VERSION_CODE |
| 6744 | |
| 6745 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 6746 | struct net_device *dev, u8 *mac) |
| 6747 | { |
| 6748 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6749 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | 15407ac | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 6750 | VOS_STATUS vos_status; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6751 | int status; |
Madan Mohan Koyyalamudi | 15407ac | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 6752 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6753 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6754 | ENTER(); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6755 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6756 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6757 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6758 | return -EINVAL; |
| 6759 | } |
| 6760 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6761 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6762 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6763 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6764 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6765 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6766 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6767 | "%s: HDD context is not valid", __func__); |
| 6768 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6769 | } |
| 6770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6771 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6772 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6773 | ) |
| 6774 | { |
| 6775 | if( NULL == mac ) |
| 6776 | { |
| 6777 | v_U16_t i; |
| 6778 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 6779 | { |
| 6780 | if(pAdapter->aStaInfo[i].isUsed) |
| 6781 | { |
| 6782 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 6783 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6784 | "%s: Delete STA with MAC::" |
| 6785 | "%02x:%02x:%02x:%02x:%02x:%02x", |
| 6786 | __func__, |
| 6787 | macAddr[0], macAddr[1], macAddr[2], |
| 6788 | macAddr[3], macAddr[4], macAddr[5]); |
| 6789 | hdd_softap_sta_deauth(pAdapter, macAddr); |
| 6790 | } |
| 6791 | } |
| 6792 | } |
| 6793 | else |
| 6794 | { |
Madan Mohan Koyyalamudi | 15407ac | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 6795 | |
| 6796 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 6797 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 6798 | { |
| 6799 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6800 | "%s: Skip this DEL STA as this is not used::" |
| 6801 | "%02x:%02x:%02x:%02x:%02x:%02x", |
| 6802 | __func__, |
| 6803 | mac[0], mac[1], mac[2], |
| 6804 | mac[3], mac[4], mac[5]); |
| 6805 | return -ENOENT; |
| 6806 | } |
| 6807 | |
| 6808 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 6809 | { |
| 6810 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6811 | "%s: Skip this DEL STA as deauth is in progress::" |
| 6812 | "%02x:%02x:%02x:%02x:%02x:%02x", |
| 6813 | __func__, |
| 6814 | mac[0], mac[1], mac[2], |
| 6815 | mac[3], mac[4], mac[5]); |
| 6816 | return -ENOENT; |
| 6817 | } |
| 6818 | |
| 6819 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 6820 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6821 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6822 | "%s: Delete STA with MAC::" |
| 6823 | "%02x:%02x:%02x:%02x:%02x:%02x", |
| 6824 | __func__, |
| 6825 | mac[0], mac[1], mac[2], |
| 6826 | mac[3], mac[4], mac[5]); |
Madan Mohan Koyyalamudi | 15407ac | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 6827 | |
| 6828 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 6829 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 6830 | { |
| 6831 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 6832 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6833 | "%s: STA removal failed for ::" |
| 6834 | "%02x:%02x:%02x:%02x:%02x:%02x", |
| 6835 | __func__, |
| 6836 | mac[0], mac[1], mac[2], |
| 6837 | mac[3], mac[4], mac[5]); |
| 6838 | return -ENOENT; |
| 6839 | } |
| 6840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6841 | } |
| 6842 | } |
| 6843 | |
| 6844 | EXIT(); |
| 6845 | |
| 6846 | return 0; |
| 6847 | } |
| 6848 | |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6849 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 6850 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 6851 | { |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 6852 | int status = -EPERM; |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6853 | #ifdef FEATURE_WLAN_TDLS |
| 6854 | u32 mask, set; |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6855 | ENTER(); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6856 | mask = params->sta_flags_mask; |
| 6857 | |
| 6858 | set = params->sta_flags_set; |
| 6859 | |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6860 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 6861 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6862 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 6863 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 6864 | #endif |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6865 | |
| 6866 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 6867 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 74e2a6c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6868 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6869 | } |
| 6870 | } |
| 6871 | #endif |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 6872 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6873 | } |
| 6874 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6875 | |
| 6876 | #ifdef FEATURE_WLAN_LFR |
| 6877 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6878 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6879 | { |
| 6880 | #define MAX_PMKSAIDS_IN_CACHE 8 |
| 6881 | static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD Local cache |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6882 | static tANI_U32 i; // HDD Local Cache index |
| 6883 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6884 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6885 | tHalHandle halHandle; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6886 | eHalStatus result; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6887 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6888 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6889 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6890 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6891 | ENTER(); |
| 6892 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6893 | // Validate pAdapter |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6894 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6895 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6896 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6897 | return -EINVAL; |
| 6898 | } |
| 6899 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6900 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6901 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6902 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6903 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6904 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 6905 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6906 | "%s: HDD context is not valid", __func__); |
| 6907 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6908 | } |
| 6909 | |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6910 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6911 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6912 | |
| 6913 | for (j = 0; j < i; j++) |
| 6914 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6915 | if(vos_mem_compare(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6916 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 6917 | { |
| 6918 | /* BSSID matched previous entry. Overwrite it. */ |
| 6919 | BSSIDMatched = 1; |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6920 | vos_mem_copy(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6921 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6922 | vos_mem_copy(PMKIDCache[j].PMKID, |
| 6923 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6924 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6925 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6926 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6927 | dump_bssid(pmksa->bssid); |
| 6928 | dump_pmkid(halHandle, pmksa->pmkid); |
| 6929 | break; |
| 6930 | } |
| 6931 | } |
| 6932 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 6933 | /* Check we compared all entries,if then take the first slot now */ |
| 6934 | if(j == MAX_PMKSAIDS_IN_CACHE) i=0; |
| 6935 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6936 | if (!BSSIDMatched) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6937 | { |
| 6938 | // Now, we DON'T have a BSSID match, so take a new entry in the cache. |
| 6939 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 6940 | pmksa->bssid, ETHER_ADDR_LEN); |
| 6941 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 6942 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6943 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6944 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Adding a new cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6945 | __func__, i ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6946 | dump_bssid(pmksa->bssid); |
| 6947 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6948 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6949 | // The "i=0" doesn't work for the call to sme_RoamSetPMKIDCache() - LFR FIXME |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6950 | if (i<=(MAX_PMKSAIDS_IN_CACHE-1)) i++; else i=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6951 | } |
| 6952 | |
| 6953 | |
| 6954 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6955 | //hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with %d cache entries."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6956 | // __func__, i ); |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6957 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6958 | __func__, i ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6959 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6960 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 6961 | PMKIDCache, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6962 | i ); |
| 6963 | return 0; |
| 6964 | } |
| 6965 | |
| 6966 | |
| 6967 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6968 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6969 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6970 | ENTER(); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6971 | // TODO: Implement this later. |
| 6972 | return 0; |
| 6973 | } |
| 6974 | |
| 6975 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 6976 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6977 | ENTER(); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6978 | // TODO: Implement this later. |
| 6979 | return 0; |
| 6980 | } |
| 6981 | #endif |
| 6982 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 6983 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6984 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 6985 | struct net_device *dev, struct cfg80211_update_ft_ies_params *ftie) |
| 6986 | { |
| 6987 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6988 | hdd_station_ctx_t *pHddStaCtx; |
| 6989 | |
| 6990 | if (NULL == pAdapter) |
| 6991 | { |
| 6992 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__); |
| 6993 | return -ENODEV; |
| 6994 | } |
| 6995 | |
| 6996 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6997 | |
| 6998 | // Added for debug on reception of Re-assoc Req. |
| 6999 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 7000 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7001 | hddLog(LOGE, FL("Called with Ie of length = %d when not associated\n"), |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7002 | ftie->ie_len); |
| 7003 | hddLog(LOGE, FL("Should be Re-assoc Req IEs\n")); |
| 7004 | } |
| 7005 | |
| 7006 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7007 | hddLog(LOGE, FL("%s called with Ie of length = %d\n"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7008 | ftie->ie_len); |
| 7009 | #endif |
| 7010 | |
| 7011 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 9e906c9 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 7012 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 7013 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7014 | ftie->ie_len); |
| 7015 | return 0; |
| 7016 | } |
| 7017 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7018 | |
Gopichand Nakkala | 3b34fa8 | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7019 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 7020 | |
| 7021 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 7022 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 7023 | { |
| 7024 | int ret; |
| 7025 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 7026 | hdd_context_t *pHddCtx; |
| 7027 | |
| 7028 | if (NULL == pAdapter) |
| 7029 | { |
| 7030 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7031 | "%s: HDD adapter is Null", __func__); |
| 7032 | return ; |
| 7033 | } |
| 7034 | |
| 7035 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7036 | if (NULL == pHddCtx) |
| 7037 | { |
| 7038 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7039 | "%s: HDD context is Null!!!", __func__); |
| 7040 | return ; |
| 7041 | } |
| 7042 | |
| 7043 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 7044 | |
| 7045 | if (0 > ret) |
| 7046 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 7047 | |
| 7048 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
| 7049 | } |
| 7050 | |
| 7051 | /* |
| 7052 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 7053 | * NL interface to enable PNO |
| 7054 | */ |
| 7055 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 7056 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 7057 | { |
| 7058 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7059 | tpSirPNOScanReq pPnoRequest = NULL; |
| 7060 | hdd_context_t *pHddCtx; |
| 7061 | tHalHandle hHal; |
| 7062 | v_U32_t i, indx, num_ch; |
| 7063 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 7064 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 7065 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 7066 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 7067 | |
| 7068 | if (NULL == pAdapter) |
| 7069 | { |
| 7070 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7071 | "%s: HDD adapter is Null", __func__); |
| 7072 | return -ENODEV; |
| 7073 | } |
| 7074 | |
| 7075 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7076 | if (NULL == pHddCtx) |
| 7077 | { |
| 7078 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7079 | "%s: HDD context is Null!!!", __func__); |
| 7080 | return -ENODEV; |
| 7081 | } |
| 7082 | |
| 7083 | if (pHddCtx->isLogpInProgress) |
| 7084 | { |
| 7085 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7086 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 7087 | return -EAGAIN; |
| 7088 | } |
| 7089 | |
| 7090 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7091 | if (NULL == hHal) |
| 7092 | { |
| 7093 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7094 | "%s: HAL context is Null!!!", __func__); |
| 7095 | return -EAGAIN; |
| 7096 | } |
| 7097 | |
| 7098 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 7099 | if (NULL == pPnoRequest) |
| 7100 | { |
| 7101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7102 | "%s: vos_mem_malloc failed", __func__); |
| 7103 | return -ENODEV; |
| 7104 | } |
| 7105 | |
| 7106 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 7107 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 7108 | |
| 7109 | if (( !pPnoRequest->ucNetworksCount ) || |
| 7110 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 7111 | { |
| 7112 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7113 | "Network input is not correct"); |
| 7114 | goto error; |
| 7115 | } |
| 7116 | |
| 7117 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 7118 | { |
| 7119 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7120 | "Incorrect number of channels"); |
| 7121 | goto error; |
| 7122 | } |
| 7123 | |
| 7124 | /* Framework provides one set of channels(all) |
| 7125 | * common for all saved profile */ |
| 7126 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 7127 | channels_allowed, &num_channels_allowed)) |
| 7128 | { |
| 7129 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7130 | "%s: failed to get valid channel list", __func__); |
| 7131 | goto error; |
| 7132 | } |
| 7133 | /* Checking each channel against allowed channel list */ |
| 7134 | num_ch = 0; |
| 7135 | for (i = 0; i < request->n_channels; i++) |
| 7136 | { |
| 7137 | for (indx = 0; indx < num_channels_allowed; indx++) |
| 7138 | { |
| 7139 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 7140 | { |
| 7141 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 7142 | break ; |
| 7143 | } |
| 7144 | } |
| 7145 | } |
| 7146 | |
| 7147 | /* Filling per profile params */ |
| 7148 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 7149 | { |
| 7150 | pPnoRequest->aNetworks[i].ssId.length = |
| 7151 | request->match_sets[i].ssid.ssid_len; |
| 7152 | |
| 7153 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 7154 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 7155 | { |
| 7156 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7157 | "SSID Len %d is not correct for network %d", |
| 7158 | pPnoRequest->aNetworks[i].ssId.length, i); |
| 7159 | goto error; |
| 7160 | } |
| 7161 | |
| 7162 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 7163 | request->match_sets[i].ssid.ssid, |
| 7164 | request->match_sets[i].ssid.ssid_len); |
| 7165 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 7166 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 7167 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 7168 | |
| 7169 | /*Copying list of valid channel into request */ |
| 7170 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 7171 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 7172 | |
| 7173 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 7174 | } |
| 7175 | |
| 7176 | /* framework provides interval in ms */ |
| 7177 | pPnoRequest->scanTimers.ucScanTimersCount = 1; |
| 7178 | pPnoRequest->scanTimers.aTimerValues[0].uTimerValue = |
| 7179 | (request->interval)/1000; |
| 7180 | pPnoRequest->scanTimers.aTimerValues[0].uTimerRepeat = 0; |
| 7181 | pPnoRequest->modePNO = SIR_PNO_MODE_ON_SUSPEND; |
| 7182 | |
| 7183 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7184 | pPnoRequest, pAdapter->sessionId, |
| 7185 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 7186 | if (eHAL_STATUS_SUCCESS != status) |
| 7187 | { |
| 7188 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7189 | "Failed to enable PNO"); |
| 7190 | goto error; |
| 7191 | } |
| 7192 | |
| 7193 | error: |
| 7194 | vos_mem_free(pPnoRequest); |
| 7195 | return status; |
| 7196 | } |
| 7197 | |
| 7198 | /* |
| 7199 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 7200 | * NL interface to disable PNO |
| 7201 | */ |
| 7202 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 7203 | struct net_device *dev) |
| 7204 | { |
| 7205 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 7206 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7207 | hdd_context_t *pHddCtx; |
| 7208 | tHalHandle hHal; |
| 7209 | tpSirPNOScanReq pPnoRequest = NULL; |
| 7210 | |
| 7211 | ENTER(); |
| 7212 | |
| 7213 | if (NULL == pAdapter) |
| 7214 | { |
| 7215 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7216 | "%s: HDD adapter is Null", __func__); |
| 7217 | return -ENODEV; |
| 7218 | } |
| 7219 | |
| 7220 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7221 | if (NULL == pHddCtx) |
| 7222 | { |
| 7223 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7224 | "%s: HDD context is Null!!!", __func__); |
| 7225 | return -ENODEV; |
| 7226 | } |
| 7227 | |
| 7228 | if (pHddCtx->isLogpInProgress) |
| 7229 | { |
| 7230 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7231 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 7232 | return -EAGAIN; |
| 7233 | } |
| 7234 | |
| 7235 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7236 | if (NULL == hHal) |
| 7237 | { |
| 7238 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7239 | "%s: HAL context is Null!!!", __func__); |
| 7240 | return -EAGAIN; |
| 7241 | } |
| 7242 | |
| 7243 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 7244 | if (NULL == pPnoRequest) |
| 7245 | { |
| 7246 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7247 | "%s: vos_mem_malloc failed", __func__); |
| 7248 | return -ENODEV; |
| 7249 | } |
| 7250 | |
| 7251 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 7252 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 7253 | pPnoRequest->ucNetworksCount = 0; |
| 7254 | |
| 7255 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 7256 | pAdapter->sessionId, |
| 7257 | NULL, pAdapter); |
| 7258 | if (eHAL_STATUS_SUCCESS != status) |
| 7259 | { |
| 7260 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7261 | "Failed to disabled PNO"); |
| 7262 | } |
| 7263 | |
| 7264 | vos_mem_free(pPnoRequest); |
| 7265 | |
| 7266 | EXIT(); |
| 7267 | return status; |
| 7268 | } |
| 7269 | |
| 7270 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 7271 | |
| 7272 | |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7273 | #ifdef FEATURE_WLAN_TDLS |
| 7274 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 7275 | u8 *peer, u8 action_code, u8 dialog_token, |
| 7276 | u16 status_code, const u8 *buf, size_t len) |
| 7277 | { |
| 7278 | |
| 7279 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7280 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7281 | u8 peerMac[6]; |
| 7282 | VOS_STATUS status; |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7283 | int max_sta_failed = 0; |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7284 | int responder; |
Hoonki Lee | 2f383f2 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 7285 | long rc; |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7286 | |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7287 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7288 | { |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7289 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7290 | "Invalid arguments"); |
| 7291 | return -EINVAL; |
| 7292 | } |
| 7293 | |
Sameer Thalappil | 5d3cbc4 | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7294 | if (pHddCtx->isLogpInProgress) |
| 7295 | { |
| 7296 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7297 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7298 | wlan_hdd_tdls_set_link_status(pAdapter, peer, eTDLS_LINK_IDLE); |
Sameer Thalappil | 5d3cbc4 | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7299 | return -EBUSY; |
| 7300 | } |
| 7301 | |
Hoonki Lee | 8c368e9 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7302 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7303 | { |
Hoonki Lee | 8c368e9 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7304 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7305 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 7306 | MAC_ADDRESS_STR " action %d declined.", |
| 7307 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7308 | return -ENOTSUPP; |
| 7309 | } |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7310 | |
Hoonki Lee | 8c368e9 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7311 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 7312 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 7313 | { |
| 7314 | /* if tdls_mode is disabled to respond to peer's request */ |
| 7315 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 7316 | { |
| 7317 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7318 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7319 | " TDLS mode is disabled. action %d declined.", |
| 7320 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 8c368e9 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7321 | |
| 7322 | return -ENOTSUPP; |
| 7323 | } |
| 7324 | } |
| 7325 | |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7326 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 7327 | { |
Hoonki Lee | 39d2ece | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 7328 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7329 | { |
| 7330 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7331 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7332 | " TDLS setup is ongoing. action %d declined.", |
| 7333 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 7334 | return -EPERM; |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7335 | } |
| 7336 | } |
| 7337 | |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7338 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 7339 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7340 | { |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 7341 | if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter)) |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7342 | { |
| 7343 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 7344 | we return error code at 'add_station()'. Hence we have this |
| 7345 | check again in addtion to add_station(). |
| 7346 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7347 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7348 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7349 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7350 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7351 | " TDLS Max peer already connected. action %d declined.", |
| 7352 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7353 | goto error; |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7354 | } |
| 7355 | else |
| 7356 | { |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7357 | /* maximum reached. tweak to send error code to peer and return |
| 7358 | error code to supplicant */ |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7359 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7360 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7361 | "%s: " MAC_ADDRESS_STR |
| 7362 | " TDLS Max peer already connected send response status %d", |
| 7363 | __func__, MAC_ADDR_ARRAY(peer), status_code); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7364 | max_sta_failed = -EPERM; |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7365 | /* fall through to send setup resp with failure status |
| 7366 | code */ |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7367 | } |
| 7368 | } |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7369 | else |
| 7370 | { |
| 7371 | hddTdlsPeer_t *pTdlsPeer; |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 7372 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7373 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7374 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7375 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | f596fc4 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7376 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 7377 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7378 | return -EPERM; |
| 7379 | } |
| 7380 | } |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7381 | } |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7382 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7383 | |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7384 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 7385 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7386 | "%s: " MAC_ADDRESS_STR " action %d, dialog_token %d status %d, len = %d", |
| 7387 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 7388 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7389 | #endif |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7390 | |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7391 | /*Except teardown responder will not be used so just make 0*/ |
| 7392 | responder = 0; |
Hoonki Lee | 03683e8 | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7393 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7394 | { |
Gopichand Nakkala | 24c3341 | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 7395 | |
| 7396 | hddTdlsPeer_t *pTdlsPeer; |
| 7397 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac); |
| 7398 | |
| 7399 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 7400 | responder = pTdlsPeer->is_responder; |
| 7401 | else |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7402 | { |
Gopichand Nakkala | 24c3341 | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 7403 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7404 | "%s: " MAC_ADDRESS_STR " peer doesn't exist or not connected %d dialog_token %d status %d, len = %d", |
| 7405 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 7406 | dialog_token, status_code, len); |
| 7407 | return -EPERM; |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7408 | } |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7409 | } |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7410 | |
Hoonki Lee | cf53642 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 7411 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
| 7412 | (SIR_MAC_TDLS_DIS_RSP == action_code)) |
| 7413 | { |
| 7414 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 7415 | { |
| 7416 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7417 | "%s: Sending Disc/Setup Rsp Frame.Disable BMPS", __func__); |
| 7418 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 7419 | } |
| 7420 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
| 7421 | } |
| 7422 | |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7423 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 7424 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 7425 | { |
| 7426 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7427 | "%s: " MAC_ADDRESS_STR " action %d couldn't sent, as one is pending. return EBUSY\n", |
| 7428 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 7429 | return -EBUSY; |
| 7430 | } |
| 7431 | |
| 7432 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7433 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 7434 | |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7435 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7436 | peerMac, action_code, dialog_token, status_code, (tANI_U8 *)buf, len, responder); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7437 | |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7438 | if (VOS_STATUS_SUCCESS != status) |
| 7439 | { |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7440 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7441 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7442 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | cf53642 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 7443 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 7444 | goto error; |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7445 | } |
| 7446 | |
Hoonki Lee | 2f383f2 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 7447 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 7448 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 7449 | |
| 7450 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7451 | { |
Hoonki Lee | 2f383f2 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 7452 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7453 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %lu", |
| 7454 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7455 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 2f383f2 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 7456 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 7457 | goto error; |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7458 | } |
| 7459 | |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7460 | if (max_sta_failed) |
Hoonki Lee | cf53642 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 7461 | { |
| 7462 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7463 | return max_sta_failed; |
Hoonki Lee | cf53642 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 7464 | } |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7465 | |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7466 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 7467 | { |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 7468 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7469 | } |
| 7470 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 7471 | { |
Gopichand Nakkala | cb408cd | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 7472 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | d90d148 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7473 | } |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7474 | |
| 7475 | return 0; |
Gopichand Nakkala | 0f8b68d | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7476 | error: |
| 7477 | /* max_sta_failed ; we didn't set to CONNECTING for this case, |
| 7478 | because we already know that this transaction will be failed, |
| 7479 | but we weren't sure if supplicant call DISABLE_LINK or not. So, |
| 7480 | to be safe, do not change the state mahine. |
| 7481 | */ |
| 7482 | if(max_sta_failed == 0 && |
| 7483 | (WLAN_IS_TDLS_SETUP_ACTION(action_code))) |
| 7484 | wlan_hdd_tdls_set_link_status(pAdapter, peerMac, eTDLS_LINK_IDLE); |
| 7485 | return -EPERM; |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7486 | } |
| 7487 | |
| 7488 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 7489 | u8 *peer, enum nl80211_tdls_operation oper) |
| 7490 | { |
| 7491 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7492 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7493 | int status; |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 7494 | #ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP |
| 7495 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 7496 | tANI_U8 staIdx; |
| 7497 | #endif |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7498 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 7499 | const char *tdls_oper_str[]= { |
| 7500 | "NL80211_TDLS_DISCOVERY_REQ", |
| 7501 | "NL80211_TDLS_SETUP", |
| 7502 | "NL80211_TDLS_TEARDOWN", |
| 7503 | "NL80211_TDLS_ENABLE_LINK", |
| 7504 | "NL80211_TDLS_DISABLE_LINK", |
| 7505 | "NL80211_TDLS_UNKONW_OPER"}; |
| 7506 | #endif |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7507 | hddTdlsPeer_t *pTdlsPeer; |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7508 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7509 | if ( NULL == peer ) |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7510 | { |
Gopichand Nakkala | f8d8481 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7511 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | 20b2cb9 | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 7512 | "%s: Invalid arguments", __func__); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7513 | return -EINVAL; |
| 7514 | } |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7515 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7516 | status = wlan_hdd_validate_context(pHddCtx); |
| 7517 | |
| 7518 | if (0 != status) |
Sameer Thalappil | 5d3cbc4 | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7519 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7520 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7521 | "%s: HDD context is not valid", __func__); |
| 7522 | return status; |
Sameer Thalappil | 5d3cbc4 | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7523 | } |
| 7524 | |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7525 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer); |
| 7526 | |
| 7527 | if ( NULL == pTdlsPeer ) { |
| 7528 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR " (oper %d) not exsting. ignored", |
| 7529 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 7530 | return -EINVAL; |
| 7531 | } |
| 7532 | |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7533 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 7534 | if((int)oper > 4) |
| 7535 | oper = 5; |
| 7536 | |
| 7537 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7538 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 7539 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7540 | tdls_oper_str[(int)oper]); |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7541 | #endif |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7542 | |
| 7543 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7544 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7545 | { |
Hoonki Lee | 068d414 | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 7546 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | 20b2cb9 | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 7547 | "TDLS Disabled in INI OR not enabled in FW. " |
| 7548 | "Cannot process TDLS commands"); |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7549 | return -ENOTSUPP; |
| 7550 | } |
| 7551 | |
| 7552 | switch (oper) { |
| 7553 | case NL80211_TDLS_ENABLE_LINK: |
| 7554 | { |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7555 | VOS_STATUS status; |
| 7556 | |
Gopichand Nakkala | e22f86a | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 7557 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 7558 | { |
| 7559 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 7560 | MAC_ADDRESS_STR " failed", |
| 7561 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 7562 | return -EINVAL; |
| 7563 | } |
| 7564 | |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7565 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7566 | { |
Gopichand Nakkala | 6d16574 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 7567 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED); |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7568 | /* start TDLS client registration with TL */ |
| 7569 | status = hdd_roamRegisterTDLSSTA( pAdapter, peer, pTdlsPeer->staId, pTdlsPeer->signature); |
Gopichand Nakkala | 6d16574 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 7570 | if (VOS_STATUS_SUCCESS == status) |
| 7571 | { |
Hoonki Lee | cf53642 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 7572 | if (pTdlsPeer->is_responder == 0) |
| 7573 | { |
| 7574 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 7575 | |
| 7576 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 7577 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 7578 | WAIT_TIME_TDLS_INITIATOR); |
| 7579 | /* suspend initiator TX until it receives direct packet from the |
| 7580 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 7581 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 7582 | &staId, NULL); |
| 7583 | } |
Gopichand Nakkala | 6d16574 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 7584 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 7585 | } |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7586 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 7587 | } |
| 7588 | |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7589 | } |
| 7590 | break; |
| 7591 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7592 | { |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7593 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7594 | { |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7595 | long status; |
| 7596 | |
| 7597 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 7598 | |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7599 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7600 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7601 | |
| 7602 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 7603 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
| 7604 | if (status <= 0) |
| 7605 | { |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7606 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 79aacf0 | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7608 | "%s: Del station failed status %ld", |
| 7609 | __func__, status); |
| 7610 | return -EPERM; |
| 7611 | } |
Hoonki Lee | 7f56611 | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7612 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7613 | } |
| 7614 | else |
| 7615 | { |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7617 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7618 | } |
Gopichand Nakkala | 271463a | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 7619 | #ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP |
| 7620 | if (pHddTdlsCtx->defer_link_lost_indication) |
| 7621 | { |
| 7622 | if (( TRUE == pHddCtx->cfg_ini->fEnableTDLSOxygenSupport ) && |
| 7623 | (wlan_hdd_tdlsConnectedPeers(pAdapter) == 0)) |
| 7624 | { |
| 7625 | status = wlan_hdd_disconnect(pAdapter, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 7626 | if ( 0 != status) |
| 7627 | { |
| 7628 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7629 | "%s wlan_hdd_disconnect failure, returned %d \n", |
| 7630 | __func__, (int)status ); |
| 7631 | return -EINVAL; |
| 7632 | } |
| 7633 | } |
| 7634 | } |
| 7635 | #endif |
Lee Hoonki | f143170 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 7636 | } |
Gopichand Nakkala | fde2bf5 | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7637 | break; |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7638 | case NL80211_TDLS_TEARDOWN: |
| 7639 | case NL80211_TDLS_SETUP: |
| 7640 | case NL80211_TDLS_DISCOVERY_REQ: |
| 7641 | /* We don't support in-driver setup/teardown/discovery */ |
| 7642 | return -ENOTSUPP; |
| 7643 | default: |
| 7644 | return -ENOTSUPP; |
| 7645 | } |
| 7646 | return 0; |
| 7647 | } |
Chilam NG | de0b411 | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 7648 | |
| 7649 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 7650 | struct net_device *dev, u8 *peer) |
| 7651 | { |
| 7652 | hddLog(VOS_TRACE_LEVEL_INFO, "tdls send discover req: %x %x %x %x %x %x", |
| 7653 | peer[0], peer[1], peer[2], peer[3], peer[4], peer[5]); |
| 7654 | |
| 7655 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 7656 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
| 7657 | } |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7658 | #endif |
| 7659 | |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7660 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 7661 | /* |
| 7662 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 7663 | * Callback rountine called upon receiving response for |
| 7664 | * get offload info |
| 7665 | */ |
| 7666 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 7667 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 7668 | { |
| 7669 | |
| 7670 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
| 7671 | |
| 7672 | ENTER(); |
| 7673 | |
| 7674 | if (NULL == pAdapter) |
| 7675 | { |
| 7676 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7677 | "%s: HDD adapter is Null", __func__); |
| 7678 | return ; |
| 7679 | } |
| 7680 | |
| 7681 | if (NULL == pGtkOffloadGetInfoRsp) |
| 7682 | { |
| 7683 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7684 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 7685 | return ; |
| 7686 | } |
| 7687 | |
| 7688 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 7689 | { |
| 7690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7691 | "%s: wlan Failed to get replay counter value", |
| 7692 | __func__); |
| 7693 | return ; |
| 7694 | } |
| 7695 | |
| 7696 | /* Update replay counter to NL */ |
| 7697 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
| 7698 | (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter, GFP_KERNEL); |
| 7699 | } |
| 7700 | |
| 7701 | /* |
| 7702 | * FUNCTION: wlan_hdd_cfg80211_set_rekey_data |
| 7703 | * This function is used to offload GTK rekeying job to the firmware. |
| 7704 | */ |
| 7705 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 7706 | struct cfg80211_gtk_rekey_data *data) |
| 7707 | { |
| 7708 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7709 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7710 | hdd_station_ctx_t *pHddStaCtx; |
| 7711 | tHalHandle hHal; |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7712 | int result; |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7713 | tpSirGtkOffloadParams pGtkOffloadReqParams; |
| 7714 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 7715 | |
| 7716 | ENTER(); |
| 7717 | |
| 7718 | if (NULL == pAdapter) |
| 7719 | { |
| 7720 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7721 | "%s: HDD adapter is Null", __func__); |
| 7722 | return -ENODEV; |
| 7723 | } |
| 7724 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7725 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7726 | |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7727 | if (0 != result) |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7728 | { |
Gopichand Nakkala | 6e0b95b | 2013-05-24 18:34:25 +0530 | [diff] [blame^] | 7729 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7730 | "%s: HDD context is not valid", __func__); |
| 7731 | return result; |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7732 | } |
| 7733 | |
| 7734 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7735 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7736 | if (NULL == hHal) |
| 7737 | { |
| 7738 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7739 | "%s: HAL context is Null!!!", __func__); |
| 7740 | return -EAGAIN; |
| 7741 | } |
| 7742 | |
| 7743 | pGtkOffloadReqParams = |
| 7744 | &pHddStaCtx->gtkOffloadRequestParams.gtkOffloadReqParams; |
| 7745 | |
| 7746 | pGtkOffloadReqParams->ulFlags = GTK_OFFLOAD_ENABLE; |
| 7747 | memcpy(pGtkOffloadReqParams->aKCK, data->kck, NL80211_KCK_LEN); |
| 7748 | memcpy(pGtkOffloadReqParams->aKEK, data->kek, NL80211_KEK_LEN); |
| 7749 | memcpy(pGtkOffloadReqParams->bssId, &pHddStaCtx->conn_info.bssId, |
| 7750 | WNI_CFG_BSSID_LEN); |
| 7751 | memcpy(&pGtkOffloadReqParams->ullKeyReplayCounter, &data->replay_ctr, |
| 7752 | sizeof (tANI_U64)); |
| 7753 | |
| 7754 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 7755 | { |
| 7756 | /* if wlan is suspended, enable GTK offload directly from here */ |
| 7757 | status = sme_SetGTKOffload(hHal, pGtkOffloadReqParams, |
| 7758 | pAdapter->sessionId); |
| 7759 | |
| 7760 | if (eHAL_STATUS_SUCCESS != status) |
| 7761 | { |
| 7762 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7763 | "%s: sme_SetGTKOffload failed, returned %d", |
| 7764 | __func__, status); |
| 7765 | return status; |
| 7766 | } |
| 7767 | pHddStaCtx->gtkOffloadRequestParams.requested = FALSE; |
| 7768 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7769 | "%s: sme_SetGTKOffload successfull", __func__); |
| 7770 | } |
| 7771 | else |
| 7772 | { |
| 7773 | pHddStaCtx->gtkOffloadRequestParams.requested = TRUE; |
| 7774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7775 | "%s: wlan not suspended GTKOffload request is stored", |
| 7776 | __func__); |
| 7777 | return eHAL_STATUS_SUCCESS; |
| 7778 | } |
| 7779 | return status; |
| 7780 | } |
| 7781 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
| 7782 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7783 | /* cfg80211_ops */ |
Gopichand Nakkala | 2544ed6 | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7784 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7785 | { |
| 7786 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 7787 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 7788 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 7789 | .change_station = wlan_hdd_change_station, |
| 7790 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7791 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 7792 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 7793 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7794 | #else |
| 7795 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 7796 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 7797 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7798 | #endif |
| 7799 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 7800 | .add_key = wlan_hdd_cfg80211_add_key, |
| 7801 | .get_key = wlan_hdd_cfg80211_get_key, |
| 7802 | .del_key = wlan_hdd_cfg80211_del_key, |
| 7803 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | cab8ddc | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 7804 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7805 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | cab8ddc | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 7806 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7807 | .scan = wlan_hdd_cfg80211_scan, |
| 7808 | .connect = wlan_hdd_cfg80211_connect, |
| 7809 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 7810 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 7811 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 7812 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 7813 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 7814 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7815 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 7816 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
| 7817 | .mgmt_tx = wlan_hdd_action, |
| 7818 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7819 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 7820 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 7821 | .set_txq_params = wlan_hdd_set_txq_params, |
| 7822 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7823 | .get_station = wlan_hdd_cfg80211_get_station, |
| 7824 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 7825 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7826 | .add_station = wlan_hdd_cfg80211_add_station, |
| 7827 | #ifdef FEATURE_WLAN_LFR |
| 7828 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 7829 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 7830 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 7831 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7832 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 7833 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 7834 | #endif |
Mohit Khanna | c0b992f | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7835 | #ifdef FEATURE_WLAN_TDLS |
| 7836 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 7837 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 7838 | #endif |
Gopichand Nakkala | 11cc1a9 | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7839 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 7840 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 7841 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 3b34fa8 | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7842 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 7843 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 7844 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 7845 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7846 | }; |
| 7847 | |