Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 747461f | 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 | 747461f | 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 | 747461f | 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 | f77ef0a | 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 | f77ef0a | 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 | f77ef0a | 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 | f77ef0a | 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 | f77ef0a | 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 | f77ef0a | 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 | f77ef0a | 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 | 20c4c04 | 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 | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 84 | #ifdef FEATURE_WLAN_TDLS |
| 85 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 87 | #include "wlan_qct_wda.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 88 | #endif |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 89 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 90 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 91 | |
| 92 | #define g_mode_rates_size (12) |
| 93 | #define a_mode_rates_size (8) |
| 94 | #define FREQ_BASE_80211G (2407) |
| 95 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 96 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 97 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
| 99 | ((int) OFFSET_OF( tSirBssDescription, ieFields))) |
| 100 | |
| 101 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 102 | .band = IEEE80211_BAND_2GHZ, \ |
| 103 | .center_freq = (freq), \ |
| 104 | .hw_value = (chan),\ |
| 105 | .flags = (flag), \ |
| 106 | .max_antenna_gain = 0 ,\ |
| 107 | .max_power = 30, \ |
| 108 | } |
| 109 | |
| 110 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 111 | .band = IEEE80211_BAND_5GHZ, \ |
| 112 | .center_freq = (freq), \ |
| 113 | .hw_value = (chan),\ |
| 114 | .flags = (flag), \ |
| 115 | .max_antenna_gain = 0 ,\ |
| 116 | .max_power = 30, \ |
| 117 | } |
| 118 | |
| 119 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 120 | {\ |
| 121 | .bitrate = rate, \ |
| 122 | .hw_value = rate_id, \ |
| 123 | .flags = flag, \ |
| 124 | } |
| 125 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 126 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 127 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 128 | #else |
| 129 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 130 | #endif |
| 131 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 132 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 133 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 134 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 135 | #endif |
| 136 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 137 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | { |
| 139 | WLAN_CIPHER_SUITE_WEP40, |
| 140 | WLAN_CIPHER_SUITE_WEP104, |
| 141 | WLAN_CIPHER_SUITE_TKIP, |
| 142 | #ifdef FEATURE_WLAN_CCX |
| 143 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 144 | WLAN_CIPHER_SUITE_KRK, |
| 145 | WLAN_CIPHER_SUITE_CCMP, |
| 146 | #else |
| 147 | WLAN_CIPHER_SUITE_CCMP, |
| 148 | #endif |
| 149 | #ifdef FEATURE_WLAN_WAPI |
| 150 | WLAN_CIPHER_SUITE_SMS4, |
| 151 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 152 | #ifdef WLAN_FEATURE_11W |
| 153 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 154 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 158 | { |
| 159 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 160 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 161 | } |
| 162 | |
| 163 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 164 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | HDD2GHZCHAN(2412, 1, 0) , |
| 166 | HDD2GHZCHAN(2417, 2, 0) , |
| 167 | HDD2GHZCHAN(2422, 3, 0) , |
| 168 | HDD2GHZCHAN(2427, 4, 0) , |
| 169 | HDD2GHZCHAN(2432, 5, 0) , |
| 170 | HDD2GHZCHAN(2437, 6, 0) , |
| 171 | HDD2GHZCHAN(2442, 7, 0) , |
| 172 | HDD2GHZCHAN(2447, 8, 0) , |
| 173 | HDD2GHZCHAN(2452, 9, 0) , |
| 174 | HDD2GHZCHAN(2457, 10, 0) , |
| 175 | HDD2GHZCHAN(2462, 11, 0) , |
| 176 | HDD2GHZCHAN(2467, 12, 0) , |
| 177 | HDD2GHZCHAN(2472, 13, 0) , |
| 178 | HDD2GHZCHAN(2484, 14, 0) , |
| 179 | }; |
| 180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 182 | { |
| 183 | HDD2GHZCHAN(2412, 1, 0) , |
| 184 | HDD2GHZCHAN(2437, 6, 0) , |
| 185 | HDD2GHZCHAN(2462, 11, 0) , |
| 186 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | |
| 188 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 189 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 190 | HDD5GHZCHAN(4920, 240, 0) , |
| 191 | HDD5GHZCHAN(4940, 244, 0) , |
| 192 | HDD5GHZCHAN(4960, 248, 0) , |
| 193 | HDD5GHZCHAN(4980, 252, 0) , |
| 194 | HDD5GHZCHAN(5040, 208, 0) , |
| 195 | HDD5GHZCHAN(5060, 212, 0) , |
| 196 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | HDD5GHZCHAN(5180, 36, 0) , |
| 198 | HDD5GHZCHAN(5200, 40, 0) , |
| 199 | HDD5GHZCHAN(5220, 44, 0) , |
| 200 | HDD5GHZCHAN(5240, 48, 0) , |
| 201 | HDD5GHZCHAN(5260, 52, 0) , |
| 202 | HDD5GHZCHAN(5280, 56, 0) , |
| 203 | HDD5GHZCHAN(5300, 60, 0) , |
| 204 | HDD5GHZCHAN(5320, 64, 0) , |
| 205 | HDD5GHZCHAN(5500,100, 0) , |
| 206 | HDD5GHZCHAN(5520,104, 0) , |
| 207 | HDD5GHZCHAN(5540,108, 0) , |
| 208 | HDD5GHZCHAN(5560,112, 0) , |
| 209 | HDD5GHZCHAN(5580,116, 0) , |
| 210 | HDD5GHZCHAN(5600,120, 0) , |
| 211 | HDD5GHZCHAN(5620,124, 0) , |
| 212 | HDD5GHZCHAN(5640,128, 0) , |
| 213 | HDD5GHZCHAN(5660,132, 0) , |
| 214 | HDD5GHZCHAN(5680,136, 0) , |
| 215 | HDD5GHZCHAN(5700,140, 0) , |
| 216 | HDD5GHZCHAN(5745,149, 0) , |
| 217 | HDD5GHZCHAN(5765,153, 0) , |
| 218 | HDD5GHZCHAN(5785,157, 0) , |
| 219 | HDD5GHZCHAN(5805,161, 0) , |
| 220 | HDD5GHZCHAN(5825,165, 0) , |
| 221 | }; |
| 222 | |
| 223 | static struct ieee80211_rate g_mode_rates[] = |
| 224 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 225 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 226 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 227 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 228 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 229 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 230 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 231 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 232 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 233 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 234 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 235 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 237 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 238 | |
| 239 | static struct ieee80211_rate a_mode_rates[] = |
| 240 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 241 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 242 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 243 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 244 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 245 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 246 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 247 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 248 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 249 | }; |
| 250 | |
| 251 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 252 | { |
| 253 | .channels = hdd_channels_2_4_GHZ, |
| 254 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 255 | .band = IEEE80211_BAND_2GHZ, |
| 256 | .bitrates = g_mode_rates, |
| 257 | .n_bitrates = g_mode_rates_size, |
| 258 | .ht_cap.ht_supported = 1, |
| 259 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 260 | | IEEE80211_HT_CAP_GRN_FLD |
| 261 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 262 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 263 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 264 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 265 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 266 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 267 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 268 | }; |
| 269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 271 | { |
| 272 | .channels = hdd_social_channels_2_4_GHZ, |
| 273 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 274 | .band = IEEE80211_BAND_2GHZ, |
| 275 | .bitrates = g_mode_rates, |
| 276 | .n_bitrates = g_mode_rates_size, |
| 277 | .ht_cap.ht_supported = 1, |
| 278 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 279 | | IEEE80211_HT_CAP_GRN_FLD |
| 280 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 281 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 282 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 283 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 284 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 285 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 286 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 287 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | |
| 289 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 290 | { |
| 291 | .channels = hdd_channels_5_GHZ, |
| 292 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 293 | .band = IEEE80211_BAND_5GHZ, |
| 294 | .bitrates = a_mode_rates, |
| 295 | .n_bitrates = a_mode_rates_size, |
| 296 | .ht_cap.ht_supported = 1, |
| 297 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 298 | | IEEE80211_HT_CAP_GRN_FLD |
| 299 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 300 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 301 | | IEEE80211_HT_CAP_SGI_40 |
| 302 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 303 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 304 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 305 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 306 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 307 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 308 | }; |
| 309 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 310 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | TX/RX direction for each kind of interface */ |
| 312 | static const struct ieee80211_txrx_stypes |
| 313 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 314 | [NL80211_IFTYPE_STATION] = { |
| 315 | .tx = 0xffff, |
| 316 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 317 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 318 | }, |
| 319 | [NL80211_IFTYPE_AP] = { |
| 320 | .tx = 0xffff, |
| 321 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 322 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 323 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 324 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 325 | BIT(SIR_MAC_MGMT_AUTH) | |
| 326 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 327 | BIT(SIR_MAC_MGMT_ACTION), |
| 328 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 329 | [NL80211_IFTYPE_ADHOC] = { |
| 330 | .tx = 0xffff, |
| 331 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 332 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 333 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 334 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 335 | BIT(SIR_MAC_MGMT_AUTH) | |
| 336 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 337 | BIT(SIR_MAC_MGMT_ACTION), |
| 338 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 340 | .tx = 0xffff, |
| 341 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 342 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 343 | }, |
| 344 | [NL80211_IFTYPE_P2P_GO] = { |
| 345 | /* This is also same as for SoftAP */ |
| 346 | .tx = 0xffff, |
| 347 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 348 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 349 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 350 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 351 | BIT(SIR_MAC_MGMT_AUTH) | |
| 352 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 353 | BIT(SIR_MAC_MGMT_ACTION), |
| 354 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | }; |
| 356 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 357 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 358 | static const struct ieee80211_iface_limit |
| 359 | wlan_hdd_iface_limit[] = { |
| 360 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 361 | /* max = 3 ; Our driver create two interfaces during driver init |
| 362 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 363 | * interface until a group is formed. In JB architecture, once the |
| 364 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 365 | * Client. |
| 366 | * When supplicant remove the group, it first issue a set interface |
| 367 | * cmd to change the mode back to Station. In JB this works fine as |
| 368 | * we advertize two station type interface during driver init. |
| 369 | * Some vendors create separate interface for P2P GO/Client, |
| 370 | * after group formation(Third one). But while group remove |
| 371 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 372 | * But as we advertized only two sta type interfaces nl80211 was |
| 373 | * returning error for the third one which was leading to failure in |
| 374 | * delete interface. Ideally while removing the group, supplicant |
| 375 | * should not try to change the 3rd interface mode to Station type. |
| 376 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 377 | * interface type to 3 |
| 378 | */ |
| 379 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 380 | .types = BIT(NL80211_IFTYPE_STATION), |
| 381 | }, |
| 382 | { |
| 383 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 384 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 385 | }, |
| 386 | { |
| 387 | .max = 1, |
| 388 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 389 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 390 | }, |
| 391 | }; |
| 392 | |
| 393 | /* By default, only single channel concurrency is allowed */ |
| 394 | static struct ieee80211_iface_combination |
| 395 | wlan_hdd_iface_combination = { |
| 396 | .limits = wlan_hdd_iface_limit, |
| 397 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 398 | /* |
| 399 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 400 | * and p2p0 interfaces during driver init |
| 401 | * Some vendors create separate interface for P2P operations. |
| 402 | * wlan0: STA interface |
| 403 | * p2p0: P2P Device interface, action frames goes |
| 404 | * through this interface. |
| 405 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 406 | * created for p2p operations(GO/CLIENT interface). |
| 407 | */ |
| 408 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 409 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 410 | .beacon_int_infra_match = false, |
| 411 | }; |
| 412 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 415 | |
| 416 | /* Data rate 100KBPS based on IE Index */ |
| 417 | struct index_data_rate_type |
| 418 | { |
| 419 | v_U8_t beacon_rate_index; |
| 420 | v_U16_t supported_rate[4]; |
| 421 | }; |
| 422 | |
| 423 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 424 | The IDX field is the rate index |
| 425 | The HI field is the rate when RSSI is strong or being ignored |
| 426 | (in this case we report actual rate) |
| 427 | The MID field is the rate when RSSI is moderate |
| 428 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 429 | The LO field is the rate when RSSI is low |
| 430 | (in this case we don't report rates, actual current rate used) |
| 431 | */ |
| 432 | static const struct |
| 433 | { |
| 434 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 435 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | } supported_data_rate[] = |
| 437 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 438 | /* IDX HI HM LM LO (RSSI-based index */ |
| 439 | {2, { 10, 10, 10, 0}}, |
| 440 | {4, { 20, 20, 10, 0}}, |
| 441 | {11, { 55, 20, 10, 0}}, |
| 442 | {12, { 60, 55, 20, 0}}, |
| 443 | {18, { 90, 55, 20, 0}}, |
| 444 | {22, {110, 55, 20, 0}}, |
| 445 | {24, {120, 90, 60, 0}}, |
| 446 | {36, {180, 120, 60, 0}}, |
| 447 | {44, {220, 180, 60, 0}}, |
| 448 | {48, {240, 180, 90, 0}}, |
| 449 | {66, {330, 180, 90, 0}}, |
| 450 | {72, {360, 240, 90, 0}}, |
| 451 | {96, {480, 240, 120, 0}}, |
| 452 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | }; |
| 454 | |
| 455 | /* MCS Based rate table */ |
| 456 | static struct index_data_rate_type supported_mcs_rate[] = |
| 457 | { |
| 458 | /* MCS L20 L40 S20 S40 */ |
| 459 | {0, {65, 135, 72, 150}}, |
| 460 | {1, {130, 270, 144, 300}}, |
| 461 | {2, {195, 405, 217, 450}}, |
| 462 | {3, {260, 540, 289, 600}}, |
| 463 | {4, {390, 810, 433, 900}}, |
| 464 | {5, {520, 1080, 578, 1200}}, |
| 465 | {6, {585, 1215, 650, 1350}}, |
| 466 | {7, {650, 1350, 722, 1500}} |
| 467 | }; |
| 468 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 469 | #ifdef WLAN_FEATURE_11AC |
| 470 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 471 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 472 | |
| 473 | struct index_vht_data_rate_type |
| 474 | { |
| 475 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 476 | v_U16_t supported_VHT80_rate[2]; |
| 477 | v_U16_t supported_VHT40_rate[2]; |
| 478 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 479 | }; |
| 480 | |
| 481 | typedef enum |
| 482 | { |
| 483 | DATA_RATE_11AC_MAX_MCS_7, |
| 484 | DATA_RATE_11AC_MAX_MCS_8, |
| 485 | DATA_RATE_11AC_MAX_MCS_9, |
| 486 | DATA_RATE_11AC_MAX_MCS_NA |
| 487 | } eDataRate11ACMaxMcs; |
| 488 | |
| 489 | /* MCS Based VHT rate table */ |
| 490 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 491 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 492 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 493 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 494 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 495 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 496 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 497 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 498 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 499 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 500 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 501 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 502 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 503 | }; |
| 504 | #endif /* WLAN_FEATURE_11AC */ |
| 505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | extern struct net_device_ops net_ops_struct; |
| 507 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 508 | #ifdef WLAN_NL80211_TESTMODE |
| 509 | enum wlan_hdd_tm_attr |
| 510 | { |
| 511 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 512 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 513 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 514 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 515 | /* keep last */ |
| 516 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 517 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 518 | }; |
| 519 | |
| 520 | enum wlan_hdd_tm_cmd |
| 521 | { |
| 522 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 523 | }; |
| 524 | |
| 525 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 526 | |
| 527 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 528 | { |
| 529 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 530 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 531 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 532 | }; |
| 533 | #endif /* WLAN_NL80211_TESTMODE */ |
| 534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 536 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 537 | * This function is called by hdd_wlan_startup() |
| 538 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 539 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 541 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | { |
| 543 | struct wiphy *wiphy; |
| 544 | ENTER(); |
| 545 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 546 | /* |
| 547 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | */ |
| 549 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 550 | |
| 551 | if (!wiphy) |
| 552 | { |
| 553 | /* Print error and jump into err label and free the memory */ |
| 554 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 555 | return NULL; |
| 556 | } |
| 557 | |
| 558 | return wiphy; |
| 559 | } |
| 560 | |
| 561 | /* |
| 562 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 563 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | * private ioctl to change the band value |
| 565 | */ |
| 566 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 567 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 568 | int i, j; |
| 569 | eNVChannelEnabledType channelEnabledState; |
| 570 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 571 | ENTER(); |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 572 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 574 | |
| 575 | if (NULL == wiphy->bands[i]) |
| 576 | { |
| 577 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 578 | __func__, i); |
| 579 | continue; |
| 580 | } |
| 581 | |
| 582 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 583 | { |
| 584 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 585 | |
| 586 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 587 | band->channels[j].hw_value); |
| 588 | |
| 589 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 590 | { |
| 591 | // Enable Social channels for P2P |
| 592 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 593 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 594 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 595 | else |
| 596 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 597 | continue; |
| 598 | } |
| 599 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 600 | { |
| 601 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 602 | continue; |
| 603 | } |
| 604 | |
| 605 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 606 | NV_CHANNEL_INVALID == channelEnabledState) |
| 607 | { |
| 608 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 609 | } |
| 610 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 611 | { |
| 612 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 613 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 618 | |IEEE80211_CHAN_RADAR); |
| 619 | } |
| 620 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 621 | } |
| 622 | return 0; |
| 623 | } |
| 624 | /* |
| 625 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 626 | * This function is called by hdd_wlan_startup() |
| 627 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 628 | * This function is used to initialize and register wiphy structure. |
| 629 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 630 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | struct wiphy *wiphy, |
| 632 | hdd_config_t *pCfg |
| 633 | ) |
| 634 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 635 | int i, j; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 636 | ENTER(); |
| 637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | /* Now bind the underlying wlan device with wiphy */ |
| 639 | set_wiphy_dev(wiphy, dev); |
| 640 | |
| 641 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 642 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 643 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 644 | /* the flag for the other case would be initialzed in |
| 645 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 646 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 647 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 648 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 649 | /* This will disable updating of NL channels from passive to |
| 650 | * active if a beacon is received on passive channel. */ |
| 651 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 652 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 653 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 654 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 655 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 656 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 657 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 658 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 659 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 660 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 661 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 662 | |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 663 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 664 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 665 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 666 | || pCfg->isFastRoamIniFeatureEnabled |
| 667 | #endif |
| 668 | #ifdef FEATURE_WLAN_CCX |
| 669 | || pCfg->isCcxIniFeatureEnabled |
| 670 | #endif |
| 671 | ) |
| 672 | { |
| 673 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 674 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 675 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 676 | #ifdef FEATURE_WLAN_TDLS |
| 677 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 678 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 679 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 680 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 681 | if (pCfg->configPNOScanSupport) |
| 682 | { |
| 683 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 684 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 685 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 686 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 687 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 688 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 689 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 690 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 691 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 692 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 693 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 694 | driver need to determine what to do with both |
| 695 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 696 | |
| 697 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 698 | #else |
| 699 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 700 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 701 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 702 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 703 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 704 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 705 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 706 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 708 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 709 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 711 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 712 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 713 | | BIT(NL80211_IFTYPE_AP); |
| 714 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 715 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 716 | if( pCfg->enableMCC ) |
| 717 | { |
| 718 | /* Currently, supports up to two channels */ |
| 719 | wlan_hdd_iface_combination.num_different_channels = 2; |
| 720 | |
| 721 | if( !pCfg->allowMCCGODiffBI ) |
| 722 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
| 723 | |
| 724 | } |
| 725 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 726 | wiphy->n_iface_combinations = 1; |
| 727 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | /* Before registering we need to update the ht capabilitied based |
| 730 | * on ini values*/ |
| 731 | if( !pCfg->ShortGI20MhzEnable ) |
| 732 | { |
| 733 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 734 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 735 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 736 | } |
| 737 | |
| 738 | if( !pCfg->ShortGI40MhzEnable ) |
| 739 | { |
| 740 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 741 | } |
| 742 | |
| 743 | if( !pCfg->nChannelBondingMode5GHz ) |
| 744 | { |
| 745 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 746 | } |
| 747 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 748 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 749 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 750 | |
| 751 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 752 | { |
| 753 | |
| 754 | if (NULL == wiphy->bands[i]) |
| 755 | { |
| 756 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 757 | __func__, i); |
| 758 | continue; |
| 759 | } |
| 760 | |
| 761 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 762 | { |
| 763 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 764 | |
| 765 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 766 | { |
| 767 | // Enable social channels for P2P |
| 768 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 769 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 770 | else |
| 771 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 772 | continue; |
| 773 | } |
| 774 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 775 | { |
| 776 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 777 | continue; |
| 778 | } |
| 779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 780 | } |
| 781 | /*Initialise the supported cipher suite details*/ |
| 782 | wiphy->cipher_suites = hdd_cipher_suites; |
| 783 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 784 | |
| 785 | /*signal strength in mBm (100*dBm) */ |
| 786 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 787 | |
| 788 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 789 | wiphy->max_remain_on_channel_duration = 1000; |
| 790 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 792 | EXIT(); |
| 793 | return 0; |
| 794 | } |
| 795 | |
| 796 | /* In this function we are registering wiphy. */ |
| 797 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 798 | { |
| 799 | ENTER(); |
| 800 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | if (0 > wiphy_register(wiphy)) |
| 802 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 803 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 805 | return -EIO; |
| 806 | } |
| 807 | |
| 808 | EXIT(); |
| 809 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 812 | /* In this function we are updating channel list when, |
| 813 | regulatory domain is FCC and country code is US. |
| 814 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 815 | As per FCC smart phone is not a indoor device. |
| 816 | GO should not opeate on indoor channels */ |
| 817 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 818 | { |
| 819 | int j; |
| 820 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 821 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 822 | //Default counrtycode from NV at the time of wiphy initialization. |
| 823 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 824 | &defaultCountryCode[0])) |
| 825 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 826 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 827 | } |
| 828 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 829 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 830 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 831 | { |
| 832 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 833 | return; |
| 834 | } |
| 835 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 836 | { |
| 837 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 838 | // Mark UNII -1 band channel as passive |
| 839 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 840 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 841 | } |
| 842 | } |
| 843 | } |
| 844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 845 | /* In this function we will do all post VOS start initialization. |
| 846 | In this function we will register for all frame in which supplicant |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 847 | is interested. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | */ |
| 849 | void wlan_hdd_cfg80211_post_voss_start(hdd_adapter_t* pAdapter) |
| 850 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 851 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 852 | /* Register for all P2P action, public action etc frames */ |
| 853 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 854 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 855 | ENTER(); |
| 856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 857 | /* Right now we are registering these frame when driver is getting |
| 858 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 859 | frame register ops, we will move this code as a part of that */ |
| 860 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 861 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 862 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 863 | |
| 864 | /* GAS Initial Response */ |
| 865 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 866 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | /* GAS Comeback Request */ |
| 869 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 870 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 871 | |
| 872 | /* GAS Comeback Response */ |
| 873 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 874 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 875 | |
| 876 | /* P2P Public Action */ |
| 877 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 878 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 879 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 880 | |
| 881 | /* P2P Action */ |
| 882 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 883 | (v_U8_t*)P2P_ACTION_FRAME, |
| 884 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 885 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 886 | /* WNM BSS Transition Request frame */ |
| 887 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 888 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 889 | WNM_BSS_ACTION_FRAME_SIZE ); |
| 890 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 891 | #ifdef WLAN_FEATURE_11W |
| 892 | /* SA Query Response Action Frame */ |
| 893 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 894 | (v_U8_t*)SA_QUERY_FRAME_RSP, |
| 895 | SA_QUERY_FRAME_RSP_SIZE ); |
| 896 | #endif /* WLAN_FEATURE_11W */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | } |
| 898 | |
| 899 | void wlan_hdd_cfg80211_pre_voss_stop(hdd_adapter_t* pAdapter) |
| 900 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 902 | /* Register for all P2P action, public action etc frames */ |
| 903 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 904 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 905 | ENTER(); |
| 906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | /* Right now we are registering these frame when driver is getting |
| 908 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 909 | frame register ops, we will move this code as a part of that */ |
| 910 | /* GAS Initial Request */ |
| 911 | |
| 912 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 913 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 914 | |
| 915 | /* GAS Initial Response */ |
| 916 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 917 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 919 | /* GAS Comeback Request */ |
| 920 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 921 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 922 | |
| 923 | /* GAS Comeback Response */ |
| 924 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 925 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 926 | |
| 927 | /* P2P Public Action */ |
| 928 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 929 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 931 | |
| 932 | /* P2P Action */ |
| 933 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 934 | (v_U8_t*)P2P_ACTION_FRAME, |
| 935 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 936 | |
| 937 | #ifdef WLAN_FEATURE_11W |
| 938 | /* SA Query Response Action Frame */ |
| 939 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 940 | (v_U8_t*)SA_QUERY_FRAME_RSP, |
| 941 | SA_QUERY_FRAME_RSP_SIZE ); |
| 942 | #endif /* WLAN_FEATURE_11W */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | #ifdef FEATURE_WLAN_WAPI |
| 946 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 947 | const u8 *mac_addr, u8 *key , int key_Len) |
| 948 | { |
| 949 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 950 | tCsrRoamSetKey setKey; |
| 951 | v_BOOL_t isConnected = TRUE; |
| 952 | int status = 0; |
| 953 | v_U32_t roamId= 0xFF; |
| 954 | tANI_U8 *pKeyPtr = NULL; |
| 955 | int n = 0; |
| 956 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 957 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | __func__,pAdapter->device_mode); |
| 959 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 960 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 961 | setKey.keyId = key_index; // Store Key ID |
| 962 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 963 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 964 | setKey.paeRole = 0 ; // the PAE role |
| 965 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 966 | { |
| 967 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 968 | } |
| 969 | else |
| 970 | { |
| 971 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 972 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 973 | } |
| 974 | setKey.keyLength = key_Len; |
| 975 | pKeyPtr = setKey.Key; |
| 976 | memcpy( pKeyPtr, key, key_Len); |
| 977 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 978 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | __func__, key_Len); |
| 980 | for (n = 0 ; n < key_Len; n++) |
| 981 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 982 | __func__,n,setKey.Key[n]); |
| 983 | |
| 984 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 985 | if ( isConnected ) |
| 986 | { |
| 987 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 988 | pAdapter->sessionId, &setKey, &roamId ); |
| 989 | } |
| 990 | if ( status != 0 ) |
| 991 | { |
| 992 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 993 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 994 | __LINE__, status ); |
| 995 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 996 | } |
| 997 | } |
| 998 | #endif /* FEATURE_WLAN_WAPI*/ |
| 999 | |
| 1000 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1001 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1002 | beacon_data_t **ppBeacon, |
| 1003 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1004 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1005 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1006 | beacon_data_t **ppBeacon, |
| 1007 | struct cfg80211_beacon_data *params, |
| 1008 | int dtim_period) |
| 1009 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1010 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | int size; |
| 1012 | beacon_data_t *beacon = NULL; |
| 1013 | beacon_data_t *old = NULL; |
| 1014 | int head_len,tail_len; |
| 1015 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1016 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | if (params->head && !params->head_len) |
| 1018 | return -EINVAL; |
| 1019 | |
| 1020 | old = pAdapter->sessionCtx.ap.beacon; |
| 1021 | |
| 1022 | if (!params->head && !old) |
| 1023 | return -EINVAL; |
| 1024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 1026 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 1027 | if (!params->dtim_period) |
| 1028 | return -EINVAL; |
| 1029 | #endif |
| 1030 | |
| 1031 | if(params->head) |
| 1032 | head_len = params->head_len; |
| 1033 | else |
| 1034 | head_len = old->head_len; |
| 1035 | |
| 1036 | if(params->tail || !old) |
| 1037 | tail_len = params->tail_len; |
| 1038 | else |
| 1039 | tail_len = old->tail_len; |
| 1040 | |
| 1041 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 1042 | |
| 1043 | beacon = kzalloc(size, GFP_KERNEL); |
| 1044 | |
| 1045 | if( beacon == NULL ) |
| 1046 | return -ENOMEM; |
| 1047 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1048 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1049 | if(params->dtim_period || !old ) |
| 1050 | beacon->dtim_period = params->dtim_period; |
| 1051 | else |
| 1052 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1053 | #else |
| 1054 | if(dtim_period || !old ) |
| 1055 | beacon->dtim_period = dtim_period; |
| 1056 | else |
| 1057 | beacon->dtim_period = old->dtim_period; |
| 1058 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1059 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1060 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 1061 | beacon->tail = beacon->head + head_len; |
| 1062 | beacon->head_len = head_len; |
| 1063 | beacon->tail_len = tail_len; |
| 1064 | |
| 1065 | if(params->head) { |
| 1066 | memcpy (beacon->head,params->head,beacon->head_len); |
| 1067 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1068 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | if(old) |
| 1070 | memcpy (beacon->head,old->head,beacon->head_len); |
| 1071 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1073 | if(params->tail) { |
| 1074 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 1075 | } |
| 1076 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1077 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 1079 | } |
| 1080 | |
| 1081 | *ppBeacon = beacon; |
| 1082 | |
| 1083 | kfree(old); |
| 1084 | |
| 1085 | return 0; |
| 1086 | |
| 1087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | |
| 1089 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 1090 | { |
| 1091 | int left = length; |
| 1092 | v_U8_t *ptr = pIes; |
| 1093 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1094 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1095 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1096 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | elem_id = ptr[0]; |
| 1098 | elem_len = ptr[1]; |
| 1099 | left -= 2; |
| 1100 | if(elem_len > left) |
| 1101 | { |
| 1102 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1103 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | eid,elem_len,left); |
| 1105 | return NULL; |
| 1106 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1107 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | { |
| 1109 | return ptr; |
| 1110 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1111 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1112 | left -= elem_len; |
| 1113 | ptr += (elem_len + 2); |
| 1114 | } |
| 1115 | return NULL; |
| 1116 | } |
| 1117 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1118 | /* Check if rate is 11g rate or not */ |
| 1119 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 1120 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 1121 | static const u8 gRateArray[8] = {12, 18, 24, 36, 48, 72, 96, 108}; /* actual rate * 2 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1122 | u8 i; |
| 1123 | for (i = 0; i < 8; i++) |
| 1124 | { |
| 1125 | if(rate == gRateArray[i]) |
| 1126 | return TRUE; |
| 1127 | } |
| 1128 | return FALSE; |
| 1129 | } |
| 1130 | |
| 1131 | /* Check for 11g rate and set proper 11g only mode */ |
| 1132 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 1133 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 1134 | { |
| 1135 | u8 i, num_rates = pIe[0]; |
| 1136 | |
| 1137 | pIe += 1; |
| 1138 | for ( i = 0; i < num_rates; i++) |
| 1139 | { |
| 1140 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 1141 | { |
| 1142 | /* If rate set have 11g rate than change the mode to 11G */ |
| 1143 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 1144 | if (pIe[i] & BASIC_RATE_MASK) |
| 1145 | { |
| 1146 | /* If we have 11g rate as basic rate, it means mode |
| 1147 | is 11g only mode. |
| 1148 | */ |
| 1149 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 1150 | *pCheckRatesfor11g = FALSE; |
| 1151 | } |
| 1152 | } |
| 1153 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 1154 | { |
| 1155 | *require_ht = TRUE; |
| 1156 | } |
| 1157 | } |
| 1158 | return; |
| 1159 | } |
| 1160 | |
| 1161 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 1162 | { |
| 1163 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1164 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1165 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1166 | u8 checkRatesfor11g = TRUE; |
| 1167 | u8 require_ht = FALSE; |
| 1168 | u8 *pIe=NULL; |
| 1169 | |
| 1170 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 1171 | |
| 1172 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 1173 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 1174 | if (pIe != NULL) |
| 1175 | { |
| 1176 | pIe += 1; |
| 1177 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1178 | &pConfig->SapHw_mode); |
| 1179 | } |
| 1180 | |
| 1181 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1182 | WLAN_EID_EXT_SUPP_RATES); |
| 1183 | if (pIe != NULL) |
| 1184 | { |
| 1185 | |
| 1186 | pIe += 1; |
| 1187 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1188 | &pConfig->SapHw_mode); |
| 1189 | } |
| 1190 | |
| 1191 | if( pConfig->channel > 14 ) |
| 1192 | { |
| 1193 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 1194 | } |
| 1195 | |
| 1196 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1197 | WLAN_EID_HT_CAPABILITY); |
| 1198 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1199 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1200 | { |
| 1201 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 1202 | if(require_ht) |
| 1203 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 1204 | } |
| 1205 | } |
| 1206 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1207 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 1208 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 1209 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1210 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1211 | v_U8_t *pIe = NULL; |
| 1212 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1213 | |
| 1214 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 1215 | pBeacon->tail, pBeacon->tail_len); |
| 1216 | |
| 1217 | if (pIe) |
| 1218 | { |
| 1219 | ielen = pIe[1] + 2; |
| 1220 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 1221 | { |
| 1222 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 1223 | } |
| 1224 | else |
| 1225 | { |
| 1226 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 1227 | return -EINVAL; |
| 1228 | } |
| 1229 | *total_ielen += ielen; |
| 1230 | } |
| 1231 | return 0; |
| 1232 | } |
| 1233 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1234 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 1235 | v_U8_t *genie, v_U8_t *total_ielen) |
| 1236 | { |
| 1237 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1238 | int left = pBeacon->tail_len; |
| 1239 | v_U8_t *ptr = pBeacon->tail; |
| 1240 | v_U8_t elem_id, elem_len; |
| 1241 | v_U16_t ielen = 0; |
| 1242 | |
| 1243 | if ( NULL == ptr || 0 == left ) |
| 1244 | return; |
| 1245 | |
| 1246 | while (left >= 2) |
| 1247 | { |
| 1248 | elem_id = ptr[0]; |
| 1249 | elem_len = ptr[1]; |
| 1250 | left -= 2; |
| 1251 | if (elem_len > left) |
| 1252 | { |
| 1253 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 1254 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 1255 | elem_id, elem_len, left); |
| 1256 | return; |
| 1257 | } |
| 1258 | if (IE_EID_VENDOR == elem_id) |
| 1259 | { |
| 1260 | /* skipping the VSIE's which we don't want to include or |
| 1261 | * it will be included by existing code |
| 1262 | */ |
| 1263 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 1264 | #ifdef WLAN_FEATURE_WFD |
| 1265 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 1266 | #endif |
| 1267 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1268 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1269 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 1270 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1271 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 1272 | { |
| 1273 | ielen = ptr[1] + 2; |
| 1274 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 1275 | { |
| 1276 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 1277 | *total_ielen += ielen; |
| 1278 | } |
| 1279 | else |
| 1280 | { |
| 1281 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 1282 | "IE Length is too big " |
| 1283 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 1284 | elem_id, elem_len, *total_ielen); |
| 1285 | } |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | left -= elem_len; |
| 1290 | ptr += (elem_len + 2); |
| 1291 | } |
| 1292 | return; |
| 1293 | } |
| 1294 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1295 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1296 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1297 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1298 | #else |
| 1299 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1300 | struct cfg80211_beacon_data *params) |
| 1301 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | { |
| 1303 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1304 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1305 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1306 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1307 | |
| 1308 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 1309 | |
| 1310 | if(genie == NULL) { |
| 1311 | |
| 1312 | return -ENOMEM; |
| 1313 | } |
| 1314 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1315 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1316 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1317 | { |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1318 | ret = -EINVAL; |
| 1319 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1320 | } |
| 1321 | |
| 1322 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1323 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1324 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 1325 | { |
| 1326 | ret = -EINVAL; |
| 1327 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | } |
| 1329 | #endif |
| 1330 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1331 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1332 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1333 | { |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1334 | ret = -EINVAL; |
| 1335 | goto done; |
| 1336 | } |
| 1337 | |
| 1338 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 1339 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1340 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1342 | |
| 1343 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1344 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 1345 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1346 | { |
| 1347 | hddLog(LOGE, |
| 1348 | "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] | 1349 | ret = -EINVAL; |
| 1350 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | } |
| 1352 | |
| 1353 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1354 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 1355 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1356 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1357 | ==eHAL_STATUS_FAILURE) |
| 1358 | { |
| 1359 | hddLog(LOGE, |
| 1360 | "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] | 1361 | ret = -EINVAL; |
| 1362 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1363 | } |
| 1364 | |
| 1365 | // Added for ProResp IE |
| 1366 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 1367 | { |
| 1368 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 1369 | u8 probe_rsp_ie_len[3] = {0}; |
| 1370 | u8 counter = 0; |
| 1371 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 1372 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 1373 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 1374 | Store More then 255 bytes into One Variable. |
| 1375 | */ |
| 1376 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 1377 | { |
| 1378 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 1379 | { |
| 1380 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 1381 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 1382 | } |
| 1383 | else |
| 1384 | { |
| 1385 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 1386 | rem_probe_resp_ie_len = 0; |
| 1387 | } |
| 1388 | } |
| 1389 | |
| 1390 | rem_probe_resp_ie_len = 0; |
| 1391 | |
| 1392 | if (probe_rsp_ie_len[0] > 0) |
| 1393 | { |
| 1394 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1395 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 1396 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1397 | probe_rsp_ie_len[0], NULL, |
| 1398 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1399 | { |
| 1400 | hddLog(LOGE, |
| 1401 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1402 | ret = -EINVAL; |
| 1403 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | } |
| 1405 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 1406 | } |
| 1407 | |
| 1408 | if (probe_rsp_ie_len[1] > 0) |
| 1409 | { |
| 1410 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1411 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 1412 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1413 | probe_rsp_ie_len[1], NULL, |
| 1414 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1415 | { |
| 1416 | hddLog(LOGE, |
| 1417 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1418 | ret = -EINVAL; |
| 1419 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1420 | } |
| 1421 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 1422 | } |
| 1423 | |
| 1424 | if (probe_rsp_ie_len[2] > 0) |
| 1425 | { |
| 1426 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1427 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 1428 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1429 | probe_rsp_ie_len[2], NULL, |
| 1430 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1431 | { |
| 1432 | hddLog(LOGE, |
| 1433 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1434 | ret = -EINVAL; |
| 1435 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1436 | } |
| 1437 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 1438 | } |
| 1439 | |
| 1440 | if (probe_rsp_ie_len[1] == 0 ) |
| 1441 | { |
| 1442 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1443 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 1444 | eANI_BOOLEAN_FALSE) ) |
| 1445 | { |
| 1446 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1447 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | if (probe_rsp_ie_len[2] == 0 ) |
| 1452 | { |
| 1453 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1454 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 1455 | eANI_BOOLEAN_FALSE) ) |
| 1456 | { |
| 1457 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1458 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1459 | } |
| 1460 | } |
| 1461 | |
| 1462 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1463 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 1464 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1465 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1466 | == eHAL_STATUS_FAILURE) |
| 1467 | { |
| 1468 | hddLog(LOGE, |
| 1469 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1470 | ret = -EINVAL; |
| 1471 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1472 | } |
| 1473 | } |
| 1474 | else |
| 1475 | { |
| 1476 | // Reset WNI_CFG_PROBE_RSP Flags |
| 1477 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 1478 | |
| 1479 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1480 | "%s: No Probe Response IE received in set beacon", |
| 1481 | __func__); |
| 1482 | } |
| 1483 | |
| 1484 | // Added for AssocResp IE |
| 1485 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 1486 | { |
| 1487 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1488 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 1489 | params->assocresp_ies_len, NULL, |
| 1490 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1491 | { |
| 1492 | hddLog(LOGE, |
| 1493 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1494 | ret = -EINVAL; |
| 1495 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | } |
| 1497 | |
| 1498 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1499 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 1500 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1501 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1502 | == eHAL_STATUS_FAILURE) |
| 1503 | { |
| 1504 | hddLog(LOGE, |
| 1505 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1506 | ret = -EINVAL; |
| 1507 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1508 | } |
| 1509 | } |
| 1510 | else |
| 1511 | { |
| 1512 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1513 | "%s: No Assoc Response IE received in set beacon", |
| 1514 | __func__); |
| 1515 | |
| 1516 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1517 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 1518 | eANI_BOOLEAN_FALSE) ) |
| 1519 | { |
| 1520 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1521 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1522 | } |
| 1523 | } |
| 1524 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1525 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1526 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1527 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1529 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1530 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1531 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 1532 | * called by wlan_hdd_cfg80211_start_bss() and |
| 1533 | * wlan_hdd_cfg80211_set_channel() |
| 1534 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1535 | * channel list. |
| 1536 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1537 | VOS_STATUS wlan_hdd_validate_operation_channel(hdd_adapter_t *pAdapter,int channel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1538 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1540 | v_U32_t num_ch = 0; |
| 1541 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1542 | u32 indx = 0; |
| 1543 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1544 | v_U8_t fValidChannel = FALSE, count = 0; |
| 1545 | hdd_config_t *hdd_pConfig_ini= (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1547 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1548 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1549 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1551 | /* Validate the channel */ |
| 1552 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1553 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1554 | if ( channel == rfChannels[count].channelNum ) |
| 1555 | { |
| 1556 | fValidChannel = TRUE; |
| 1557 | break; |
| 1558 | } |
| 1559 | } |
| 1560 | if (fValidChannel != TRUE) |
| 1561 | { |
| 1562 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1563 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1564 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1565 | } |
| 1566 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1567 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1569 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1570 | valid_ch, &num_ch)) |
| 1571 | { |
| 1572 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1573 | "%s: failed to get valid channel list", __func__); |
| 1574 | return VOS_STATUS_E_FAILURE; |
| 1575 | } |
| 1576 | for (indx = 0; indx < num_ch; indx++) |
| 1577 | { |
| 1578 | if (channel == valid_ch[indx]) |
| 1579 | { |
| 1580 | break; |
| 1581 | } |
| 1582 | } |
| 1583 | |
| 1584 | if (indx >= num_ch) |
| 1585 | { |
| 1586 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1587 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1588 | return VOS_STATUS_E_FAILURE; |
| 1589 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1590 | } |
| 1591 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1592 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1593 | } |
| 1594 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1595 | /** |
| 1596 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 1597 | * This function is used to set the channel number |
| 1598 | */ |
| 1599 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 1600 | struct ieee80211_channel *chan, |
| 1601 | enum nl80211_channel_type channel_type |
| 1602 | ) |
| 1603 | { |
| 1604 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1605 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1606 | hdd_adapter_t *pAdapter = NULL; |
| 1607 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1608 | hdd_context_t *pHddCtx; |
| 1609 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1610 | |
| 1611 | ENTER(); |
| 1612 | |
| 1613 | if( NULL == dev ) |
| 1614 | { |
| 1615 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1616 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1617 | return -ENODEV; |
| 1618 | } |
| 1619 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 1620 | |
| 1621 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1622 | "%s: device_mode = %d freq = %d", __func__, |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1623 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1624 | |
| 1625 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1626 | status = wlan_hdd_validate_context(pHddCtx); |
| 1627 | |
| 1628 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1629 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1630 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1631 | "%s: HDD context is not valid", __func__); |
| 1632 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1633 | } |
| 1634 | |
| 1635 | /* |
| 1636 | * Do freq to chan conversion |
| 1637 | * TODO: for 11a |
| 1638 | */ |
| 1639 | |
| 1640 | channel = ieee80211_frequency_to_channel(freq); |
| 1641 | |
| 1642 | /* Check freq range */ |
| 1643 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 1644 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 1645 | { |
| 1646 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1647 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1648 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 1649 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1650 | return -EINVAL; |
| 1651 | } |
| 1652 | |
| 1653 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1654 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 1655 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 1656 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1657 | { |
| 1658 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1659 | { |
| 1660 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1661 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1662 | return -EINVAL; |
| 1663 | } |
| 1664 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1665 | "%s: set channel to [%d] for device mode =%d", |
| 1666 | __func__, channel,pAdapter->device_mode); |
| 1667 | } |
| 1668 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1669 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1670 | ) |
| 1671 | { |
| 1672 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1673 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 1674 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1675 | |
| 1676 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 1677 | { |
| 1678 | /* Link is up then return cant set channel*/ |
| 1679 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1680 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1681 | return -EINVAL; |
| 1682 | } |
| 1683 | |
| 1684 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1685 | pHddStaCtx->conn_info.operationChannel = channel; |
| 1686 | pRoamProfile->ChannelInfo.ChannelList = |
| 1687 | &pHddStaCtx->conn_info.operationChannel; |
| 1688 | } |
| 1689 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1690 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1691 | ) |
| 1692 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1693 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 1694 | { |
| 1695 | if(VOS_STATUS_SUCCESS != |
| 1696 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1697 | { |
| 1698 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1699 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1700 | return -EINVAL; |
| 1701 | } |
| 1702 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1703 | } |
| 1704 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1705 | { |
| 1706 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 1707 | |
| 1708 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 1709 | channel set by supplicant |
| 1710 | */ |
| 1711 | if ( cfg_param->apAutoChannelSelection ) |
| 1712 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1713 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 1714 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1715 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1716 | "%s: set channel to auto channel (0) for device mode =%d", |
| 1717 | __func__, pAdapter->device_mode); |
| 1718 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1719 | else |
| 1720 | { |
| 1721 | if(VOS_STATUS_SUCCESS != |
| 1722 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1723 | { |
| 1724 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1725 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1726 | return -EINVAL; |
| 1727 | } |
| 1728 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1729 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1730 | } |
| 1731 | } |
| 1732 | else |
| 1733 | { |
| 1734 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1735 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 1736 | return -EINVAL; |
| 1737 | } |
| 1738 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1739 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1740 | } |
| 1741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1742 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 1743 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1744 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1745 | #else |
| 1746 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1747 | struct cfg80211_beacon_data *params, |
| 1748 | const u8 *ssid, size_t ssid_len, |
| 1749 | enum nl80211_hidden_ssid hidden_ssid) |
| 1750 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1751 | { |
| 1752 | tsap_Config_t *pConfig; |
| 1753 | beacon_data_t *pBeacon = NULL; |
| 1754 | struct ieee80211_mgmt *pMgmt_frame; |
| 1755 | v_U8_t *pIe=NULL; |
| 1756 | v_U16_t capab_info; |
| 1757 | eCsrAuthType RSNAuthType; |
| 1758 | eCsrEncryptionType RSNEncryptType; |
| 1759 | eCsrEncryptionType mcRSNEncryptType; |
| 1760 | int status = VOS_STATUS_SUCCESS; |
| 1761 | tpWLAN_SAPEventCB pSapEventCallback; |
| 1762 | hdd_hostapd_state_t *pHostapdState; |
| 1763 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 1764 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1765 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1766 | struct qc_mac_acl_entry *acl_entry = NULL; |
| 1767 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 1768 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1769 | |
| 1770 | ENTER(); |
| 1771 | |
| 1772 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 1773 | |
| 1774 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1775 | |
| 1776 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1777 | |
| 1778 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1779 | |
| 1780 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 1781 | |
| 1782 | //channel is already set in the set_channel Call back |
| 1783 | //pConfig->channel = pCommitConfig->channel; |
| 1784 | |
| 1785 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1786 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1787 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 1788 | |
| 1789 | pConfig->dtim_period = pBeacon->dtim_period; |
| 1790 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1791 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1792 | pConfig->dtim_period); |
| 1793 | |
| 1794 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 1795 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1796 | { |
| 1797 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 1799 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 1800 | { |
| 1801 | tANI_BOOLEAN restartNeeded; |
| 1802 | pConfig->ieee80211d = 1; |
| 1803 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 1804 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 1805 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 1806 | } |
| 1807 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1808 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1809 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1810 | pConfig->ieee80211d = 1; |
| 1811 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 1812 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 1813 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1814 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1815 | else |
| 1816 | { |
| 1817 | pConfig->ieee80211d = 0; |
| 1818 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1819 | /* |
| 1820 | * If auto channel is configured i.e. channel is 0, |
| 1821 | * so skip channel validation. |
| 1822 | */ |
| 1823 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 1824 | { |
| 1825 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 1826 | { |
| 1827 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1828 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1829 | return -EINVAL; |
| 1830 | } |
| 1831 | } |
| 1832 | else |
| 1833 | { |
| 1834 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 1835 | { |
| 1836 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 1837 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 1838 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 1839 | } |
| 1840 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 1841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1842 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1843 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1844 | { |
| 1845 | pConfig->ieee80211d = 0; |
| 1846 | } |
| 1847 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 1848 | |
| 1849 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1850 | |
| 1851 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1852 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 1853 | |
| 1854 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 1855 | |
| 1856 | /*Set wps station to configured*/ |
| 1857 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 1858 | |
| 1859 | if(pIe) |
| 1860 | { |
| 1861 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 1862 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1863 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1864 | return -EINVAL; |
| 1865 | } |
| 1866 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 1867 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1868 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1869 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 1870 | * WPS state |
| 1871 | */ |
| 1872 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 1873 | { |
| 1874 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 1875 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 1876 | { |
| 1877 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 1878 | } |
| 1879 | } |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 1884 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1885 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1886 | |
| 1887 | pConfig->RSNWPAReqIELength = 0; |
| 1888 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1889 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1890 | WLAN_EID_RSN); |
| 1891 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1892 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1893 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 1894 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 1895 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1896 | /* The actual processing may eventually be more extensive than |
| 1897 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1898 | * by the app. |
| 1899 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1900 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 1902 | &RSNEncryptType, |
| 1903 | &mcRSNEncryptType, |
| 1904 | &RSNAuthType, |
| 1905 | pConfig->pRSNWPAReqIE[1]+2, |
| 1906 | pConfig->pRSNWPAReqIE ); |
| 1907 | |
| 1908 | if( VOS_STATUS_SUCCESS == status ) |
| 1909 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1910 | /* Now copy over all the security attributes you have |
| 1911 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | * */ |
| 1913 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 1914 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 1915 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 1916 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1917 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1918 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1919 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 1920 | } |
| 1921 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 1924 | pBeacon->tail, pBeacon->tail_len); |
| 1925 | |
| 1926 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 1927 | { |
| 1928 | if (pConfig->pRSNWPAReqIE) |
| 1929 | { |
| 1930 | /*Mixed mode WPA/WPA2*/ |
| 1931 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 1932 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 1933 | } |
| 1934 | else |
| 1935 | { |
| 1936 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 1937 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 1938 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1939 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 1941 | &RSNEncryptType, |
| 1942 | &mcRSNEncryptType, |
| 1943 | &RSNAuthType, |
| 1944 | pConfig->pRSNWPAReqIE[1]+2, |
| 1945 | pConfig->pRSNWPAReqIE ); |
| 1946 | |
| 1947 | if( VOS_STATUS_SUCCESS == status ) |
| 1948 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1949 | /* Now copy over all the security attributes you have |
| 1950 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | * */ |
| 1952 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 1953 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 1954 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 1955 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1956 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1957 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 1959 | } |
| 1960 | } |
| 1961 | } |
| 1962 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1963 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 1964 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 1965 | return -EINVAL; |
| 1966 | } |
| 1967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1968 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 1969 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1970 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | if (params->ssid != NULL) |
| 1972 | { |
| 1973 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 1974 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 1975 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 1976 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 1977 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1978 | #else |
| 1979 | if (ssid != NULL) |
| 1980 | { |
| 1981 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 1982 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 1983 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 1984 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 1985 | } |
| 1986 | #endif |
| 1987 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1988 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1989 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1991 | /* default value */ |
| 1992 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 1993 | pConfig->num_accept_mac = 0; |
| 1994 | pConfig->num_deny_mac = 0; |
| 1995 | |
| 1996 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 1997 | pBeacon->tail, pBeacon->tail_len); |
| 1998 | |
| 1999 | /* pIe for black list is following form: |
| 2000 | type : 1 byte |
| 2001 | length : 1 byte |
| 2002 | OUI : 4 bytes |
| 2003 | acl type : 1 byte |
| 2004 | no of mac addr in black list: 1 byte |
| 2005 | list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2006 | */ |
| 2007 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2008 | { |
| 2009 | pConfig->SapMacaddr_acl = pIe[6]; |
| 2010 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2011 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2013 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 2014 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2015 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 2016 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 2017 | { |
| 2018 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 2019 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | } |
| 2022 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 2023 | pBeacon->tail, pBeacon->tail_len); |
| 2024 | |
| 2025 | /* pIe for white list is following form: |
| 2026 | type : 1 byte |
| 2027 | length : 1 byte |
| 2028 | OUI : 4 bytes |
| 2029 | acl type : 1 byte |
| 2030 | no of mac addr in white list: 1 byte |
| 2031 | list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2032 | */ |
| 2033 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2034 | { |
| 2035 | pConfig->SapMacaddr_acl = pIe[6]; |
| 2036 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2037 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2038 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2039 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 2040 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2041 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 2042 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 2043 | { |
| 2044 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 2045 | acl_entry++; |
| 2046 | } |
| 2047 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2048 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2049 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 2050 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2051 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 2052 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 2053 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 2054 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 2055 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 2056 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 2057 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 2058 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2059 | (((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_AUTO) || |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 2060 | ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac) || |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 2061 | ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY)) && |
| 2062 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2063 | { |
| 2064 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 2065 | |
| 2066 | /* Disable VHT support in 2.4 GHz band */ |
| 2067 | if (pConfig->channel <= 14 && |
| 2068 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->enableVhtFor24GHzBand == FALSE) |
| 2069 | { |
| 2070 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 2071 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2072 | } |
| 2073 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2074 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 2075 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 2076 | { |
| 2077 | sme_SelectCBMode(hHal, |
| 2078 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 2079 | pConfig->channel); |
| 2080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 2082 | pConfig->ht_capab = |
| 2083 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 2084 | |
| 2085 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 2086 | { |
| 2087 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 2088 | return -EINVAL; |
| 2089 | } |
| 2090 | |
| 2091 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2092 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 2094 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2095 | pConfig->obssProtEnabled = |
| 2096 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2097 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2098 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2100 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 2101 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 2102 | (int)pConfig->channel); |
| 2103 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 2104 | pConfig->SapHw_mode, pConfig->privacy, |
| 2105 | pConfig->authType); |
| 2106 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 2107 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 2108 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 2109 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2110 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2111 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2112 | { |
| 2113 | //Bss already started. just return. |
| 2114 | //TODO Probably it should update some beacon params. |
| 2115 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 2116 | EXIT(); |
| 2117 | return 0; |
| 2118 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2119 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2120 | pConfig->persona = pHostapdAdapter->device_mode; |
| 2121 | |
| 2122 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 2123 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 2124 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 2125 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2126 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2127 | return -EINVAL; |
| 2128 | } |
| 2129 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2130 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2131 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 2132 | |
| 2133 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2135 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2136 | { |
| 2137 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2138 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 2139 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | VOS_ASSERT(0); |
| 2141 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2143 | //Succesfully started Bss update the state bit. |
| 2144 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 2145 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2146 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2147 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 2148 | { |
| 2149 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 2150 | { |
| 2151 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2152 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2153 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2154 | } |
| 2155 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 2156 | { |
| 2157 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2158 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2159 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2160 | } |
| 2161 | } |
| 2162 | #endif |
| 2163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2164 | pHostapdState->bCommit = TRUE; |
| 2165 | EXIT(); |
| 2166 | |
| 2167 | return 0; |
| 2168 | } |
| 2169 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2170 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2171 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 2172 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2173 | struct beacon_parameters *params) |
| 2174 | { |
| 2175 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2176 | hdd_context_t *pHddCtx; |
| 2177 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2178 | |
| 2179 | ENTER(); |
| 2180 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2181 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d",pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2182 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2183 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2184 | status = wlan_hdd_validate_context(pHddCtx); |
| 2185 | |
| 2186 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2187 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2188 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2189 | "%s: HDD context is not valid", __func__); |
| 2190 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2191 | } |
| 2192 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2193 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2195 | ) |
| 2196 | { |
| 2197 | beacon_data_t *old,*new; |
| 2198 | |
| 2199 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2201 | if (old) |
| 2202 | return -EALREADY; |
| 2203 | |
| 2204 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2205 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2206 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | { |
| 2208 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2209 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2210 | return -EINVAL; |
| 2211 | } |
| 2212 | |
| 2213 | pAdapter->sessionCtx.ap.beacon = new; |
| 2214 | |
| 2215 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2216 | } |
| 2217 | |
| 2218 | EXIT(); |
| 2219 | return status; |
| 2220 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2221 | |
| 2222 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2223 | struct net_device *dev, |
| 2224 | struct beacon_parameters *params) |
| 2225 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2226 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2227 | hdd_context_t *pHddCtx; |
| 2228 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | |
| 2230 | ENTER(); |
| 2231 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2232 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | __func__,pAdapter->device_mode); |
| 2234 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2235 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2236 | status = wlan_hdd_validate_context(pHddCtx); |
| 2237 | |
| 2238 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2239 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2240 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2241 | "%s: HDD context is not valid", __func__); |
| 2242 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2243 | } |
| 2244 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2245 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2247 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | { |
| 2249 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2253 | if (!old) |
| 2254 | return -ENOENT; |
| 2255 | |
| 2256 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2257 | |
| 2258 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2259 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2260 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | return -EINVAL; |
| 2262 | } |
| 2263 | |
| 2264 | pAdapter->sessionCtx.ap.beacon = new; |
| 2265 | |
| 2266 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2267 | } |
| 2268 | |
| 2269 | EXIT(); |
| 2270 | return status; |
| 2271 | } |
| 2272 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2273 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 2274 | |
| 2275 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 2277 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2278 | #else |
| 2279 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 2280 | struct net_device *dev) |
| 2281 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2282 | { |
| 2283 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2284 | hdd_context_t *pHddCtx = NULL; |
| 2285 | hdd_scaninfo_t *pScanInfo = NULL; |
| 2286 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2287 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2288 | |
| 2289 | ENTER(); |
| 2290 | |
| 2291 | if (NULL == pAdapter) |
| 2292 | { |
| 2293 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2294 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2295 | return -ENODEV; |
| 2296 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2297 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2298 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2299 | status = wlan_hdd_validate_context(pHddCtx); |
| 2300 | |
| 2301 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2302 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2303 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2304 | "%s: HDD context is not valid", __func__); |
| 2305 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2306 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2307 | |
| 2308 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2309 | if (NULL == staAdapter) |
| 2310 | { |
| 2311 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 2312 | if (NULL == staAdapter) |
| 2313 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2314 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2315 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 2316 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2317 | } |
| 2318 | } |
| 2319 | |
| 2320 | pScanInfo = &pHddCtx->scan_info; |
| 2321 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2322 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | __func__,pAdapter->device_mode); |
| 2324 | |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2325 | if ((pScanInfo != NULL) && pScanInfo->mScanPending && staAdapter) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2326 | { |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2327 | INIT_COMPLETION(pScanInfo->abortscan_event_var); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 2328 | hdd_abort_mac_scan(staAdapter->pHddCtx, pAdapter->sessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2329 | status = wait_for_completion_interruptible_timeout( |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2330 | &pScanInfo->abortscan_event_var, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2331 | msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN)); |
| 2332 | if (!status) |
| 2333 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2334 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 2335 | "%s: Timeout occurred while waiting for abortscan" , |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2336 | __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2337 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2338 | } |
| 2339 | } |
| 2340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2342 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | ) |
| 2344 | { |
| 2345 | beacon_data_t *old; |
| 2346 | |
| 2347 | old = pAdapter->sessionCtx.ap.beacon; |
| 2348 | |
| 2349 | if (!old) |
| 2350 | return -ENOENT; |
| 2351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2352 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | |
| 2354 | mutex_lock(&pHddCtx->sap_lock); |
| 2355 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 2356 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2357 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2358 | { |
| 2359 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 2360 | |
| 2361 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 2362 | |
| 2363 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2364 | { |
| 2365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2366 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2367 | VOS_ASSERT(0); |
| 2368 | } |
| 2369 | } |
| 2370 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
| 2371 | } |
| 2372 | mutex_unlock(&pHddCtx->sap_lock); |
| 2373 | |
| 2374 | if(status != VOS_STATUS_SUCCESS) |
| 2375 | { |
| 2376 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2377 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | return -EINVAL; |
| 2379 | } |
| 2380 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2381 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2382 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 2383 | ==eHAL_STATUS_FAILURE) |
| 2384 | { |
| 2385 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2386 | "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | } |
| 2388 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2389 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 2391 | eANI_BOOLEAN_FALSE) ) |
| 2392 | { |
| 2393 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2394 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2395 | } |
| 2396 | |
| 2397 | // Reset WNI_CFG_PROBE_RSP Flags |
| 2398 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 2399 | |
| 2400 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 2401 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2402 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2403 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 2404 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 2405 | { |
| 2406 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 2407 | "GO got removed"); |
| 2408 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 2409 | } |
| 2410 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2411 | } |
| 2412 | EXIT(); |
| 2413 | return status; |
| 2414 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2415 | |
| 2416 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2417 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2418 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 2419 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2420 | struct cfg80211_ap_settings *params) |
| 2421 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2422 | hdd_adapter_t *pAdapter; |
| 2423 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2424 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2425 | |
| 2426 | ENTER(); |
| 2427 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2428 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2429 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2430 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2431 | "%s: Device is Null", __func__); |
| 2432 | return -ENODEV; |
| 2433 | } |
| 2434 | |
| 2435 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2436 | if (NULL == pAdapter) |
| 2437 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2438 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2439 | "%s: HDD adapter is Null", __func__); |
| 2440 | return -ENODEV; |
| 2441 | } |
| 2442 | |
| 2443 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 2444 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2445 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2446 | "%s: HDD adapter magic is invalid", __func__); |
| 2447 | return -ENODEV; |
| 2448 | } |
| 2449 | |
| 2450 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2451 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2452 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2453 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2454 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2455 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2456 | "%s: HDD context is not valid", __func__); |
| 2457 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2458 | } |
| 2459 | |
| 2460 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %d", |
| 2461 | __func__, pAdapter->device_mode); |
| 2462 | |
| 2463 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2464 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2465 | ) |
| 2466 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2467 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2468 | |
| 2469 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2470 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2471 | if (old) |
| 2472 | return -EALREADY; |
| 2473 | |
| 2474 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 2475 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2476 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2477 | { |
| 2478 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2479 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2480 | return -EINVAL; |
| 2481 | } |
| 2482 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 2483 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2484 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 2485 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 2486 | params->channel, params->channel_type); |
| 2487 | #else |
| 2488 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 2489 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 2490 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2491 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 2492 | params->ssid_len, params->hidden_ssid); |
| 2493 | } |
| 2494 | |
| 2495 | EXIT(); |
| 2496 | return status; |
| 2497 | } |
| 2498 | |
| 2499 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2500 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2501 | struct net_device *dev, |
| 2502 | struct cfg80211_beacon_data *params) |
| 2503 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2504 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2505 | hdd_context_t *pHddCtx; |
| 2506 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2507 | |
| 2508 | ENTER(); |
| 2509 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2510 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2511 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2512 | |
| 2513 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2514 | status = wlan_hdd_validate_context(pHddCtx); |
| 2515 | |
| 2516 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2517 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2518 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2519 | "%s: HDD context is not valid", __func__); |
| 2520 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2521 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2522 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2523 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2524 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2525 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2526 | { |
| 2527 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2528 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2529 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2530 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2531 | if (!old) |
| 2532 | return -ENOENT; |
| 2533 | |
| 2534 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 2535 | |
| 2536 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2537 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2538 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2539 | return -EINVAL; |
| 2540 | } |
| 2541 | |
| 2542 | pAdapter->sessionCtx.ap.beacon = new; |
| 2543 | |
| 2544 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 2545 | } |
| 2546 | |
| 2547 | EXIT(); |
| 2548 | return status; |
| 2549 | } |
| 2550 | |
| 2551 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | |
| 2554 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 2555 | struct net_device *dev, |
| 2556 | struct bss_parameters *params) |
| 2557 | { |
| 2558 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2559 | |
| 2560 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2561 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2562 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2563 | __func__,pAdapter->device_mode); |
| 2564 | |
| 2565 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2566 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2567 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2568 | { |
| 2569 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 2570 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2571 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2572 | { |
| 2573 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2574 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2575 | } |
| 2576 | |
| 2577 | EXIT(); |
| 2578 | return 0; |
| 2579 | } |
| 2580 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2581 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 2582 | * to wait for contry code completion |
| 2583 | */ |
| 2584 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 2585 | { |
| 2586 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 2587 | complete(&call_back_pAdapter->change_country_code); |
| 2588 | return NULL; |
| 2589 | } |
| 2590 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2591 | /* |
| 2592 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 2593 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 2594 | */ |
| 2595 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 2596 | struct net_device *ndev, |
| 2597 | enum nl80211_iftype type, |
| 2598 | u32 *flags, |
| 2599 | struct vif_params *params |
| 2600 | ) |
| 2601 | { |
| 2602 | struct wireless_dev *wdev; |
| 2603 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 2604 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2605 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2606 | tCsrRoamProfile *pRoamProfile = NULL; |
| 2607 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2608 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2609 | eMib_dot11DesiredBssType connectedBssType; |
| 2610 | VOS_STATUS status; |
| 2611 | |
| 2612 | ENTER(); |
| 2613 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2614 | status = wlan_hdd_validate_context(pHddCtx); |
| 2615 | |
| 2616 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2617 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2618 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2619 | "%s: HDD context is not valid", __func__); |
| 2620 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2621 | } |
| 2622 | |
| 2623 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 2624 | __func__, pAdapter->device_mode); |
| 2625 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2626 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2627 | wdev = ndev->ieee80211_ptr; |
| 2628 | |
| 2629 | #ifdef WLAN_BTAMP_FEATURE |
| 2630 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 2631 | (NL80211_IFTYPE_ADHOC == type)|| |
| 2632 | (NL80211_IFTYPE_AP == type)|| |
| 2633 | (NL80211_IFTYPE_P2P_GO == type)) |
| 2634 | { |
| 2635 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 2636 | // stop AMP traffic |
| 2637 | status = WLANBAP_StopAmp(); |
| 2638 | if(VOS_STATUS_SUCCESS != status ) |
| 2639 | { |
| 2640 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2641 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2642 | "%s: Failed to stop AMP", __func__); |
| 2643 | return -EINVAL; |
| 2644 | } |
| 2645 | } |
| 2646 | #endif //WLAN_BTAMP_FEATURE |
| 2647 | /* Reset the current device mode bit mask*/ |
| 2648 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 2649 | |
| 2650 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2652 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2653 | ) |
| 2654 | { |
| 2655 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2656 | pRoamProfile = &pWextState->roamProfile; |
| 2657 | LastBSSType = pRoamProfile->BSSType; |
| 2658 | |
| 2659 | switch (type) |
| 2660 | { |
| 2661 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2662 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2664 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 2665 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2666 | #ifdef WLAN_FEATURE_11AC |
| 2667 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 2668 | { |
| 2669 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 2670 | } |
| 2671 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2672 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2673 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2675 | //Check for sub-string p2p to confirm its a p2p interface |
| 2676 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2677 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2678 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 2679 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 2680 | } |
| 2681 | else |
| 2682 | { |
| 2683 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2684 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2685 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 2686 | #ifdef FEATURE_WLAN_TDLS |
| 2687 | /* The open adapter for the p2p shall skip initializations in |
| 2688 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 2689 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 2690 | * tdls_init when the change_iface sets the device mode to |
| 2691 | * WLAN_HDD_P2P_CLIENT. |
| 2692 | */ |
| 2693 | |
| 2694 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2695 | { |
| 2696 | if (0 != wlan_hdd_tdls_init (pAdapter)) |
| 2697 | { |
| 2698 | return -EINVAL; |
| 2699 | } |
| 2700 | } |
| 2701 | #endif |
| 2702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2703 | break; |
| 2704 | case NL80211_IFTYPE_ADHOC: |
| 2705 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2706 | "%s: setting interface Type to ADHOC", __func__); |
| 2707 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 2708 | pRoamProfile->phyMode = |
| 2709 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2710 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2711 | wdev->iftype = type; |
| 2712 | break; |
| 2713 | |
| 2714 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | { |
| 2717 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 2718 | "%s: setting interface Type to %s", __func__, |
| 2719 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 2720 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2721 | //Cancel any remain on channel for GO mode |
| 2722 | if (NL80211_IFTYPE_P2P_GO == type) |
| 2723 | { |
| 2724 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 2725 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2726 | if (NL80211_IFTYPE_AP == type) |
| 2727 | { |
| 2728 | /* As Loading WLAN Driver one interface being created for p2p device |
| 2729 | * address. This will take one HW STA and the max number of clients |
| 2730 | * that can connect to softAP will be reduced by one. so while changing |
| 2731 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 2732 | * interface as it is not required in SoftAP mode. |
| 2733 | */ |
| 2734 | |
| 2735 | // Get P2P Adapter |
| 2736 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 2737 | |
| 2738 | if (pP2pAdapter) |
| 2739 | { |
| 2740 | hdd_stop_adapter(pHddCtx, pP2pAdapter); |
| 2741 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 2742 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 2743 | } |
| 2744 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2745 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2746 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2747 | /* A Mutex Lock is introduced while changing the mode to |
| 2748 | * protect the concurrent access for the Adapters by TDLS |
| 2749 | * module. |
| 2750 | */ |
| 2751 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 2752 | { |
| 2753 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2754 | "%s: unable to lock list", __func__); |
| 2755 | return -EINVAL; |
| 2756 | } |
| 2757 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2758 | //De-init the adapter. |
| 2759 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 2760 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 2761 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2762 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 2763 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2764 | #ifdef FEATURE_WLAN_TDLS |
| 2765 | mutex_unlock(&pHddCtx->tdls_lock); |
| 2766 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2767 | |
| 2768 | //Disable BMPS and IMPS if enabled |
| 2769 | //before starting Go |
| 2770 | if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 2771 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2772 | if(VOS_STATUS_E_FAILURE == |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2773 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 2774 | { |
| 2775 | //Fail to Exit BMPS |
| 2776 | VOS_ASSERT(0); |
| 2777 | } |
| 2778 | } |
| 2779 | |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 2780 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 2781 | (pConfig->apRandomBssidEnabled)) |
| 2782 | { |
| 2783 | /* To meet Android requirements create a randomized |
| 2784 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 2785 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 2786 | ndev->dev_addr[0] = 0x02; |
| 2787 | ndev->dev_addr[1] = 0x1A; |
| 2788 | ndev->dev_addr[2] = 0x11; |
| 2789 | ndev->dev_addr[3] |= 0xF0; |
| 2790 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 2791 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2792 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 2793 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 2794 | } |
| 2795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | hdd_set_ap_ops( pAdapter->dev ); |
| 2797 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2798 | /* This is for only SAP mode where users can |
| 2799 | * control country through ini. |
| 2800 | * P2P GO follows station country code |
| 2801 | * acquired during the STA scanning. */ |
| 2802 | if((NL80211_IFTYPE_AP == type) && |
| 2803 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 2804 | { |
| 2805 | int status = 0; |
| 2806 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 2807 | "%s: setting country code from INI ", __func__); |
| 2808 | init_completion(&pAdapter->change_country_code); |
| 2809 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 2810 | (void *)(tSmeChangeCountryCallback) |
| 2811 | wlan_hdd_change_country_code_cb, |
| 2812 | pConfig->apCntryCode, pAdapter, |
| 2813 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 2814 | eSIR_FALSE, |
| 2815 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2816 | if (eHAL_STATUS_SUCCESS == status) |
| 2817 | { |
| 2818 | /* Wait for completion */ |
| 2819 | status = wait_for_completion_interruptible_timeout( |
| 2820 | &pAdapter->change_country_code, |
| 2821 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
| 2822 | if (status <= 0) |
| 2823 | { |
| 2824 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2825 | "%s: SME Timed out while setting country code ", |
| 2826 | __func__); |
| 2827 | } |
| 2828 | } |
| 2829 | else |
| 2830 | { |
| 2831 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2832 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2833 | return -EINVAL; |
| 2834 | } |
| 2835 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | status = hdd_init_ap_mode(pAdapter); |
| 2837 | if(status != VOS_STATUS_SUCCESS) |
| 2838 | { |
| 2839 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2840 | "%s: Error initializing the ap mode", __func__); |
| 2841 | return -EINVAL; |
| 2842 | } |
| 2843 | hdd_set_conparam(1); |
| 2844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2845 | /*interface type changed update in wiphy structure*/ |
| 2846 | if(wdev) |
| 2847 | { |
| 2848 | wdev->iftype = type; |
| 2849 | pHddCtx->change_iface = type; |
| 2850 | } |
| 2851 | else |
| 2852 | { |
| 2853 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2854 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 2855 | return -EINVAL; |
| 2856 | } |
| 2857 | goto done; |
| 2858 | } |
| 2859 | |
| 2860 | default: |
| 2861 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 2862 | __func__); |
| 2863 | return -EOPNOTSUPP; |
| 2864 | } |
| 2865 | } |
| 2866 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2867 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | ) |
| 2869 | { |
| 2870 | switch(type) |
| 2871 | { |
| 2872 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2873 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2874 | case NL80211_IFTYPE_ADHOC: |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2875 | #ifdef FEATURE_WLAN_TDLS |
| 2876 | |
| 2877 | /* A Mutex Lock is introduced while changing the mode to |
| 2878 | * protect the concurrent access for the Adapters by TDLS |
| 2879 | * module. |
| 2880 | */ |
| 2881 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 2882 | { |
| 2883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2884 | "%s: unable to lock list", __func__); |
| 2885 | return -EINVAL; |
| 2886 | } |
| 2887 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2888 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 2889 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2890 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2891 | //Check for sub-string p2p to confirm its a p2p interface |
| 2892 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2893 | { |
| 2894 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 2895 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 2896 | } |
| 2897 | else |
| 2898 | { |
| 2899 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2900 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2901 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2902 | hdd_set_conparam(0); |
| 2903 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2904 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 2905 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2906 | #ifdef FEATURE_WLAN_TDLS |
| 2907 | mutex_unlock(&pHddCtx->tdls_lock); |
| 2908 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 2909 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | if( VOS_STATUS_SUCCESS != status ) |
| 2911 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2912 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 2913 | * This is the right place to enable back bmps_imps() |
| 2914 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2915 | if (pHddCtx->hdd_wlan_suspended) |
| 2916 | { |
| 2917 | hdd_set_pwrparams(pHddCtx); |
| 2918 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2919 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2920 | goto done; |
| 2921 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2923 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 2925 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2926 | goto done; |
| 2927 | default: |
| 2928 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 2929 | __func__); |
| 2930 | return -EOPNOTSUPP; |
| 2931 | |
| 2932 | } |
| 2933 | |
| 2934 | } |
| 2935 | else |
| 2936 | { |
| 2937 | return -EOPNOTSUPP; |
| 2938 | } |
| 2939 | |
| 2940 | |
| 2941 | if(pRoamProfile) |
| 2942 | { |
| 2943 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 2944 | { |
| 2945 | /*interface type changed update in wiphy structure*/ |
| 2946 | wdev->iftype = type; |
| 2947 | |
| 2948 | /*the BSS mode changed, We need to issue disconnect |
| 2949 | if connected or in IBSS disconnect state*/ |
| 2950 | if ( hdd_connGetConnectedBssType( |
| 2951 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 2952 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 2953 | { |
| 2954 | /*need to issue a disconnect to CSR.*/ |
| 2955 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 2956 | if( eHAL_STATUS_SUCCESS == |
| 2957 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2958 | pAdapter->sessionId, |
| 2959 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 2960 | { |
| 2961 | wait_for_completion_interruptible_timeout( |
| 2962 | &pAdapter->disconnect_comp_var, |
| 2963 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 2964 | } |
| 2965 | } |
| 2966 | } |
| 2967 | } |
| 2968 | |
| 2969 | done: |
| 2970 | /*set bitmask based on updated value*/ |
| 2971 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 2972 | |
| 2973 | /* Only STA mode support TM now |
| 2974 | * all other mode, TM feature should be disabled */ |
| 2975 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 2976 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 2977 | { |
| 2978 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 2979 | } |
| 2980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2981 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2982 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 2984 | { |
| 2985 | //we are ok to do AMP |
| 2986 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2987 | } |
| 2988 | #endif //WLAN_BTAMP_FEATURE |
| 2989 | EXIT(); |
| 2990 | return 0; |
| 2991 | } |
| 2992 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2993 | #ifdef FEATURE_WLAN_TDLS |
| 2994 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 2995 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 2996 | { |
| 2997 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2998 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2999 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3000 | hddTdlsPeer_t *pTdlsPeer; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3001 | |
| 3002 | ENTER(); |
| 3003 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3004 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3005 | { |
| 3006 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3007 | "Invalid arguments"); |
| 3008 | return -EINVAL; |
| 3009 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 3010 | |
| 3011 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 3012 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 3013 | { |
| 3014 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3015 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 3016 | MAC_ADDRESS_STR " Request declined.", |
| 3017 | __func__, MAC_ADDR_ARRAY(mac)); |
| 3018 | return -ENOTSUPP; |
| 3019 | } |
| 3020 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3021 | if (pHddCtx->isLogpInProgress) |
| 3022 | { |
| 3023 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3024 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3025 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3026 | return -EBUSY; |
| 3027 | } |
| 3028 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3029 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3030 | |
| 3031 | if ( NULL == pTdlsPeer ) { |
| 3032 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3033 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 3034 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 3035 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3036 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3037 | |
| 3038 | /* in add station, we accept existing valid staId if there is */ |
| 3039 | if ((0 == update) && |
| 3040 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 3041 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3042 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3043 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3044 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3045 | " link_status %d. staId %d. add station ignored.", |
| 3046 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 3047 | return 0; |
| 3048 | } |
| 3049 | /* in change station, we accept only when staId is valid */ |
| 3050 | if ((1 == update) && |
| 3051 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 3052 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 3053 | { |
| 3054 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3055 | "%s: " MAC_ADDRESS_STR |
| 3056 | " link status %d. staId %d. change station %s.", |
| 3057 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 3058 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 3059 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3060 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3061 | |
| 3062 | /* when others are on-going, we want to change link_status to idle */ |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3063 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3064 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3065 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3066 | "%s: " MAC_ADDRESS_STR |
| 3067 | " TDLS setup is ongoing. Request declined.", |
| 3068 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3069 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3070 | } |
| 3071 | |
| 3072 | /* first to check if we reached to maximum supported TDLS peer. |
| 3073 | TODO: for now, return -EPERM looks working fine, |
| 3074 | but need to check if any other errno fit into this category.*/ |
| 3075 | if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter)) |
| 3076 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3077 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3078 | "%s: " MAC_ADDRESS_STR |
| 3079 | " TDLS Max peer already connected. Request declined.", |
| 3080 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3081 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3082 | } |
| 3083 | else |
| 3084 | { |
| 3085 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3086 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3087 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3088 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3089 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3090 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 3091 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3092 | return -EPERM; |
| 3093 | } |
| 3094 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3095 | if (0 == update) |
| 3096 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_CONNECTING); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3097 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 3098 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3099 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3100 | { |
| 3101 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3102 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3103 | if(StaParams->htcap_present) |
| 3104 | { |
| 3105 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3106 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 3107 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3108 | "ht_capa->extended_capabilities: %0x", |
| 3109 | StaParams->HTCap.extendedHtCapInfo); |
| 3110 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3111 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3112 | "params->capability: %0x",StaParams->capability); |
| 3113 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3114 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3115 | if(StaParams->vhtcap_present) |
| 3116 | { |
| 3117 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3118 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 3119 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 3120 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 3121 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3122 | { |
| 3123 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3124 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3125 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 3126 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3127 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 3128 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 3129 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3130 | else if ((1 == update) && (NULL == StaParams)) |
| 3131 | { |
| 3132 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3133 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 3134 | return -EPERM; |
| 3135 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3136 | |
| 3137 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 3138 | |
| 3139 | if (!update) |
| 3140 | { |
| 3141 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3142 | pAdapter->sessionId, mac); |
| 3143 | } |
| 3144 | else |
| 3145 | { |
| 3146 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3147 | pAdapter->sessionId, mac, StaParams); |
| 3148 | } |
| 3149 | |
| 3150 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
| 3151 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 3152 | |
| 3153 | if (!status) |
| 3154 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3155 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3156 | "%s: timeout waiting for tdls add station indication", |
| 3157 | __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3158 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3159 | } |
| 3160 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 3161 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3162 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3163 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3164 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3165 | } |
| 3166 | |
| 3167 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3168 | |
| 3169 | error: |
| 3170 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
| 3171 | return -EPERM; |
| 3172 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3173 | } |
| 3174 | #endif |
| 3175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3176 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 3177 | struct net_device *dev, |
| 3178 | u8 *mac, |
| 3179 | struct station_parameters *params) |
| 3180 | { |
| 3181 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 3182 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3183 | hdd_context_t *pHddCtx; |
| 3184 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3185 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3186 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3187 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3188 | tANI_U8 isBufSta = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3189 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3190 | ENTER(); |
| 3191 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3192 | if ((NULL == pAdapter)) |
| 3193 | { |
| 3194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3195 | "invalid adapter "); |
| 3196 | return -EINVAL; |
| 3197 | } |
| 3198 | |
| 3199 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3200 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3201 | |
| 3202 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 3203 | { |
| 3204 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3205 | "invalid HDD state or HDD station context"); |
| 3206 | return -EINVAL; |
| 3207 | } |
| 3208 | |
| 3209 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3210 | { |
| 3211 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3212 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3213 | return -EAGAIN; |
| 3214 | } |
| 3215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3216 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 3217 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3218 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 3219 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3220 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3221 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3222 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3223 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3224 | WLANTL_STA_AUTHENTICATED); |
| 3225 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3226 | if (status != VOS_STATUS_SUCCESS) |
| 3227 | { |
| 3228 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3229 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 3230 | return -EINVAL; |
| 3231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3232 | } |
| 3233 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 3234 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 3235 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3236 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3237 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 3238 | StaParams.capability = params->capability; |
| 3239 | StaParams.uapsd_queues = params->uapsd_queues; |
| 3240 | StaParams.max_sp = params->max_sp; |
| 3241 | |
| 3242 | if (0 != params->ext_capab_len) |
| 3243 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 3244 | sizeof(StaParams.extn_capability)); |
| 3245 | |
| 3246 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3247 | { |
| 3248 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3249 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3250 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3251 | |
| 3252 | StaParams.supported_rates_len = params->supported_rates_len; |
| 3253 | |
| 3254 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 3255 | * The supported_rates array , for all the structures propogating till Add Sta |
| 3256 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 3257 | * modified to send more rates. |
| 3258 | */ |
| 3259 | |
| 3260 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 3261 | */ |
| 3262 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 3263 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 3264 | |
| 3265 | if (0 != StaParams.supported_rates_len) { |
| 3266 | int i = 0; |
| 3267 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 3268 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3269 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3270 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 3271 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3272 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3273 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 3274 | } |
| 3275 | |
| 3276 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3277 | { |
| 3278 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3279 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3280 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3281 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3282 | if (0 != params->ext_capab_len ) { |
| 3283 | /*Define A Macro : TODO Sunil*/ |
| 3284 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 3285 | isBufSta = 1; |
| 3286 | } |
| 3287 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3288 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, params->uapsd_queues, |
| 3289 | params->max_sp, isBufSta); |
| 3290 | if (VOS_STATUS_SUCCESS != status) { |
| 3291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3292 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 3293 | return -EINVAL; |
| 3294 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3295 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 3296 | |
| 3297 | if (VOS_STATUS_SUCCESS != status) { |
| 3298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3299 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 3300 | return -EINVAL; |
| 3301 | } |
| 3302 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3303 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 3304 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3305 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3306 | return status; |
| 3307 | } |
| 3308 | |
| 3309 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3310 | * FUNCTION: wlan_hdd_cfg80211_add_key |
| 3311 | * This function is used to initialize the key information |
| 3312 | */ |
| 3313 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3314 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3315 | struct net_device *ndev, |
| 3316 | u8 key_index, bool pairwise, |
| 3317 | const u8 *mac_addr, |
| 3318 | struct key_params *params |
| 3319 | ) |
| 3320 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3321 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3322 | struct net_device *ndev, |
| 3323 | u8 key_index, const u8 *mac_addr, |
| 3324 | struct key_params *params |
| 3325 | ) |
| 3326 | #endif |
| 3327 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3328 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3329 | tCsrRoamSetKey setKey; |
| 3330 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3331 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3332 | v_U32_t roamId= 0xFF; |
| 3333 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3334 | hdd_hostapd_state_t *pHostapdState; |
| 3335 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3336 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3337 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3338 | |
| 3339 | ENTER(); |
| 3340 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3341 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3342 | status = wlan_hdd_validate_context(pHddCtx); |
| 3343 | |
| 3344 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3345 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3346 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3347 | "%s: HDD context is not valid", __func__); |
| 3348 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3349 | } |
| 3350 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3351 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 3352 | __func__, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3353 | |
| 3354 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3355 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3356 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3357 | key_index); |
| 3358 | |
| 3359 | return -EINVAL; |
| 3360 | } |
| 3361 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3362 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 3363 | { |
| 3364 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 3365 | params->key_len); |
| 3366 | |
| 3367 | return -EINVAL; |
| 3368 | } |
| 3369 | |
| 3370 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3371 | "%s: called with key index = %d & key length %d", |
| 3372 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3373 | |
| 3374 | /*extract key idx, key len and key*/ |
| 3375 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3376 | setKey.keyId = key_index; |
| 3377 | setKey.keyLength = params->key_len; |
| 3378 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 3379 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3380 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3381 | { |
| 3382 | case WLAN_CIPHER_SUITE_WEP40: |
| 3383 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3384 | break; |
| 3385 | |
| 3386 | case WLAN_CIPHER_SUITE_WEP104: |
| 3387 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3388 | break; |
| 3389 | |
| 3390 | case WLAN_CIPHER_SUITE_TKIP: |
| 3391 | { |
| 3392 | u8 *pKey = &setKey.Key[0]; |
| 3393 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3394 | |
| 3395 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 3396 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3397 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | |
| 3399 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3400 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3401 | |--------------|----------|----------| |
| 3402 | <---16bytes---><--8bytes--><--8bytes--> |
| 3403 | |
| 3404 | */ |
| 3405 | /*Sme expects the 32 bytes key to be in the below order |
| 3406 | |
| 3407 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3408 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3409 | |--------------|----------|----------| |
| 3410 | <---16bytes---><--8bytes--><--8bytes--> |
| 3411 | */ |
| 3412 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3413 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3414 | |
| 3415 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3416 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3417 | |
| 3418 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3419 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | |
| 3421 | |
| 3422 | break; |
| 3423 | } |
| 3424 | |
| 3425 | case WLAN_CIPHER_SUITE_CCMP: |
| 3426 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 3427 | break; |
| 3428 | |
| 3429 | #ifdef FEATURE_WLAN_WAPI |
| 3430 | case WLAN_CIPHER_SUITE_SMS4: |
| 3431 | { |
| 3432 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3433 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 3434 | params->key, params->key_len); |
| 3435 | return 0; |
| 3436 | } |
| 3437 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3439 | #ifdef FEATURE_WLAN_CCX |
| 3440 | case WLAN_CIPHER_SUITE_KRK: |
| 3441 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 3442 | break; |
| 3443 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3444 | |
| 3445 | #ifdef WLAN_FEATURE_11W |
| 3446 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 3447 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 3448 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3449 | #endif |
| 3450 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3451 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3452 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3453 | __func__, params->cipher); |
| 3454 | return -EOPNOTSUPP; |
| 3455 | } |
| 3456 | |
| 3457 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 3458 | __func__, setKey.encType); |
| 3459 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3460 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3461 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3462 | (!pairwise) |
| 3463 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3464 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3465 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3466 | ) |
| 3467 | { |
| 3468 | /* set group key*/ |
| 3469 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3470 | "%s- %d: setting Broadcast key", |
| 3471 | __func__, __LINE__); |
| 3472 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3473 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3474 | } |
| 3475 | else |
| 3476 | { |
| 3477 | /* set pairwise key*/ |
| 3478 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3479 | "%s- %d: setting pairwise key", |
| 3480 | __func__, __LINE__); |
| 3481 | setKey.keyDirection = eSIR_TX_RX; |
| 3482 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 3483 | } |
| 3484 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 3485 | { |
| 3486 | setKey.keyDirection = eSIR_TX_RX; |
| 3487 | /*Set the group key*/ |
| 3488 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3489 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3491 | if ( 0 != status ) |
| 3492 | { |
| 3493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3494 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 3495 | return -EINVAL; |
| 3496 | } |
| 3497 | /*Save the keys here and call sme_RoamSetKey for setting |
| 3498 | the PTK after peer joins the IBSS network*/ |
| 3499 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 3500 | &setKey, sizeof(tCsrRoamSetKey)); |
| 3501 | return status; |
| 3502 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3503 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 3504 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 3505 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3506 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3507 | if( pHostapdState->bssState == BSS_START ) |
| 3508 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3509 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 3510 | |
| 3511 | if ( status != eHAL_STATUS_SUCCESS ) |
| 3512 | { |
| 3513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3514 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 3515 | __LINE__, status ); |
| 3516 | } |
| 3517 | } |
| 3518 | |
| 3519 | /* Saving WEP keys */ |
| 3520 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 3521 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 3522 | { |
| 3523 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 3524 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3525 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 3526 | } |
| 3527 | else |
| 3528 | { |
| 3529 | //Save the key in ap context. Issue setkey after the BSS is started. |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3530 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3531 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 3532 | } |
| 3533 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3534 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 3535 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3536 | { |
| 3537 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3538 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3539 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3540 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3541 | if (!pairwise) |
| 3542 | #else |
| 3543 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 3544 | #endif |
| 3545 | { |
| 3546 | /* set group key*/ |
| 3547 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 3548 | { |
| 3549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3550 | "%s- %d: Perform Set key Complete", |
| 3551 | __func__, __LINE__); |
| 3552 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 3553 | } |
| 3554 | } |
| 3555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3556 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 3557 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 3558 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 3559 | |
| 3560 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3561 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3562 | params->key, params->key_len); |
| 3563 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3565 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3566 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3567 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3568 | "%s: set key for peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3569 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3570 | setKey.peerMac[2], setKey.peerMac[3], |
| 3571 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3572 | setKey.keyDirection); |
| 3573 | |
| 3574 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 3575 | |
| 3576 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 3577 | { |
| 3578 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3579 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 3580 | __LINE__, vos_status ); |
| 3581 | |
| 3582 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3583 | |
| 3584 | return -EINVAL; |
| 3585 | |
| 3586 | } |
| 3587 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3588 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3589 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 3590 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 3591 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3592 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3593 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3594 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3595 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 3596 | "%s: Update PreAuth Key success", __func__); |
| 3597 | return 0; |
| 3598 | } |
| 3599 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 3600 | { |
| 3601 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3602 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 3603 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3604 | } |
| 3605 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3606 | |
| 3607 | /* issue set key request to SME*/ |
| 3608 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3609 | pAdapter->sessionId, &setKey, &roamId ); |
| 3610 | |
| 3611 | if ( 0 != status ) |
| 3612 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3613 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3614 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 3615 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3616 | return -EINVAL; |
| 3617 | } |
| 3618 | |
| 3619 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3620 | /* in case of IBSS as there was no information available about WEP keys during |
| 3621 | * 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] | 3622 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3623 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 3624 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 3625 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3626 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 3627 | ) |
| 3628 | && |
| 3629 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 3630 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 3631 | ) |
| 3632 | ) |
| 3633 | { |
| 3634 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3635 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3636 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3637 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3638 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3639 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3640 | setKey.peerMac[2], setKey.peerMac[3], |
| 3641 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3642 | setKey.keyDirection); |
| 3643 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3644 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3645 | pAdapter->sessionId, &setKey, &roamId ); |
| 3646 | |
| 3647 | if ( 0 != status ) |
| 3648 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3649 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3650 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3651 | __func__, status); |
| 3652 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3653 | return -EINVAL; |
| 3654 | } |
| 3655 | } |
| 3656 | } |
| 3657 | |
| 3658 | return 0; |
| 3659 | } |
| 3660 | |
| 3661 | /* |
| 3662 | * FUNCTION: wlan_hdd_cfg80211_get_key |
| 3663 | * This function is used to get the key information |
| 3664 | */ |
| 3665 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3666 | static int wlan_hdd_cfg80211_get_key( |
| 3667 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3669 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3670 | const u8 *mac_addr, void *cookie, |
| 3671 | void (*callback)(void *cookie, struct key_params*) |
| 3672 | ) |
| 3673 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3674 | static int wlan_hdd_cfg80211_get_key( |
| 3675 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | struct net_device *ndev, |
| 3677 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 3678 | void (*callback)(void *cookie, struct key_params*) |
| 3679 | ) |
| 3680 | #endif |
| 3681 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3682 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3683 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3684 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3685 | struct key_params params; |
| 3686 | |
| 3687 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3688 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3689 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3690 | __func__,pAdapter->device_mode); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3692 | memset(¶ms, 0, sizeof(params)); |
| 3693 | |
| 3694 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3695 | { |
| 3696 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3698 | |
| 3699 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 3700 | { |
| 3701 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3702 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3703 | break; |
| 3704 | |
| 3705 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3706 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3707 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 3708 | break; |
| 3709 | |
| 3710 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3711 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3712 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 3713 | break; |
| 3714 | |
| 3715 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3716 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 3717 | break; |
| 3718 | |
| 3719 | case eCSR_ENCRYPT_TYPE_AES: |
| 3720 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 3721 | break; |
| 3722 | |
| 3723 | default: |
| 3724 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3725 | break; |
| 3726 | } |
| 3727 | |
| 3728 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 3729 | params.seq_len = 0; |
| 3730 | params.seq = NULL; |
| 3731 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 3732 | callback(cookie, ¶ms); |
| 3733 | return 0; |
| 3734 | } |
| 3735 | |
| 3736 | /* |
| 3737 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 3738 | * This function is used to delete the key information |
| 3739 | */ |
| 3740 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3741 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3743 | u8 key_index, |
| 3744 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | const u8 *mac_addr |
| 3746 | ) |
| 3747 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3748 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3749 | struct net_device *ndev, |
| 3750 | u8 key_index, |
| 3751 | const u8 *mac_addr |
| 3752 | ) |
| 3753 | #endif |
| 3754 | { |
| 3755 | int status = 0; |
| 3756 | |
| 3757 | //This code needs to be revisited. There is sme_removeKey API, we should |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3758 | //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] | 3759 | //it is observed that this is invalidating peer |
| 3760 | //key index whenever re-key is done. This is affecting data link. |
| 3761 | //It should be ok to ignore del_key. |
| 3762 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3763 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 3764 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3765 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3766 | tCsrRoamSetKey setKey; |
| 3767 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3769 | ENTER(); |
| 3770 | |
| 3771 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 3772 | __func__,pAdapter->device_mode); |
| 3773 | |
| 3774 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3775 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3776 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3777 | key_index); |
| 3778 | |
| 3779 | return -EINVAL; |
| 3780 | } |
| 3781 | |
| 3782 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3783 | setKey.keyId = key_index; |
| 3784 | |
| 3785 | if (mac_addr) |
| 3786 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 3787 | else |
| 3788 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 3789 | |
| 3790 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 3791 | |
| 3792 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3793 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3794 | ) |
| 3795 | { |
| 3796 | |
| 3797 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3798 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 3799 | if( pHostapdState->bssState == BSS_START) |
| 3800 | { |
| 3801 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3803 | if ( status != eHAL_STATUS_SUCCESS ) |
| 3804 | { |
| 3805 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3806 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 3807 | __LINE__, status ); |
| 3808 | } |
| 3809 | } |
| 3810 | } |
| 3811 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3812 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3813 | ) |
| 3814 | { |
| 3815 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3816 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3817 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3818 | |
| 3819 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3820 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3821 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3822 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3823 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3824 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 3825 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3826 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3827 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3828 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3829 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3830 | if ( 0 != status ) |
| 3831 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3832 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3833 | "%s: sme_RoamSetKey failure, returned %d", |
| 3834 | __func__, status); |
| 3835 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3836 | return -EINVAL; |
| 3837 | } |
| 3838 | } |
| 3839 | } |
| 3840 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3841 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3842 | return status; |
| 3843 | } |
| 3844 | |
| 3845 | /* |
| 3846 | * FUNCTION: wlan_hdd_cfg80211_set_default_key |
| 3847 | * This function is used to set the default tx key index |
| 3848 | */ |
| 3849 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3850 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 3851 | struct net_device *ndev, |
| 3852 | u8 key_index, |
| 3853 | bool unicast, bool multicast) |
| 3854 | #else |
| 3855 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 3856 | struct net_device *ndev, |
| 3857 | u8 key_index) |
| 3858 | #endif |
| 3859 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3860 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3861 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3862 | hdd_wext_state_t *pWextState; |
| 3863 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3864 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3865 | |
| 3866 | ENTER(); |
| 3867 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3868 | if ((NULL == pAdapter)) |
| 3869 | { |
| 3870 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3871 | "invalid adapter"); |
| 3872 | return -EINVAL; |
| 3873 | } |
| 3874 | |
| 3875 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3876 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3877 | |
| 3878 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 3879 | { |
| 3880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3881 | "invalid Wext state or HDD context"); |
| 3882 | return -EINVAL; |
| 3883 | } |
| 3884 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3885 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3886 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3888 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3889 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3890 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3891 | key_index); |
| 3892 | |
| 3893 | return -EINVAL; |
| 3894 | } |
| 3895 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3896 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3897 | status = wlan_hdd_validate_context(pHddCtx); |
| 3898 | |
| 3899 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3900 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3901 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3902 | "%s: HDD context is not valid", __func__); |
| 3903 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3904 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3905 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3906 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3907 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3908 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3909 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3910 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 3911 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3912 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 3913 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3914 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3915 | { |
| 3916 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3917 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3919 | tCsrRoamSetKey setKey; |
| 3920 | v_U32_t roamId= 0xFF; |
| 3921 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3922 | |
| 3923 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3924 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3925 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3926 | Keys->defaultIndex = (u8)key_index; |
| 3927 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3928 | setKey.keyId = key_index; |
| 3929 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3930 | |
| 3931 | vos_mem_copy(&setKey.Key[0], |
| 3932 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3933 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3934 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3935 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3936 | |
| 3937 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3938 | &pHddStaCtx->conn_info.bssId[0], |
| 3939 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3940 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3941 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 3942 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 3943 | eCSR_ENCRYPT_TYPE_WEP104) |
| 3944 | { |
| 3945 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 3946 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 3947 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 3948 | type(104) and switching encryption type to 40*/ |
| 3949 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 3950 | eCSR_ENCRYPT_TYPE_WEP40; |
| 3951 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 3952 | eCSR_ENCRYPT_TYPE_WEP40; |
| 3953 | } |
| 3954 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3955 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3956 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3958 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3959 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3960 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3961 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | if ( 0 != status ) |
| 3963 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3964 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3965 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3966 | status); |
| 3967 | return -EINVAL; |
| 3968 | } |
| 3969 | } |
| 3970 | } |
| 3971 | |
| 3972 | /* In SoftAp mode setting key direction for default mode */ |
| 3973 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 3974 | { |
| 3975 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 3976 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 3977 | (eCSR_ENCRYPT_TYPE_AES != |
| 3978 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 3979 | ) |
| 3980 | { |
| 3981 | /* Saving key direction for default key index to TX default */ |
| 3982 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3983 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 3984 | } |
| 3985 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3987 | return status; |
| 3988 | } |
| 3989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | /* |
| 3991 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 3992 | * This function is used to inform the BSS details to nl80211 interface. |
| 3993 | */ |
| 3994 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 3995 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 3996 | { |
| 3997 | struct net_device *dev = pAdapter->dev; |
| 3998 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 3999 | struct wiphy *wiphy = wdev->wiphy; |
| 4000 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 4001 | int chan_no; |
| 4002 | int ie_length; |
| 4003 | const char *ie; |
| 4004 | unsigned int freq; |
| 4005 | struct ieee80211_channel *chan; |
| 4006 | int rssi = 0; |
| 4007 | struct cfg80211_bss *bss = NULL; |
| 4008 | |
| 4009 | ENTER(); |
| 4010 | |
| 4011 | if( NULL == pBssDesc ) |
| 4012 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4013 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4014 | return bss; |
| 4015 | } |
| 4016 | |
| 4017 | chan_no = pBssDesc->channelId; |
| 4018 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 4019 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 4020 | |
| 4021 | if( NULL == ie ) |
| 4022 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4023 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: IE of BSS descriptor is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4024 | return bss; |
| 4025 | } |
| 4026 | |
| 4027 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 4028 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 4029 | { |
| 4030 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 4031 | } |
| 4032 | else |
| 4033 | { |
| 4034 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 4035 | } |
| 4036 | #else |
| 4037 | freq = ieee80211_channel_to_frequency(chan_no); |
| 4038 | #endif |
| 4039 | |
| 4040 | chan = __ieee80211_get_channel(wiphy, freq); |
| 4041 | |
| 4042 | bss = cfg80211_get_bss(wiphy, chan, pBssDesc->bssId, |
| 4043 | &roamProfile->SSID.ssId[0], roamProfile->SSID.length, |
| 4044 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
| 4045 | if (bss == NULL) |
| 4046 | { |
| 4047 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
| 4048 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4049 | return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
| 4050 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4051 | pBssDesc->capabilityInfo, |
| 4052 | pBssDesc->beaconInterval, ie, ie_length, |
| 4053 | rssi, GFP_KERNEL )); |
| 4054 | } |
| 4055 | else |
| 4056 | { |
| 4057 | return bss; |
| 4058 | } |
| 4059 | } |
| 4060 | |
| 4061 | |
| 4062 | |
| 4063 | /* |
| 4064 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 4065 | * This function is used to inform the BSS details to nl80211 interface. |
| 4066 | */ |
| 4067 | struct cfg80211_bss* |
| 4068 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 4069 | tSirBssDescription *bss_desc |
| 4070 | ) |
| 4071 | { |
| 4072 | /* |
| 4073 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 4074 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 4075 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 4076 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 4077 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 4078 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 4079 | cfg80211_inform_bss_frame. |
| 4080 | */ |
| 4081 | struct net_device *dev = pAdapter->dev; |
| 4082 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4083 | struct wiphy *wiphy = wdev->wiphy; |
| 4084 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 4085 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 4086 | qcom_ie_age *qie_age = NULL; |
| 4087 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 4088 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4089 | 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] | 4090 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4091 | const char *ie = |
| 4092 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 4093 | unsigned int freq; |
| 4094 | struct ieee80211_channel *chan; |
| 4095 | struct ieee80211_mgmt *mgmt = |
| 4096 | kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
| 4097 | struct cfg80211_bss *bss_status = NULL; |
| 4098 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 4099 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4100 | hdd_context_t *pHddCtx; |
| 4101 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4102 | #ifdef WLAN_OPEN_SOURCE |
| 4103 | struct timespec ts; |
| 4104 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4105 | |
| 4106 | ENTER(); |
| 4107 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4108 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4109 | status = wlan_hdd_validate_context(pHddCtx); |
| 4110 | |
| 4111 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
| 4112 | if (pHddCtx->isLoadUnloadInProgress) |
| 4113 | { |
| 4114 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4115 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 4116 | return NULL; |
| 4117 | } |
| 4118 | |
| 4119 | |
| 4120 | if (0 != status) |
| 4121 | { |
| 4122 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4123 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 4124 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4125 | } |
| 4126 | |
| 4127 | |
| 4128 | if (!mgmt) |
| 4129 | { |
| 4130 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4131 | "%s: memory allocation failed ", __func__); |
| 4132 | return NULL; |
| 4133 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 4134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4135 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4136 | |
| 4137 | #ifdef WLAN_OPEN_SOURCE |
| 4138 | /* Android does not want the timestamp from the frame. |
| 4139 | Instead it wants a monotonic increasing value */ |
| 4140 | get_monotonic_boottime(&ts); |
| 4141 | mgmt->u.probe_resp.timestamp = |
| 4142 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 4143 | #else |
| 4144 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4145 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 4146 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4147 | |
| 4148 | #endif |
| 4149 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4150 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 4151 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 4152 | |
| 4153 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 4154 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 4155 | /* Assuming this is the last IE, copy at the end */ |
| 4156 | ie_length -=sizeof(qcom_ie_age); |
| 4157 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 4158 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 4159 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 4160 | qie_age->oui_1 = QCOM_OUI1; |
| 4161 | qie_age->oui_2 = QCOM_OUI2; |
| 4162 | qie_age->oui_3 = QCOM_OUI3; |
| 4163 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 4164 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 4165 | #endif |
| 4166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4167 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 4168 | if (bss_desc->fProbeRsp) |
| 4169 | { |
| 4170 | mgmt->frame_control |= |
| 4171 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 4172 | } |
| 4173 | else |
| 4174 | { |
| 4175 | mgmt->frame_control |= |
| 4176 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 4177 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4178 | |
| 4179 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4180 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4181 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 4182 | { |
| 4183 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 4184 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4185 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4186 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 4187 | |
| 4188 | { |
| 4189 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 4190 | } |
| 4191 | else |
| 4192 | { |
| 4193 | kfree(mgmt); |
| 4194 | return NULL; |
| 4195 | } |
| 4196 | #else |
| 4197 | freq = ieee80211_channel_to_frequency(chan_no); |
| 4198 | #endif |
| 4199 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 4200 | /*when the band is changed on the fly using the GUI, three things are done |
| 4201 | * 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) |
| 4202 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 4203 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 4204 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 4205 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 4206 | * 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 |
| 4207 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 4208 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 4209 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 4210 | * So drop the bss and continue to next bss. |
| 4211 | */ |
| 4212 | if(chan == NULL) |
| 4213 | { |
| 4214 | hddLog(VOS_TRACE_LEVEL_INFO, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 4215 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 4216 | return NULL; |
| 4217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | /*To keep the rssi icon of the connected AP in the scan window |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4219 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4220 | * */ |
| 4221 | if (( eConnectionState_Associated == |
| 4222 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 4223 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 4224 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 4225 | WNI_CFG_BSSID_LEN))) |
| 4226 | { |
| 4227 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 4228 | rssi = (pAdapter->rssi * 100); |
| 4229 | } |
| 4230 | else |
| 4231 | { |
| 4232 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 4233 | } |
| 4234 | |
| 4235 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 4236 | frame_len, rssi, GFP_KERNEL); |
| 4237 | kfree(mgmt); |
| 4238 | return bss_status; |
| 4239 | } |
| 4240 | |
| 4241 | /* |
| 4242 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 4243 | * This function is used to update the BSS data base of CFG8011 |
| 4244 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4245 | 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] | 4246 | tCsrRoamInfo *pRoamInfo |
| 4247 | ) |
| 4248 | { |
| 4249 | tCsrRoamConnectedProfile roamProfile; |
| 4250 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4251 | struct cfg80211_bss *bss = NULL; |
| 4252 | |
| 4253 | ENTER(); |
| 4254 | |
| 4255 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 4256 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 4257 | |
| 4258 | if (NULL != roamProfile.pBssDesc) |
| 4259 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4260 | bss = wlan_hdd_cfg80211_inform_bss(pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4261 | &roamProfile); |
| 4262 | |
| 4263 | if (NULL == bss) |
| 4264 | { |
| 4265 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 4266 | __func__); |
| 4267 | } |
| 4268 | |
| 4269 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 4270 | } |
| 4271 | else |
| 4272 | { |
| 4273 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 4274 | __func__); |
| 4275 | } |
| 4276 | return bss; |
| 4277 | } |
| 4278 | |
| 4279 | /* |
| 4280 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 4281 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4282 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 4283 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4284 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4285 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4286 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4287 | tCsrScanResultInfo *pScanResult; |
| 4288 | eHalStatus status = 0; |
| 4289 | tScanResultHandle pResult; |
| 4290 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4291 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | |
| 4293 | ENTER(); |
| 4294 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4295 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4296 | |
| 4297 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4298 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4299 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4300 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 4301 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4302 | } |
| 4303 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4304 | |
| 4305 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
| 4306 | if (pHddCtx->isLoadUnloadInProgress) |
| 4307 | { |
| 4308 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4309 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 4310 | return VOS_STATUS_E_PERM; |
| 4311 | } |
| 4312 | |
| 4313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | /* |
| 4315 | * start getting scan results and populate cgf80211 BSS database |
| 4316 | */ |
| 4317 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 4318 | |
| 4319 | /* no scan results */ |
| 4320 | if (NULL == pResult) |
| 4321 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4322 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4323 | return status; |
| 4324 | } |
| 4325 | |
| 4326 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 4327 | |
| 4328 | while (pScanResult) |
| 4329 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4330 | /* |
| 4331 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 4332 | * entry already exists in bss data base of cfg80211 for that |
| 4333 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 4334 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 4335 | * mgmt packet as input. As of now there is no possibility to get |
| 4336 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4337 | * ieee80211_mgmt(probe response) and passing to c |
| 4338 | * fg80211_inform_bss_frame. |
| 4339 | * */ |
| 4340 | |
| 4341 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4342 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4343 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4344 | |
| 4345 | if (NULL == bss_status) |
| 4346 | { |
| 4347 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4348 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4349 | } |
| 4350 | else |
| 4351 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 4352 | cfg80211_put_bss( |
| 4353 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 4354 | wiphy, |
| 4355 | #endif |
| 4356 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4357 | } |
| 4358 | |
| 4359 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 4360 | } |
| 4361 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4362 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4363 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4364 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4365 | } |
| 4366 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4367 | void |
| 4368 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 4369 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4370 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 4371 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4372 | } /****** end hddPrintMacAddr() ******/ |
| 4373 | |
| 4374 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4375 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4376 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4377 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4378 | "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4379 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 4380 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 4381 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4382 | } /****** end hddPrintPmkId() ******/ |
| 4383 | |
| 4384 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 4385 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 4386 | |
| 4387 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 4388 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 4389 | |
| 4390 | #define dump_bssid(bssid) \ |
| 4391 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4392 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 4393 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4394 | } |
| 4395 | |
| 4396 | #define dump_pmkid(pMac, pmkid) \ |
| 4397 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4398 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 4399 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4400 | } |
| 4401 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4402 | #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] | 4403 | /* |
| 4404 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 4405 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 4406 | */ |
| 4407 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4408 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4409 | int index, bool preauth ) |
| 4410 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4411 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4412 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4413 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4414 | |
| 4415 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4416 | 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] | 4417 | |
| 4418 | if( NULL == pRoamInfo ) |
| 4419 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4420 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4421 | return -EINVAL; |
| 4422 | } |
| 4423 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4424 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 4425 | { |
| 4426 | dump_bssid(pRoamInfo->bssid); |
| 4427 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4428 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4429 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4430 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4431 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4432 | } |
| 4433 | #endif //FEATURE_WLAN_LFR |
| 4434 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4435 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4436 | /* |
| 4437 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 4438 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 4439 | * |
| 4440 | */ |
| 4441 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 4442 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 4443 | tCsrRoamInfo *pRoamInfo) |
| 4444 | { |
| 4445 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4446 | union iwreq_data wrqu; |
| 4447 | |
| 4448 | ENTER(); |
| 4449 | |
| 4450 | if (NULL == pAdapter) |
| 4451 | { |
| 4452 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4453 | return VOS_STATUS_E_FAILURE; |
| 4454 | } |
| 4455 | |
| 4456 | /* create the event */ |
| 4457 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4458 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4459 | |
| 4460 | wrqu.data.pointer = metrics_notification; |
| 4461 | wrqu.data.length = scnprintf(metrics_notification, |
| 4462 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 4463 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4464 | |
| 4465 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4466 | |
| 4467 | EXIT(); |
| 4468 | |
| 4469 | return VOS_STATUS_SUCCESS; |
| 4470 | } |
| 4471 | |
| 4472 | /* |
| 4473 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 4474 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 4475 | * or failure |
| 4476 | */ |
| 4477 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 4478 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 4479 | { |
| 4480 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4481 | union iwreq_data wrqu; |
| 4482 | |
| 4483 | ENTER(); |
| 4484 | |
| 4485 | if (NULL == pAdapter) |
| 4486 | { |
| 4487 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4488 | return VOS_STATUS_E_FAILURE; |
| 4489 | } |
| 4490 | |
| 4491 | /* create the event */ |
| 4492 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4493 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4494 | |
| 4495 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 4496 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 4497 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4498 | |
| 4499 | if (1 == preauth_status) |
| 4500 | strncat(metrics_notification, " TRUE", 5); |
| 4501 | else |
| 4502 | strncat(metrics_notification, " FALSE", 6); |
| 4503 | |
| 4504 | wrqu.data.pointer = metrics_notification; |
| 4505 | wrqu.data.length = strlen(metrics_notification); |
| 4506 | |
| 4507 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4508 | |
| 4509 | EXIT(); |
| 4510 | |
| 4511 | return VOS_STATUS_SUCCESS; |
| 4512 | } |
| 4513 | |
| 4514 | /* |
| 4515 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 4516 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 4517 | * |
| 4518 | */ |
| 4519 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 4520 | tCsrRoamInfo *pRoamInfo) |
| 4521 | { |
| 4522 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4523 | union iwreq_data wrqu; |
| 4524 | |
| 4525 | ENTER(); |
| 4526 | |
| 4527 | if (NULL == pAdapter) |
| 4528 | { |
| 4529 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4530 | return VOS_STATUS_E_FAILURE; |
| 4531 | } |
| 4532 | |
| 4533 | /* create the event */ |
| 4534 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4535 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4536 | |
| 4537 | wrqu.data.pointer = metrics_notification; |
| 4538 | wrqu.data.length = scnprintf(metrics_notification, |
| 4539 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 4540 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4541 | |
| 4542 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4543 | |
| 4544 | EXIT(); |
| 4545 | |
| 4546 | return VOS_STATUS_SUCCESS; |
| 4547 | } |
| 4548 | #endif |
| 4549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4550 | /* |
| 4551 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 4552 | * scanning callback function, called after finishing scan |
| 4553 | * |
| 4554 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4555 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4556 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 4557 | { |
| 4558 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4559 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4560 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4561 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4562 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | struct cfg80211_scan_request *req = NULL; |
| 4564 | int ret = 0; |
| 4565 | |
| 4566 | ENTER(); |
| 4567 | |
| 4568 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4569 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4570 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4571 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 4572 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 4573 | pScanInfo->mScanPendingCounter = 0; |
| 4574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | //Block on scan req completion variable. Can't wait forever though. |
| 4576 | ret = wait_for_completion_interruptible_timeout( |
| 4577 | &pScanInfo->scan_req_completion_event, |
| 4578 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
| 4579 | if (!ret) |
| 4580 | { |
| 4581 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4582 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4583 | } |
| 4584 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4585 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | { |
| 4587 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4588 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4589 | } |
| 4590 | |
| 4591 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4592 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4593 | { |
| 4594 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4595 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4596 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4597 | (int) scanId); |
| 4598 | } |
| 4599 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4600 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | pAdapter); |
| 4602 | |
| 4603 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4604 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4605 | |
| 4606 | |
| 4607 | /* If any client wait scan result through WEXT |
| 4608 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4609 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4610 | { |
| 4611 | /* The other scan request waiting for current scan finish |
| 4612 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4613 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4615 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | } |
| 4617 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4618 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4619 | { |
| 4620 | struct net_device *dev = pAdapter->dev; |
| 4621 | union iwreq_data wrqu; |
| 4622 | int we_event; |
| 4623 | char *msg; |
| 4624 | |
| 4625 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4626 | we_event = SIOCGIWSCAN; |
| 4627 | msg = NULL; |
| 4628 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 4629 | } |
| 4630 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4631 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4632 | |
| 4633 | /* Get the Scan Req */ |
| 4634 | req = pAdapter->request; |
| 4635 | |
| 4636 | if (!req) |
| 4637 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4638 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4639 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4640 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4641 | } |
| 4642 | |
| 4643 | /* |
| 4644 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4645 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4646 | req->n_ssids = 0; |
| 4647 | req->n_channels = 0; |
| 4648 | req->ie = 0; |
| 4649 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4650 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4651 | /* Scan is no longer pending */ |
| 4652 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4653 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 4654 | /* |
| 4655 | * cfg80211_scan_done informing NL80211 about completion |
| 4656 | * of scanning |
| 4657 | */ |
| 4658 | cfg80211_scan_done(req, false); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 4659 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4660 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4661 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4662 | /* release the wake lock at the end of the scan*/ |
| 4663 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4664 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4665 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 4666 | * immediatly after the driver gets connect request(i.e after scan) |
| 4667 | * from supplicant, this result in app's is suspending and not able |
| 4668 | * to process the connect request to AP */ |
Amar Singhal | 6144c00 | 2013-05-03 16:11:42 -0700 | [diff] [blame] | 4669 | hdd_allow_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4670 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4671 | #ifdef FEATURE_WLAN_TDLS |
| 4672 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 4673 | #endif |
| 4674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4675 | EXIT(); |
| 4676 | return 0; |
| 4677 | } |
| 4678 | |
| 4679 | /* |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4680 | * FUNCTION: hdd_isScanAllowed |
| 4681 | * Go through each adapter and check if scan allowed |
| 4682 | * |
| 4683 | */ |
| 4684 | v_BOOL_t hdd_isScanAllowed( hdd_context_t *pHddCtx ) |
| 4685 | { |
| 4686 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 4687 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 4688 | hdd_adapter_t *pAdapter = NULL; |
| 4689 | VOS_STATUS status = 0; |
| 4690 | v_U8_t staId = 0; |
| 4691 | v_U8_t *staMac = NULL; |
| 4692 | |
| 4693 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 4694 | |
| 4695 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 4696 | { |
| 4697 | pAdapter = pAdapterNode->pAdapter; |
| 4698 | |
| 4699 | if( pAdapter ) |
| 4700 | { |
| 4701 | hddLog(VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4702 | "%s: Adapter with device mode %d exists", |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4703 | __func__, pAdapter->device_mode); |
| 4704 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 4705 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 4706 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
| 4707 | { |
| 4708 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4709 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 4710 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 4711 | { |
| 4712 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 4713 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 4714 | "%s: client " MAC_ADDRESS_STR |
| 4715 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 4716 | MAC_ADDR_ARRAY(staMac)); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4717 | return VOS_FALSE; |
| 4718 | } |
| 4719 | } |
| 4720 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 4721 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 4722 | { |
| 4723 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 4724 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4725 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4726 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 4727 | { |
| 4728 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 4729 | |
| 4730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 4731 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 4732 | "middle of WPS/EAPOL exchange.", __func__, |
| 4733 | MAC_ADDR_ARRAY(staMac)); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4734 | return VOS_FALSE; |
| 4735 | } |
| 4736 | } |
| 4737 | } |
| 4738 | } |
| 4739 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 4740 | pAdapterNode = pNext; |
| 4741 | } |
| 4742 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4743 | "%s: Scan allowed", __func__); |
| 4744 | return VOS_TRUE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4745 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4746 | |
| 4747 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4748 | * FUNCTION: wlan_hdd_cfg80211_scan |
| 4749 | * this scan respond to scan trigger and update cfg80211 scan database |
| 4750 | * later, scan dump command can be used to recieve scan results |
| 4751 | */ |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 4752 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 4753 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 4754 | struct net_device *dev, |
| 4755 | #endif |
| 4756 | struct cfg80211_scan_request *request) |
| 4757 | { |
| 4758 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 4759 | struct net_device *dev = request->wdev->netdev; |
| 4760 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4761 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4762 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 4763 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4764 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4765 | tCsrScanRequest scanRequest; |
| 4766 | tANI_U8 *channelList = NULL, i; |
| 4767 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4768 | int status; |
| 4769 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4770 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4771 | |
| 4772 | ENTER(); |
| 4773 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4774 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4775 | __func__,pAdapter->device_mode); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4776 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4777 | status = wlan_hdd_validate_context(pHddCtx); |
| 4778 | |
| 4779 | if (0 != status) |
| 4780 | { |
| 4781 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4782 | "%s: HDD context is not valid", __func__); |
| 4783 | return status; |
| 4784 | } |
| 4785 | |
| 4786 | cfg_param = pHddCtx->cfg_ini; |
| 4787 | pScanInfo = &pHddCtx->scan_info; |
| 4788 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4789 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4790 | (eConnectionState_Connecting == |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4791 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4792 | { |
| 4793 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 4794 | "%s: %p(%d) Connection in progress: Scan request denied (EBUSY)", __func__, \ |
| 4795 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4796 | return -EBUSY; |
| 4797 | } |
| 4798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4799 | #ifdef WLAN_BTAMP_FEATURE |
| 4800 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4801 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4802 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 4803 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4804 | "%s: No scanning when AMP is on", __func__); |
| 4805 | return -EOPNOTSUPP; |
| 4806 | } |
| 4807 | #endif |
| 4808 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4809 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4810 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4812 | "%s: Not scanning on device_mode = %d", |
| 4813 | __func__, pAdapter->device_mode); |
| 4814 | return -EOPNOTSUPP; |
| 4815 | } |
| 4816 | |
| 4817 | if (TRUE == pScanInfo->mScanPending) |
| 4818 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 4819 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 4820 | { |
| 4821 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 4822 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4823 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | } |
| 4825 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4826 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4827 | //Channel and action frame is pending |
| 4828 | //Otherwise Cancel Remain On Channel and allow Scan |
| 4829 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4830 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4831 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 4832 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4833 | return -EBUSY; |
| 4834 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4835 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4836 | /* if tdls disagree scan right now, return immediately. |
| 4837 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 4838 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 4839 | */ |
| 4840 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 4841 | wiphy, |
| 4842 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 4843 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 4844 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4845 | request); |
| 4846 | if(status <= 0) |
| 4847 | { |
| 4848 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: TDLS Pending %d", __func__, status); |
| 4849 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4850 | } |
| 4851 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4852 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4853 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 4854 | { |
| 4855 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 4856 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4857 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 4860 | { |
| 4861 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 4862 | "%s: MAX TM Level Scan not allowed", __func__); |
| 4863 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4864 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4865 | } |
| 4866 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 4867 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4868 | /* Check if scan is allowed at this point of time. |
| 4869 | */ |
| 4870 | if (!hdd_isScanAllowed(pHddCtx)) |
| 4871 | { |
| 4872 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 4873 | return -EBUSY; |
| 4874 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 4877 | |
| 4878 | if (NULL != request) |
| 4879 | { |
| 4880 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4881 | (int)request->n_ssids); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4882 | |
| 4883 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 4884 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 4885 | * is not aging out the scan results. |
| 4886 | */ |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4887 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4888 | { |
| 4889 | request->n_ssids = 0; |
| 4890 | } |
| 4891 | |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4892 | if ((request->ssids) && (0 < request->n_ssids)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4893 | { |
| 4894 | tCsrSSIDInfo *SsidInfo; |
| 4895 | int j; |
| 4896 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 4897 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 4898 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 4899 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 4900 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 4901 | |
| 4902 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 4903 | { |
| 4904 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4905 | "memory alloc failed SSIDInfo buffer"); |
| 4906 | return -ENOMEM; |
| 4907 | } |
| 4908 | |
| 4909 | /* copy all the ssid's and their length */ |
| 4910 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 4911 | { |
| 4912 | /* get the ssid length */ |
| 4913 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 4914 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 4915 | SsidInfo->SSID.length); |
| 4916 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 4917 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d: %s", |
| 4918 | j, SsidInfo->SSID.ssId); |
| 4919 | } |
| 4920 | /* set the scan type to active */ |
| 4921 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4922 | } |
| 4923 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 4924 | { |
| 4925 | /* set the scan type to active */ |
| 4926 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4927 | } |
| 4928 | else |
| 4929 | { |
| 4930 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 4931 | scanRequest.scanType = pScanInfo->scan_mode; |
| 4932 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4933 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4934 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
| 4935 | } |
| 4936 | else |
| 4937 | { |
| 4938 | /* set the scan type to active */ |
| 4939 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 4940 | vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); |
| 4941 | |
| 4942 | /* set min and max channel time to zero */ |
| 4943 | scanRequest.minChnTime = 0; |
| 4944 | scanRequest.maxChnTime = 0; |
| 4945 | } |
| 4946 | |
| 4947 | /* set BSSType to default type */ |
| 4948 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 4949 | |
| 4950 | /*TODO: scan the requested channels only*/ |
| 4951 | |
| 4952 | /*Right now scanning all the channels */ |
| 4953 | if( request ) |
| 4954 | { |
| 4955 | if( request->n_channels ) |
| 4956 | { |
| 4957 | channelList = vos_mem_malloc( request->n_channels ); |
| 4958 | if( NULL == channelList ) |
| 4959 | { |
| 4960 | status = -ENOMEM; |
| 4961 | goto free_mem; |
| 4962 | } |
| 4963 | |
| 4964 | for( i = 0 ; i < request->n_channels ; i++ ) |
| 4965 | channelList[i] = request->channels[i]->hw_value; |
| 4966 | } |
| 4967 | |
| 4968 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 4969 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 4970 | |
| 4971 | /* set requestType to full scan */ |
| 4972 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4973 | |
| 4974 | /* 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] | 4975 | * search (Flush on both full scan and social scan but not on single |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4976 | * 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] | 4977 | */ |
| 4978 | |
| 4979 | /* Supplicant does single channel scan after 8-way handshake |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4980 | * and in that case driver shoudnt flush scan results. If |
| 4981 | * driver flushes the scan results here and unfortunately if |
| 4982 | * the AP doesnt respond to our probe req then association |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 4983 | * fails which is not desired |
| 4984 | */ |
| 4985 | |
| 4986 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 4987 | { |
| 4988 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4989 | pAdapter->sessionId ); |
| 4990 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | |
| 4992 | if( request->ie_len ) |
| 4993 | { |
| 4994 | /* save this for future association (join requires this) */ |
| 4995 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 4996 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 4997 | pScanInfo->scanAddIE.length = request->ie_len; |
| 4998 | |
| 4999 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5000 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 5001 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5002 | ) |
| 5003 | { |
| 5004 | pwextBuf->roamProfile.pAddIEScan = pScanInfo->scanAddIE.addIEdata; |
| 5005 | pwextBuf->roamProfile.nAddIEScanLength = pScanInfo->scanAddIE.length; |
| 5006 | } |
| 5007 | |
| 5008 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 5009 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 5010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5011 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 5012 | request->ie_len); |
| 5013 | if (pP2pIe != NULL) |
| 5014 | { |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 5015 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 5016 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 5017 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 5018 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5019 | { |
| 5020 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 5021 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 5022 | "Go nego completed to Connection is started"); |
| 5023 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 5024 | "for 8way Handshake"); |
| 5025 | } |
| 5026 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 5027 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5028 | { |
| 5029 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 5030 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 5031 | "Disconnected state to Connection is started"); |
| 5032 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 5033 | "for 4way Handshake"); |
| 5034 | } |
| 5035 | #endif |
| 5036 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5037 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 5038 | if(TRUE == request->no_cck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5040 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5041 | "%s: This is a P2P Search", __func__); |
| 5042 | scanRequest.p2pSearch = 1; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5043 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5044 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
| 5045 | { |
Madan Mohan Koyyalamudi | 1b1d9e8 | 2012-10-21 11:38:33 -0700 | [diff] [blame] | 5046 | /* set requestType to P2P Discovery */ |
| 5047 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5048 | } |
| 5049 | |
| 5050 | /* |
| 5051 | Skip Dfs Channel in case of P2P Search |
| 5052 | if it is set in ini file |
| 5053 | */ |
| 5054 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 5055 | { |
| 5056 | scanRequest.skipDfsChnlInP2pSearch = 1; |
| 5057 | } |
| 5058 | else |
| 5059 | { |
| 5060 | scanRequest.skipDfsChnlInP2pSearch = 0; |
| 5061 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5063 | } |
| 5064 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5065 | } |
| 5066 | } |
| 5067 | |
| 5068 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 5069 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 5070 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 5071 | * address the following issues. |
| 5072 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 5073 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 5074 | * for long time, this result in apps running at full power for long time. |
| 5075 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 5076 | * be stuck in full power because of resume BMPS |
| 5077 | */ |
| 5078 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5079 | |
| 5080 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5081 | pAdapter->sessionId, &scanRequest, &scanId, |
| 5082 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | if (eHAL_STATUS_SUCCESS != status) |
| 5085 | { |
| 5086 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5087 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 5088 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 5089 | if(eHAL_STATUS_RESOURCES == status) |
| 5090 | { |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 5091 | 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] | 5092 | status = -EBUSY; |
| 5093 | } else { |
| 5094 | status = -EIO; |
| 5095 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 5096 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | goto free_mem; |
| 5098 | } |
| 5099 | |
| 5100 | pScanInfo->mScanPending = TRUE; |
| 5101 | pAdapter->request = request; |
| 5102 | pScanInfo->scanId = scanId; |
| 5103 | |
| 5104 | complete(&pScanInfo->scan_req_completion_event); |
| 5105 | |
| 5106 | free_mem: |
| 5107 | if( scanRequest.SSIDs.SSIDList ) |
| 5108 | { |
| 5109 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 5110 | } |
| 5111 | |
| 5112 | if( channelList ) |
| 5113 | vos_mem_free( channelList ); |
| 5114 | |
| 5115 | EXIT(); |
| 5116 | |
| 5117 | return status; |
| 5118 | } |
| 5119 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5120 | |
| 5121 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 5122 | { |
| 5123 | v_U8_t iniDot11Mode = |
| 5124 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 5125 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 5126 | |
| 5127 | switch ( iniDot11Mode ) |
| 5128 | { |
| 5129 | case eHDD_DOT11_MODE_AUTO: |
| 5130 | case eHDD_DOT11_MODE_11ac: |
| 5131 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 5132 | #ifdef WLAN_FEATURE_11AC |
| 5133 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 5134 | #else |
| 5135 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 5136 | #endif |
| 5137 | break; |
| 5138 | case eHDD_DOT11_MODE_11n: |
| 5139 | case eHDD_DOT11_MODE_11n_ONLY: |
| 5140 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 5141 | break; |
| 5142 | default: |
| 5143 | hddDot11Mode = iniDot11Mode; |
| 5144 | break; |
| 5145 | } |
| 5146 | /* This call decides required channel bonding mode */ |
| 5147 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 5148 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 5149 | operationChannel); |
| 5150 | } |
| 5151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5152 | /* |
| 5153 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5154 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5155 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5156 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5157 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | { |
| 5159 | int status = 0; |
| 5160 | hdd_wext_state_t *pWextState; |
| 5161 | v_U32_t roamId; |
| 5162 | tCsrRoamProfile *pRoamProfile; |
| 5163 | eMib_dot11DesiredBssType connectedBssType; |
| 5164 | eCsrAuthType RSNAuthType; |
| 5165 | |
| 5166 | ENTER(); |
| 5167 | |
| 5168 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5170 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 5171 | { |
| 5172 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 5173 | return -EINVAL; |
| 5174 | } |
| 5175 | |
| 5176 | pRoamProfile = &pWextState->roamProfile; |
| 5177 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5178 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5179 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5180 | int ret = 0; |
| 5181 | hdd_station_ctx_t *pHddStaCtx; |
| 5182 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5183 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 5184 | |
| 5185 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 5186 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 5187 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5188 | { |
| 5189 | /* Issue disconnect to CSR */ |
| 5190 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5191 | if( eHAL_STATUS_SUCCESS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5192 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5193 | pAdapter->sessionId, |
| 5194 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 5195 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5196 | ret = wait_for_completion_interruptible_timeout( |
| 5197 | &pAdapter->disconnect_comp_var, |
| 5198 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 5199 | if (0 == ret) |
| 5200 | { |
| 5201 | VOS_ASSERT(0); |
| 5202 | } |
| 5203 | } |
| 5204 | } |
| 5205 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 5206 | { |
| 5207 | ret = wait_for_completion_interruptible_timeout( |
| 5208 | &pAdapter->disconnect_comp_var, |
| 5209 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 5210 | if (0 == ret) |
| 5211 | { |
| 5212 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5213 | } |
| 5214 | } |
| 5215 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5216 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 5218 | { |
| 5219 | /*QoS not enabled in cfg file*/ |
| 5220 | pRoamProfile->uapsd_mask = 0; |
| 5221 | } |
| 5222 | else |
| 5223 | { |
| 5224 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5225 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5226 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 5227 | } |
| 5228 | |
| 5229 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 5230 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 5231 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5232 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5233 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 5234 | ssid, ssid_len); |
| 5235 | |
| 5236 | if (bssid) |
| 5237 | { |
| 5238 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 5239 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 5240 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5241 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 5242 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | case of join failure we should send valid BSSID to supplicant |
| 5244 | */ |
| 5245 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 5246 | WNI_CFG_BSSID_LEN); |
| 5247 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 5248 | else |
| 5249 | { |
| 5250 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 5251 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5252 | |
| 5253 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 5254 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5255 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5256 | /*set gen ie*/ |
| 5257 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5258 | /*set auth*/ |
| 5259 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5261 | #ifdef FEATURE_WLAN_WAPI |
| 5262 | if (pAdapter->wapi_info.nWapiMode) |
| 5263 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5264 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5265 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5266 | { |
| 5267 | case WAPI_AUTH_MODE_PSK: |
| 5268 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5269 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5270 | pAdapter->wapi_info.wapiAuthMode); |
| 5271 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5272 | break; |
| 5273 | } |
| 5274 | case WAPI_AUTH_MODE_CERT: |
| 5275 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5276 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | pAdapter->wapi_info.wapiAuthMode); |
| 5278 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5279 | break; |
| 5280 | } |
| 5281 | } // End of switch |
| 5282 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5283 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5284 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5285 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5286 | pRoamProfile->AuthType.numEntries = 1; |
| 5287 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5288 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5289 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5290 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5291 | } |
| 5292 | } |
| 5293 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5294 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 5295 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5296 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 5297 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5298 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 5299 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 5300 | sizeof (tSirGtkOffloadParams)); |
| 5301 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5302 | } |
| 5303 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5304 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 5305 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5306 | if( operatingChannel ) |
| 5307 | { |
| 5308 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 5309 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5310 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5311 | else |
| 5312 | { |
| 5313 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5314 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5315 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5316 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 5317 | { |
| 5318 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 5319 | } |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5320 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 5321 | * has a direct path to call hdd_smeRoamCallback(), which will change the conn_state |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5322 | * If direct path, conn_state will be accordingly changed to NotConnected or Associated |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5323 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5324 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 5325 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 5326 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5327 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5328 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5329 | eConnectionState_Connecting); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5330 | |
| 5331 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5332 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 5333 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 5334 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5335 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5336 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5337 | |
| 5338 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5339 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 5340 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 5341 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5342 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5343 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5344 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5345 | |
| 5346 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5347 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5349 | } |
| 5350 | else |
| 5351 | { |
| 5352 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 5353 | return -EINVAL; |
| 5354 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5355 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5356 | return status; |
| 5357 | } |
| 5358 | |
| 5359 | /* |
| 5360 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 5361 | * This function is used to set the authentication type (OPEN/SHARED). |
| 5362 | * |
| 5363 | */ |
| 5364 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 5365 | enum nl80211_auth_type auth_type) |
| 5366 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5367 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5369 | |
| 5370 | ENTER(); |
| 5371 | |
| 5372 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5373 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5374 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5375 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5376 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5377 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 5378 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 5379 | break; |
| 5380 | |
| 5381 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5382 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5383 | case NL80211_AUTHTYPE_FT: |
| 5384 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5385 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5386 | "%s: set authentication type to OPEN", __func__); |
| 5387 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5388 | break; |
| 5389 | |
| 5390 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5391 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5392 | "%s: set authentication type to SHARED", __func__); |
| 5393 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5394 | break; |
| 5395 | #ifdef FEATURE_WLAN_CCX |
| 5396 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5397 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5398 | "%s: set authentication type to CCKM WPA", __func__); |
| 5399 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 5400 | break; |
| 5401 | #endif |
| 5402 | |
| 5403 | |
| 5404 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5405 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5406 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5407 | auth_type); |
| 5408 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 5409 | return -EINVAL; |
| 5410 | } |
| 5411 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5412 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5413 | pHddStaCtx->conn_info.authType; |
| 5414 | return 0; |
| 5415 | } |
| 5416 | |
| 5417 | /* |
| 5418 | * FUNCTION: wlan_hdd_set_akm_suite |
| 5419 | * This function is used to set the key mgmt type(PSK/8021x). |
| 5420 | * |
| 5421 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5422 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | u32 key_mgmt |
| 5424 | ) |
| 5425 | { |
| 5426 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5427 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5428 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5429 | /*set key mgmt type*/ |
| 5430 | switch(key_mgmt) |
| 5431 | { |
| 5432 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5433 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5434 | case WLAN_AKM_SUITE_FT_PSK: |
| 5435 | #endif |
| 5436 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5437 | __func__); |
| 5438 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5439 | break; |
| 5440 | |
| 5441 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5442 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5443 | case WLAN_AKM_SUITE_FT_8021X: |
| 5444 | #endif |
| 5445 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5446 | __func__); |
| 5447 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5448 | break; |
| 5449 | #ifdef FEATURE_WLAN_CCX |
| 5450 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 5451 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5452 | case WLAN_AKM_SUITE_CCKM: |
| 5453 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 5454 | __func__); |
| 5455 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5456 | break; |
| 5457 | #endif |
| 5458 | |
| 5459 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5460 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | __func__, key_mgmt); |
| 5462 | return -EINVAL; |
| 5463 | |
| 5464 | } |
| 5465 | return 0; |
| 5466 | } |
| 5467 | |
| 5468 | /* |
| 5469 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5470 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5471 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 5472 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5473 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 5474 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | bool ucast |
| 5476 | ) |
| 5477 | { |
| 5478 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5479 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5480 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5481 | |
| 5482 | ENTER(); |
| 5483 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5484 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5485 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5486 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | __func__, cipher); |
| 5488 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5489 | } |
| 5490 | else |
| 5491 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5493 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5494 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | { |
| 5496 | case IW_AUTH_CIPHER_NONE: |
| 5497 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5498 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5501 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5505 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5506 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5508 | case WLAN_CIPHER_SUITE_TKIP: |
| 5509 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5510 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5511 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5512 | case WLAN_CIPHER_SUITE_CCMP: |
| 5513 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5514 | break; |
| 5515 | #ifdef FEATURE_WLAN_WAPI |
| 5516 | case WLAN_CIPHER_SUITE_SMS4: |
| 5517 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 5518 | break; |
| 5519 | #endif |
| 5520 | |
| 5521 | #ifdef FEATURE_WLAN_CCX |
| 5522 | case WLAN_CIPHER_SUITE_KRK: |
| 5523 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 5524 | break; |
| 5525 | #endif |
| 5526 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5527 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5528 | __func__, cipher); |
| 5529 | return -EOPNOTSUPP; |
| 5530 | } |
| 5531 | } |
| 5532 | |
| 5533 | if (ucast) |
| 5534 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5535 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | __func__, encryptionType); |
| 5537 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 5538 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5539 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | encryptionType; |
| 5541 | } |
| 5542 | else |
| 5543 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5544 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5545 | __func__, encryptionType); |
| 5546 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 5547 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5548 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 5549 | } |
| 5550 | |
| 5551 | return 0; |
| 5552 | } |
| 5553 | |
| 5554 | |
| 5555 | /* |
| 5556 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 5557 | * This function is used to parse WPA/RSN IE's. |
| 5558 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5559 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 5560 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5561 | size_t ie_len |
| 5562 | ) |
| 5563 | { |
| 5564 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5565 | u8 *genie = ie; |
| 5566 | v_U16_t remLen = ie_len; |
| 5567 | #ifdef FEATURE_WLAN_WAPI |
| 5568 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 5569 | u16 *tmp; |
| 5570 | v_U16_t akmsuiteCount; |
| 5571 | int *akmlist; |
| 5572 | #endif |
| 5573 | ENTER(); |
| 5574 | |
| 5575 | /* clear previous assocAddIE */ |
| 5576 | pWextState->assocAddIE.length = 0; |
| 5577 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
| 5578 | |
| 5579 | while (remLen >= 2) |
| 5580 | { |
| 5581 | v_U16_t eLen = 0; |
| 5582 | v_U8_t elementId; |
| 5583 | elementId = *genie++; |
| 5584 | eLen = *genie++; |
| 5585 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5586 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5587 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5588 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5589 | |
| 5590 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5591 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5592 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5593 | 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] | 5594 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5596 | "%s: Invalid WPA IE", __func__); |
| 5597 | return -EINVAL; |
| 5598 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5599 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5600 | { |
| 5601 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5602 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5603 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5605 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5606 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5607 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 5608 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | VOS_ASSERT(0); |
| 5610 | return -ENOMEM; |
| 5611 | } |
| 5612 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5613 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5614 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5615 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5616 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 5617 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5618 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5619 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5620 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 5621 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5622 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 5623 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 5624 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 5625 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 5626 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 5627 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5628 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 5629 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5630 | { |
| 5631 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5632 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5635 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5636 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5637 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5638 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | VOS_ASSERT(0); |
| 5640 | return -ENOMEM; |
| 5641 | } |
| 5642 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5643 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5644 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5645 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5646 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5647 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5648 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5649 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5650 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 5651 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | /*Consider WFD IE, only for P2P Client */ |
| 5653 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 5654 | { |
| 5655 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5656 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5659 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5660 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5661 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5662 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5663 | VOS_ASSERT(0); |
| 5664 | return -ENOMEM; |
| 5665 | } |
| 5666 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 5667 | // WPS IE + P2P IE + WFD IE |
| 5668 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5669 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5672 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5673 | } |
| 5674 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5675 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5676 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5677 | HS20_OUI_TYPE_SIZE)) ) |
| 5678 | { |
| 5679 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5680 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5681 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5682 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5683 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5684 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5685 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5686 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5687 | VOS_ASSERT(0); |
| 5688 | return -ENOMEM; |
| 5689 | } |
| 5690 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5691 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5692 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 5693 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5694 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5695 | } |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5696 | |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 5697 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 5698 | |
| 5699 | /* populating as ADDIE in beacon frames */ |
| 5700 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5701 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 5702 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 5703 | { |
| 5704 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5705 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 5706 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5707 | { |
| 5708 | hddLog(LOGE, |
| 5709 | "Coldn't pass " |
| 5710 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 5711 | } |
| 5712 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 5713 | else |
| 5714 | hddLog(LOGE, |
| 5715 | "Could not pass on " |
| 5716 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 5717 | |
| 5718 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 5719 | beaconIE's need to be populated in probe response frames */ |
| 5720 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 5721 | { |
| 5722 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 5723 | u8 probe_rsp_ie_len[3] = {0}; |
| 5724 | u8 counter = 0; |
| 5725 | |
| 5726 | /* Check Probe Resp Length if it is greater then 255 then |
| 5727 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 5728 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 5729 | not able Store More then 255 bytes into One Variable */ |
| 5730 | |
| 5731 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 5732 | { |
| 5733 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 5734 | { |
| 5735 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 5736 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 5737 | } |
| 5738 | else |
| 5739 | { |
| 5740 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 5741 | rem_probe_resp_ie_len = 0; |
| 5742 | } |
| 5743 | } |
| 5744 | |
| 5745 | rem_probe_resp_ie_len = 0; |
| 5746 | |
| 5747 | if (probe_rsp_ie_len[0] > 0) |
| 5748 | { |
| 5749 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5750 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 5751 | (tANI_U8*)(genie - 2), |
| 5752 | probe_rsp_ie_len[0], NULL, |
| 5753 | eANI_BOOLEAN_FALSE) |
| 5754 | == eHAL_STATUS_FAILURE) |
| 5755 | { |
| 5756 | hddLog(LOGE, |
| 5757 | "Could not pass" |
| 5758 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 5759 | } |
| 5760 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 5761 | } |
| 5762 | |
| 5763 | if (probe_rsp_ie_len[1] > 0) |
| 5764 | { |
| 5765 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5766 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 5767 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 5768 | probe_rsp_ie_len[1], NULL, |
| 5769 | eANI_BOOLEAN_FALSE) |
| 5770 | == eHAL_STATUS_FAILURE) |
| 5771 | { |
| 5772 | hddLog(LOGE, |
| 5773 | "Could not pass" |
| 5774 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 5775 | } |
| 5776 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 5777 | } |
| 5778 | |
| 5779 | if (probe_rsp_ie_len[2] > 0) |
| 5780 | { |
| 5781 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5782 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 5783 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 5784 | probe_rsp_ie_len[2], NULL, |
| 5785 | eANI_BOOLEAN_FALSE) |
| 5786 | == eHAL_STATUS_FAILURE) |
| 5787 | { |
| 5788 | hddLog(LOGE, |
| 5789 | "Could not pass" |
| 5790 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 5791 | } |
| 5792 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 5793 | } |
| 5794 | |
| 5795 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5796 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 5797 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5798 | { |
| 5799 | hddLog(LOGE, |
| 5800 | "Could not pass" |
| 5801 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 5802 | } |
| 5803 | } |
| 5804 | else |
| 5805 | { |
| 5806 | // Reset WNI_CFG_PROBE_RSP Flags |
| 5807 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 5808 | |
| 5809 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5810 | "%s: No Probe Response IE received in set beacon", |
| 5811 | __func__); |
| 5812 | } |
| 5813 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | break; |
| 5815 | case DOT11F_EID_RSN: |
| 5816 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 5817 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 5818 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 5819 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 5820 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 5821 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5822 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 5823 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5824 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5825 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5826 | 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] | 5827 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5828 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5829 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5830 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5831 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5832 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5833 | VOS_ASSERT(0); |
| 5834 | return -ENOMEM; |
| 5835 | } |
| 5836 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5837 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5838 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5839 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5840 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5841 | break; |
| 5842 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5843 | #ifdef FEATURE_WLAN_WAPI |
| 5844 | case WLAN_EID_WAPI: |
| 5845 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5846 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5847 | pAdapter->wapi_info.nWapiMode); |
| 5848 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5849 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5850 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 5851 | tmp = tmp + 1; |
| 5852 | akmlist = (int *)(tmp); |
| 5853 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 5854 | { |
| 5855 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 5856 | } |
| 5857 | else |
| 5858 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5859 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | VOS_ASSERT(0); |
| 5861 | return -EINVAL; |
| 5862 | } |
| 5863 | |
| 5864 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 5865 | { |
| 5866 | 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] | 5867 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5870 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5871 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5872 | 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] | 5873 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5874 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 5875 | } |
| 5876 | break; |
| 5877 | #endif |
| 5878 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5879 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5880 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5881 | /* when Unknown IE is received we should break and continue |
| 5882 | * to the next IE in the buffer instead we were returning |
| 5883 | * so changing this to break */ |
| 5884 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | } |
| 5886 | genie += eLen; |
| 5887 | remLen -= eLen; |
| 5888 | } |
| 5889 | EXIT(); |
| 5890 | return 0; |
| 5891 | } |
| 5892 | |
| 5893 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 5894 | * FUNCTION: hdd_isWPAIEPresent |
| 5895 | * Parse the received IE to find the WPA IE |
| 5896 | * |
| 5897 | */ |
| 5898 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 5899 | { |
| 5900 | v_U8_t eLen = 0; |
| 5901 | v_U16_t remLen = ie_len; |
| 5902 | v_U8_t elementId = 0; |
| 5903 | |
| 5904 | while (remLen >= 2) |
| 5905 | { |
| 5906 | elementId = *ie++; |
| 5907 | eLen = *ie++; |
| 5908 | remLen -= 2; |
| 5909 | if (eLen > remLen) |
| 5910 | { |
| 5911 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5912 | "%s: IE length is wrong %d", __func__, eLen); |
| 5913 | return FALSE; |
| 5914 | } |
| 5915 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 5916 | { |
| 5917 | /* OUI - 0x00 0X50 0XF2 |
| 5918 | WPA Information Element - 0x01 |
| 5919 | WPA version - 0x01*/ |
| 5920 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 5921 | return TRUE; |
| 5922 | } |
| 5923 | ie += eLen; |
| 5924 | remLen -= eLen; |
| 5925 | } |
| 5926 | return FALSE; |
| 5927 | } |
| 5928 | |
| 5929 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5931 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | * parameters during connect operation. |
| 5933 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5934 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5935 | struct cfg80211_connect_params *req |
| 5936 | ) |
| 5937 | { |
| 5938 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5939 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | ENTER(); |
| 5941 | |
| 5942 | /*set wpa version*/ |
| 5943 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 5944 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5945 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5946 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 5947 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5948 | { |
| 5949 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 5950 | } |
| 5951 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 5952 | { |
| 5953 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 5954 | } |
| 5955 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5956 | |
| 5957 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5958 | pWextState->wpaVersion); |
| 5959 | |
| 5960 | /*set authentication type*/ |
| 5961 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 5962 | |
| 5963 | if (0 > status) |
| 5964 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5965 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5966 | "%s: failed to set authentication type ", __func__); |
| 5967 | return status; |
| 5968 | } |
| 5969 | |
| 5970 | /*set key mgmt type*/ |
| 5971 | if (req->crypto.n_akm_suites) |
| 5972 | { |
| 5973 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 5974 | if (0 > status) |
| 5975 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5976 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | __func__); |
| 5978 | return status; |
| 5979 | } |
| 5980 | } |
| 5981 | |
| 5982 | /*set pairwise cipher type*/ |
| 5983 | if (req->crypto.n_ciphers_pairwise) |
| 5984 | { |
| 5985 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 5986 | req->crypto.ciphers_pairwise[0], true); |
| 5987 | if (0 > status) |
| 5988 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5989 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5990 | "%s: failed to set unicast cipher type", __func__); |
| 5991 | return status; |
| 5992 | } |
| 5993 | } |
| 5994 | else |
| 5995 | { |
| 5996 | /*Reset previous cipher suite to none*/ |
| 5997 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 5998 | if (0 > status) |
| 5999 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6000 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6001 | "%s: failed to set unicast cipher type", __func__); |
| 6002 | return status; |
| 6003 | } |
| 6004 | } |
| 6005 | |
| 6006 | /*set group cipher type*/ |
| 6007 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 6008 | false); |
| 6009 | |
| 6010 | if (0 > status) |
| 6011 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6012 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | __func__); |
| 6014 | return status; |
| 6015 | } |
| 6016 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6017 | #ifdef WLAN_FEATURE_11W |
| 6018 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 6019 | #endif |
| 6020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 6022 | if (req->ie_len) |
| 6023 | { |
| 6024 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 6025 | if ( 0 > status) |
| 6026 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6027 | 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] | 6028 | __func__); |
| 6029 | return status; |
| 6030 | } |
| 6031 | } |
| 6032 | |
| 6033 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6034 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6035 | { |
| 6036 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 6037 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 6038 | ) |
| 6039 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6040 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6041 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 6042 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6043 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6044 | __func__); |
| 6045 | return -EOPNOTSUPP; |
| 6046 | } |
| 6047 | else |
| 6048 | { |
| 6049 | u8 key_len = req->key_len; |
| 6050 | u8 key_idx = req->key_idx; |
| 6051 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6052 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6053 | && (CSR_MAX_NUM_KEY > key_idx) |
| 6054 | ) |
| 6055 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6056 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6057 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6058 | __func__, key_idx, key_len); |
| 6059 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6060 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6061 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6062 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6063 | (u8)key_len; |
| 6064 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 6065 | } |
| 6066 | } |
| 6067 | } |
| 6068 | } |
| 6069 | |
| 6070 | return status; |
| 6071 | } |
| 6072 | |
| 6073 | /* |
| 6074 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6075 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6076 | * parameters during connect operation. |
| 6077 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6078 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6079 | struct net_device *ndev, |
| 6080 | struct cfg80211_connect_params *req |
| 6081 | ) |
| 6082 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6083 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6084 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6085 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
| 6086 | hdd_context_t *pHddCtx = NULL; |
| 6087 | |
| 6088 | ENTER(); |
| 6089 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6090 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6091 | "%s: device_mode = %d",__func__,pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6092 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6093 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6094 | status = wlan_hdd_validate_context(pHddCtx); |
| 6095 | |
| 6096 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6097 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6098 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6099 | "%s: HDD context is not valid", __func__); |
| 6100 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6101 | } |
| 6102 | |
| 6103 | #ifdef WLAN_BTAMP_FEATURE |
| 6104 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6105 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6107 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6108 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 6109 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6110 | } |
| 6111 | #endif |
| 6112 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6113 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | |
| 6115 | if ( 0 > status) |
| 6116 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6117 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6118 | __func__); |
| 6119 | return status; |
| 6120 | } |
| 6121 | |
| 6122 | //If Device Mode is Station Concurrent Sessions Exit BMps |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 6123 | //P2P Mode will be taken care in Open/close adapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 6125 | (vos_concurrent_sessions_running())) |
| 6126 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6127 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6128 | } |
| 6129 | |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 6130 | if ( req->channel ) |
| 6131 | { |
| 6132 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 6133 | req->ssid_len, req->bssid, |
| 6134 | req->channel->hw_value); |
| 6135 | } |
| 6136 | else |
| 6137 | { |
| 6138 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6139 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 6140 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | |
| 6142 | if (0 > status) |
| 6143 | { |
| 6144 | //ReEnable BMPS if disabled |
| 6145 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 6146 | (NULL != pHddCtx)) |
| 6147 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 6148 | if (pHddCtx->hdd_wlan_suspended) |
| 6149 | { |
| 6150 | hdd_set_pwrparams(pHddCtx); |
| 6151 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6152 | //ReEnable Bmps and Imps back |
| 6153 | hdd_enable_bmps_imps(pHddCtx); |
| 6154 | } |
| 6155 | |
| 6156 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 6157 | return status; |
| 6158 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6159 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6160 | EXIT(); |
| 6161 | return status; |
| 6162 | } |
| 6163 | |
| 6164 | |
| 6165 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6166 | * FUNCTION: wlan_hdd_disconnect |
| 6167 | * This function is used to issue a disconnect request to SME |
| 6168 | */ |
| 6169 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 6170 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6171 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6172 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6173 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6174 | |
| 6175 | status = wlan_hdd_validate_context(pHddCtx); |
| 6176 | |
| 6177 | if (0 != status) |
| 6178 | { |
| 6179 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6180 | "%s: HDD context is not valid", __func__); |
| 6181 | return status; |
| 6182 | } |
| 6183 | |
| 6184 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6185 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6186 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6187 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6188 | /*issue disconnect*/ |
| 6189 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6190 | pAdapter->sessionId, reason); |
| 6191 | |
| 6192 | if ( 0 != status ) |
| 6193 | { |
| 6194 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6195 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6196 | __func__, (int)status ); |
| 6197 | return -EINVAL; |
| 6198 | } |
| 6199 | wait_for_completion_interruptible_timeout( |
| 6200 | &pAdapter->disconnect_comp_var, |
| 6201 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 6202 | /*stop tx queues*/ |
| 6203 | netif_tx_disable(pAdapter->dev); |
| 6204 | netif_carrier_off(pAdapter->dev); |
| 6205 | return status; |
| 6206 | } |
| 6207 | |
| 6208 | |
| 6209 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6210 | * FUNCTION: wlan_hdd_cfg80211_disconnect |
| 6211 | * This function is used to issue a disconnect request to SME |
| 6212 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6213 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | struct net_device *dev, |
| 6215 | u16 reason |
| 6216 | ) |
| 6217 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6218 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 6219 | tCsrRoamProfile *pRoamProfile = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6221 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6222 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6223 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6224 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6225 | tANI_U8 staIdx; |
| 6226 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6228 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6229 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6230 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6231 | __func__,pAdapter->device_mode); |
| 6232 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6233 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 6234 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6235 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6236 | status = wlan_hdd_validate_context(pHddCtx); |
| 6237 | |
| 6238 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6239 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6240 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6241 | "%s: HDD context is not valid", __func__); |
| 6242 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6245 | if (NULL != pRoamProfile) |
| 6246 | { |
| 6247 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 6248 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 6249 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6250 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6251 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6252 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6253 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6254 | switch(reason) |
| 6255 | { |
| 6256 | case WLAN_REASON_MIC_FAILURE: |
| 6257 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 6258 | break; |
| 6259 | |
| 6260 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 6261 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 6262 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 6263 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 6264 | break; |
| 6265 | |
| 6266 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 6267 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
| 6268 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 6269 | break; |
| 6270 | |
| 6271 | case WLAN_REASON_DEAUTH_LEAVING: |
| 6272 | default: |
| 6273 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 6274 | break; |
| 6275 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6276 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 6277 | pScanInfo = &pHddCtx->scan_info; |
| 6278 | if (pScanInfo->mScanPending) |
| 6279 | { |
| 6280 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
| 6281 | "Aborting Scan"); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6282 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6283 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6285 | #ifdef FEATURE_WLAN_TDLS |
| 6286 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6287 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6288 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6289 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 6290 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6291 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6292 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6293 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6294 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6295 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6296 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6297 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6298 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6299 | pAdapter->sessionId, |
| 6300 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6301 | } |
| 6302 | } |
| 6303 | #endif |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6304 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 6305 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | { |
| 6307 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6308 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6309 | __func__, (int)status ); |
| 6310 | return -EINVAL; |
| 6311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6312 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 6313 | else |
| 6314 | { |
| 6315 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 6316 | "called while in %d state", __func__, |
| 6317 | pHddStaCtx->conn_info.connState); |
| 6318 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6319 | } |
| 6320 | else |
| 6321 | { |
| 6322 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 6323 | } |
| 6324 | |
| 6325 | return status; |
| 6326 | } |
| 6327 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6329 | /* |
| 6330 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6331 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | * settings in IBSS mode. |
| 6333 | */ |
| 6334 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6335 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | struct cfg80211_ibss_params *params |
| 6337 | ) |
| 6338 | { |
| 6339 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6340 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6341 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6342 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6343 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6344 | ENTER(); |
| 6345 | |
| 6346 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 6347 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | |
| 6349 | if (params->ie_len && ( NULL != params->ie) ) |
| 6350 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6351 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 6352 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6353 | { |
| 6354 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 6355 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6356 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6357 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6359 | tDot11fIEWPA dot11WPAIE; |
| 6360 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6361 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6362 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 6363 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6364 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 6365 | params->ie_len, DOT11F_EID_WPA); |
| 6366 | if ( NULL != ie ) |
| 6367 | { |
| 6368 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 6369 | // Unpack the WPA IE |
| 6370 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 6371 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 6372 | &ie[2+4], |
| 6373 | ie[1] - 4, |
| 6374 | &dot11WPAIE); |
| 6375 | /*Extract the multicast cipher, the encType for unicast |
| 6376 | cipher for wpa-none is none*/ |
| 6377 | encryptionType = |
| 6378 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 6379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 6383 | |
| 6384 | if (0 > status) |
| 6385 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6386 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6387 | __func__); |
| 6388 | return status; |
| 6389 | } |
| 6390 | } |
| 6391 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6392 | pWextState->roamProfile.AuthType.authType[0] = |
| 6393 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6394 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6395 | |
| 6396 | if (params->privacy) |
| 6397 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6398 | /* Security enabled IBSS, At this time there is no information available |
| 6399 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6400 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6401 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6403 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6404 | *enable privacy bit in beacons */ |
| 6405 | |
| 6406 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6407 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6408 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6409 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6410 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 6411 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 6412 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6413 | return status; |
| 6414 | } |
| 6415 | |
| 6416 | /* |
| 6417 | * FUNCTION: wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6418 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6420 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6421 | struct net_device *dev, |
| 6422 | struct cfg80211_ibss_params *params |
| 6423 | ) |
| 6424 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6425 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6426 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6427 | tCsrRoamProfile *pRoamProfile; |
| 6428 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6429 | bool alloc_bssid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6431 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6432 | |
| 6433 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6434 | |
| 6435 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6436 | "%s: device_mode = %d",__func__,pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6437 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6438 | status = wlan_hdd_validate_context(pHddCtx); |
| 6439 | |
| 6440 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6441 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6442 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6443 | "%s: HDD context is not valid", __func__); |
| 6444 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6445 | } |
| 6446 | |
| 6447 | if (NULL == pWextState) |
| 6448 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6449 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6450 | __func__); |
| 6451 | return -EIO; |
| 6452 | } |
| 6453 | |
| 6454 | pRoamProfile = &pWextState->roamProfile; |
| 6455 | |
| 6456 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 6457 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6458 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6459 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6460 | return -EINVAL; |
| 6461 | } |
| 6462 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 6463 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 6464 | if (NULL != params->bssid) { |
| 6465 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 6466 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 6467 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6468 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 6469 | return -EIO; |
| 6470 | } |
| 6471 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6472 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 6473 | { |
| 6474 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 6475 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6476 | { |
| 6477 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6478 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 6479 | return -EIO; |
| 6480 | } |
| 6481 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 6482 | if (!params->bssid) |
| 6483 | { |
| 6484 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6485 | "%s:Failed memory allocation", __func__); |
| 6486 | return -EIO; |
| 6487 | } |
| 6488 | vos_mem_copy((v_U8_t *)params->bssid, |
| 6489 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 6490 | VOS_MAC_ADDR_SIZE); |
| 6491 | alloc_bssid = VOS_TRUE; |
| 6492 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 6493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6494 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6495 | if (NULL != |
| 6496 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 6497 | params->chandef.chan) |
| 6498 | #else |
| 6499 | params->channel) |
| 6500 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6501 | { |
| 6502 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6503 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6504 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6505 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6506 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6507 | |
| 6508 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6509 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6510 | ieee80211_frequency_to_channel( |
| 6511 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 6512 | params->chandef.chan->center_freq); |
| 6513 | #else |
| 6514 | params->channel->center_freq); |
| 6515 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6516 | |
| 6517 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6518 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6519 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6520 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 6521 | __func__); |
| 6522 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6523 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6524 | |
| 6525 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6526 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6527 | if (channelNum == validChan[indx]) |
| 6528 | { |
| 6529 | break; |
| 6530 | } |
| 6531 | } |
| 6532 | if (indx >= numChans) |
| 6533 | { |
| 6534 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6535 | __func__, channelNum); |
| 6536 | return -EINVAL; |
| 6537 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6538 | /* Set the Operational Channel */ |
| 6539 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 6540 | channelNum); |
| 6541 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6542 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 6543 | pRoamProfile->ChannelInfo.ChannelList = |
| 6544 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6545 | } |
| 6546 | |
| 6547 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6548 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6549 | if (status < 0) |
| 6550 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6551 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6552 | __func__); |
| 6553 | return status; |
| 6554 | } |
| 6555 | |
| 6556 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6557 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6558 | params->ssid_len, params->bssid, |
| 6559 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | |
| 6561 | if (0 > status) |
| 6562 | { |
| 6563 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 6564 | return status; |
| 6565 | } |
| 6566 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6567 | if (NULL != params->bssid && |
| 6568 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 6569 | alloc_bssid == VOS_TRUE) |
| 6570 | { |
| 6571 | vos_mem_free(params->bssid); |
| 6572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | return 0; |
| 6574 | } |
| 6575 | |
| 6576 | /* |
| 6577 | * FUNCTION: wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6578 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6579 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6580 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6581 | struct net_device *dev |
| 6582 | ) |
| 6583 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6584 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6585 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6586 | tCsrRoamProfile *pRoamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6587 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6588 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6589 | |
| 6590 | ENTER(); |
| 6591 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6592 | status = wlan_hdd_validate_context(pHddCtx); |
| 6593 | |
| 6594 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6595 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6596 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6597 | "%s: HDD context is not valid", __func__); |
| 6598 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6599 | } |
| 6600 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6601 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",__func__,pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6602 | if (NULL == pWextState) |
| 6603 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6604 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | __func__); |
| 6606 | return -EIO; |
| 6607 | } |
| 6608 | |
| 6609 | pRoamProfile = &pWextState->roamProfile; |
| 6610 | |
| 6611 | /* Issue disconnect only if interface type is set to IBSS */ |
| 6612 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 6613 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6614 | 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] | 6615 | __func__); |
| 6616 | return -EINVAL; |
| 6617 | } |
| 6618 | |
| 6619 | /* Issue Disconnect request */ |
| 6620 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 6621 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 6622 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 6623 | |
| 6624 | return 0; |
| 6625 | } |
| 6626 | |
| 6627 | /* |
| 6628 | * FUNCTION: wlan_hdd_cfg80211_set_wiphy_params |
| 6629 | * This function is used to set the phy parameters |
| 6630 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 6631 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6632 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6633 | u32 changed) |
| 6634 | { |
| 6635 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6636 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6637 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6638 | |
| 6639 | ENTER(); |
| 6640 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6641 | status = wlan_hdd_validate_context(pHddCtx); |
| 6642 | |
| 6643 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6644 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6645 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6646 | "%s: HDD context is not valid", __func__); |
| 6647 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6648 | } |
| 6649 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 6651 | { |
| 6652 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 6653 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 6654 | wiphy->rts_threshold; |
| 6655 | |
| 6656 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6657 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6658 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6659 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6660 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6661 | __func__, rts_threshold); |
| 6662 | return -EINVAL; |
| 6663 | } |
| 6664 | |
| 6665 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 6666 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6667 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6668 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6670 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | __func__, rts_threshold); |
| 6672 | return -EIO; |
| 6673 | } |
| 6674 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6675 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | rts_threshold); |
| 6677 | } |
| 6678 | |
| 6679 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 6680 | { |
| 6681 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 6682 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 6683 | wiphy->frag_threshold; |
| 6684 | |
| 6685 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6686 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6687 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6688 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6689 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | frag_threshold); |
| 6691 | return -EINVAL; |
| 6692 | } |
| 6693 | |
| 6694 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 6695 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6696 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6697 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6698 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6699 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6700 | __func__, frag_threshold); |
| 6701 | return -EIO; |
| 6702 | } |
| 6703 | |
| 6704 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 6705 | frag_threshold); |
| 6706 | } |
| 6707 | |
| 6708 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 6709 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 6710 | { |
| 6711 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 6712 | wiphy->retry_short : |
| 6713 | wiphy->retry_long; |
| 6714 | |
| 6715 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 6716 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 6717 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6718 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | __func__, retry_value); |
| 6720 | return -EINVAL; |
| 6721 | } |
| 6722 | |
| 6723 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 6724 | { |
| 6725 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 6726 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6727 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6728 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6729 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6730 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | __func__, retry_value); |
| 6732 | return -EIO; |
| 6733 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6734 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6735 | __func__, retry_value); |
| 6736 | } |
| 6737 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 6738 | { |
| 6739 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 6740 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6741 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6742 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6743 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6744 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6745 | __func__, retry_value); |
| 6746 | return -EIO; |
| 6747 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6748 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6749 | __func__, retry_value); |
| 6750 | } |
| 6751 | } |
| 6752 | |
| 6753 | return 0; |
| 6754 | } |
| 6755 | |
| 6756 | /* |
| 6757 | * FUNCTION: wlan_hdd_cfg80211_set_txpower |
| 6758 | * This function is used to set the txpower |
| 6759 | */ |
| 6760 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6761 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 6762 | struct wireless_dev *wdev, |
| 6763 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6764 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6765 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6766 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6767 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6768 | #endif |
| 6769 | int dbm) |
| 6770 | { |
| 6771 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6772 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6773 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 6774 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6775 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6776 | |
| 6777 | ENTER(); |
| 6778 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6779 | status = wlan_hdd_validate_context(pHddCtx); |
| 6780 | |
| 6781 | if (0 != status) |
| 6782 | { |
| 6783 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6784 | "%s: HDD context is not valid", __func__); |
| 6785 | return status; |
| 6786 | } |
| 6787 | |
| 6788 | hHal = pHddCtx->hHal; |
| 6789 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6790 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 6791 | dbm, ccmCfgSetCallback, |
| 6792 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6793 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6794 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6795 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 6796 | return -EIO; |
| 6797 | } |
| 6798 | |
| 6799 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 6800 | dbm); |
| 6801 | |
| 6802 | switch(type) |
| 6803 | { |
| 6804 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 6805 | /* Fall through */ |
| 6806 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 6807 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 6808 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6809 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 6810 | __func__); |
| 6811 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6812 | } |
| 6813 | break; |
| 6814 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6815 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6816 | __func__); |
| 6817 | return -EOPNOTSUPP; |
| 6818 | break; |
| 6819 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6820 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 6821 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6822 | return -EIO; |
| 6823 | } |
| 6824 | |
| 6825 | return 0; |
| 6826 | } |
| 6827 | |
| 6828 | /* |
| 6829 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 6830 | * This function is used to read the txpower |
| 6831 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6832 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 6833 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 6834 | struct wireless_dev *wdev, |
| 6835 | #endif |
| 6836 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6837 | { |
| 6838 | |
| 6839 | hdd_adapter_t *pAdapter; |
| 6840 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6841 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6842 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6843 | ENTER(); |
| 6844 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6845 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6846 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6847 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6848 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6849 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6850 | "%s: HDD context is not valid", __func__); |
| 6851 | *dbm = 0; |
| 6852 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6853 | } |
| 6854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6855 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6856 | if (NULL == pAdapter) |
| 6857 | { |
| 6858 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 6859 | return -ENOENT; |
| 6860 | } |
| 6861 | |
| 6862 | wlan_hdd_get_classAstats(pAdapter); |
| 6863 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 6864 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6865 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6866 | return 0; |
| 6867 | } |
| 6868 | |
| 6869 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 6870 | u8* mac, struct station_info *sinfo) |
| 6871 | { |
| 6872 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 6873 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6874 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 6875 | tANI_U8 rate_flags; |
| 6876 | |
| 6877 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 6878 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6879 | |
| 6880 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 6881 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 6882 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 6883 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 6884 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 6885 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 6886 | tANI_U16 maxRate = 0; |
| 6887 | tANI_U16 myRate; |
| 6888 | tANI_U16 currentRate = 0; |
| 6889 | tANI_U8 maxSpeedMCS = 0; |
| 6890 | tANI_U8 maxMCSIdx = 0; |
| 6891 | tANI_U8 rateFlag = 1; |
| 6892 | tANI_U8 i, j, rssidx; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 6893 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6894 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6895 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6896 | #ifdef WLAN_FEATURE_11AC |
| 6897 | tANI_U32 vht_mcs_map; |
| 6898 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 6899 | #endif /* WLAN_FEATURE_11AC */ |
| 6900 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6901 | ENTER(); |
| 6902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6903 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 6904 | (0 == ssidlen)) |
| 6905 | { |
| 6906 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 6907 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 6908 | /*To keep GUI happy*/ |
| 6909 | return 0; |
| 6910 | } |
| 6911 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6912 | status = wlan_hdd_validate_context(pHddCtx); |
| 6913 | |
| 6914 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6915 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6916 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6917 | "%s: HDD context is not valid", __func__); |
| 6918 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6919 | } |
| 6920 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 6921 | wlan_hdd_get_station_stats(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6922 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 6923 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 6924 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 6925 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 6926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6927 | //convert to the UI units of 100kbps |
| 6928 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 6929 | |
| 6930 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6931 | 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] | 6932 | sinfo->signal, |
| 6933 | pCfg->reportMaxLinkSpeed, |
| 6934 | myRate, |
| 6935 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6936 | (int) pCfg->linkSpeedRssiMid, |
| 6937 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 6938 | (int) rate_flags, |
| 6939 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6940 | #endif //LINKSPEED_DEBUG_ENABLED |
| 6941 | |
| 6942 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 6943 | { |
| 6944 | // we do not want to necessarily report the current speed |
| 6945 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 6946 | { |
| 6947 | // report the max possible speed |
| 6948 | rssidx = 0; |
| 6949 | } |
| 6950 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 6951 | { |
| 6952 | // report the max possible speed with RSSI scaling |
| 6953 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 6954 | { |
| 6955 | // report the max possible speed |
| 6956 | rssidx = 0; |
| 6957 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6958 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6959 | { |
| 6960 | // report middle speed |
| 6961 | rssidx = 1; |
| 6962 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6963 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 6964 | { |
| 6965 | // report middle speed |
| 6966 | rssidx = 2; |
| 6967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6968 | else |
| 6969 | { |
| 6970 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 6971 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6972 | } |
| 6973 | } |
| 6974 | else |
| 6975 | { |
| 6976 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 6977 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6978 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 6979 | __func__, pCfg->reportMaxLinkSpeed); |
| 6980 | rssidx = 0; |
| 6981 | } |
| 6982 | |
| 6983 | maxRate = 0; |
| 6984 | |
| 6985 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 6986 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 6987 | OperationalRates, &ORLeng)) |
| 6988 | { |
| 6989 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 6990 | /*To keep GUI happy*/ |
| 6991 | return 0; |
| 6992 | } |
| 6993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6994 | for (i = 0; i < ORLeng; i++) |
| 6995 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6996 | 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] | 6997 | { |
| 6998 | /* Validate Rate Set */ |
| 6999 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 7000 | { |
| 7001 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 7002 | break; |
| 7003 | } |
| 7004 | } |
| 7005 | /* Update MAX rate */ |
| 7006 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 7007 | } |
| 7008 | |
| 7009 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 7010 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 7011 | ExtendedRates, &ERLeng)) |
| 7012 | { |
| 7013 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 7014 | /*To keep GUI happy*/ |
| 7015 | return 0; |
| 7016 | } |
| 7017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7018 | for (i = 0; i < ERLeng; i++) |
| 7019 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7020 | 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] | 7021 | { |
| 7022 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 7023 | { |
| 7024 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 7025 | break; |
| 7026 | } |
| 7027 | } |
| 7028 | /* Update MAX rate */ |
| 7029 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 7030 | } |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 7031 | /* Get MCS Rate Set -- |
| 7032 | only if we are connected at MCS rates (or) |
| 7033 | if we are always reporting max speed (or) |
| 7034 | if we have good rssi */ |
| 7035 | if (((0 == rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) || |
| 7036 | (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7037 | { |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 7038 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 7039 | MCSRates, &MCSLeng)) |
| 7040 | { |
| 7041 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 7042 | /*To keep GUI happy*/ |
| 7043 | return 0; |
| 7044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7046 | #ifdef WLAN_FEATURE_11AC |
| 7047 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7048 | 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] | 7049 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7050 | ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_VHT_TX_MCS_MAP, &vht_mcs_map); |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7051 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7052 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7053 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7054 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7055 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7056 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7057 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7058 | maxMCSIdx = 7; |
| 7059 | } |
| 7060 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 7061 | { |
| 7062 | maxMCSIdx = 8; |
| 7063 | } |
| 7064 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 7065 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7066 | //VHT20 is supporting 0~8 |
| 7067 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7068 | maxMCSIdx = 8; |
| 7069 | else |
| 7070 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7071 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7072 | |
| 7073 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7074 | { |
| 7075 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 7076 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 7077 | } |
| 7078 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 7079 | { |
| 7080 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 7081 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 7082 | } |
| 7083 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7084 | { |
| 7085 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 7086 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 7087 | } |
| 7088 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7089 | maxSpeedMCS = 1; |
| 7090 | if (currentRate > maxRate) |
| 7091 | { |
| 7092 | maxRate = currentRate; |
| 7093 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7094 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7095 | } |
| 7096 | else |
| 7097 | #endif /* WLAN_FEATURE_11AC */ |
| 7098 | { |
| 7099 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7100 | { |
| 7101 | rateFlag |= 1; |
| 7102 | } |
| 7103 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7104 | { |
| 7105 | rateFlag |= 2; |
| 7106 | } |
| 7107 | |
| 7108 | for (i = 0; i < MCSLeng; i++) |
| 7109 | { |
| 7110 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
| 7111 | for (j = 0; j < temp; j++) |
| 7112 | { |
| 7113 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 7114 | { |
| 7115 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 7116 | break; |
| 7117 | } |
| 7118 | } |
| 7119 | if ((j < temp) && (currentRate > maxRate)) |
| 7120 | { |
| 7121 | maxRate = currentRate; |
| 7122 | maxSpeedMCS = 1; |
| 7123 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 7124 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7125 | } |
| 7126 | } |
| 7127 | } |
| 7128 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7129 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 7130 | { |
| 7131 | maxRate = myRate; |
| 7132 | maxSpeedMCS = 1; |
| 7133 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 7134 | } |
| 7135 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7136 | // 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] | 7137 | if (((maxRate < myRate) && (0 == rssidx)) || |
| 7138 | (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7139 | { |
| 7140 | maxRate = myRate; |
| 7141 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 7142 | { |
| 7143 | maxSpeedMCS = 0; |
| 7144 | } |
| 7145 | else |
| 7146 | { |
| 7147 | maxSpeedMCS = 1; |
| 7148 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 7149 | } |
| 7150 | } |
| 7151 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7152 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7153 | { |
| 7154 | sinfo->txrate.legacy = maxRate; |
| 7155 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7156 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 7157 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7158 | } |
| 7159 | else |
| 7160 | { |
| 7161 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7162 | #ifdef WLAN_FEATURE_11AC |
| 7163 | sinfo->txrate.nss = 1; |
| 7164 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7165 | { |
| 7166 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7167 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7168 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7169 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7170 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7171 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7172 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7173 | } |
| 7174 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7175 | { |
| 7176 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7177 | } |
| 7178 | #endif /* WLAN_FEATURE_11AC */ |
| 7179 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 7180 | { |
| 7181 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 7182 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7183 | { |
| 7184 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7185 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7187 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7188 | { |
| 7189 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7190 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7192 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7193 | pr_info("Reporting MCS rate %d flags %x\n", |
| 7194 | sinfo->txrate.mcs, |
| 7195 | sinfo->txrate.flags ); |
| 7196 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7197 | } |
| 7198 | } |
| 7199 | else |
| 7200 | { |
| 7201 | // report current rate instead of max rate |
| 7202 | |
| 7203 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 7204 | { |
| 7205 | //provide to the UI in units of 100kbps |
| 7206 | sinfo->txrate.legacy = myRate; |
| 7207 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7208 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 7209 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7210 | } |
| 7211 | else |
| 7212 | { |
| 7213 | //must be MCS |
| 7214 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7215 | #ifdef WLAN_FEATURE_11AC |
| 7216 | sinfo->txrate.nss = 1; |
| 7217 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7218 | { |
| 7219 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7220 | } |
| 7221 | else |
| 7222 | #endif /* WLAN_FEATURE_11AC */ |
| 7223 | { |
| 7224 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 7225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7227 | { |
| 7228 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7229 | } |
| 7230 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7231 | { |
| 7232 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7233 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7234 | #ifdef WLAN_FEATURE_11AC |
| 7235 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7236 | { |
| 7237 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 7238 | } |
| 7239 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7240 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7241 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 7242 | sinfo->txrate.mcs, |
| 7243 | sinfo->txrate.flags ); |
| 7244 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7245 | } |
| 7246 | } |
| 7247 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 7248 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 7249 | sinfo->tx_packets = |
| 7250 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 7251 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 7252 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 7253 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 7254 | |
| 7255 | sinfo->tx_retries = |
| 7256 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 7257 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 7258 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 7259 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 7260 | |
| 7261 | sinfo->tx_failed = |
| 7262 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 7263 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 7264 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 7265 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 7266 | |
| 7267 | sinfo->filled |= |
| 7268 | STATION_INFO_TX_PACKETS | |
| 7269 | STATION_INFO_TX_RETRIES | |
| 7270 | STATION_INFO_TX_FAILED; |
| 7271 | |
| 7272 | EXIT(); |
| 7273 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7274 | } |
| 7275 | |
| 7276 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 7277 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7278 | { |
| 7279 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7280 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7281 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7282 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7283 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7284 | ENTER(); |
| 7285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7286 | if (NULL == pAdapter) |
| 7287 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7288 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7289 | return -ENODEV; |
| 7290 | } |
| 7291 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7292 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7293 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7294 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7295 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7296 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7297 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7298 | "%s: HDD context is not valid", __func__); |
| 7299 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7300 | } |
| 7301 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7302 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 7303 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 7304 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 7305 | (eConnectionState_Associated == |
| 7306 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 7307 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 7308 | |
| 7309 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7310 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 7311 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7312 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7313 | { |
| 7314 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7315 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7316 | __func__, vos_status); |
| 7317 | } |
| 7318 | } |
| 7319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7320 | /**The get power cmd from the supplicant gets updated by the nl only |
| 7321 | *on successful execution of the function call |
| 7322 | *we are oppositely mapped w.r.t mode in the driver |
| 7323 | **/ |
| 7324 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 7325 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7326 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7327 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 7328 | { |
| 7329 | return -EINVAL; |
| 7330 | } |
| 7331 | return 0; |
| 7332 | } |
| 7333 | |
| 7334 | |
| 7335 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7336 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 7337 | struct net_device *netdev, |
| 7338 | u8 key_index) |
| 7339 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7340 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7341 | return 0; |
| 7342 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7343 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7344 | |
| 7345 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 7346 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 7347 | struct net_device *dev, |
| 7348 | struct ieee80211_txq_params *params) |
| 7349 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7350 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7351 | return 0; |
| 7352 | } |
| 7353 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7354 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 7355 | struct ieee80211_txq_params *params) |
| 7356 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7357 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7358 | return 0; |
| 7359 | } |
| 7360 | #endif //LINUX_VERSION_CODE |
| 7361 | |
| 7362 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 7363 | struct net_device *dev, u8 *mac) |
| 7364 | { |
| 7365 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7366 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7367 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7368 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7369 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7370 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7371 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7372 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7373 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7374 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7375 | return -EINVAL; |
| 7376 | } |
| 7377 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7378 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7379 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7380 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7381 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7382 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7383 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7384 | "%s: HDD context is not valid", __func__); |
| 7385 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7386 | } |
| 7387 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7388 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7389 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7390 | ) |
| 7391 | { |
| 7392 | if( NULL == mac ) |
| 7393 | { |
| 7394 | v_U16_t i; |
| 7395 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 7396 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 7397 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 7398 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7399 | { |
| 7400 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 7401 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7402 | "%s: Delete STA with MAC::" |
| 7403 | MAC_ADDRESS_STR, |
| 7404 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 7405 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 7406 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7407 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7408 | } |
| 7409 | } |
| 7410 | } |
| 7411 | else |
| 7412 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7413 | |
| 7414 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 7415 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7416 | { |
| 7417 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7418 | "%s: Skip this DEL STA as this is not used::" |
| 7419 | MAC_ADDRESS_STR, |
| 7420 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7421 | return -ENOENT; |
| 7422 | } |
| 7423 | |
| 7424 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 7425 | { |
| 7426 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7427 | "%s: Skip this DEL STA as deauth is in progress::" |
| 7428 | MAC_ADDRESS_STR, |
| 7429 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7430 | return -ENOENT; |
| 7431 | } |
| 7432 | |
| 7433 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 7434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7436 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7437 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7438 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7439 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7440 | |
| 7441 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 7442 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7443 | { |
| 7444 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 7445 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7446 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7447 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7448 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7449 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7450 | return -ENOENT; |
| 7451 | } |
| 7452 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7453 | } |
| 7454 | } |
| 7455 | |
| 7456 | EXIT(); |
| 7457 | |
| 7458 | return 0; |
| 7459 | } |
| 7460 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7461 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 7462 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 7463 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7464 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7465 | #ifdef FEATURE_WLAN_TDLS |
| 7466 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7467 | ENTER(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7468 | mask = params->sta_flags_mask; |
| 7469 | |
| 7470 | set = params->sta_flags_set; |
| 7471 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7472 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 7473 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7474 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 7475 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 7476 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7477 | |
| 7478 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 7479 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7480 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7481 | } |
| 7482 | } |
| 7483 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7484 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7485 | } |
| 7486 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7487 | |
| 7488 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7489 | #define MAX_PMKSAIDS_IN_CACHE 8 |
| 7490 | |
| 7491 | static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD local cache |
| 7492 | static tANI_U32 PMKIDCacheIndex; // HDD local Cache index |
| 7493 | |
| 7494 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7495 | 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] | 7496 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7497 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7498 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7499 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7500 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7501 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7502 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7503 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7504 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7505 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7506 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 7507 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7508 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7509 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7510 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7511 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7512 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7513 | return -EINVAL; |
| 7514 | } |
| 7515 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7516 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7517 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7518 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7519 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7520 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7521 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7522 | "%s: HDD context is not valid", __func__); |
| 7523 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7524 | } |
| 7525 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7526 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7527 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7528 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7529 | for (j = 0; j < PMKIDCacheIndex; j++) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7530 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7531 | if(vos_mem_compare(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7532 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 7533 | { |
| 7534 | /* BSSID matched previous entry. Overwrite it. */ |
| 7535 | BSSIDMatched = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7536 | vos_mem_copy(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7537 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7538 | vos_mem_copy(PMKIDCache[j].PMKID, |
| 7539 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7540 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7541 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7542 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7543 | dump_bssid(pmksa->bssid); |
| 7544 | dump_pmkid(halHandle, pmksa->pmkid); |
| 7545 | break; |
| 7546 | } |
| 7547 | } |
| 7548 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 7549 | /* Check we compared all entries,if then take the first slot now */ |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7550 | if(j == MAX_PMKSAIDS_IN_CACHE) PMKIDCacheIndex=0; |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 7551 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7552 | if (!BSSIDMatched) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7553 | { |
| 7554 | // Now, we DON'T have a BSSID match, so take a new entry in the cache. |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7555 | vos_mem_copy(PMKIDCache[PMKIDCacheIndex].BSSID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7556 | pmksa->bssid, ETHER_ADDR_LEN); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7557 | vos_mem_copy(PMKIDCache[PMKIDCacheIndex].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7558 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7559 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7560 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Adding a new cache entry %d.", |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7561 | __func__, PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7562 | dump_bssid(pmksa->bssid); |
| 7563 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7564 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7565 | // The "i=0" doesn't work for the call to sme_RoamSetPMKIDCache() - LFR FIXME |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7566 | if (PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) PMKIDCacheIndex++; else PMKIDCacheIndex = 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7567 | } |
| 7568 | |
| 7569 | |
| 7570 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7571 | //hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with %d cache entries."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7572 | // __func__, i ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7573 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7574 | __func__, PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7575 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7576 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 7577 | PMKIDCache, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7578 | PMKIDCacheIndex); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7579 | return 0; |
| 7580 | } |
| 7581 | |
| 7582 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7583 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7584 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7585 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7586 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7587 | tANI_U32 j=0; |
| 7588 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7589 | tHalHandle halHandle; |
| 7590 | int status; |
| 7591 | tANI_U8 BSSIDMatched = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7592 | hdd_context_t *pHddCtx; |
| 7593 | int result = 0; |
| 7594 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7595 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 7596 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7597 | |
| 7598 | /* Validate pAdapter */ |
| 7599 | if (NULL == pAdapter) |
| 7600 | { |
| 7601 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 7602 | return -EINVAL; |
| 7603 | } |
| 7604 | |
| 7605 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7606 | status = wlan_hdd_validate_context(pHddCtx); |
| 7607 | |
| 7608 | if (0 != status) |
| 7609 | { |
| 7610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7611 | "%s: HDD context is not valid", __func__); |
| 7612 | return status; |
| 7613 | } |
| 7614 | |
| 7615 | /*Retrieve halHandle*/ |
| 7616 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7617 | |
| 7618 | /*in case index is 0,no entry to delete*/ |
| 7619 | if (0 == PMKIDCacheIndex) |
| 7620 | { |
| 7621 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid entry to delete" , |
| 7622 | __func__); |
| 7623 | return -EINVAL; |
| 7624 | } |
| 7625 | |
| 7626 | /*find the matching PMKSA entry from j=0 to (index-1), |
| 7627 | * and delete the matched one |
| 7628 | */ |
| 7629 | for (j = 0; j<PMKIDCacheIndex; j++) |
| 7630 | { |
| 7631 | if (vos_mem_compare(PMKIDCache[j].BSSID, |
| 7632 | pmksa->bssid, |
| 7633 | WNI_CFG_BSSID_LEN)) |
| 7634 | { |
| 7635 | /* BSSID matched entry */ |
| 7636 | BSSIDMatched = 1; |
| 7637 | |
| 7638 | if (j<PMKIDCacheIndex-1) |
| 7639 | { |
| 7640 | /*replace the matching entry with the last entry in HDD local cache*/ |
| 7641 | vos_mem_copy(PMKIDCache[j].BSSID, |
| 7642 | PMKIDCache[PMKIDCacheIndex-1].BSSID, |
| 7643 | WNI_CFG_BSSID_LEN); |
| 7644 | vos_mem_copy(PMKIDCache[j].PMKID, |
| 7645 | PMKIDCache[PMKIDCacheIndex-1].PMKID, |
| 7646 | CSR_RSN_PMKID_SIZE); |
| 7647 | } |
| 7648 | |
| 7649 | /*clear the last entry in HDD cache ---[index-1]*/ |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7650 | vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].BSSID, WNI_CFG_BSSID_LEN); |
| 7651 | vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].PMKID, CSR_RSN_PMKID_SIZE); |
| 7652 | |
| 7653 | /*reduce the PMKID array index*/ |
| 7654 | PMKIDCacheIndex--; |
| 7655 | |
| 7656 | /*delete the last PMKID cache in CSR*/ |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 7657 | result = sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7658 | if (0 != result) |
| 7659 | { |
| 7660 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", |
| 7661 | __func__,PMKIDCacheIndex); |
| 7662 | } |
| 7663 | |
| 7664 | dump_bssid(pmksa->bssid); |
| 7665 | dump_pmkid(halHandle,pmksa->pmkid); |
| 7666 | |
| 7667 | break; |
| 7668 | } |
| 7669 | } |
| 7670 | |
| 7671 | /* we compare all entries,but cannot find matching entry */ |
| 7672 | if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched) |
| 7673 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7674 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7675 | "%s: No such PMKSA entry existed " MAC_ADDRESS_STR, |
| 7676 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7677 | dump_bssid(pmksa->bssid); |
| 7678 | dump_pmkid(halHandle, pmksa->pmkid); |
| 7679 | return -EINVAL; |
| 7680 | } |
| 7681 | return result; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7682 | } |
| 7683 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7684 | |
| 7685 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7686 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 7687 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7688 | tANI_U32 j=0; |
| 7689 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7690 | tHalHandle halHandle; |
| 7691 | hdd_context_t *pHddCtx; |
| 7692 | tANI_U8 *pBSSId; |
| 7693 | int status; |
| 7694 | int result; |
| 7695 | |
| 7696 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 7697 | |
| 7698 | /* Validate pAdapter */ |
| 7699 | if (NULL == pAdapter) |
| 7700 | { |
| 7701 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7702 | "%s: Invalid Adapter" ,__func__); |
| 7703 | return -EINVAL; |
| 7704 | } |
| 7705 | |
| 7706 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7707 | status = wlan_hdd_validate_context(pHddCtx); |
| 7708 | |
| 7709 | if (0 != status) |
| 7710 | { |
| 7711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7712 | "%s: HDD context is not valid", __func__); |
| 7713 | return status; |
| 7714 | } |
| 7715 | |
| 7716 | /*Retrieve halHandle*/ |
| 7717 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7718 | |
| 7719 | /*in case index is 0,no entry to delete*/ |
| 7720 | if (0 == PMKIDCacheIndex) |
| 7721 | { |
| 7722 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid entry to delete" , |
| 7723 | __func__); |
| 7724 | return -EINVAL; |
| 7725 | } |
| 7726 | |
| 7727 | /*delete all the PMKSA one by one */ |
| 7728 | for (j = 0; j<PMKIDCacheIndex; j++) |
| 7729 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7730 | pBSSId =(tANI_U8 *)(PMKIDCache[j].BSSID); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7731 | |
| 7732 | /*delete the PMKID in CSR*/ |
| 7733 | result = sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId); |
| 7734 | |
| 7735 | if (0!= result) |
| 7736 | { |
| 7737 | hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.", |
| 7738 | __func__,j); |
| 7739 | } |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 7740 | /*clear the entry in HDD cache 0--index-1 */ |
| 7741 | vos_mem_zero(PMKIDCache[j].BSSID, WNI_CFG_BSSID_LEN); |
| 7742 | vos_mem_zero(PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7743 | } |
| 7744 | |
| 7745 | PMKIDCacheIndex = 0; |
| 7746 | return result; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7747 | } |
| 7748 | #endif |
| 7749 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7750 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7751 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7752 | struct net_device *dev, struct cfg80211_update_ft_ies_params *ftie) |
| 7753 | { |
| 7754 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7755 | hdd_station_ctx_t *pHddStaCtx; |
| 7756 | |
| 7757 | if (NULL == pAdapter) |
| 7758 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7759 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7760 | return -ENODEV; |
| 7761 | } |
| 7762 | |
| 7763 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7764 | |
| 7765 | // Added for debug on reception of Re-assoc Req. |
| 7766 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 7767 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7768 | hddLog(LOGE, FL("Called with Ie of length = %zu when not associated"), |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7769 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7770 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7771 | } |
| 7772 | |
| 7773 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7774 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7775 | ftie->ie_len); |
| 7776 | #endif |
| 7777 | |
| 7778 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 7779 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 7780 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7781 | ftie->ie_len); |
| 7782 | return 0; |
| 7783 | } |
| 7784 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7785 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7786 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 7787 | |
| 7788 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 7789 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 7790 | { |
| 7791 | int ret; |
| 7792 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 7793 | hdd_context_t *pHddCtx; |
| 7794 | |
| 7795 | if (NULL == pAdapter) |
| 7796 | { |
| 7797 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7798 | "%s: HDD adapter is Null", __func__); |
| 7799 | return ; |
| 7800 | } |
| 7801 | |
| 7802 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7803 | if (NULL == pHddCtx) |
| 7804 | { |
| 7805 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7806 | "%s: HDD context is Null!!!", __func__); |
| 7807 | return ; |
| 7808 | } |
| 7809 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 7810 | spin_lock(&pHddCtx->schedScan_lock); |
| 7811 | if (TRUE == pHddCtx->isWiphySuspended) |
| 7812 | { |
| 7813 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 7814 | spin_unlock(&pHddCtx->schedScan_lock); |
| 7815 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7816 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 7817 | return ; |
| 7818 | } |
| 7819 | spin_unlock(&pHddCtx->schedScan_lock); |
| 7820 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7821 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 7822 | |
| 7823 | if (0 > ret) |
| 7824 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 7825 | |
| 7826 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 7827 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7828 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7829 | } |
| 7830 | |
| 7831 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 7832 | * FUNCTION: wlan_hdd_is_pno_allowed |
| 7833 | * To check is there any P2P GO/SAP or P2P Client/STA |
| 7834 | * session is active |
| 7835 | */ |
| 7836 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 7837 | { |
| 7838 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 7839 | hdd_adapter_t *pTempAdapter = NULL; |
| 7840 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7841 | int status = 0; |
| 7842 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 7843 | |
| 7844 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 7845 | { |
| 7846 | pTempAdapter = pAdapterNode->pAdapter; |
| 7847 | |
| 7848 | if (pTempAdapter != pAdapter) |
| 7849 | { |
| 7850 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) && |
| 7851 | (eConnectionState_NotConnected != (WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter))->conn_info.connState)) || |
| 7852 | (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) || |
| 7853 | (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) || |
| 7854 | (WLAN_HDD_SOFTAP == pTempAdapter->device_mode)) |
| 7855 | { |
| 7856 | return eHAL_STATUS_SUCCESS; |
| 7857 | } |
| 7858 | } |
| 7859 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 7860 | pAdapterNode = pNext; |
| 7861 | } |
| 7862 | return eHAL_STATUS_FAILURE; |
| 7863 | } |
| 7864 | |
| 7865 | /* |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7866 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 7867 | * NL interface to enable PNO |
| 7868 | */ |
| 7869 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 7870 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 7871 | { |
| 7872 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7873 | tpSirPNOScanReq pPnoRequest = NULL; |
| 7874 | hdd_context_t *pHddCtx; |
| 7875 | tHalHandle hHal; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 7876 | v_U32_t i, indx, num_ch, tempInterval; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7877 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 7878 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 7879 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 7880 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7881 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7882 | |
| 7883 | if (NULL == pAdapter) |
| 7884 | { |
| 7885 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7886 | "%s: HDD adapter is Null", __func__); |
| 7887 | return -ENODEV; |
| 7888 | } |
| 7889 | |
| 7890 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 7891 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7892 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 7893 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7894 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7895 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7896 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7897 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7898 | } |
| 7899 | |
| 7900 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7901 | if (NULL == hHal) |
| 7902 | { |
| 7903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7904 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 7905 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7906 | } |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 7907 | /* The current firmware design for PNO does not consider concurrent |
| 7908 | * active sessions.Hence , determine the concurrent active sessions |
| 7909 | * and return a failure to the framework on a request for schedule |
| 7910 | * scan. |
| 7911 | */ |
| 7912 | if (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter)) |
| 7913 | { |
| 7914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7915 | "%s: Cannot handle sched_scan as p2p session is active", __func__); |
| 7916 | return -EBUSY; |
| 7917 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7918 | |
| 7919 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 7920 | if (NULL == pPnoRequest) |
| 7921 | { |
| 7922 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7923 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7924 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7925 | } |
| 7926 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 7927 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7928 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 7929 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 7930 | |
| 7931 | if (( !pPnoRequest->ucNetworksCount ) || |
| 7932 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 7933 | { |
| 7934 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7935 | "Network input is not correct"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7936 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7937 | goto error; |
| 7938 | } |
| 7939 | |
| 7940 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 7941 | { |
| 7942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7943 | "Incorrect number of channels"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7944 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7945 | goto error; |
| 7946 | } |
| 7947 | |
| 7948 | /* Framework provides one set of channels(all) |
| 7949 | * common for all saved profile */ |
| 7950 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 7951 | channels_allowed, &num_channels_allowed)) |
| 7952 | { |
| 7953 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7954 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7955 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7956 | goto error; |
| 7957 | } |
| 7958 | /* Checking each channel against allowed channel list */ |
| 7959 | num_ch = 0; |
| 7960 | for (i = 0; i < request->n_channels; i++) |
| 7961 | { |
| 7962 | for (indx = 0; indx < num_channels_allowed; indx++) |
| 7963 | { |
| 7964 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 7965 | { |
| 7966 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 7967 | break ; |
| 7968 | } |
| 7969 | } |
| 7970 | } |
| 7971 | |
| 7972 | /* Filling per profile params */ |
| 7973 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 7974 | { |
| 7975 | pPnoRequest->aNetworks[i].ssId.length = |
| 7976 | request->match_sets[i].ssid.ssid_len; |
| 7977 | |
| 7978 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 7979 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 7980 | { |
| 7981 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7982 | "SSID Len %d is not correct for network %d", |
| 7983 | pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 7984 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7985 | goto error; |
| 7986 | } |
| 7987 | |
| 7988 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 7989 | request->match_sets[i].ssid.ssid, |
| 7990 | request->match_sets[i].ssid.ssid_len); |
| 7991 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 7992 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 7993 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 7994 | |
| 7995 | /*Copying list of valid channel into request */ |
| 7996 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 7997 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 7998 | |
| 7999 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 8000 | } |
| 8001 | |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 8002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 8003 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 8004 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 8005 | { |
| 8006 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 8007 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 8008 | pPnoRequest->us24GProbeTemplateLen); |
| 8009 | |
| 8010 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 8011 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 8012 | pPnoRequest->us5GProbeTemplateLen); |
| 8013 | } |
| 8014 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 8015 | /* Driver gets only one time interval which is hardcoded in |
| 8016 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 8017 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 8018 | * 80,160,320 secs. And number of scan cycle for each timer |
| 8019 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 8020 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 8021 | * will be repeated after each interval specified by supplicant |
| 8022 | * till PNO is disabled. |
| 8023 | */ |
| 8024 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 8025 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 8026 | else |
| 8027 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 8028 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 8029 | |
| 8030 | tempInterval = (request->interval)/1000; |
| 8031 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8032 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 8033 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 8034 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 8035 | { |
| 8036 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 8037 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 8038 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 8039 | tempInterval *= 2; |
| 8040 | } |
| 8041 | //Repeat last timer until pno disabled. |
| 8042 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 8043 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 8044 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8045 | |
| 8046 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8047 | pPnoRequest, pAdapter->sessionId, |
| 8048 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 8049 | if (eHAL_STATUS_SUCCESS != status) |
| 8050 | { |
| 8051 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8052 | "Failed to enable PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8053 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8054 | goto error; |
| 8055 | } |
| 8056 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8057 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8058 | "PNO scanRequest offloaded"); |
| 8059 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8060 | error: |
| 8061 | vos_mem_free(pPnoRequest); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8062 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8063 | } |
| 8064 | |
| 8065 | /* |
| 8066 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 8067 | * NL interface to disable PNO |
| 8068 | */ |
| 8069 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 8070 | struct net_device *dev) |
| 8071 | { |
| 8072 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 8073 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8074 | hdd_context_t *pHddCtx; |
| 8075 | tHalHandle hHal; |
| 8076 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8077 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8078 | |
| 8079 | ENTER(); |
| 8080 | |
| 8081 | if (NULL == pAdapter) |
| 8082 | { |
| 8083 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8084 | "%s: HDD adapter is Null", __func__); |
| 8085 | return -ENODEV; |
| 8086 | } |
| 8087 | |
| 8088 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8089 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8090 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8091 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8092 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8093 | "%s: HDD context is Null", __func__); |
| 8094 | return -ENODEV; |
| 8095 | } |
| 8096 | |
| 8097 | /* The return 0 is intentional when isLogpInProgress and |
| 8098 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 8099 | * failure in sched_scan_stop , especially for a case where the unload |
| 8100 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 8101 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 8102 | * success. If it returns a failure , then its next invocation due to the |
| 8103 | * clean up of the second interface will have the dev pointer corresponding |
| 8104 | * to the first one leading to a crash. |
| 8105 | */ |
| 8106 | if (pHddCtx->isLogpInProgress) |
| 8107 | { |
| 8108 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8109 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8110 | return ret; |
| 8111 | } |
| 8112 | |
| 8113 | if (pHddCtx->isLoadUnloadInProgress) |
| 8114 | { |
| 8115 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8116 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 8117 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8118 | } |
| 8119 | |
| 8120 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8121 | if (NULL == hHal) |
| 8122 | { |
| 8123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8124 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8125 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8126 | } |
| 8127 | |
| 8128 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 8129 | if (NULL == pPnoRequest) |
| 8130 | { |
| 8131 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8132 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8133 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8134 | } |
| 8135 | |
| 8136 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 8137 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 8138 | pPnoRequest->ucNetworksCount = 0; |
| 8139 | |
| 8140 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 8141 | pAdapter->sessionId, |
| 8142 | NULL, pAdapter); |
| 8143 | if (eHAL_STATUS_SUCCESS != status) |
| 8144 | { |
| 8145 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8146 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8147 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8148 | } |
| 8149 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8150 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8151 | "%s: PNO scan disabled", __func__); |
| 8152 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8153 | vos_mem_free(pPnoRequest); |
| 8154 | |
| 8155 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8156 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8157 | } |
| 8158 | |
| 8159 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 8160 | |
| 8161 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8162 | #ifdef FEATURE_WLAN_TDLS |
| 8163 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 8164 | u8 *peer, u8 action_code, u8 dialog_token, |
| 8165 | u16 status_code, const u8 *buf, size_t len) |
| 8166 | { |
| 8167 | |
| 8168 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8169 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8170 | u8 peerMac[6]; |
| 8171 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8172 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8173 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8174 | long rc; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8175 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8176 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8177 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8179 | "Invalid arguments"); |
| 8180 | return -EINVAL; |
| 8181 | } |
| 8182 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8183 | if (pHddCtx->isLogpInProgress) |
| 8184 | { |
| 8185 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8186 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8187 | wlan_hdd_tdls_set_link_status(pAdapter, peer, eTDLS_LINK_IDLE); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8188 | return -EBUSY; |
| 8189 | } |
| 8190 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8191 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8192 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8193 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8194 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8195 | MAC_ADDRESS_STR " action %d declined.", |
| 8196 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8197 | return -ENOTSUPP; |
| 8198 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8199 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8200 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 8201 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 8202 | { |
| 8203 | /* if tdls_mode is disabled to respond to peer's request */ |
| 8204 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 8205 | { |
| 8206 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8207 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8208 | " TDLS mode is disabled. action %d declined.", |
| 8209 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8210 | |
| 8211 | return -ENOTSUPP; |
| 8212 | } |
| 8213 | } |
| 8214 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8215 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 8216 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8217 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8218 | { |
| 8219 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8220 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8221 | " TDLS setup is ongoing. action %d declined.", |
| 8222 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 8223 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8224 | } |
| 8225 | } |
| 8226 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8227 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 8228 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8229 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8230 | if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8231 | { |
| 8232 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 8233 | we return error code at 'add_station()'. Hence we have this |
| 8234 | check again in addtion to add_station(). |
| 8235 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8236 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8237 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8238 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8239 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8240 | " TDLS Max peer already connected. action %d declined.", |
| 8241 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8242 | goto error; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8243 | } |
| 8244 | else |
| 8245 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8246 | /* maximum reached. tweak to send error code to peer and return |
| 8247 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8248 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8249 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8250 | "%s: " MAC_ADDRESS_STR |
| 8251 | " TDLS Max peer already connected send response status %d", |
| 8252 | __func__, MAC_ADDR_ARRAY(peer), status_code); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8253 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8254 | /* fall through to send setup resp with failure status |
| 8255 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8256 | } |
| 8257 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8258 | else |
| 8259 | { |
| 8260 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8261 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8262 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8263 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8264 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8265 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 8266 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8267 | return -EPERM; |
| 8268 | } |
| 8269 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8270 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8271 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8272 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8273 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 8274 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8275 | "%s: " MAC_ADDRESS_STR " action %d, dialog_token %d status %d, len = %d", |
| 8276 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 8277 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8278 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8279 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8280 | /*Except teardown responder will not be used so just make 0*/ |
| 8281 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8282 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8283 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8284 | |
| 8285 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8286 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8287 | |
| 8288 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 8289 | responder = pTdlsPeer->is_responder; |
| 8290 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8291 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8292 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8293 | "%s: " MAC_ADDRESS_STR " peer doesn't exist or not connected %d dialog_token %d status %d, len = %d", |
| 8294 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 8295 | dialog_token, status_code, len); |
| 8296 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8297 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8298 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8299 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8300 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 8301 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8302 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8303 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 8304 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8305 | { |
| 8306 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 8307 | { |
| 8308 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8309 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8310 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 8311 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8312 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 8313 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8314 | } |
| 8315 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8316 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 8317 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 8318 | { |
| 8319 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8320 | "%s: " MAC_ADDRESS_STR " action %d couldn't sent, as one is pending. return EBUSY", |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8321 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 8322 | return -EBUSY; |
| 8323 | } |
| 8324 | |
| 8325 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8326 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 8327 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8328 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8329 | peerMac, action_code, dialog_token, status_code, (tANI_U8 *)buf, len, responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8330 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8331 | if (VOS_STATUS_SUCCESS != status) |
| 8332 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8333 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8334 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8335 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8336 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 8337 | goto error; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8338 | } |
| 8339 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8340 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 8341 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 8342 | |
| 8343 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8344 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8345 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8346 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8347 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8348 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8349 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 8350 | goto error; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8351 | } |
| 8352 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8353 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8354 | { |
| 8355 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8356 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8357 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8358 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8359 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 8360 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8361 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8362 | } |
| 8363 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 8364 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8365 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8366 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8367 | |
| 8368 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8369 | error: |
| 8370 | /* max_sta_failed ; we didn't set to CONNECTING for this case, |
| 8371 | because we already know that this transaction will be failed, |
| 8372 | but we weren't sure if supplicant call DISABLE_LINK or not. So, |
| 8373 | to be safe, do not change the state mahine. |
| 8374 | */ |
| 8375 | if(max_sta_failed == 0 && |
| 8376 | (WLAN_IS_TDLS_SETUP_ACTION(action_code))) |
| 8377 | wlan_hdd_tdls_set_link_status(pAdapter, peerMac, eTDLS_LINK_IDLE); |
| 8378 | return -EPERM; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8379 | } |
| 8380 | |
| 8381 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 8382 | u8 *peer, enum nl80211_tdls_operation oper) |
| 8383 | { |
| 8384 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8385 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8386 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8387 | hddTdlsPeer_t *pTdlsPeer; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8388 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8389 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8390 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8391 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8392 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8393 | return -EINVAL; |
| 8394 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8395 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8396 | status = wlan_hdd_validate_context(pHddCtx); |
| 8397 | |
| 8398 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8399 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8400 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8401 | "%s: HDD context is not valid", __func__); |
| 8402 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8403 | } |
| 8404 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8405 | |
| 8406 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8407 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8408 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8409 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8410 | "TDLS Disabled in INI OR not enabled in FW. " |
| 8411 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8412 | return -ENOTSUPP; |
| 8413 | } |
| 8414 | |
| 8415 | switch (oper) { |
| 8416 | case NL80211_TDLS_ENABLE_LINK: |
| 8417 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8418 | VOS_STATUS status; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8419 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8420 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8421 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 8422 | |
| 8423 | if ( NULL == pTdlsPeer ) { |
| 8424 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 8425 | " (oper %d) not exsting. ignored", |
| 8426 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 8427 | return -EINVAL; |
| 8428 | } |
| 8429 | |
| 8430 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8431 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 8432 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 8433 | "NL80211_TDLS_ENABLE_LINK"); |
| 8434 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 8435 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 8436 | { |
| 8437 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 8438 | MAC_ADDRESS_STR " failed", |
| 8439 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 8440 | return -EINVAL; |
| 8441 | } |
| 8442 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8443 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8444 | { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 8445 | long ret; |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 8446 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 8447 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 8448 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 8449 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 8450 | return -EINVAL; |
| 8451 | } |
| 8452 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8453 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 8454 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8455 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 8456 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 8457 | * register with the TL on after the response for this operation |
| 8458 | * is received . |
| 8459 | */ |
| 8460 | ret = wait_for_completion_interruptible_timeout( |
| 8461 | &pAdapter->tdls_link_establish_req_comp, |
| 8462 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 8463 | if (ret <= 0) |
| 8464 | { |
| 8465 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8466 | "%s: Link Establish Request Faled Status %ld", |
| 8467 | __func__, ret); |
| 8468 | return -EINVAL; |
| 8469 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8470 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 8471 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 8472 | /* Mark TDLS client Authenticated .*/ |
| 8473 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 8474 | pTdlsPeer->staId, |
| 8475 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 8476 | if (VOS_STATUS_SUCCESS == status) |
| 8477 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8478 | if (pTdlsPeer->is_responder == 0) |
| 8479 | { |
| 8480 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 8481 | |
| 8482 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 8483 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 8484 | WAIT_TIME_TDLS_INITIATOR); |
| 8485 | /* suspend initiator TX until it receives direct packet from the |
| 8486 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 8487 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 8488 | &staId, NULL); |
| 8489 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 8490 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 8491 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8492 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8493 | |
| 8494 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 8495 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 8496 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8497 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 8498 | int ac; |
| 8499 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 8500 | WLANTL_AC_VI, |
| 8501 | WLANTL_AC_BK, |
| 8502 | WLANTL_AC_BE }; |
| 8503 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 8504 | for(ac=0; ac < 4; ac++) |
| 8505 | { |
| 8506 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 8507 | pTdlsPeer->staId, ucAc[ac], |
| 8508 | tlTid[ac], tlTid[ac], 0, 0, |
| 8509 | WLANTL_BI_DIR ); |
| 8510 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8511 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8512 | } |
| 8513 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8514 | } |
| 8515 | break; |
| 8516 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8517 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8518 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 8519 | |
| 8520 | if ( NULL == pTdlsPeer ) { |
| 8521 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 8522 | " (oper %d) not exsting. ignored", |
| 8523 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 8524 | return -EINVAL; |
| 8525 | } |
| 8526 | |
| 8527 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8528 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 8529 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 8530 | "NL80211_TDLS_DISABLE_LINK"); |
| 8531 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8532 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8533 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8534 | long status; |
| 8535 | |
| 8536 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 8537 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8538 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8539 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8540 | |
| 8541 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 8542 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
| 8543 | if (status <= 0) |
| 8544 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8545 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8547 | "%s: Del station failed status %ld", |
| 8548 | __func__, status); |
| 8549 | return -EPERM; |
| 8550 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8551 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8552 | } |
| 8553 | else |
| 8554 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8555 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8556 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8557 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8558 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8559 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8560 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8561 | { |
| 8562 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8563 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 8564 | __func__, MAC_ADDR_ARRAY(peer)); |
| 8565 | |
| 8566 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 8567 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 8568 | |
| 8569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8570 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 8571 | __func__); |
| 8572 | return -ENOTSUPP; |
| 8573 | } |
| 8574 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8575 | |
| 8576 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 8577 | |
| 8578 | if ( NULL == pTdlsPeer ) { |
| 8579 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 8580 | " peer not exsting", |
| 8581 | __func__, MAC_ADDR_ARRAY(peer)); |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame^] | 8582 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8583 | } |
| 8584 | else { |
| 8585 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 8586 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 8587 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame^] | 8588 | |
| 8589 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 8590 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8591 | break; |
| 8592 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8593 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8594 | { |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 8595 | hddTdlsPeer_t *pTdlsPeer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8597 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 8598 | __func__, MAC_ADDR_ARRAY(peer)); |
| 8599 | |
| 8600 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 8601 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 8602 | |
| 8603 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8604 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 8605 | __func__); |
| 8606 | return -ENOTSUPP; |
| 8607 | } |
| 8608 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 8609 | /* To cater the requirement of establishing the TDLS link |
| 8610 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 8611 | */ |
| 8612 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 8613 | if (pTdlsPeer == NULL) { |
| 8614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8615 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 8616 | __func__, MAC_ADDR_ARRAY(peer)); |
| 8617 | return -EINVAL; |
| 8618 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame^] | 8619 | |
| 8620 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 8621 | |
| 8622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8623 | " %s TDLS Add Force Peer Failed", |
| 8624 | __func__); |
| 8625 | return -EINVAL; |
| 8626 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 8627 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8628 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8629 | case NL80211_TDLS_DISCOVERY_REQ: |
| 8630 | /* We don't support in-driver setup/teardown/discovery */ |
| 8631 | return -ENOTSUPP; |
| 8632 | default: |
| 8633 | return -ENOTSUPP; |
| 8634 | } |
| 8635 | return 0; |
| 8636 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 8637 | |
| 8638 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 8639 | struct net_device *dev, u8 *peer) |
| 8640 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 8641 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8642 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 8643 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 8644 | |
| 8645 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 8646 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
| 8647 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8648 | #endif |
| 8649 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8650 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 8651 | /* |
| 8652 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 8653 | * Callback rountine called upon receiving response for |
| 8654 | * get offload info |
| 8655 | */ |
| 8656 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 8657 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 8658 | { |
| 8659 | |
| 8660 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8661 | tANI_U8 tempReplayCounter[8]; |
| 8662 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8663 | |
| 8664 | ENTER(); |
| 8665 | |
| 8666 | if (NULL == pAdapter) |
| 8667 | { |
| 8668 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8669 | "%s: HDD adapter is Null", __func__); |
| 8670 | return ; |
| 8671 | } |
| 8672 | |
| 8673 | if (NULL == pGtkOffloadGetInfoRsp) |
| 8674 | { |
| 8675 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8676 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 8677 | return ; |
| 8678 | } |
| 8679 | |
| 8680 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 8681 | { |
| 8682 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8683 | "%s: wlan Failed to get replay counter value", |
| 8684 | __func__); |
| 8685 | return ; |
| 8686 | } |
| 8687 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8688 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8689 | /* Update replay counter */ |
| 8690 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 8691 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 8692 | |
| 8693 | { |
| 8694 | /* changing from little to big endian since supplicant |
| 8695 | * works on big endian format |
| 8696 | */ |
| 8697 | int i; |
| 8698 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 8699 | |
| 8700 | for (i = 0; i < 8; i++) |
| 8701 | { |
| 8702 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 8703 | } |
| 8704 | } |
| 8705 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8706 | /* Update replay counter to NL */ |
| 8707 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8708 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8709 | } |
| 8710 | |
| 8711 | /* |
| 8712 | * FUNCTION: wlan_hdd_cfg80211_set_rekey_data |
| 8713 | * This function is used to offload GTK rekeying job to the firmware. |
| 8714 | */ |
| 8715 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 8716 | struct cfg80211_gtk_rekey_data *data) |
| 8717 | { |
| 8718 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8719 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8720 | hdd_station_ctx_t *pHddStaCtx; |
| 8721 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8722 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8723 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8724 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 8725 | |
| 8726 | ENTER(); |
| 8727 | |
| 8728 | if (NULL == pAdapter) |
| 8729 | { |
| 8730 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8731 | "%s: HDD adapter is Null", __func__); |
| 8732 | return -ENODEV; |
| 8733 | } |
| 8734 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8735 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8736 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8737 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8738 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8740 | "%s: HDD context is not valid", __func__); |
| 8741 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8742 | } |
| 8743 | |
| 8744 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8745 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8746 | if (NULL == hHal) |
| 8747 | { |
| 8748 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8749 | "%s: HAL context is Null!!!", __func__); |
| 8750 | return -EAGAIN; |
| 8751 | } |
| 8752 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8753 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 8754 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 8755 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 8756 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8757 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8758 | { |
| 8759 | /* changing from big to little endian since driver |
| 8760 | * works on little endian format |
| 8761 | */ |
| 8762 | tANI_U8 *p = |
| 8763 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 8764 | int i; |
| 8765 | |
| 8766 | for (i = 0; i < 8; i++) |
| 8767 | { |
| 8768 | p[7-i] = data->replay_ctr[i]; |
| 8769 | } |
| 8770 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8771 | |
| 8772 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 8773 | { |
| 8774 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8775 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 8776 | sizeof (tSirGtkOffloadParams)); |
| 8777 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8778 | pAdapter->sessionId); |
| 8779 | |
| 8780 | if (eHAL_STATUS_SUCCESS != status) |
| 8781 | { |
| 8782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8783 | "%s: sme_SetGTKOffload failed, returned %d", |
| 8784 | __func__, status); |
| 8785 | return status; |
| 8786 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8787 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8788 | "%s: sme_SetGTKOffload successfull", __func__); |
| 8789 | } |
| 8790 | else |
| 8791 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8792 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8793 | "%s: wlan not suspended GTKOffload request is stored", |
| 8794 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8795 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 8796 | |
| 8797 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 8798 | } |
| 8799 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
| 8800 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8801 | /* |
| 8802 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 8803 | * This function is used to set access control policy |
| 8804 | */ |
| 8805 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 8806 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 8807 | { |
| 8808 | int i; |
| 8809 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8810 | hdd_hostapd_state_t *pHostapdState; |
| 8811 | tsap_Config_t *pConfig; |
| 8812 | v_CONTEXT_t pVosContext = NULL; |
| 8813 | hdd_context_t *pHddCtx; |
| 8814 | int status; |
| 8815 | |
| 8816 | ENTER(); |
| 8817 | |
| 8818 | if (NULL == pAdapter) |
| 8819 | { |
| 8820 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8821 | "%s: HDD adapter is Null", __func__); |
| 8822 | return -ENODEV; |
| 8823 | } |
| 8824 | |
| 8825 | if (NULL == params) |
| 8826 | { |
| 8827 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8828 | "%s: params is Null", __func__); |
| 8829 | return -EINVAL; |
| 8830 | } |
| 8831 | |
| 8832 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8833 | status = wlan_hdd_validate_context(pHddCtx); |
| 8834 | |
| 8835 | if (0 != status) |
| 8836 | { |
| 8837 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8838 | "%s: HDD context is not valid", __func__); |
| 8839 | return status; |
| 8840 | } |
| 8841 | |
| 8842 | pVosContext = pHddCtx->pvosContext; |
| 8843 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 8844 | |
| 8845 | if (NULL == pHostapdState) |
| 8846 | { |
| 8847 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8848 | "%s: pHostapdState is Null", __func__); |
| 8849 | return -EINVAL; |
| 8850 | } |
| 8851 | |
| 8852 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 8853 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 8854 | |
| 8855 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 8856 | { |
| 8857 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 8858 | |
| 8859 | /* default value */ |
| 8860 | pConfig->num_accept_mac = 0; |
| 8861 | pConfig->num_deny_mac = 0; |
| 8862 | |
| 8863 | /** |
| 8864 | * access control policy |
| 8865 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 8866 | * listed in hostapd.deny file. |
| 8867 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 8868 | * listed in hostapd.accept file. |
| 8869 | */ |
| 8870 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 8871 | { |
| 8872 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 8873 | } |
| 8874 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 8875 | { |
| 8876 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 8877 | } |
| 8878 | else |
| 8879 | { |
| 8880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8881 | "%s:Acl Policy : %d is not supported", |
| 8882 | __func__, params->acl_policy); |
| 8883 | return -ENOTSUPP; |
| 8884 | } |
| 8885 | |
| 8886 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 8887 | { |
| 8888 | pConfig->num_accept_mac = params->n_acl_entries; |
| 8889 | for (i = 0; i < params->n_acl_entries; i++) |
| 8890 | { |
| 8891 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8892 | "** Add ACL MAC entry %i in WhiletList :" |
| 8893 | MAC_ADDRESS_STR, i, |
| 8894 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 8895 | |
| 8896 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 8897 | sizeof(qcmacaddr)); |
| 8898 | } |
| 8899 | } |
| 8900 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 8901 | { |
| 8902 | pConfig->num_deny_mac = params->n_acl_entries; |
| 8903 | for (i = 0; i < params->n_acl_entries; i++) |
| 8904 | { |
| 8905 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8906 | "** Add ACL MAC entry %i in BlackList :" |
| 8907 | MAC_ADDRESS_STR, i, |
| 8908 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 8909 | |
| 8910 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 8911 | sizeof(qcmacaddr)); |
| 8912 | } |
| 8913 | } |
| 8914 | |
| 8915 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 8916 | { |
| 8917 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8918 | "%s: SAP Set Mac Acl fail", __func__); |
| 8919 | return -EINVAL; |
| 8920 | } |
| 8921 | } |
| 8922 | else |
| 8923 | { |
| 8924 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8925 | "%s: Invalid device_mode = %d", |
| 8926 | __func__, pAdapter->device_mode); |
| 8927 | return -EINVAL; |
| 8928 | } |
| 8929 | |
| 8930 | return 0; |
| 8931 | } |
| 8932 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8933 | #ifdef WLAN_NL80211_TESTMODE |
| 8934 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8935 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8936 | ( |
| 8937 | void *pAdapter, |
| 8938 | void *indCont |
| 8939 | ) |
| 8940 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8941 | tSirLPHBInd *lphbInd; |
| 8942 | struct sk_buff *skb; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8943 | |
| 8944 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8945 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8946 | |
| 8947 | if (NULL == indCont) |
| 8948 | { |
| 8949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8950 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8951 | return; |
| 8952 | } |
| 8953 | |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8954 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8955 | skb = cfg80211_testmode_alloc_event_skb( |
| 8956 | ((hdd_adapter_t *)pAdapter)->wdev.wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8957 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8958 | GFP_ATOMIC); |
| 8959 | if (!skb) |
| 8960 | { |
| 8961 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8962 | "LPHB timeout, NL buffer alloc fail"); |
| 8963 | return; |
| 8964 | } |
| 8965 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 8966 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_CMD, WLAN_HDD_TM_CMD_WLAN_HB)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8967 | { |
| 8968 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8969 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 8970 | goto nla_put_failure; |
| 8971 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 8972 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8973 | { |
| 8974 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8975 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 8976 | goto nla_put_failure; |
| 8977 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 8978 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 8979 | sizeof(tSirLPHBInd), lphbInd)) |
| 8980 | { |
| 8981 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8982 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 8983 | goto nla_put_failure; |
| 8984 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 8985 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 8986 | return; |
| 8987 | |
| 8988 | nla_put_failure: |
| 8989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8990 | "NLA Put fail"); |
| 8991 | kfree_skb(skb); |
| 8992 | |
| 8993 | return; |
| 8994 | } |
| 8995 | #endif /* FEATURE_WLAN_LPHB */ |
| 8996 | |
| 8997 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 8998 | { |
| 8999 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 9000 | int err = 0; |
| 9001 | #ifdef FEATURE_WLAN_LPHB |
| 9002 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9003 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9004 | #endif /* FEATURE_WLAN_LPHB */ |
| 9005 | |
| 9006 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 9007 | if (err) |
| 9008 | { |
| 9009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9010 | "%s Testmode INV ATTR", __func__); |
| 9011 | return err; |
| 9012 | } |
| 9013 | |
| 9014 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 9015 | { |
| 9016 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9017 | "%s Testmode INV CMD", __func__); |
| 9018 | return -EINVAL; |
| 9019 | } |
| 9020 | |
| 9021 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 9022 | { |
| 9023 | #ifdef FEATURE_WLAN_LPHB |
| 9024 | /* Low Power Heartbeat configuration request */ |
| 9025 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 9026 | { |
| 9027 | int buf_len; |
| 9028 | void *buf; |
| 9029 | tSirLPHBReq *hb_params = NULL; |
| 9030 | |
| 9031 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 9032 | { |
| 9033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9034 | "%s Testmode INV DATA", __func__); |
| 9035 | return -EINVAL; |
| 9036 | } |
| 9037 | |
| 9038 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 9039 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 9040 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 9041 | if (NULL == hb_params) |
| 9042 | { |
| 9043 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9044 | "%s Request Buffer Alloc Fail", __func__); |
| 9045 | return -EINVAL; |
| 9046 | } |
| 9047 | |
| 9048 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9049 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 9050 | hb_params, |
| 9051 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 9052 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9053 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9054 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9055 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9056 | vos_mem_free(hb_params); |
| 9057 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9058 | return 0; |
| 9059 | } |
| 9060 | #endif /* FEATURE_WLAN_LPHB */ |
| 9061 | default: |
| 9062 | return -EOPNOTSUPP; |
| 9063 | } |
| 9064 | |
| 9065 | return err; |
| 9066 | } |
| 9067 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 9068 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9069 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 9070 | struct net_device *dev, |
| 9071 | int idx, struct survey_info *survey) |
| 9072 | { |
| 9073 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9074 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9075 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9076 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9077 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9078 | v_S7_t snr,rssi; |
| 9079 | int status, i, j, filled = 0; |
| 9080 | |
| 9081 | ENTER(); |
| 9082 | |
| 9083 | |
| 9084 | if (NULL == pAdapter) |
| 9085 | { |
| 9086 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9087 | "%s: HDD adapter is Null", __func__); |
| 9088 | return -ENODEV; |
| 9089 | } |
| 9090 | |
| 9091 | if (NULL == wiphy) |
| 9092 | { |
| 9093 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9094 | "%s: wiphy is Null", __func__); |
| 9095 | return -ENODEV; |
| 9096 | } |
| 9097 | |
| 9098 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9099 | status = wlan_hdd_validate_context(pHddCtx); |
| 9100 | |
| 9101 | if (0 != status) |
| 9102 | { |
| 9103 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9104 | "%s: HDD context is not valid", __func__); |
| 9105 | return status; |
| 9106 | } |
| 9107 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9108 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9109 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9110 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9111 | 0 != pAdapter->survey_idx || |
| 9112 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9113 | { |
| 9114 | /* The survey dump ops when implemented completely is expected to |
| 9115 | * return a survey of all channels and the ops is called by the |
| 9116 | * kernel with incremental values of the argument 'idx' till it |
| 9117 | * returns -ENONET. But we can only support the survey for the |
| 9118 | * operating channel for now. survey_idx is used to track |
| 9119 | * that the ops is called only once and then return -ENONET for |
| 9120 | * the next iteration |
| 9121 | */ |
| 9122 | pAdapter->survey_idx = 0; |
| 9123 | return -ENONET; |
| 9124 | } |
| 9125 | |
| 9126 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9127 | |
| 9128 | wlan_hdd_get_snr(pAdapter, &snr); |
| 9129 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 9130 | |
| 9131 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 9132 | hdd_wlan_get_freq(channel, &freq); |
| 9133 | |
| 9134 | |
| 9135 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 9136 | { |
| 9137 | if (NULL == wiphy->bands[i]) |
| 9138 | { |
| 9139 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 9140 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 9141 | continue; |
| 9142 | } |
| 9143 | |
| 9144 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 9145 | { |
| 9146 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 9147 | |
| 9148 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 9149 | { |
| 9150 | survey->channel = &band->channels[j]; |
| 9151 | /* The Rx BDs contain SNR values in dB for the received frames |
| 9152 | * while the supplicant expects noise. So we calculate and |
| 9153 | * return the value of noise (dBm) |
| 9154 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 9155 | */ |
| 9156 | survey->noise = rssi - snr; |
| 9157 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 9158 | filled = 1; |
| 9159 | } |
| 9160 | } |
| 9161 | } |
| 9162 | |
| 9163 | if (filled) |
| 9164 | pAdapter->survey_idx = 1; |
| 9165 | else |
| 9166 | { |
| 9167 | pAdapter->survey_idx = 0; |
| 9168 | return -ENONET; |
| 9169 | } |
| 9170 | |
| 9171 | return 0; |
| 9172 | } |
| 9173 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9174 | /* |
| 9175 | * FUNCTION: wlan_hdd_cfg80211_resume_wlan |
| 9176 | * this is called when cfg80211 driver resume |
| 9177 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 9178 | */ |
| 9179 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 9180 | { |
| 9181 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9182 | hdd_adapter_t *pAdapter; |
| 9183 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 9184 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 9185 | |
| 9186 | ENTER(); |
| 9187 | |
| 9188 | if ( NULL == pHddCtx ) |
| 9189 | { |
| 9190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9191 | "%s: HddCtx validation failed", __func__); |
| 9192 | return 0; |
| 9193 | } |
| 9194 | |
| 9195 | if (pHddCtx->isLogpInProgress) |
| 9196 | { |
| 9197 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9198 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 9199 | return 0; |
| 9200 | } |
| 9201 | |
| 9202 | if (pHddCtx->isLoadUnloadInProgress) |
| 9203 | { |
| 9204 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9205 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 9206 | return 0; |
| 9207 | } |
| 9208 | |
| 9209 | spin_lock(&pHddCtx->schedScan_lock); |
| 9210 | pHddCtx->isWiphySuspended = FALSE; |
| 9211 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 9212 | { |
| 9213 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9214 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9215 | "%s: Return resume is not due to PNO indication", __func__); |
| 9216 | return 0; |
| 9217 | } |
| 9218 | // Reset flag to avoid updatating cfg80211 data old results again |
| 9219 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 9220 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9221 | |
| 9222 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 9223 | |
| 9224 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 9225 | { |
| 9226 | pAdapter = pAdapterNode->pAdapter; |
| 9227 | if ( (NULL != pAdapter) && |
| 9228 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 9229 | { |
| 9230 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
| 9231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 9232 | "%s: NO SCAN result", __func__); |
| 9233 | else |
| 9234 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
| 9235 | |
| 9236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9237 | "%s : cfg80211 scan result database updated", __func__); |
| 9238 | |
| 9239 | return 0; |
| 9240 | |
| 9241 | } |
| 9242 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 9243 | pAdapterNode = pNext; |
| 9244 | } |
| 9245 | |
| 9246 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9247 | "%s: Failed to find Adapter", __func__); |
| 9248 | return 0; |
| 9249 | } |
| 9250 | |
| 9251 | /* |
| 9252 | * FUNCTION: wlan_hdd_cfg80211_suspend_wlan |
| 9253 | * this is called when cfg80211 driver suspends |
| 9254 | */ |
| 9255 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 9256 | struct cfg80211_wowlan *wow) |
| 9257 | { |
| 9258 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9259 | |
| 9260 | ENTER(); |
| 9261 | if (NULL == pHddCtx) |
| 9262 | { |
| 9263 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9264 | "%s: HddCtx validation failed", __func__); |
| 9265 | return 0; |
| 9266 | } |
| 9267 | |
| 9268 | pHddCtx->isWiphySuspended = TRUE; |
| 9269 | |
| 9270 | EXIT(); |
| 9271 | |
| 9272 | return 0; |
| 9273 | } |
| 9274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9275 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9276 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9277 | { |
| 9278 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 9279 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 9280 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 9281 | .change_station = wlan_hdd_change_station, |
| 9282 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9283 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 9284 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 9285 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9286 | #else |
| 9287 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 9288 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 9289 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9290 | #endif |
| 9291 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 9292 | .add_key = wlan_hdd_cfg80211_add_key, |
| 9293 | .get_key = wlan_hdd_cfg80211_get_key, |
| 9294 | .del_key = wlan_hdd_cfg80211_del_key, |
| 9295 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9296 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9297 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9298 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9299 | .scan = wlan_hdd_cfg80211_scan, |
| 9300 | .connect = wlan_hdd_cfg80211_connect, |
| 9301 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 9302 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 9303 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 9304 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 9305 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 9306 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9307 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 9308 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
| 9309 | .mgmt_tx = wlan_hdd_action, |
| 9310 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9311 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 9312 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 9313 | .set_txq_params = wlan_hdd_set_txq_params, |
| 9314 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9315 | .get_station = wlan_hdd_cfg80211_get_station, |
| 9316 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 9317 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9318 | .add_station = wlan_hdd_cfg80211_add_station, |
| 9319 | #ifdef FEATURE_WLAN_LFR |
| 9320 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 9321 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 9322 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 9323 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9324 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 9325 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 9326 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9327 | #ifdef FEATURE_WLAN_TDLS |
| 9328 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 9329 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 9330 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9331 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 9332 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 9333 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9334 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 9335 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 9336 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 9337 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9338 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 9339 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9340 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9341 | #ifdef WLAN_NL80211_TESTMODE |
| 9342 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 9343 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9344 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9345 | }; |
| 9346 | |