Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 23 | * Copyright (c) 2012-2014 Qualcomm Atheros, Inc. |
| 24 | * All Rights Reserved. |
| 25 | * Qualcomm Atheros Confidential and Proprietary. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | /**======================================================================== |
| 31 | |
| 32 | \file wlan_hdd_cfg80211.c |
| 33 | |
| 34 | \brief WLAN Host Device Driver implementation |
| 35 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 36 | ========================================================================*/ |
| 37 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 38 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | EDIT HISTORY FOR FILE |
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 | This section contains comments describing changes made to the module. |
| 44 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | |
| 46 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 47 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | |
| 49 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 50 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 51 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | |
| 54 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 55 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | ==========================================================================*/ |
| 57 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | |
| 59 | #include <linux/version.h> |
| 60 | #include <linux/module.h> |
| 61 | #include <linux/kernel.h> |
| 62 | #include <linux/init.h> |
| 63 | #include <linux/wireless.h> |
| 64 | #include <wlan_hdd_includes.h> |
| 65 | #include <net/arp.h> |
| 66 | #include <net/cfg80211.h> |
| 67 | #include <linux/wireless.h> |
| 68 | #include <wlan_hdd_wowl.h> |
| 69 | #include <aniGlobal.h> |
| 70 | #include "ccmApi.h" |
| 71 | #include "sirParams.h" |
| 72 | #include "dot11f.h" |
| 73 | #include "wlan_hdd_assoc.h" |
| 74 | #include "wlan_hdd_wext.h" |
| 75 | #include "sme_Api.h" |
| 76 | #include "wlan_hdd_p2p.h" |
| 77 | #include "wlan_hdd_cfg80211.h" |
| 78 | #include "wlan_hdd_hostapd.h" |
| 79 | #include "sapInternal.h" |
| 80 | #include "wlan_hdd_softap_tx_rx.h" |
| 81 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 82 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 83 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_trace.h" |
| 85 | #include "vos_types.h" |
| 86 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | #ifdef WLAN_BTAMP_FEATURE |
| 88 | #include "bap_hdd_misc.h" |
| 89 | #endif |
| 90 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 91 | #ifdef FEATURE_WLAN_TDLS |
| 92 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 93 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 94 | #include "wlan_qct_wda.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 95 | #endif |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 96 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | |
| 99 | #define g_mode_rates_size (12) |
| 100 | #define a_mode_rates_size (8) |
| 101 | #define FREQ_BASE_80211G (2407) |
| 102 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 103 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 104 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 106 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | |
| 108 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 109 | .band = IEEE80211_BAND_2GHZ, \ |
| 110 | .center_freq = (freq), \ |
| 111 | .hw_value = (chan),\ |
| 112 | .flags = (flag), \ |
| 113 | .max_antenna_gain = 0 ,\ |
| 114 | .max_power = 30, \ |
| 115 | } |
| 116 | |
| 117 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 118 | .band = IEEE80211_BAND_5GHZ, \ |
| 119 | .center_freq = (freq), \ |
| 120 | .hw_value = (chan),\ |
| 121 | .flags = (flag), \ |
| 122 | .max_antenna_gain = 0 ,\ |
| 123 | .max_power = 30, \ |
| 124 | } |
| 125 | |
| 126 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 127 | {\ |
| 128 | .bitrate = rate, \ |
| 129 | .hw_value = rate_id, \ |
| 130 | .flags = flag, \ |
| 131 | } |
| 132 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 133 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 134 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 135 | #else |
| 136 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 137 | #endif |
| 138 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 139 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 140 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 141 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 142 | #endif |
| 143 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 144 | #define HDD_CHANNEL_14 14 |
| 145 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 146 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | { |
| 148 | WLAN_CIPHER_SUITE_WEP40, |
| 149 | WLAN_CIPHER_SUITE_WEP104, |
| 150 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 151 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 152 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 153 | WLAN_CIPHER_SUITE_KRK, |
| 154 | WLAN_CIPHER_SUITE_CCMP, |
| 155 | #else |
| 156 | WLAN_CIPHER_SUITE_CCMP, |
| 157 | #endif |
| 158 | #ifdef FEATURE_WLAN_WAPI |
| 159 | WLAN_CIPHER_SUITE_SMS4, |
| 160 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 161 | #ifdef WLAN_FEATURE_11W |
| 162 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 163 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 167 | { |
| 168 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 169 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 170 | } |
| 171 | |
| 172 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 173 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | HDD2GHZCHAN(2412, 1, 0) , |
| 175 | HDD2GHZCHAN(2417, 2, 0) , |
| 176 | HDD2GHZCHAN(2422, 3, 0) , |
| 177 | HDD2GHZCHAN(2427, 4, 0) , |
| 178 | HDD2GHZCHAN(2432, 5, 0) , |
| 179 | HDD2GHZCHAN(2437, 6, 0) , |
| 180 | HDD2GHZCHAN(2442, 7, 0) , |
| 181 | HDD2GHZCHAN(2447, 8, 0) , |
| 182 | HDD2GHZCHAN(2452, 9, 0) , |
| 183 | HDD2GHZCHAN(2457, 10, 0) , |
| 184 | HDD2GHZCHAN(2462, 11, 0) , |
| 185 | HDD2GHZCHAN(2467, 12, 0) , |
| 186 | HDD2GHZCHAN(2472, 13, 0) , |
| 187 | HDD2GHZCHAN(2484, 14, 0) , |
| 188 | }; |
| 189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 191 | { |
| 192 | HDD2GHZCHAN(2412, 1, 0) , |
| 193 | HDD2GHZCHAN(2437, 6, 0) , |
| 194 | HDD2GHZCHAN(2462, 11, 0) , |
| 195 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 196 | |
| 197 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 198 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 199 | HDD5GHZCHAN(4920, 240, 0) , |
| 200 | HDD5GHZCHAN(4940, 244, 0) , |
| 201 | HDD5GHZCHAN(4960, 248, 0) , |
| 202 | HDD5GHZCHAN(4980, 252, 0) , |
| 203 | HDD5GHZCHAN(5040, 208, 0) , |
| 204 | HDD5GHZCHAN(5060, 212, 0) , |
| 205 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | HDD5GHZCHAN(5180, 36, 0) , |
| 207 | HDD5GHZCHAN(5200, 40, 0) , |
| 208 | HDD5GHZCHAN(5220, 44, 0) , |
| 209 | HDD5GHZCHAN(5240, 48, 0) , |
| 210 | HDD5GHZCHAN(5260, 52, 0) , |
| 211 | HDD5GHZCHAN(5280, 56, 0) , |
| 212 | HDD5GHZCHAN(5300, 60, 0) , |
| 213 | HDD5GHZCHAN(5320, 64, 0) , |
| 214 | HDD5GHZCHAN(5500,100, 0) , |
| 215 | HDD5GHZCHAN(5520,104, 0) , |
| 216 | HDD5GHZCHAN(5540,108, 0) , |
| 217 | HDD5GHZCHAN(5560,112, 0) , |
| 218 | HDD5GHZCHAN(5580,116, 0) , |
| 219 | HDD5GHZCHAN(5600,120, 0) , |
| 220 | HDD5GHZCHAN(5620,124, 0) , |
| 221 | HDD5GHZCHAN(5640,128, 0) , |
| 222 | HDD5GHZCHAN(5660,132, 0) , |
| 223 | HDD5GHZCHAN(5680,136, 0) , |
| 224 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 225 | #ifdef FEATURE_WLAN_CH144 |
| 226 | HDD5GHZCHAN(5720,144, 0) , |
| 227 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | HDD5GHZCHAN(5745,149, 0) , |
| 229 | HDD5GHZCHAN(5765,153, 0) , |
| 230 | HDD5GHZCHAN(5785,157, 0) , |
| 231 | HDD5GHZCHAN(5805,161, 0) , |
| 232 | HDD5GHZCHAN(5825,165, 0) , |
| 233 | }; |
| 234 | |
| 235 | static struct ieee80211_rate g_mode_rates[] = |
| 236 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 237 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 238 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 239 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 240 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 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), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 249 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 250 | |
| 251 | static struct ieee80211_rate a_mode_rates[] = |
| 252 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 253 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 254 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 255 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 256 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 257 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 258 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 259 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 261 | }; |
| 262 | |
| 263 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 264 | { |
| 265 | .channels = hdd_channels_2_4_GHZ, |
| 266 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 267 | .band = IEEE80211_BAND_2GHZ, |
| 268 | .bitrates = g_mode_rates, |
| 269 | .n_bitrates = g_mode_rates_size, |
| 270 | .ht_cap.ht_supported = 1, |
| 271 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 272 | | IEEE80211_HT_CAP_GRN_FLD |
| 273 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 274 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 275 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 276 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 277 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 278 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 279 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 280 | }; |
| 281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 283 | { |
| 284 | .channels = hdd_social_channels_2_4_GHZ, |
| 285 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 286 | .band = IEEE80211_BAND_2GHZ, |
| 287 | .bitrates = g_mode_rates, |
| 288 | .n_bitrates = g_mode_rates_size, |
| 289 | .ht_cap.ht_supported = 1, |
| 290 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 291 | | IEEE80211_HT_CAP_GRN_FLD |
| 292 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 293 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 294 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 295 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 296 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 297 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 298 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 299 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | |
| 301 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 302 | { |
| 303 | .channels = hdd_channels_5_GHZ, |
| 304 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 305 | .band = IEEE80211_BAND_5GHZ, |
| 306 | .bitrates = a_mode_rates, |
| 307 | .n_bitrates = a_mode_rates_size, |
| 308 | .ht_cap.ht_supported = 1, |
| 309 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 310 | | IEEE80211_HT_CAP_GRN_FLD |
| 311 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 312 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 313 | | IEEE80211_HT_CAP_SGI_40 |
| 314 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 315 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 316 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 317 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 318 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 319 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 320 | }; |
| 321 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 322 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | TX/RX direction for each kind of interface */ |
| 324 | static const struct ieee80211_txrx_stypes |
| 325 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 326 | [NL80211_IFTYPE_STATION] = { |
| 327 | .tx = 0xffff, |
| 328 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 329 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 330 | }, |
| 331 | [NL80211_IFTYPE_AP] = { |
| 332 | .tx = 0xffff, |
| 333 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 334 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 335 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 336 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 337 | BIT(SIR_MAC_MGMT_AUTH) | |
| 338 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 339 | BIT(SIR_MAC_MGMT_ACTION), |
| 340 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 341 | [NL80211_IFTYPE_ADHOC] = { |
| 342 | .tx = 0xffff, |
| 343 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 344 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 345 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 346 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 347 | BIT(SIR_MAC_MGMT_AUTH) | |
| 348 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 349 | BIT(SIR_MAC_MGMT_ACTION), |
| 350 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 352 | .tx = 0xffff, |
| 353 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 354 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 355 | }, |
| 356 | [NL80211_IFTYPE_P2P_GO] = { |
| 357 | /* This is also same as for SoftAP */ |
| 358 | .tx = 0xffff, |
| 359 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 360 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 361 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 362 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 363 | BIT(SIR_MAC_MGMT_AUTH) | |
| 364 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 365 | BIT(SIR_MAC_MGMT_ACTION), |
| 366 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | }; |
| 368 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 369 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 370 | static const struct ieee80211_iface_limit |
| 371 | wlan_hdd_iface_limit[] = { |
| 372 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 373 | /* max = 3 ; Our driver create two interfaces during driver init |
| 374 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 375 | * interface until a group is formed. In JB architecture, once the |
| 376 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 377 | * Client. |
| 378 | * When supplicant remove the group, it first issue a set interface |
| 379 | * cmd to change the mode back to Station. In JB this works fine as |
| 380 | * we advertize two station type interface during driver init. |
| 381 | * Some vendors create separate interface for P2P GO/Client, |
| 382 | * after group formation(Third one). But while group remove |
| 383 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 384 | * But as we advertized only two sta type interfaces nl80211 was |
| 385 | * returning error for the third one which was leading to failure in |
| 386 | * delete interface. Ideally while removing the group, supplicant |
| 387 | * should not try to change the 3rd interface mode to Station type. |
| 388 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 389 | * interface type to 3 |
| 390 | */ |
| 391 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 392 | .types = BIT(NL80211_IFTYPE_STATION), |
| 393 | }, |
| 394 | { |
| 395 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 396 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 397 | }, |
| 398 | { |
| 399 | .max = 1, |
| 400 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 401 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 402 | }, |
| 403 | }; |
| 404 | |
| 405 | /* By default, only single channel concurrency is allowed */ |
| 406 | static struct ieee80211_iface_combination |
| 407 | wlan_hdd_iface_combination = { |
| 408 | .limits = wlan_hdd_iface_limit, |
| 409 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 410 | /* |
| 411 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 412 | * and p2p0 interfaces during driver init |
| 413 | * Some vendors create separate interface for P2P operations. |
| 414 | * wlan0: STA interface |
| 415 | * p2p0: P2P Device interface, action frames goes |
| 416 | * through this interface. |
| 417 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 418 | * created for p2p operations(GO/CLIENT interface). |
| 419 | */ |
| 420 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 421 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 422 | .beacon_int_infra_match = false, |
| 423 | }; |
| 424 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 427 | |
| 428 | /* Data rate 100KBPS based on IE Index */ |
| 429 | struct index_data_rate_type |
| 430 | { |
| 431 | v_U8_t beacon_rate_index; |
| 432 | v_U16_t supported_rate[4]; |
| 433 | }; |
| 434 | |
| 435 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 436 | The IDX field is the rate index |
| 437 | The HI field is the rate when RSSI is strong or being ignored |
| 438 | (in this case we report actual rate) |
| 439 | The MID field is the rate when RSSI is moderate |
| 440 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 441 | The LO field is the rate when RSSI is low |
| 442 | (in this case we don't report rates, actual current rate used) |
| 443 | */ |
| 444 | static const struct |
| 445 | { |
| 446 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 447 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | } supported_data_rate[] = |
| 449 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 450 | /* IDX HI HM LM LO (RSSI-based index */ |
| 451 | {2, { 10, 10, 10, 0}}, |
| 452 | {4, { 20, 20, 10, 0}}, |
| 453 | {11, { 55, 20, 10, 0}}, |
| 454 | {12, { 60, 55, 20, 0}}, |
| 455 | {18, { 90, 55, 20, 0}}, |
| 456 | {22, {110, 55, 20, 0}}, |
| 457 | {24, {120, 90, 60, 0}}, |
| 458 | {36, {180, 120, 60, 0}}, |
| 459 | {44, {220, 180, 60, 0}}, |
| 460 | {48, {240, 180, 90, 0}}, |
| 461 | {66, {330, 180, 90, 0}}, |
| 462 | {72, {360, 240, 90, 0}}, |
| 463 | {96, {480, 240, 120, 0}}, |
| 464 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | }; |
| 466 | |
| 467 | /* MCS Based rate table */ |
| 468 | static struct index_data_rate_type supported_mcs_rate[] = |
| 469 | { |
| 470 | /* MCS L20 L40 S20 S40 */ |
| 471 | {0, {65, 135, 72, 150}}, |
| 472 | {1, {130, 270, 144, 300}}, |
| 473 | {2, {195, 405, 217, 450}}, |
| 474 | {3, {260, 540, 289, 600}}, |
| 475 | {4, {390, 810, 433, 900}}, |
| 476 | {5, {520, 1080, 578, 1200}}, |
| 477 | {6, {585, 1215, 650, 1350}}, |
| 478 | {7, {650, 1350, 722, 1500}} |
| 479 | }; |
| 480 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 481 | #ifdef WLAN_FEATURE_11AC |
| 482 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 483 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 484 | |
| 485 | struct index_vht_data_rate_type |
| 486 | { |
| 487 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 488 | v_U16_t supported_VHT80_rate[2]; |
| 489 | v_U16_t supported_VHT40_rate[2]; |
| 490 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 491 | }; |
| 492 | |
| 493 | typedef enum |
| 494 | { |
| 495 | DATA_RATE_11AC_MAX_MCS_7, |
| 496 | DATA_RATE_11AC_MAX_MCS_8, |
| 497 | DATA_RATE_11AC_MAX_MCS_9, |
| 498 | DATA_RATE_11AC_MAX_MCS_NA |
| 499 | } eDataRate11ACMaxMcs; |
| 500 | |
| 501 | /* MCS Based VHT rate table */ |
| 502 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 503 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 504 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 505 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 506 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 507 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 508 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 509 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 510 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 511 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 512 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 513 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 514 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 515 | }; |
| 516 | #endif /* WLAN_FEATURE_11AC */ |
| 517 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | extern struct net_device_ops net_ops_struct; |
| 519 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 520 | #ifdef WLAN_NL80211_TESTMODE |
| 521 | enum wlan_hdd_tm_attr |
| 522 | { |
| 523 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 524 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 525 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 526 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 527 | /* keep last */ |
| 528 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 529 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 530 | }; |
| 531 | |
| 532 | enum wlan_hdd_tm_cmd |
| 533 | { |
| 534 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 535 | }; |
| 536 | |
| 537 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 538 | |
| 539 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 540 | { |
| 541 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 542 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 543 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 544 | }; |
| 545 | #endif /* WLAN_NL80211_TESTMODE */ |
| 546 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 547 | #ifdef FEATURE_WLAN_CH_AVOID |
| 548 | /* |
| 549 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 550 | * This is called when wlan driver needs to send vendor specific |
| 551 | * avoid frequency range event to userspace |
| 552 | */ |
| 553 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 554 | tHddAvoidFreqList *pAvoidFreqList) |
| 555 | { |
| 556 | struct sk_buff *vendor_event; |
| 557 | |
| 558 | ENTER(); |
| 559 | |
| 560 | if (!pHddCtx) |
| 561 | { |
| 562 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 563 | "%s: HDD context is null", __func__); |
| 564 | return -1; |
| 565 | } |
| 566 | |
| 567 | if (!pAvoidFreqList) |
| 568 | { |
| 569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 570 | "%s: pAvoidFreqList is null", __func__); |
| 571 | return -1; |
| 572 | } |
| 573 | |
| 574 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 575 | sizeof(tHddAvoidFreqList), |
| 576 | QCOM_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
| 577 | GFP_KERNEL); |
| 578 | if (!vendor_event) |
| 579 | { |
| 580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 581 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 582 | return -1; |
| 583 | } |
| 584 | |
| 585 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 586 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 587 | |
| 588 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 589 | |
| 590 | EXIT(); |
| 591 | return 0; |
| 592 | } |
| 593 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 594 | |
| 595 | /* vendor specific events */ |
| 596 | static const struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
| 597 | { |
| 598 | #ifdef FEATURE_WLAN_CH_AVOID |
| 599 | { |
| 600 | .vendor_id = QCOM_NL80211_VENDOR_ID, |
| 601 | .subcmd = QCOM_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
| 602 | }, |
| 603 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 604 | }; |
| 605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 606 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 607 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 608 | * This function is called by hdd_wlan_startup() |
| 609 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 610 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 612 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | { |
| 614 | struct wiphy *wiphy; |
| 615 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 616 | /* |
| 617 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | */ |
| 619 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 620 | |
| 621 | if (!wiphy) |
| 622 | { |
| 623 | /* Print error and jump into err label and free the memory */ |
| 624 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 625 | return NULL; |
| 626 | } |
| 627 | |
| 628 | return wiphy; |
| 629 | } |
| 630 | |
| 631 | /* |
| 632 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 633 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | * private ioctl to change the band value |
| 635 | */ |
| 636 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 637 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 638 | int i, j; |
| 639 | eNVChannelEnabledType channelEnabledState; |
| 640 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 641 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 642 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 643 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 645 | |
| 646 | if (NULL == wiphy->bands[i]) |
| 647 | { |
| 648 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 649 | __func__, i); |
| 650 | continue; |
| 651 | } |
| 652 | |
| 653 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 654 | { |
| 655 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 656 | |
| 657 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 658 | band->channels[j].hw_value); |
| 659 | |
| 660 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 661 | { |
| 662 | // Enable Social channels for P2P |
| 663 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 664 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 665 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 666 | else |
| 667 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 668 | continue; |
| 669 | } |
| 670 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 671 | { |
| 672 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 673 | continue; |
| 674 | } |
| 675 | |
| 676 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 677 | NV_CHANNEL_INVALID == channelEnabledState) |
| 678 | { |
| 679 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 680 | } |
| 681 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 682 | { |
| 683 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 684 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 685 | } |
| 686 | else |
| 687 | { |
| 688 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 689 | |IEEE80211_CHAN_RADAR); |
| 690 | } |
| 691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | } |
| 693 | return 0; |
| 694 | } |
| 695 | /* |
| 696 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 697 | * This function is called by hdd_wlan_startup() |
| 698 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | * This function is used to initialize and register wiphy structure. |
| 700 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 701 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 702 | struct wiphy *wiphy, |
| 703 | hdd_config_t *pCfg |
| 704 | ) |
| 705 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 706 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 707 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 708 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 709 | ENTER(); |
| 710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 711 | /* Now bind the underlying wlan device with wiphy */ |
| 712 | set_wiphy_dev(wiphy, dev); |
| 713 | |
| 714 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 715 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 716 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 717 | /* the flag for the other case would be initialzed in |
| 718 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 719 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 720 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 721 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 722 | /* This will disable updating of NL channels from passive to |
| 723 | * active if a beacon is received on passive channel. */ |
| 724 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 725 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 726 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 727 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 728 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 729 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 730 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 731 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 732 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 733 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 734 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 735 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 736 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 737 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 738 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 739 | || pCfg->isFastRoamIniFeatureEnabled |
| 740 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 741 | #ifdef FEATURE_WLAN_ESE |
| 742 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 743 | #endif |
| 744 | ) |
| 745 | { |
| 746 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 747 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 748 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 749 | #ifdef FEATURE_WLAN_TDLS |
| 750 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 751 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 752 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 753 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 754 | if (pCfg->configPNOScanSupport) |
| 755 | { |
| 756 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 757 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 758 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 759 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 760 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 761 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 762 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 763 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 764 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 765 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 766 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 767 | driver need to determine what to do with both |
| 768 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 769 | |
| 770 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 771 | #else |
| 772 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 773 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 774 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 775 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 776 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 777 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 778 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 779 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 781 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 782 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 785 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 786 | | BIT(NL80211_IFTYPE_AP); |
| 787 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 788 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 789 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 790 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 791 | if( pCfg->enableMCC ) |
| 792 | { |
| 793 | /* Currently, supports up to two channels */ |
| 794 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 795 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 796 | if( !pCfg->allowMCCGODiffBI ) |
| 797 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 798 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 799 | } |
| 800 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 801 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 802 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 803 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 805 | /* Before registering we need to update the ht capabilitied based |
| 806 | * on ini values*/ |
| 807 | if( !pCfg->ShortGI20MhzEnable ) |
| 808 | { |
| 809 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 810 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 811 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 812 | } |
| 813 | |
| 814 | if( !pCfg->ShortGI40MhzEnable ) |
| 815 | { |
| 816 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 817 | } |
| 818 | |
| 819 | if( !pCfg->nChannelBondingMode5GHz ) |
| 820 | { |
| 821 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 822 | } |
| 823 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 824 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 825 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 826 | { |
| 827 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 828 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 829 | |
| 830 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 831 | { |
| 832 | |
| 833 | if (NULL == wiphy->bands[i]) |
| 834 | { |
| 835 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 836 | __func__, i); |
| 837 | continue; |
| 838 | } |
| 839 | |
| 840 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 841 | { |
| 842 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 843 | |
| 844 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 845 | { |
| 846 | // Enable social channels for P2P |
| 847 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 848 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 849 | else |
| 850 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 851 | continue; |
| 852 | } |
| 853 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 854 | { |
| 855 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 856 | continue; |
| 857 | } |
| 858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | } |
| 860 | /*Initialise the supported cipher suite details*/ |
| 861 | wiphy->cipher_suites = hdd_cipher_suites; |
| 862 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 863 | |
| 864 | /*signal strength in mBm (100*dBm) */ |
| 865 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 866 | |
| 867 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | wiphy->max_remain_on_channel_duration = 1000; |
| 869 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 871 | wiphy->n_vendor_commands = 0; |
| 872 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 873 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 874 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 875 | EXIT(); |
| 876 | return 0; |
| 877 | } |
| 878 | |
| 879 | /* In this function we are registering wiphy. */ |
| 880 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 881 | { |
| 882 | ENTER(); |
| 883 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | if (0 > wiphy_register(wiphy)) |
| 885 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 886 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 887 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 888 | return -EIO; |
| 889 | } |
| 890 | |
| 891 | EXIT(); |
| 892 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 893 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 895 | /* In this function we are updating channel list when, |
| 896 | regulatory domain is FCC and country code is US. |
| 897 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 898 | As per FCC smart phone is not a indoor device. |
| 899 | GO should not opeate on indoor channels */ |
| 900 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 901 | { |
| 902 | int j; |
| 903 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 904 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 905 | //Default counrtycode from NV at the time of wiphy initialization. |
| 906 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 907 | &defaultCountryCode[0])) |
| 908 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 909 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 910 | } |
| 911 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 912 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 913 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 914 | { |
| 915 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 916 | return; |
| 917 | } |
| 918 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 919 | { |
| 920 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 921 | // Mark UNII -1 band channel as passive |
| 922 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 923 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 928 | /* In this function we will do all post VOS start initialization. |
| 929 | In this function we will register for all frame in which supplicant |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 930 | is interested. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 931 | */ |
| 932 | void wlan_hdd_cfg80211_post_voss_start(hdd_adapter_t* pAdapter) |
| 933 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 934 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 935 | /* Register for all P2P action, public action etc frames */ |
| 936 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 937 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 938 | ENTER(); |
| 939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | /* Right now we are registering these frame when driver is getting |
| 941 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 942 | frame register ops, we will move this code as a part of that */ |
| 943 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 944 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 946 | |
| 947 | /* GAS Initial Response */ |
| 948 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 949 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | /* GAS Comeback Request */ |
| 952 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 953 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 954 | |
| 955 | /* GAS Comeback Response */ |
| 956 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 957 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 958 | |
| 959 | /* P2P Public Action */ |
| 960 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 961 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 962 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 963 | |
| 964 | /* P2P Action */ |
| 965 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 966 | (v_U8_t*)P2P_ACTION_FRAME, |
| 967 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 968 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 969 | /* WNM BSS Transition Request frame */ |
| 970 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 971 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 972 | WNM_BSS_ACTION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | void wlan_hdd_cfg80211_pre_voss_stop(hdd_adapter_t* pAdapter) |
| 976 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 978 | /* Register for all P2P action, public action etc frames */ |
| 979 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 980 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 981 | ENTER(); |
| 982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | /* Right now we are registering these frame when driver is getting |
| 984 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 985 | frame register ops, we will move this code as a part of that */ |
| 986 | /* GAS Initial Request */ |
| 987 | |
| 988 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 989 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 990 | |
| 991 | /* GAS Initial Response */ |
| 992 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 993 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | /* GAS Comeback Request */ |
| 996 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 997 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 998 | |
| 999 | /* GAS Comeback Response */ |
| 1000 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 1001 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 1002 | |
| 1003 | /* P2P Public Action */ |
| 1004 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1005 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 1007 | |
| 1008 | /* P2P Action */ |
| 1009 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 1010 | (v_U8_t*)P2P_ACTION_FRAME, |
| 1011 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1012 | |
| 1013 | #ifdef WLAN_FEATURE_11W |
| 1014 | /* SA Query Response Action Frame */ |
| 1015 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 1016 | (v_U8_t*)SA_QUERY_FRAME_RSP, |
| 1017 | SA_QUERY_FRAME_RSP_SIZE ); |
| 1018 | #endif /* WLAN_FEATURE_11W */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1019 | } |
| 1020 | |
| 1021 | #ifdef FEATURE_WLAN_WAPI |
| 1022 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 1023 | const u8 *mac_addr, u8 *key , int key_Len) |
| 1024 | { |
| 1025 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1026 | tCsrRoamSetKey setKey; |
| 1027 | v_BOOL_t isConnected = TRUE; |
| 1028 | int status = 0; |
| 1029 | v_U32_t roamId= 0xFF; |
| 1030 | tANI_U8 *pKeyPtr = NULL; |
| 1031 | int n = 0; |
| 1032 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1033 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | __func__,pAdapter->device_mode); |
| 1035 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 1036 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | setKey.keyId = key_index; // Store Key ID |
| 1038 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 1039 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 1040 | setKey.paeRole = 0 ; // the PAE role |
| 1041 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 1042 | { |
| 1043 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 1044 | } |
| 1045 | else |
| 1046 | { |
| 1047 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 1048 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 1049 | } |
| 1050 | setKey.keyLength = key_Len; |
| 1051 | pKeyPtr = setKey.Key; |
| 1052 | memcpy( pKeyPtr, key, key_Len); |
| 1053 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1054 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | __func__, key_Len); |
| 1056 | for (n = 0 ; n < key_Len; n++) |
| 1057 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 1058 | __func__,n,setKey.Key[n]); |
| 1059 | |
| 1060 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 1061 | if ( isConnected ) |
| 1062 | { |
| 1063 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1064 | pAdapter->sessionId, &setKey, &roamId ); |
| 1065 | } |
| 1066 | if ( status != 0 ) |
| 1067 | { |
| 1068 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1069 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 1070 | __LINE__, status ); |
| 1071 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 1072 | } |
| 1073 | } |
| 1074 | #endif /* FEATURE_WLAN_WAPI*/ |
| 1075 | |
| 1076 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1077 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | beacon_data_t **ppBeacon, |
| 1079 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1080 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1081 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1082 | beacon_data_t **ppBeacon, |
| 1083 | struct cfg80211_beacon_data *params, |
| 1084 | int dtim_period) |
| 1085 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1086 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1087 | int size; |
| 1088 | beacon_data_t *beacon = NULL; |
| 1089 | beacon_data_t *old = NULL; |
| 1090 | int head_len,tail_len; |
| 1091 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1092 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1093 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1094 | { |
| 1095 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1096 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | |
| 1100 | old = pAdapter->sessionCtx.ap.beacon; |
| 1101 | |
| 1102 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1103 | { |
| 1104 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1105 | FL("session(%d) old and new heads points to NULL"), |
| 1106 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1107 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1108 | } |
| 1109 | |
| 1110 | if (params->tail && !params->tail_len) |
| 1111 | { |
| 1112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1113 | FL("tail_len is zero but tail is not NULL")); |
| 1114 | return -EINVAL; |
| 1115 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1116 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1117 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 1118 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 1119 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1120 | { |
| 1121 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1122 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1123 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1124 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1125 | #endif |
| 1126 | |
| 1127 | if(params->head) |
| 1128 | head_len = params->head_len; |
| 1129 | else |
| 1130 | head_len = old->head_len; |
| 1131 | |
| 1132 | if(params->tail || !old) |
| 1133 | tail_len = params->tail_len; |
| 1134 | else |
| 1135 | tail_len = old->tail_len; |
| 1136 | |
| 1137 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 1138 | |
| 1139 | beacon = kzalloc(size, GFP_KERNEL); |
| 1140 | |
| 1141 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1142 | { |
| 1143 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1144 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1145 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1147 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1148 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1149 | if(params->dtim_period || !old ) |
| 1150 | beacon->dtim_period = params->dtim_period; |
| 1151 | else |
| 1152 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1153 | #else |
| 1154 | if(dtim_period || !old ) |
| 1155 | beacon->dtim_period = dtim_period; |
| 1156 | else |
| 1157 | beacon->dtim_period = old->dtim_period; |
| 1158 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1160 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 1161 | beacon->tail = beacon->head + head_len; |
| 1162 | beacon->head_len = head_len; |
| 1163 | beacon->tail_len = tail_len; |
| 1164 | |
| 1165 | if(params->head) { |
| 1166 | memcpy (beacon->head,params->head,beacon->head_len); |
| 1167 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1168 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1169 | if(old) |
| 1170 | memcpy (beacon->head,old->head,beacon->head_len); |
| 1171 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1173 | if(params->tail) { |
| 1174 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 1175 | } |
| 1176 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1177 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1178 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 1179 | } |
| 1180 | |
| 1181 | *ppBeacon = beacon; |
| 1182 | |
| 1183 | kfree(old); |
| 1184 | |
| 1185 | return 0; |
| 1186 | |
| 1187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | |
| 1189 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 1190 | { |
| 1191 | int left = length; |
| 1192 | v_U8_t *ptr = pIes; |
| 1193 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1194 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1195 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1196 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | elem_id = ptr[0]; |
| 1198 | elem_len = ptr[1]; |
| 1199 | left -= 2; |
| 1200 | if(elem_len > left) |
| 1201 | { |
| 1202 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1203 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1204 | eid,elem_len,left); |
| 1205 | return NULL; |
| 1206 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1207 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1208 | { |
| 1209 | return ptr; |
| 1210 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | left -= elem_len; |
| 1213 | ptr += (elem_len + 2); |
| 1214 | } |
| 1215 | return NULL; |
| 1216 | } |
| 1217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | /* Check if rate is 11g rate or not */ |
| 1219 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 1220 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 1221 | 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] | 1222 | u8 i; |
| 1223 | for (i = 0; i < 8; i++) |
| 1224 | { |
| 1225 | if(rate == gRateArray[i]) |
| 1226 | return TRUE; |
| 1227 | } |
| 1228 | return FALSE; |
| 1229 | } |
| 1230 | |
| 1231 | /* Check for 11g rate and set proper 11g only mode */ |
| 1232 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 1233 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 1234 | { |
| 1235 | u8 i, num_rates = pIe[0]; |
| 1236 | |
| 1237 | pIe += 1; |
| 1238 | for ( i = 0; i < num_rates; i++) |
| 1239 | { |
| 1240 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 1241 | { |
| 1242 | /* If rate set have 11g rate than change the mode to 11G */ |
| 1243 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 1244 | if (pIe[i] & BASIC_RATE_MASK) |
| 1245 | { |
| 1246 | /* If we have 11g rate as basic rate, it means mode |
| 1247 | is 11g only mode. |
| 1248 | */ |
| 1249 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 1250 | *pCheckRatesfor11g = FALSE; |
| 1251 | } |
| 1252 | } |
| 1253 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 1254 | { |
| 1255 | *require_ht = TRUE; |
| 1256 | } |
| 1257 | } |
| 1258 | return; |
| 1259 | } |
| 1260 | |
| 1261 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 1262 | { |
| 1263 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1264 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1265 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1266 | u8 checkRatesfor11g = TRUE; |
| 1267 | u8 require_ht = FALSE; |
| 1268 | u8 *pIe=NULL; |
| 1269 | |
| 1270 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 1271 | |
| 1272 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 1273 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 1274 | if (pIe != NULL) |
| 1275 | { |
| 1276 | pIe += 1; |
| 1277 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1278 | &pConfig->SapHw_mode); |
| 1279 | } |
| 1280 | |
| 1281 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1282 | WLAN_EID_EXT_SUPP_RATES); |
| 1283 | if (pIe != NULL) |
| 1284 | { |
| 1285 | |
| 1286 | pIe += 1; |
| 1287 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 1288 | &pConfig->SapHw_mode); |
| 1289 | } |
| 1290 | |
| 1291 | if( pConfig->channel > 14 ) |
| 1292 | { |
| 1293 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 1294 | } |
| 1295 | |
| 1296 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 1297 | WLAN_EID_HT_CAPABILITY); |
| 1298 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1299 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | { |
| 1301 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 1302 | if(require_ht) |
| 1303 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 1304 | } |
| 1305 | } |
| 1306 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1307 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 1308 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 1309 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1310 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1311 | v_U8_t *pIe = NULL; |
| 1312 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1313 | |
| 1314 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 1315 | pBeacon->tail, pBeacon->tail_len); |
| 1316 | |
| 1317 | if (pIe) |
| 1318 | { |
| 1319 | ielen = pIe[1] + 2; |
| 1320 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 1321 | { |
| 1322 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 1323 | } |
| 1324 | else |
| 1325 | { |
| 1326 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 1327 | return -EINVAL; |
| 1328 | } |
| 1329 | *total_ielen += ielen; |
| 1330 | } |
| 1331 | return 0; |
| 1332 | } |
| 1333 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1334 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 1335 | v_U8_t *genie, v_U8_t *total_ielen) |
| 1336 | { |
| 1337 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1338 | int left = pBeacon->tail_len; |
| 1339 | v_U8_t *ptr = pBeacon->tail; |
| 1340 | v_U8_t elem_id, elem_len; |
| 1341 | v_U16_t ielen = 0; |
| 1342 | |
| 1343 | if ( NULL == ptr || 0 == left ) |
| 1344 | return; |
| 1345 | |
| 1346 | while (left >= 2) |
| 1347 | { |
| 1348 | elem_id = ptr[0]; |
| 1349 | elem_len = ptr[1]; |
| 1350 | left -= 2; |
| 1351 | if (elem_len > left) |
| 1352 | { |
| 1353 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 1354 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 1355 | elem_id, elem_len, left); |
| 1356 | return; |
| 1357 | } |
| 1358 | if (IE_EID_VENDOR == elem_id) |
| 1359 | { |
| 1360 | /* skipping the VSIE's which we don't want to include or |
| 1361 | * it will be included by existing code |
| 1362 | */ |
| 1363 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 1364 | #ifdef WLAN_FEATURE_WFD |
| 1365 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 1366 | #endif |
| 1367 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1368 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1369 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 1370 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 1371 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 1372 | { |
| 1373 | ielen = ptr[1] + 2; |
| 1374 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 1375 | { |
| 1376 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 1377 | *total_ielen += ielen; |
| 1378 | } |
| 1379 | else |
| 1380 | { |
| 1381 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 1382 | "IE Length is too big " |
| 1383 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 1384 | elem_id, elem_len, *total_ielen); |
| 1385 | } |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | left -= elem_len; |
| 1390 | ptr += (elem_len + 2); |
| 1391 | } |
| 1392 | return; |
| 1393 | } |
| 1394 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1395 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1397 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1398 | #else |
| 1399 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 1400 | struct cfg80211_beacon_data *params) |
| 1401 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1402 | { |
| 1403 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1404 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1406 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1407 | |
| 1408 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 1409 | |
| 1410 | if(genie == NULL) { |
| 1411 | |
| 1412 | return -ENOMEM; |
| 1413 | } |
| 1414 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1415 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1416 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1417 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1418 | hddLog(LOGE, |
| 1419 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1420 | ret = -EINVAL; |
| 1421 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | } |
| 1423 | |
| 1424 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1425 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1426 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 1427 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1428 | hddLog(LOGE, |
| 1429 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1430 | ret = -EINVAL; |
| 1431 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1432 | } |
| 1433 | #endif |
| 1434 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1435 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 1436 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1437 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 1438 | hddLog(LOGE, |
| 1439 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1440 | ret = -EINVAL; |
| 1441 | goto done; |
| 1442 | } |
| 1443 | |
| 1444 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 1445 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 1446 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1447 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1448 | |
| 1449 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1450 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 1451 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1452 | { |
| 1453 | hddLog(LOGE, |
| 1454 | "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] | 1455 | ret = -EINVAL; |
| 1456 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | } |
| 1458 | |
| 1459 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1460 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 1461 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1462 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1463 | ==eHAL_STATUS_FAILURE) |
| 1464 | { |
| 1465 | hddLog(LOGE, |
| 1466 | "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] | 1467 | ret = -EINVAL; |
| 1468 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1469 | } |
| 1470 | |
| 1471 | // Added for ProResp IE |
| 1472 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 1473 | { |
| 1474 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 1475 | u8 probe_rsp_ie_len[3] = {0}; |
| 1476 | u8 counter = 0; |
| 1477 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 1478 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 1479 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 1480 | Store More then 255 bytes into One Variable. |
| 1481 | */ |
| 1482 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 1483 | { |
| 1484 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 1485 | { |
| 1486 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 1487 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 1488 | } |
| 1489 | else |
| 1490 | { |
| 1491 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 1492 | rem_probe_resp_ie_len = 0; |
| 1493 | } |
| 1494 | } |
| 1495 | |
| 1496 | rem_probe_resp_ie_len = 0; |
| 1497 | |
| 1498 | if (probe_rsp_ie_len[0] > 0) |
| 1499 | { |
| 1500 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1501 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 1502 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1503 | probe_rsp_ie_len[0], NULL, |
| 1504 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1505 | { |
| 1506 | hddLog(LOGE, |
| 1507 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1508 | ret = -EINVAL; |
| 1509 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1510 | } |
| 1511 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 1512 | } |
| 1513 | |
| 1514 | if (probe_rsp_ie_len[1] > 0) |
| 1515 | { |
| 1516 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1517 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 1518 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1519 | probe_rsp_ie_len[1], NULL, |
| 1520 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1521 | { |
| 1522 | hddLog(LOGE, |
| 1523 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1524 | ret = -EINVAL; |
| 1525 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1526 | } |
| 1527 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 1528 | } |
| 1529 | |
| 1530 | if (probe_rsp_ie_len[2] > 0) |
| 1531 | { |
| 1532 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1533 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 1534 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 1535 | probe_rsp_ie_len[2], NULL, |
| 1536 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1537 | { |
| 1538 | hddLog(LOGE, |
| 1539 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1540 | ret = -EINVAL; |
| 1541 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1542 | } |
| 1543 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 1544 | } |
| 1545 | |
| 1546 | if (probe_rsp_ie_len[1] == 0 ) |
| 1547 | { |
| 1548 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1549 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 1550 | eANI_BOOLEAN_FALSE) ) |
| 1551 | { |
| 1552 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1553 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1554 | } |
| 1555 | } |
| 1556 | |
| 1557 | if (probe_rsp_ie_len[2] == 0 ) |
| 1558 | { |
| 1559 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1560 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 1561 | eANI_BOOLEAN_FALSE) ) |
| 1562 | { |
| 1563 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1564 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1565 | } |
| 1566 | } |
| 1567 | |
| 1568 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1569 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 1570 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1571 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1572 | == eHAL_STATUS_FAILURE) |
| 1573 | { |
| 1574 | hddLog(LOGE, |
| 1575 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1576 | ret = -EINVAL; |
| 1577 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | } |
| 1579 | } |
| 1580 | else |
| 1581 | { |
| 1582 | // Reset WNI_CFG_PROBE_RSP Flags |
| 1583 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 1584 | |
| 1585 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1586 | "%s: No Probe Response IE received in set beacon", |
| 1587 | __func__); |
| 1588 | } |
| 1589 | |
| 1590 | // Added for AssocResp IE |
| 1591 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 1592 | { |
| 1593 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1594 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 1595 | params->assocresp_ies_len, NULL, |
| 1596 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 1597 | { |
| 1598 | hddLog(LOGE, |
| 1599 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1600 | ret = -EINVAL; |
| 1601 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1605 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 1606 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 1607 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 1608 | == eHAL_STATUS_FAILURE) |
| 1609 | { |
| 1610 | hddLog(LOGE, |
| 1611 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1612 | ret = -EINVAL; |
| 1613 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1614 | } |
| 1615 | } |
| 1616 | else |
| 1617 | { |
| 1618 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1619 | "%s: No Assoc Response IE received in set beacon", |
| 1620 | __func__); |
| 1621 | |
| 1622 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 1623 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 1624 | eANI_BOOLEAN_FALSE) ) |
| 1625 | { |
| 1626 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1627 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1628 | } |
| 1629 | } |
| 1630 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1631 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1632 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 1633 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1635 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1636 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1637 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 1638 | * called by wlan_hdd_cfg80211_start_bss() and |
| 1639 | * wlan_hdd_cfg80211_set_channel() |
| 1640 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1641 | * channel list. |
| 1642 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1643 | 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] | 1644 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1645 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1646 | v_U32_t num_ch = 0; |
| 1647 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1648 | u32 indx = 0; |
| 1649 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1650 | v_U8_t fValidChannel = FALSE, count = 0; |
| 1651 | 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] | 1652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1653 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1654 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1655 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1656 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1657 | /* Validate the channel */ |
| 1658 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1659 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1660 | if ( channel == rfChannels[count].channelNum ) |
| 1661 | { |
| 1662 | fValidChannel = TRUE; |
| 1663 | break; |
| 1664 | } |
| 1665 | } |
| 1666 | if (fValidChannel != TRUE) |
| 1667 | { |
| 1668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1669 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1670 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | } |
| 1672 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1673 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1674 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 1675 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1676 | valid_ch, &num_ch)) |
| 1677 | { |
| 1678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1679 | "%s: failed to get valid channel list", __func__); |
| 1680 | return VOS_STATUS_E_FAILURE; |
| 1681 | } |
| 1682 | for (indx = 0; indx < num_ch; indx++) |
| 1683 | { |
| 1684 | if (channel == valid_ch[indx]) |
| 1685 | { |
| 1686 | break; |
| 1687 | } |
| 1688 | } |
| 1689 | |
| 1690 | if (indx >= num_ch) |
| 1691 | { |
| 1692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1693 | "%s: Invalid Channel [%d]", __func__, channel); |
| 1694 | return VOS_STATUS_E_FAILURE; |
| 1695 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1696 | } |
| 1697 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1698 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1699 | } |
| 1700 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1701 | /** |
| 1702 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 1703 | * This function is used to set the channel number |
| 1704 | */ |
| 1705 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 1706 | struct ieee80211_channel *chan, |
| 1707 | enum nl80211_channel_type channel_type |
| 1708 | ) |
| 1709 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 1710 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1711 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1712 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1713 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1714 | hdd_context_t *pHddCtx; |
| 1715 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1716 | |
| 1717 | ENTER(); |
| 1718 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 1719 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1720 | if( NULL == dev ) |
| 1721 | { |
| 1722 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1723 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1724 | return -ENODEV; |
| 1725 | } |
| 1726 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 1727 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 1728 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 1729 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 1730 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1731 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1732 | "%s: device_mode = %d freq = %d", __func__, |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1733 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1734 | |
| 1735 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1736 | status = wlan_hdd_validate_context(pHddCtx); |
| 1737 | |
| 1738 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1739 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1740 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1741 | "%s: HDD context is not valid", __func__); |
| 1742 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1743 | } |
| 1744 | |
| 1745 | /* |
| 1746 | * Do freq to chan conversion |
| 1747 | * TODO: for 11a |
| 1748 | */ |
| 1749 | |
| 1750 | channel = ieee80211_frequency_to_channel(freq); |
| 1751 | |
| 1752 | /* Check freq range */ |
| 1753 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 1754 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 1755 | { |
| 1756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1757 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1758 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 1759 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1760 | return -EINVAL; |
| 1761 | } |
| 1762 | |
| 1763 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1764 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 1765 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 1766 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1767 | { |
| 1768 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1769 | { |
| 1770 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1771 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1772 | return -EINVAL; |
| 1773 | } |
| 1774 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1775 | "%s: set channel to [%d] for device mode =%d", |
| 1776 | __func__, channel,pAdapter->device_mode); |
| 1777 | } |
| 1778 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1779 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1780 | ) |
| 1781 | { |
| 1782 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1783 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 1784 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1785 | |
| 1786 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 1787 | { |
| 1788 | /* Link is up then return cant set channel*/ |
| 1789 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1790 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1791 | return -EINVAL; |
| 1792 | } |
| 1793 | |
| 1794 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1795 | pHddStaCtx->conn_info.operationChannel = channel; |
| 1796 | pRoamProfile->ChannelInfo.ChannelList = |
| 1797 | &pHddStaCtx->conn_info.operationChannel; |
| 1798 | } |
| 1799 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1800 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1801 | ) |
| 1802 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1803 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 1804 | { |
| 1805 | if(VOS_STATUS_SUCCESS != |
| 1806 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1807 | { |
| 1808 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1809 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1810 | return -EINVAL; |
| 1811 | } |
| 1812 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1813 | } |
| 1814 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1815 | { |
| 1816 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 1817 | |
| 1818 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 1819 | channel set by supplicant |
| 1820 | */ |
| 1821 | if ( cfg_param->apAutoChannelSelection ) |
| 1822 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1823 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 1824 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1825 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1826 | "%s: set channel to auto channel (0) for device mode =%d", |
| 1827 | __func__, pAdapter->device_mode); |
| 1828 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1829 | else |
| 1830 | { |
| 1831 | if(VOS_STATUS_SUCCESS != |
| 1832 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 1833 | { |
| 1834 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1835 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 1836 | return -EINVAL; |
| 1837 | } |
| 1838 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 1839 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1840 | } |
| 1841 | } |
| 1842 | else |
| 1843 | { |
| 1844 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1845 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 1846 | return -EINVAL; |
| 1847 | } |
| 1848 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 1849 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 1850 | } |
| 1851 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1852 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 1853 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1854 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1855 | #else |
| 1856 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 1857 | struct cfg80211_beacon_data *params, |
| 1858 | const u8 *ssid, size_t ssid_len, |
| 1859 | enum nl80211_hidden_ssid hidden_ssid) |
| 1860 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | { |
| 1862 | tsap_Config_t *pConfig; |
| 1863 | beacon_data_t *pBeacon = NULL; |
| 1864 | struct ieee80211_mgmt *pMgmt_frame; |
| 1865 | v_U8_t *pIe=NULL; |
| 1866 | v_U16_t capab_info; |
| 1867 | eCsrAuthType RSNAuthType; |
| 1868 | eCsrEncryptionType RSNEncryptType; |
| 1869 | eCsrEncryptionType mcRSNEncryptType; |
| 1870 | int status = VOS_STATUS_SUCCESS; |
| 1871 | tpWLAN_SAPEventCB pSapEventCallback; |
| 1872 | hdd_hostapd_state_t *pHostapdState; |
| 1873 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 1874 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1875 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1876 | struct qc_mac_acl_entry *acl_entry = NULL; |
| 1877 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 1878 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1879 | v_BOOL_t MFPCapable; |
| 1880 | v_BOOL_t MFPRequired; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 1881 | eHddDot11Mode sapDot11Mode = |
| 1882 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1883 | |
| 1884 | ENTER(); |
| 1885 | |
| 1886 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 1887 | |
| 1888 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 1889 | |
| 1890 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 1891 | |
| 1892 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 1893 | |
| 1894 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 1895 | |
| 1896 | //channel is already set in the set_channel Call back |
| 1897 | //pConfig->channel = pCommitConfig->channel; |
| 1898 | |
| 1899 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1900 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 1902 | |
| 1903 | pConfig->dtim_period = pBeacon->dtim_period; |
| 1904 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1905 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1906 | pConfig->dtim_period); |
| 1907 | |
| 1908 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 1909 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1910 | { |
| 1911 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 1913 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 1914 | { |
| 1915 | tANI_BOOLEAN restartNeeded; |
| 1916 | pConfig->ieee80211d = 1; |
| 1917 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 1918 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 1919 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 1920 | } |
| 1921 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1923 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1924 | pConfig->ieee80211d = 1; |
| 1925 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 1926 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 1927 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1929 | else |
| 1930 | { |
| 1931 | pConfig->ieee80211d = 0; |
| 1932 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1933 | /* |
| 1934 | * If auto channel is configured i.e. channel is 0, |
| 1935 | * so skip channel validation. |
| 1936 | */ |
| 1937 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 1938 | { |
| 1939 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 1940 | { |
| 1941 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1942 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 1943 | return -EINVAL; |
| 1944 | } |
| 1945 | } |
| 1946 | else |
| 1947 | { |
| 1948 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 1949 | { |
| 1950 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 1951 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 1952 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 1953 | } |
| 1954 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 1955 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1957 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | { |
| 1959 | pConfig->ieee80211d = 0; |
| 1960 | } |
| 1961 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 1962 | |
| 1963 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1964 | |
| 1965 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 1967 | |
| 1968 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 1969 | |
| 1970 | /*Set wps station to configured*/ |
| 1971 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 1972 | |
| 1973 | if(pIe) |
| 1974 | { |
| 1975 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 1976 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1977 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1978 | return -EINVAL; |
| 1979 | } |
| 1980 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 1981 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1982 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1983 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 1984 | * WPS state |
| 1985 | */ |
| 1986 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 1987 | { |
| 1988 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 1989 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 1990 | { |
| 1991 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 1992 | } |
| 1993 | } |
| 1994 | } |
| 1995 | else |
| 1996 | { |
| 1997 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 1998 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1999 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2000 | |
| 2001 | pConfig->RSNWPAReqIELength = 0; |
| 2002 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2003 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | WLAN_EID_RSN); |
| 2005 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2006 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 2008 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 2009 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2010 | /* The actual processing may eventually be more extensive than |
| 2011 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | * by the app. |
| 2013 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2014 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2015 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 2016 | &RSNEncryptType, |
| 2017 | &mcRSNEncryptType, |
| 2018 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 2019 | &MFPCapable, |
| 2020 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | pConfig->pRSNWPAReqIE[1]+2, |
| 2022 | pConfig->pRSNWPAReqIE ); |
| 2023 | |
| 2024 | if( VOS_STATUS_SUCCESS == status ) |
| 2025 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2026 | /* Now copy over all the security attributes you have |
| 2027 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2028 | * */ |
| 2029 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 2030 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 2031 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 2032 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2033 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2034 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2035 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 2036 | } |
| 2037 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2039 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 2040 | pBeacon->tail, pBeacon->tail_len); |
| 2041 | |
| 2042 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 2043 | { |
| 2044 | if (pConfig->pRSNWPAReqIE) |
| 2045 | { |
| 2046 | /*Mixed mode WPA/WPA2*/ |
| 2047 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 2048 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 2049 | } |
| 2050 | else |
| 2051 | { |
| 2052 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 2053 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 2054 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2055 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2056 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 2057 | &RSNEncryptType, |
| 2058 | &mcRSNEncryptType, |
| 2059 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 2060 | &MFPCapable, |
| 2061 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2062 | pConfig->pRSNWPAReqIE[1]+2, |
| 2063 | pConfig->pRSNWPAReqIE ); |
| 2064 | |
| 2065 | if( VOS_STATUS_SUCCESS == status ) |
| 2066 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2067 | /* Now copy over all the security attributes you have |
| 2068 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2069 | * */ |
| 2070 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 2071 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 2072 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 2073 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2074 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2075 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2076 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 2077 | } |
| 2078 | } |
| 2079 | } |
| 2080 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2081 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 2082 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 2083 | return -EINVAL; |
| 2084 | } |
| 2085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2086 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 2087 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2088 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2089 | if (params->ssid != NULL) |
| 2090 | { |
| 2091 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 2092 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 2093 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 2094 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 2095 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2096 | #else |
| 2097 | if (ssid != NULL) |
| 2098 | { |
| 2099 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 2100 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 2101 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 2102 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 2103 | } |
| 2104 | #endif |
| 2105 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2106 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2107 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | /* default value */ |
| 2110 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 2111 | pConfig->num_accept_mac = 0; |
| 2112 | pConfig->num_deny_mac = 0; |
| 2113 | |
| 2114 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 2115 | pBeacon->tail, pBeacon->tail_len); |
| 2116 | |
| 2117 | /* pIe for black list is following form: |
| 2118 | type : 1 byte |
| 2119 | length : 1 byte |
| 2120 | OUI : 4 bytes |
| 2121 | acl type : 1 byte |
| 2122 | no of mac addr in black list: 1 byte |
| 2123 | 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] | 2124 | */ |
| 2125 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2126 | { |
| 2127 | pConfig->SapMacaddr_acl = pIe[6]; |
| 2128 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2129 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2131 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 2132 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2133 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 2134 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 2135 | { |
| 2136 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 2137 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2138 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2139 | } |
| 2140 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 2141 | pBeacon->tail, pBeacon->tail_len); |
| 2142 | |
| 2143 | /* pIe for white list is following form: |
| 2144 | type : 1 byte |
| 2145 | length : 1 byte |
| 2146 | OUI : 4 bytes |
| 2147 | acl type : 1 byte |
| 2148 | no of mac addr in white list: 1 byte |
| 2149 | 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] | 2150 | */ |
| 2151 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | { |
| 2153 | pConfig->SapMacaddr_acl = pIe[6]; |
| 2154 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2155 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2156 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2157 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 2158 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2159 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 2160 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 2161 | { |
| 2162 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 2163 | acl_entry++; |
| 2164 | } |
| 2165 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 2168 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2169 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 2170 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 2171 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 2172 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 2173 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 2174 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 2175 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 2176 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 2177 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 2178 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 2179 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 2180 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 2181 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2182 | { |
| 2183 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 2184 | |
| 2185 | /* Disable VHT support in 2.4 GHz band */ |
| 2186 | if (pConfig->channel <= 14 && |
| 2187 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->enableVhtFor24GHzBand == FALSE) |
| 2188 | { |
| 2189 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 2190 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2191 | } |
| 2192 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2193 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 2194 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 2195 | { |
| 2196 | sme_SelectCBMode(hHal, |
| 2197 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 2198 | pConfig->channel); |
| 2199 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 2201 | pConfig->ht_capab = |
| 2202 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 2203 | |
| 2204 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 2205 | { |
| 2206 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 2207 | return -EINVAL; |
| 2208 | } |
| 2209 | |
| 2210 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2211 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 2213 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2214 | pConfig->obssProtEnabled = |
| 2215 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 2217 | #ifdef WLAN_FEATURE_11W |
| 2218 | pConfig->mfpCapable = MFPCapable; |
| 2219 | pConfig->mfpRequired = MFPRequired; |
| 2220 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 2221 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 2222 | #endif |
| 2223 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2224 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2225 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2226 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 2227 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 2228 | (int)pConfig->channel); |
| 2229 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 2230 | pConfig->SapHw_mode, pConfig->privacy, |
| 2231 | pConfig->authType); |
| 2232 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 2233 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 2234 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 2235 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2236 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2237 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | { |
| 2239 | //Bss already started. just return. |
| 2240 | //TODO Probably it should update some beacon params. |
| 2241 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 2242 | EXIT(); |
| 2243 | return 0; |
| 2244 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | pConfig->persona = pHostapdAdapter->device_mode; |
| 2247 | |
| 2248 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 2249 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 2250 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 2251 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2252 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2253 | return -EINVAL; |
| 2254 | } |
| 2255 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2256 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2257 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 2258 | |
| 2259 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2262 | { |
| 2263 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2264 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 2265 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2266 | VOS_ASSERT(0); |
| 2267 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2269 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 2270 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2271 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2272 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 2273 | { |
| 2274 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 2275 | { |
| 2276 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2277 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2278 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2279 | } |
| 2280 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 2281 | { |
| 2282 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 2283 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2284 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2285 | } |
| 2286 | } |
| 2287 | #endif |
| 2288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2289 | pHostapdState->bCommit = TRUE; |
| 2290 | EXIT(); |
| 2291 | |
| 2292 | return 0; |
| 2293 | } |
| 2294 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2295 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2296 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 2297 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2298 | struct beacon_parameters *params) |
| 2299 | { |
| 2300 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2301 | hdd_context_t *pHddCtx; |
| 2302 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2303 | |
| 2304 | ENTER(); |
| 2305 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2306 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2307 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 2308 | pAdapter->sessionId, params->interval)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2309 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d",pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2310 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2311 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2312 | status = wlan_hdd_validate_context(pHddCtx); |
| 2313 | |
| 2314 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2315 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2316 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2317 | "%s: HDD context is not valid", __func__); |
| 2318 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2319 | } |
| 2320 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2321 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2322 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | ) |
| 2324 | { |
| 2325 | beacon_data_t *old,*new; |
| 2326 | |
| 2327 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2329 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2330 | { |
| 2331 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2332 | FL("already beacon info added to session(%d)"), |
| 2333 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2335 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | |
| 2337 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2338 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2339 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2340 | { |
| 2341 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2342 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | return -EINVAL; |
| 2344 | } |
| 2345 | |
| 2346 | pAdapter->sessionCtx.ap.beacon = new; |
| 2347 | |
| 2348 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2349 | } |
| 2350 | |
| 2351 | EXIT(); |
| 2352 | return status; |
| 2353 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2354 | |
| 2355 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2356 | struct net_device *dev, |
| 2357 | struct beacon_parameters *params) |
| 2358 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2359 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2360 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2361 | hdd_context_t *pHddCtx; |
| 2362 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2363 | |
| 2364 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2365 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2366 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 2367 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2368 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2369 | __func__,pAdapter->device_mode); |
| 2370 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2371 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2372 | status = wlan_hdd_validate_context(pHddCtx); |
| 2373 | |
| 2374 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2375 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2376 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2377 | "%s: HDD context is not valid", __func__); |
| 2378 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2379 | } |
| 2380 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2381 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2382 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2383 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2384 | { |
| 2385 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2389 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2390 | { |
| 2391 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2392 | FL("session(%d) old and new heads points to NULL"), |
| 2393 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2394 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2396 | |
| 2397 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 2398 | |
| 2399 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2400 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2401 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2402 | return -EINVAL; |
| 2403 | } |
| 2404 | |
| 2405 | pAdapter->sessionCtx.ap.beacon = new; |
| 2406 | |
| 2407 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 2408 | } |
| 2409 | |
| 2410 | EXIT(); |
| 2411 | return status; |
| 2412 | } |
| 2413 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2414 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 2415 | |
| 2416 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2417 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 2418 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2419 | #else |
| 2420 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 2421 | struct net_device *dev) |
| 2422 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2423 | { |
| 2424 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2425 | hdd_context_t *pHddCtx = NULL; |
| 2426 | hdd_scaninfo_t *pScanInfo = NULL; |
| 2427 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2428 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2429 | |
| 2430 | ENTER(); |
| 2431 | |
| 2432 | if (NULL == pAdapter) |
| 2433 | { |
| 2434 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2435 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2436 | return -ENODEV; |
| 2437 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2438 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2439 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2440 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 2441 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2442 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2443 | status = wlan_hdd_validate_context(pHddCtx); |
| 2444 | |
| 2445 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2446 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2447 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2448 | "%s: HDD context is not valid", __func__); |
| 2449 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2450 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2451 | |
| 2452 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2453 | if (NULL == staAdapter) |
| 2454 | { |
| 2455 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 2456 | if (NULL == staAdapter) |
| 2457 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2459 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 2460 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2461 | } |
| 2462 | } |
| 2463 | |
| 2464 | pScanInfo = &pHddCtx->scan_info; |
| 2465 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2466 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | __func__,pAdapter->device_mode); |
| 2468 | |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2469 | if ((pScanInfo != NULL) && pScanInfo->mScanPending && staAdapter) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2470 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2471 | long ret; |
| 2472 | |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2473 | INIT_COMPLETION(pScanInfo->abortscan_event_var); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 2474 | hdd_abort_mac_scan(staAdapter->pHddCtx, pAdapter->sessionId, |
| 2475 | eCSR_SCAN_ABORT_DEFAULT); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2476 | ret = wait_for_completion_interruptible_timeout( |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 2477 | &pScanInfo->abortscan_event_var, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2478 | msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2479 | if (ret <= 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2480 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 2481 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2482 | FL("Timeout occurred while waiting for abortscan %ld"), |
| 2483 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 2484 | |
| 2485 | if (pHddCtx->isLogpInProgress) |
| 2486 | { |
| 2487 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2488 | "%s: LOGP in Progress. Ignore!!!", __func__); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2489 | |
| 2490 | VOS_ASSERT(pScanInfo->mScanPending); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 2491 | return -EAGAIN; |
| 2492 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2493 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2494 | } |
| 2495 | } |
| 2496 | |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 2497 | hdd_hostapd_stop(dev); |
| 2498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2499 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2500 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2501 | ) |
| 2502 | { |
| 2503 | beacon_data_t *old; |
| 2504 | |
| 2505 | old = pAdapter->sessionCtx.ap.beacon; |
| 2506 | |
| 2507 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2508 | { |
| 2509 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2510 | FL("session(%d) beacon data points to NULL"), |
| 2511 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2513 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2516 | |
| 2517 | mutex_lock(&pHddCtx->sap_lock); |
| 2518 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 2519 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2520 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2521 | { |
| 2522 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 2523 | |
| 2524 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 2525 | |
| 2526 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2527 | { |
| 2528 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2529 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2530 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2531 | } |
| 2532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2533 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
| 2534 | } |
| 2535 | mutex_unlock(&pHddCtx->sap_lock); |
| 2536 | |
| 2537 | if(status != VOS_STATUS_SUCCESS) |
| 2538 | { |
| 2539 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2540 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2541 | return -EINVAL; |
| 2542 | } |
| 2543 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2544 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 2546 | ==eHAL_STATUS_FAILURE) |
| 2547 | { |
| 2548 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2549 | "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] | 2550 | } |
| 2551 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 2552 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 2554 | eANI_BOOLEAN_FALSE) ) |
| 2555 | { |
| 2556 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2557 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2558 | } |
| 2559 | |
| 2560 | // Reset WNI_CFG_PROBE_RSP Flags |
| 2561 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 2562 | |
| 2563 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 2564 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 2565 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 2566 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 2567 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 2568 | { |
| 2569 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 2570 | "GO got removed"); |
| 2571 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 2572 | } |
| 2573 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2574 | } |
| 2575 | EXIT(); |
| 2576 | return status; |
| 2577 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2578 | |
| 2579 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2580 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2581 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 2582 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2583 | struct cfg80211_ap_settings *params) |
| 2584 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2585 | hdd_adapter_t *pAdapter; |
| 2586 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2587 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2588 | |
| 2589 | ENTER(); |
| 2590 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2591 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2592 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2593 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2594 | "%s: Device is Null", __func__); |
| 2595 | return -ENODEV; |
| 2596 | } |
| 2597 | |
| 2598 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2599 | if (NULL == pAdapter) |
| 2600 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2601 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2602 | "%s: HDD adapter is Null", __func__); |
| 2603 | return -ENODEV; |
| 2604 | } |
| 2605 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2606 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2607 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 2608 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2609 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 2610 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2611 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2612 | "%s: HDD adapter magic is invalid", __func__); |
| 2613 | return -ENODEV; |
| 2614 | } |
| 2615 | |
| 2616 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2617 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2618 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2619 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2620 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2621 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2622 | "%s: HDD context is not valid", __func__); |
| 2623 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2624 | } |
| 2625 | |
| 2626 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %d", |
| 2627 | __func__, pAdapter->device_mode); |
| 2628 | |
| 2629 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2630 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2631 | ) |
| 2632 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2633 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2634 | |
| 2635 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2636 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2637 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2638 | { |
| 2639 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2640 | FL("already beacon info added to session(%d)"), |
| 2641 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2642 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2643 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2644 | |
| 2645 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 2646 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2647 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2648 | { |
| 2649 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 2650 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2651 | return -EINVAL; |
| 2652 | } |
| 2653 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 2654 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2655 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 2656 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 2657 | params->channel, params->channel_type); |
| 2658 | #else |
| 2659 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 2660 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 2661 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2662 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 2663 | params->ssid_len, params->hidden_ssid); |
| 2664 | } |
| 2665 | |
| 2666 | EXIT(); |
| 2667 | return status; |
| 2668 | } |
| 2669 | |
| 2670 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2671 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2672 | struct net_device *dev, |
| 2673 | struct cfg80211_beacon_data *params) |
| 2674 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2675 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2676 | hdd_context_t *pHddCtx; |
| 2677 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2678 | |
| 2679 | ENTER(); |
| 2680 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2681 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2682 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 2683 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2684 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2685 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2686 | |
| 2687 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2688 | status = wlan_hdd_validate_context(pHddCtx); |
| 2689 | |
| 2690 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2691 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2692 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2693 | "%s: HDD context is not valid", __func__); |
| 2694 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 2695 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2696 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2697 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2698 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2699 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2700 | { |
| 2701 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2702 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2703 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2704 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2705 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2706 | { |
| 2707 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2708 | FL("session(%d) beacon data points to NULL"), |
| 2709 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2710 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2711 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2712 | |
| 2713 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 2714 | |
| 2715 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2716 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2717 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2718 | return -EINVAL; |
| 2719 | } |
| 2720 | |
| 2721 | pAdapter->sessionCtx.ap.beacon = new; |
| 2722 | |
| 2723 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 2724 | } |
| 2725 | |
| 2726 | EXIT(); |
| 2727 | return status; |
| 2728 | } |
| 2729 | |
| 2730 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 2731 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | |
| 2733 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 2734 | struct net_device *dev, |
| 2735 | struct bss_parameters *params) |
| 2736 | { |
| 2737 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2738 | |
| 2739 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2740 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2741 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2742 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 2743 | pAdapter->sessionId, params->ap_isolate)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2744 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2745 | __func__,pAdapter->device_mode); |
| 2746 | |
| 2747 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2749 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2750 | { |
| 2751 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 2752 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2753 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2754 | { |
| 2755 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2757 | } |
| 2758 | |
| 2759 | EXIT(); |
| 2760 | return 0; |
| 2761 | } |
| 2762 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2763 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 2764 | * to wait for contry code completion |
| 2765 | */ |
| 2766 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 2767 | { |
| 2768 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 2769 | complete(&call_back_pAdapter->change_country_code); |
| 2770 | return NULL; |
| 2771 | } |
| 2772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2773 | /* |
| 2774 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 2775 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 2776 | */ |
| 2777 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 2778 | struct net_device *ndev, |
| 2779 | enum nl80211_iftype type, |
| 2780 | u32 *flags, |
| 2781 | struct vif_params *params |
| 2782 | ) |
| 2783 | { |
| 2784 | struct wireless_dev *wdev; |
| 2785 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2786 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2787 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | tCsrRoamProfile *pRoamProfile = NULL; |
| 2789 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2790 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2791 | eMib_dot11DesiredBssType connectedBssType; |
| 2792 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2793 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2794 | |
| 2795 | ENTER(); |
| 2796 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2797 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2798 | { |
| 2799 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2800 | "%s: Adapter context is null", __func__); |
| 2801 | return VOS_STATUS_E_FAILURE; |
| 2802 | } |
| 2803 | |
| 2804 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2805 | if (!pHddCtx) |
| 2806 | { |
| 2807 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2808 | "%s: HDD context is null", __func__); |
| 2809 | return VOS_STATUS_E_FAILURE; |
| 2810 | } |
| 2811 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 2812 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 2813 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 2814 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2815 | status = wlan_hdd_validate_context(pHddCtx); |
| 2816 | |
| 2817 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2818 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2819 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2820 | "%s: HDD context is not valid", __func__); |
| 2821 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2822 | } |
| 2823 | |
| 2824 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 2825 | __func__, pAdapter->device_mode); |
| 2826 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 2827 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2828 | wdev = ndev->ieee80211_ptr; |
| 2829 | |
| 2830 | #ifdef WLAN_BTAMP_FEATURE |
| 2831 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 2832 | (NL80211_IFTYPE_ADHOC == type)|| |
| 2833 | (NL80211_IFTYPE_AP == type)|| |
| 2834 | (NL80211_IFTYPE_P2P_GO == type)) |
| 2835 | { |
| 2836 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 2837 | // stop AMP traffic |
| 2838 | status = WLANBAP_StopAmp(); |
| 2839 | if(VOS_STATUS_SUCCESS != status ) |
| 2840 | { |
| 2841 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2842 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2843 | "%s: Failed to stop AMP", __func__); |
| 2844 | return -EINVAL; |
| 2845 | } |
| 2846 | } |
| 2847 | #endif //WLAN_BTAMP_FEATURE |
| 2848 | /* Reset the current device mode bit mask*/ |
| 2849 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 2850 | |
| 2851 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2852 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2853 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2854 | ) |
| 2855 | { |
| 2856 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 2857 | if (!pWextState) |
| 2858 | { |
| 2859 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2860 | "%s: pWextState is null", __func__); |
| 2861 | return VOS_STATUS_E_FAILURE; |
| 2862 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2863 | pRoamProfile = &pWextState->roamProfile; |
| 2864 | LastBSSType = pRoamProfile->BSSType; |
| 2865 | |
| 2866 | switch (type) |
| 2867 | { |
| 2868 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2870 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2871 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 2872 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2873 | #ifdef WLAN_FEATURE_11AC |
| 2874 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 2875 | { |
| 2876 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 2877 | } |
| 2878 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2879 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2880 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2881 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2882 | //Check for sub-string p2p to confirm its a p2p interface |
| 2883 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2884 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2885 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 2886 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 2887 | } |
| 2888 | else |
| 2889 | { |
| 2890 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2891 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 2892 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 2893 | #ifdef FEATURE_WLAN_TDLS |
| 2894 | /* The open adapter for the p2p shall skip initializations in |
| 2895 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 2896 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 2897 | * tdls_init when the change_iface sets the device mode to |
| 2898 | * WLAN_HDD_P2P_CLIENT. |
| 2899 | */ |
| 2900 | |
| 2901 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2902 | { |
| 2903 | if (0 != wlan_hdd_tdls_init (pAdapter)) |
| 2904 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2905 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2906 | "%s: tdls initialization failed", __func__); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 2907 | return -EINVAL; |
| 2908 | } |
| 2909 | } |
| 2910 | #endif |
| 2911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | break; |
| 2913 | case NL80211_IFTYPE_ADHOC: |
| 2914 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2915 | "%s: setting interface Type to ADHOC", __func__); |
| 2916 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 2917 | pRoamProfile->phyMode = |
| 2918 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2919 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2920 | wdev->iftype = type; |
| 2921 | break; |
| 2922 | |
| 2923 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2925 | { |
| 2926 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 2927 | "%s: setting interface Type to %s", __func__, |
| 2928 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 2929 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 2930 | //Cancel any remain on channel for GO mode |
| 2931 | if (NL80211_IFTYPE_P2P_GO == type) |
| 2932 | { |
| 2933 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 2934 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2935 | if (NL80211_IFTYPE_AP == type) |
| 2936 | { |
| 2937 | /* As Loading WLAN Driver one interface being created for p2p device |
| 2938 | * address. This will take one HW STA and the max number of clients |
| 2939 | * that can connect to softAP will be reduced by one. so while changing |
| 2940 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 2941 | * interface as it is not required in SoftAP mode. |
| 2942 | */ |
| 2943 | |
| 2944 | // Get P2P Adapter |
| 2945 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 2946 | |
| 2947 | if (pP2pAdapter) |
| 2948 | { |
| 2949 | hdd_stop_adapter(pHddCtx, pP2pAdapter); |
| 2950 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 2951 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 2952 | } |
| 2953 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 2954 | //Disable IMPS & BMPS for SAP/GO |
| 2955 | if(VOS_STATUS_E_FAILURE == |
| 2956 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 2957 | { |
| 2958 | //Fail to Exit BMPS |
| 2959 | VOS_ASSERT(0); |
| 2960 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2961 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 2962 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2963 | /* A Mutex Lock is introduced while changing the mode to |
| 2964 | * protect the concurrent access for the Adapters by TDLS |
| 2965 | * module. |
| 2966 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2967 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2968 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2969 | //De-init the adapter. |
| 2970 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 2971 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 2972 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2973 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 2974 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2975 | #ifdef FEATURE_WLAN_TDLS |
| 2976 | mutex_unlock(&pHddCtx->tdls_lock); |
| 2977 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 2978 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 2979 | (pConfig->apRandomBssidEnabled)) |
| 2980 | { |
| 2981 | /* To meet Android requirements create a randomized |
| 2982 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 2983 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 2984 | ndev->dev_addr[0] = 0x02; |
| 2985 | ndev->dev_addr[1] = 0x1A; |
| 2986 | ndev->dev_addr[2] = 0x11; |
| 2987 | ndev->dev_addr[3] |= 0xF0; |
| 2988 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 2989 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2990 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 2991 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 2992 | } |
| 2993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2994 | hdd_set_ap_ops( pAdapter->dev ); |
| 2995 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 2996 | /* This is for only SAP mode where users can |
| 2997 | * control country through ini. |
| 2998 | * P2P GO follows station country code |
| 2999 | * acquired during the STA scanning. */ |
| 3000 | if((NL80211_IFTYPE_AP == type) && |
| 3001 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 3002 | { |
| 3003 | int status = 0; |
| 3004 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 3005 | "%s: setting country code from INI ", __func__); |
| 3006 | init_completion(&pAdapter->change_country_code); |
| 3007 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 3008 | (void *)(tSmeChangeCountryCallback) |
| 3009 | wlan_hdd_change_country_code_cb, |
| 3010 | pConfig->apCntryCode, pAdapter, |
| 3011 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 3012 | eSIR_FALSE, |
| 3013 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 3014 | if (eHAL_STATUS_SUCCESS == status) |
| 3015 | { |
| 3016 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3017 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 3018 | &pAdapter->change_country_code, |
| 3019 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3020 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 3021 | { |
| 3022 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3023 | FL("SME Timed out while setting country code %ld"), |
| 3024 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 3025 | |
| 3026 | if (pHddCtx->isLogpInProgress) |
| 3027 | { |
| 3028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3029 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 3030 | return -EAGAIN; |
| 3031 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 3032 | } |
| 3033 | } |
| 3034 | else |
| 3035 | { |
| 3036 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3037 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 3038 | return -EINVAL; |
| 3039 | } |
| 3040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3041 | status = hdd_init_ap_mode(pAdapter); |
| 3042 | if(status != VOS_STATUS_SUCCESS) |
| 3043 | { |
| 3044 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3045 | "%s: Error initializing the ap mode", __func__); |
| 3046 | return -EINVAL; |
| 3047 | } |
| 3048 | hdd_set_conparam(1); |
| 3049 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3050 | /*interface type changed update in wiphy structure*/ |
| 3051 | if(wdev) |
| 3052 | { |
| 3053 | wdev->iftype = type; |
| 3054 | pHddCtx->change_iface = type; |
| 3055 | } |
| 3056 | else |
| 3057 | { |
| 3058 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3059 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 3060 | return -EINVAL; |
| 3061 | } |
| 3062 | goto done; |
| 3063 | } |
| 3064 | |
| 3065 | default: |
| 3066 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 3067 | __func__); |
| 3068 | return -EOPNOTSUPP; |
| 3069 | } |
| 3070 | } |
| 3071 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3072 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3073 | ) |
| 3074 | { |
| 3075 | switch(type) |
| 3076 | { |
| 3077 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3078 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3079 | case NL80211_IFTYPE_ADHOC: |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3080 | #ifdef FEATURE_WLAN_TDLS |
| 3081 | |
| 3082 | /* A Mutex Lock is introduced while changing the mode to |
| 3083 | * protect the concurrent access for the Adapters by TDLS |
| 3084 | * module. |
| 3085 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 3086 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3087 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3088 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 3089 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3090 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 3091 | //Check for sub-string p2p to confirm its a p2p interface |
| 3092 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 3093 | { |
| 3094 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 3095 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 3096 | } |
| 3097 | else |
| 3098 | { |
| 3099 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3100 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 3101 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | hdd_set_conparam(0); |
| 3103 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3104 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 3105 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3106 | #ifdef FEATURE_WLAN_TDLS |
| 3107 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3108 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 3109 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3110 | if( VOS_STATUS_SUCCESS != status ) |
| 3111 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3112 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 3113 | * This is the right place to enable back bmps_imps() |
| 3114 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 3115 | if (pHddCtx->hdd_wlan_suspended) |
| 3116 | { |
| 3117 | hdd_set_pwrparams(pHddCtx); |
| 3118 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3119 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3120 | goto done; |
| 3121 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3122 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3123 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 3125 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | goto done; |
| 3127 | default: |
| 3128 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 3129 | __func__); |
| 3130 | return -EOPNOTSUPP; |
| 3131 | |
| 3132 | } |
| 3133 | |
| 3134 | } |
| 3135 | else |
| 3136 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3137 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%d)", |
| 3138 | __func__, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | return -EOPNOTSUPP; |
| 3140 | } |
| 3141 | |
| 3142 | |
| 3143 | if(pRoamProfile) |
| 3144 | { |
| 3145 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 3146 | { |
| 3147 | /*interface type changed update in wiphy structure*/ |
| 3148 | wdev->iftype = type; |
| 3149 | |
| 3150 | /*the BSS mode changed, We need to issue disconnect |
| 3151 | if connected or in IBSS disconnect state*/ |
| 3152 | if ( hdd_connGetConnectedBssType( |
| 3153 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 3154 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 3155 | { |
| 3156 | /*need to issue a disconnect to CSR.*/ |
| 3157 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 3158 | if( eHAL_STATUS_SUCCESS == |
| 3159 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3160 | pAdapter->sessionId, |
| 3161 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 3162 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3163 | ret = wait_for_completion_interruptible_timeout( |
| 3164 | &pAdapter->disconnect_comp_var, |
| 3165 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 3166 | if (ret <= 0) |
| 3167 | { |
| 3168 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3169 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 3170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3171 | } |
| 3172 | } |
| 3173 | } |
| 3174 | } |
| 3175 | |
| 3176 | done: |
| 3177 | /*set bitmask based on updated value*/ |
| 3178 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 3179 | |
| 3180 | /* Only STA mode support TM now |
| 3181 | * all other mode, TM feature should be disabled */ |
| 3182 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 3183 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 3184 | { |
| 3185 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 3186 | } |
| 3187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3188 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3189 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3190 | (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 3191 | { |
| 3192 | //we are ok to do AMP |
| 3193 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 3194 | } |
| 3195 | #endif //WLAN_BTAMP_FEATURE |
| 3196 | EXIT(); |
| 3197 | return 0; |
| 3198 | } |
| 3199 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3200 | #ifdef FEATURE_WLAN_TDLS |
| 3201 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 3202 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 3203 | { |
| 3204 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3205 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3206 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3207 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3208 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 3209 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3210 | |
| 3211 | ENTER(); |
| 3212 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3213 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3214 | { |
| 3215 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3216 | "Invalid arguments"); |
| 3217 | return -EINVAL; |
| 3218 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 3219 | |
| 3220 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 3221 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 3222 | { |
| 3223 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3224 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 3225 | MAC_ADDRESS_STR " Request declined.", |
| 3226 | __func__, MAC_ADDR_ARRAY(mac)); |
| 3227 | return -ENOTSUPP; |
| 3228 | } |
| 3229 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3230 | if (pHddCtx->isLogpInProgress) |
| 3231 | { |
| 3232 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3233 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3234 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3235 | return -EBUSY; |
| 3236 | } |
| 3237 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 3238 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3239 | |
| 3240 | if ( NULL == pTdlsPeer ) { |
| 3241 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3242 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 3243 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 3244 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3245 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3246 | |
| 3247 | /* in add station, we accept existing valid staId if there is */ |
| 3248 | if ((0 == update) && |
| 3249 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 3250 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3251 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3252 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3253 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3254 | " link_status %d. staId %d. add station ignored.", |
| 3255 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 3256 | return 0; |
| 3257 | } |
| 3258 | /* in change station, we accept only when staId is valid */ |
| 3259 | if ((1 == update) && |
| 3260 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 3261 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 3262 | { |
| 3263 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3264 | "%s: " MAC_ADDRESS_STR |
| 3265 | " link status %d. staId %d. change station %s.", |
| 3266 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 3267 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 3268 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3269 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3270 | |
| 3271 | /* 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] | 3272 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3273 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3274 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3275 | "%s: " MAC_ADDRESS_STR |
| 3276 | " TDLS setup is ongoing. Request declined.", |
| 3277 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3278 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3279 | } |
| 3280 | |
| 3281 | /* first to check if we reached to maximum supported TDLS peer. |
| 3282 | TODO: for now, return -EPERM looks working fine, |
| 3283 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 3284 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 3285 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3286 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3288 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 3289 | " TDLS Max peer already connected. Request declined." |
| 3290 | " Num of peers (%d), Max allowed (%d).", |
| 3291 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 3292 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3293 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3294 | } |
| 3295 | else |
| 3296 | { |
| 3297 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 3298 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3299 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3300 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3302 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 3303 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3304 | return -EPERM; |
| 3305 | } |
| 3306 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3307 | if (0 == update) |
| 3308 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_CONNECTING); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3309 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 3310 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3311 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3312 | { |
| 3313 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3314 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3315 | if(StaParams->htcap_present) |
| 3316 | { |
| 3317 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3318 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 3319 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3320 | "ht_capa->extended_capabilities: %0x", |
| 3321 | StaParams->HTCap.extendedHtCapInfo); |
| 3322 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3323 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3324 | "params->capability: %0x",StaParams->capability); |
| 3325 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3326 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3327 | if(StaParams->vhtcap_present) |
| 3328 | { |
| 3329 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3330 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 3331 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 3332 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 3333 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3334 | { |
| 3335 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3336 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3337 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 3338 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 3339 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 3340 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 3341 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 3342 | else if ((1 == update) && (NULL == StaParams)) |
| 3343 | { |
| 3344 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3345 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 3346 | return -EPERM; |
| 3347 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3348 | |
| 3349 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 3350 | |
| 3351 | if (!update) |
| 3352 | { |
| 3353 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3354 | pAdapter->sessionId, mac); |
| 3355 | } |
| 3356 | else |
| 3357 | { |
| 3358 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3359 | pAdapter->sessionId, mac, StaParams); |
| 3360 | } |
| 3361 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3362 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3363 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 3364 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3365 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3366 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3368 | "%s: timeout waiting for tdls add station indication %ld", |
| 3369 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3370 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3371 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3372 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3373 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 3374 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 3375 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3376 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 3377 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3378 | } |
| 3379 | |
| 3380 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 3381 | |
| 3382 | error: |
| 3383 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
| 3384 | return -EPERM; |
| 3385 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3386 | } |
| 3387 | #endif |
| 3388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3389 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 3390 | struct net_device *dev, |
| 3391 | u8 *mac, |
| 3392 | struct station_parameters *params) |
| 3393 | { |
| 3394 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 3395 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3396 | hdd_context_t *pHddCtx; |
| 3397 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3399 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3400 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3401 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 3402 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3403 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3404 | ENTER(); |
| 3405 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3406 | if ((NULL == pAdapter)) |
| 3407 | { |
| 3408 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3409 | "invalid adapter "); |
| 3410 | return -EINVAL; |
| 3411 | } |
| 3412 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3413 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3414 | TRACE_CODE_HDD_CHANGE_STATION, |
| 3415 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3416 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3417 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3418 | |
| 3419 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 3420 | { |
| 3421 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3422 | "invalid HDD state or HDD station context"); |
| 3423 | return -EINVAL; |
| 3424 | } |
| 3425 | |
| 3426 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3427 | { |
| 3428 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3429 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3430 | return -EAGAIN; |
| 3431 | } |
| 3432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3433 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 3434 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3435 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 3436 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3438 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3439 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3440 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3441 | WLANTL_STA_AUTHENTICATED); |
| 3442 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3443 | if (status != VOS_STATUS_SUCCESS) |
| 3444 | { |
| 3445 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3446 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 3447 | return -EINVAL; |
| 3448 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3449 | } |
| 3450 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 3451 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 3452 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3453 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3454 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 3455 | StaParams.capability = params->capability; |
| 3456 | StaParams.uapsd_queues = params->uapsd_queues; |
| 3457 | StaParams.max_sp = params->max_sp; |
| 3458 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 3459 | /* Convert (first channel , number of channels) tuple to |
| 3460 | * the total list of channels. This goes with the assumption |
| 3461 | * that if the first channel is < 14, then the next channels |
| 3462 | * are an incremental of 1 else an incremental of 4 till the number |
| 3463 | * of channels. |
| 3464 | */ |
| 3465 | if (0 != params->supported_channels_len) { |
| 3466 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 3467 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 3468 | { |
| 3469 | int wifi_chan_index; |
| 3470 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 3471 | wifi_chan_index = |
| 3472 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 3473 | no_of_channels = params->supported_channels[i+1]; |
| 3474 | for(k=1; k <= no_of_channels; k++) |
| 3475 | { |
| 3476 | StaParams.supported_channels[j+1] = |
| 3477 | StaParams.supported_channels[j] + wifi_chan_index; |
| 3478 | j+=1; |
| 3479 | } |
| 3480 | } |
| 3481 | StaParams.supported_channels_len = j; |
| 3482 | } |
| 3483 | vos_mem_copy(StaParams.supported_oper_classes, |
| 3484 | params->supported_oper_classes, |
| 3485 | params->supported_oper_classes_len); |
| 3486 | StaParams.supported_oper_classes_len = |
| 3487 | params->supported_oper_classes_len; |
| 3488 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3489 | if (0 != params->ext_capab_len) |
| 3490 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 3491 | sizeof(StaParams.extn_capability)); |
| 3492 | |
| 3493 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3494 | { |
| 3495 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3496 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3497 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3498 | |
| 3499 | StaParams.supported_rates_len = params->supported_rates_len; |
| 3500 | |
| 3501 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 3502 | * The supported_rates array , for all the structures propogating till Add Sta |
| 3503 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 3504 | * modified to send more rates. |
| 3505 | */ |
| 3506 | |
| 3507 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 3508 | */ |
| 3509 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 3510 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 3511 | |
| 3512 | if (0 != StaParams.supported_rates_len) { |
| 3513 | int i = 0; |
| 3514 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 3515 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3516 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3517 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 3518 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 3519 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3520 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 3521 | } |
| 3522 | |
| 3523 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3524 | { |
| 3525 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3526 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3527 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3528 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3529 | if (0 != params->ext_capab_len ) { |
| 3530 | /*Define A Macro : TODO Sunil*/ |
| 3531 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 3532 | isBufSta = 1; |
| 3533 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 3534 | /* TDLS Channel Switching Support */ |
| 3535 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 3536 | isOffChannelSupported = 1; |
| 3537 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3538 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 3539 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 3540 | &StaParams, isBufSta, |
| 3541 | isOffChannelSupported); |
| 3542 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3543 | if (VOS_STATUS_SUCCESS != status) { |
| 3544 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3545 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 3546 | return -EINVAL; |
| 3547 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3548 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 3549 | |
| 3550 | if (VOS_STATUS_SUCCESS != status) { |
| 3551 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3552 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 3553 | return -EINVAL; |
| 3554 | } |
| 3555 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 3556 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 3557 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3558 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3559 | return status; |
| 3560 | } |
| 3561 | |
| 3562 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3563 | * FUNCTION: wlan_hdd_cfg80211_add_key |
| 3564 | * This function is used to initialize the key information |
| 3565 | */ |
| 3566 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3567 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3568 | struct net_device *ndev, |
| 3569 | u8 key_index, bool pairwise, |
| 3570 | const u8 *mac_addr, |
| 3571 | struct key_params *params |
| 3572 | ) |
| 3573 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3574 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3575 | struct net_device *ndev, |
| 3576 | u8 key_index, const u8 *mac_addr, |
| 3577 | struct key_params *params |
| 3578 | ) |
| 3579 | #endif |
| 3580 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3581 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3582 | tCsrRoamSetKey setKey; |
| 3583 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3584 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3585 | v_U32_t roamId= 0xFF; |
| 3586 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3587 | hdd_hostapd_state_t *pHostapdState; |
| 3588 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3589 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3590 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3591 | |
| 3592 | ENTER(); |
| 3593 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3594 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3595 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 3596 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3597 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3598 | status = wlan_hdd_validate_context(pHddCtx); |
| 3599 | |
| 3600 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3601 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3602 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3603 | "%s: HDD context is not valid", __func__); |
| 3604 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3605 | } |
| 3606 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3607 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
| 3608 | __func__, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | |
| 3610 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3611 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3612 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3613 | key_index); |
| 3614 | |
| 3615 | return -EINVAL; |
| 3616 | } |
| 3617 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3618 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 3619 | { |
| 3620 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 3621 | params->key_len); |
| 3622 | |
| 3623 | return -EINVAL; |
| 3624 | } |
| 3625 | |
| 3626 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3627 | "%s: called with key index = %d & key length %d", |
| 3628 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3629 | |
| 3630 | /*extract key idx, key len and key*/ |
| 3631 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3632 | setKey.keyId = key_index; |
| 3633 | setKey.keyLength = params->key_len; |
| 3634 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 3635 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3636 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3637 | { |
| 3638 | case WLAN_CIPHER_SUITE_WEP40: |
| 3639 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3640 | break; |
| 3641 | |
| 3642 | case WLAN_CIPHER_SUITE_WEP104: |
| 3643 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3644 | break; |
| 3645 | |
| 3646 | case WLAN_CIPHER_SUITE_TKIP: |
| 3647 | { |
| 3648 | u8 *pKey = &setKey.Key[0]; |
| 3649 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3650 | |
| 3651 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 3652 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3653 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | |
| 3655 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3656 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | |--------------|----------|----------| |
| 3658 | <---16bytes---><--8bytes--><--8bytes--> |
| 3659 | |
| 3660 | */ |
| 3661 | /*Sme expects the 32 bytes key to be in the below order |
| 3662 | |
| 3663 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3664 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | |--------------|----------|----------| |
| 3666 | <---16bytes---><--8bytes--><--8bytes--> |
| 3667 | */ |
| 3668 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3669 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3670 | |
| 3671 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3672 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3673 | |
| 3674 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3675 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | |
| 3677 | |
| 3678 | break; |
| 3679 | } |
| 3680 | |
| 3681 | case WLAN_CIPHER_SUITE_CCMP: |
| 3682 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 3683 | break; |
| 3684 | |
| 3685 | #ifdef FEATURE_WLAN_WAPI |
| 3686 | case WLAN_CIPHER_SUITE_SMS4: |
| 3687 | { |
| 3688 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3689 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 3690 | params->key, params->key_len); |
| 3691 | return 0; |
| 3692 | } |
| 3693 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3694 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3695 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | case WLAN_CIPHER_SUITE_KRK: |
| 3697 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 3698 | break; |
| 3699 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3700 | |
| 3701 | #ifdef WLAN_FEATURE_11W |
| 3702 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 3703 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 3704 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3705 | #endif |
| 3706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3707 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3708 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | __func__, params->cipher); |
| 3710 | return -EOPNOTSUPP; |
| 3711 | } |
| 3712 | |
| 3713 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 3714 | __func__, setKey.encType); |
| 3715 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3716 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3717 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3718 | (!pairwise) |
| 3719 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3720 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3721 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3722 | ) |
| 3723 | { |
| 3724 | /* set group key*/ |
| 3725 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3726 | "%s- %d: setting Broadcast key", |
| 3727 | __func__, __LINE__); |
| 3728 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3729 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3730 | } |
| 3731 | else |
| 3732 | { |
| 3733 | /* set pairwise key*/ |
| 3734 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3735 | "%s- %d: setting pairwise key", |
| 3736 | __func__, __LINE__); |
| 3737 | setKey.keyDirection = eSIR_TX_RX; |
| 3738 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 3739 | } |
| 3740 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 3741 | { |
| 3742 | setKey.keyDirection = eSIR_TX_RX; |
| 3743 | /*Set the group key*/ |
| 3744 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3745 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3746 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3747 | if ( 0 != status ) |
| 3748 | { |
| 3749 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3750 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 3751 | return -EINVAL; |
| 3752 | } |
| 3753 | /*Save the keys here and call sme_RoamSetKey for setting |
| 3754 | the PTK after peer joins the IBSS network*/ |
| 3755 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 3756 | &setKey, sizeof(tCsrRoamSetKey)); |
| 3757 | return status; |
| 3758 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3759 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 3760 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 3761 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3762 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3763 | if( pHostapdState->bssState == BSS_START ) |
| 3764 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 3765 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3766 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 3767 | |
| 3768 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 3769 | { |
| 3770 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3771 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 3772 | __LINE__, vos_status ); |
| 3773 | |
| 3774 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3775 | |
| 3776 | return -EINVAL; |
| 3777 | } |
| 3778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3779 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 3780 | |
| 3781 | if ( status != eHAL_STATUS_SUCCESS ) |
| 3782 | { |
| 3783 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3784 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 3785 | __LINE__, status ); |
| 3786 | } |
| 3787 | } |
| 3788 | |
| 3789 | /* Saving WEP keys */ |
| 3790 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 3791 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 3792 | { |
| 3793 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 3794 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3795 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 3796 | } |
| 3797 | else |
| 3798 | { |
| 3799 | //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] | 3800 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3801 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 3802 | } |
| 3803 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3804 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 3805 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3806 | { |
| 3807 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3808 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3809 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3810 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 3811 | if (!pairwise) |
| 3812 | #else |
| 3813 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 3814 | #endif |
| 3815 | { |
| 3816 | /* set group key*/ |
| 3817 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 3818 | { |
| 3819 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3820 | "%s- %d: Perform Set key Complete", |
| 3821 | __func__, __LINE__); |
| 3822 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 3823 | } |
| 3824 | } |
| 3825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3826 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 3827 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 3828 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 3829 | |
| 3830 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 3831 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3832 | params->key, params->key_len); |
| 3833 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3835 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3836 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3837 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3838 | "%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] | 3839 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3840 | setKey.peerMac[2], setKey.peerMac[3], |
| 3841 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3842 | setKey.keyDirection); |
| 3843 | |
| 3844 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 3845 | |
| 3846 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 3847 | { |
| 3848 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3849 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 3850 | __LINE__, vos_status ); |
| 3851 | |
| 3852 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3853 | |
| 3854 | return -EINVAL; |
| 3855 | |
| 3856 | } |
| 3857 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3858 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3859 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 3860 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 3861 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3862 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3863 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3864 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 3865 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 3866 | "%s: Update PreAuth Key success", __func__); |
| 3867 | return 0; |
| 3868 | } |
| 3869 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 3870 | { |
| 3871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3872 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 3873 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3874 | } |
| 3875 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3876 | |
| 3877 | /* issue set key request to SME*/ |
| 3878 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3879 | pAdapter->sessionId, &setKey, &roamId ); |
| 3880 | |
| 3881 | if ( 0 != status ) |
| 3882 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3883 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3884 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 3885 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3886 | return -EINVAL; |
| 3887 | } |
| 3888 | |
| 3889 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3890 | /* in case of IBSS as there was no information available about WEP keys during |
| 3891 | * 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] | 3892 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3893 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 3894 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 3895 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3896 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 3897 | ) |
| 3898 | && |
| 3899 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 3900 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 3901 | ) |
| 3902 | ) |
| 3903 | { |
| 3904 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3905 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3906 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3907 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3908 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3909 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 3910 | setKey.peerMac[2], setKey.peerMac[3], |
| 3911 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3912 | setKey.keyDirection); |
| 3913 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3914 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3915 | pAdapter->sessionId, &setKey, &roamId ); |
| 3916 | |
| 3917 | if ( 0 != status ) |
| 3918 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3920 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3921 | __func__, status); |
| 3922 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3923 | return -EINVAL; |
| 3924 | } |
| 3925 | } |
| 3926 | } |
| 3927 | |
| 3928 | return 0; |
| 3929 | } |
| 3930 | |
| 3931 | /* |
| 3932 | * FUNCTION: wlan_hdd_cfg80211_get_key |
| 3933 | * This function is used to get the key information |
| 3934 | */ |
| 3935 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3936 | static int wlan_hdd_cfg80211_get_key( |
| 3937 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3938 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3939 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3940 | const u8 *mac_addr, void *cookie, |
| 3941 | void (*callback)(void *cookie, struct key_params*) |
| 3942 | ) |
| 3943 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3944 | static int wlan_hdd_cfg80211_get_key( |
| 3945 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3946 | struct net_device *ndev, |
| 3947 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 3948 | void (*callback)(void *cookie, struct key_params*) |
| 3949 | ) |
| 3950 | #endif |
| 3951 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3952 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3953 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3954 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3955 | struct key_params params; |
| 3956 | |
| 3957 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3958 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3959 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3960 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 3961 | pAdapter->sessionId, params.cipher)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3962 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3963 | __func__,pAdapter->device_mode); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3965 | memset(¶ms, 0, sizeof(params)); |
| 3966 | |
| 3967 | if (CSR_MAX_NUM_KEY <= key_index) |
| 3968 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3969 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3970 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3972 | |
| 3973 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 3974 | { |
| 3975 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3976 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3977 | break; |
| 3978 | |
| 3979 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3980 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3981 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 3982 | break; |
| 3983 | |
| 3984 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3985 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3986 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 3987 | break; |
| 3988 | |
| 3989 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3990 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 3991 | break; |
| 3992 | |
| 3993 | case eCSR_ENCRYPT_TYPE_AES: |
| 3994 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 3995 | break; |
| 3996 | |
| 3997 | default: |
| 3998 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 3999 | break; |
| 4000 | } |
| 4001 | |
| 4002 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 4003 | params.seq_len = 0; |
| 4004 | params.seq = NULL; |
| 4005 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 4006 | callback(cookie, ¶ms); |
| 4007 | return 0; |
| 4008 | } |
| 4009 | |
| 4010 | /* |
| 4011 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 4012 | * This function is used to delete the key information |
| 4013 | */ |
| 4014 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4015 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4016 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4017 | u8 key_index, |
| 4018 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4019 | const u8 *mac_addr |
| 4020 | ) |
| 4021 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4022 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4023 | struct net_device *ndev, |
| 4024 | u8 key_index, |
| 4025 | const u8 *mac_addr |
| 4026 | ) |
| 4027 | #endif |
| 4028 | { |
| 4029 | int status = 0; |
| 4030 | |
| 4031 | //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] | 4032 | //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] | 4033 | //it is observed that this is invalidating peer |
| 4034 | //key index whenever re-key is done. This is affecting data link. |
| 4035 | //It should be ok to ignore del_key. |
| 4036 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4037 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 4038 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 4040 | tCsrRoamSetKey setKey; |
| 4041 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4043 | ENTER(); |
| 4044 | |
| 4045 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 4046 | __func__,pAdapter->device_mode); |
| 4047 | |
| 4048 | if (CSR_MAX_NUM_KEY <= key_index) |
| 4049 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4050 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4051 | key_index); |
| 4052 | |
| 4053 | return -EINVAL; |
| 4054 | } |
| 4055 | |
| 4056 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4057 | setKey.keyId = key_index; |
| 4058 | |
| 4059 | if (mac_addr) |
| 4060 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 4061 | else |
| 4062 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 4063 | |
| 4064 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4065 | |
| 4066 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4067 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4068 | ) |
| 4069 | { |
| 4070 | |
| 4071 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4072 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 4073 | if( pHostapdState->bssState == BSS_START) |
| 4074 | { |
| 4075 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | if ( status != eHAL_STATUS_SUCCESS ) |
| 4078 | { |
| 4079 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4080 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 4081 | __LINE__, status ); |
| 4082 | } |
| 4083 | } |
| 4084 | } |
| 4085 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4086 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4087 | ) |
| 4088 | { |
| 4089 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4090 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4091 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4092 | |
| 4093 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4094 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4095 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 4096 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4097 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4098 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 4099 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4100 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4101 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4102 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4104 | if ( 0 != status ) |
| 4105 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4106 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | "%s: sme_RoamSetKey failure, returned %d", |
| 4108 | __func__, status); |
| 4109 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4110 | return -EINVAL; |
| 4111 | } |
| 4112 | } |
| 4113 | } |
| 4114 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4115 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | return status; |
| 4117 | } |
| 4118 | |
| 4119 | /* |
| 4120 | * FUNCTION: wlan_hdd_cfg80211_set_default_key |
| 4121 | * This function is used to set the default tx key index |
| 4122 | */ |
| 4123 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 4124 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 4125 | struct net_device *ndev, |
| 4126 | u8 key_index, |
| 4127 | bool unicast, bool multicast) |
| 4128 | #else |
| 4129 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 4130 | struct net_device *ndev, |
| 4131 | u8 key_index) |
| 4132 | #endif |
| 4133 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4134 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4135 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4136 | hdd_wext_state_t *pWextState; |
| 4137 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4138 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | |
| 4140 | ENTER(); |
| 4141 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4142 | if ((NULL == pAdapter)) |
| 4143 | { |
| 4144 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4145 | "invalid adapter"); |
| 4146 | return -EINVAL; |
| 4147 | } |
| 4148 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4149 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4150 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 4151 | pAdapter->sessionId, key_index)); |
| 4152 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4153 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4154 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4155 | |
| 4156 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 4157 | { |
| 4158 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4159 | "invalid Wext state or HDD context"); |
| 4160 | return -EINVAL; |
| 4161 | } |
| 4162 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4163 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4164 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4166 | if (CSR_MAX_NUM_KEY <= key_index) |
| 4167 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4168 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4169 | key_index); |
| 4170 | |
| 4171 | return -EINVAL; |
| 4172 | } |
| 4173 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4174 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4175 | status = wlan_hdd_validate_context(pHddCtx); |
| 4176 | |
| 4177 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4178 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4179 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4180 | "%s: HDD context is not valid", __func__); |
| 4181 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4182 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4185 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4186 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4187 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4188 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 4189 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4190 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 4191 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4193 | { |
| 4194 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4195 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | tCsrRoamSetKey setKey; |
| 4198 | v_U32_t roamId= 0xFF; |
| 4199 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4200 | |
| 4201 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4202 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4203 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | Keys->defaultIndex = (u8)key_index; |
| 4205 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4206 | setKey.keyId = key_index; |
| 4207 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4208 | |
| 4209 | vos_mem_copy(&setKey.Key[0], |
| 4210 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4211 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4212 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4213 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4214 | |
| 4215 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4216 | &pHddStaCtx->conn_info.bssId[0], |
| 4217 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4218 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4219 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 4220 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 4221 | eCSR_ENCRYPT_TYPE_WEP104) |
| 4222 | { |
| 4223 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 4224 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 4225 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 4226 | type(104) and switching encryption type to 40*/ |
| 4227 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 4228 | eCSR_ENCRYPT_TYPE_WEP40; |
| 4229 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 4230 | eCSR_ENCRYPT_TYPE_WEP40; |
| 4231 | } |
| 4232 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4233 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4236 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4237 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4240 | if ( 0 != status ) |
| 4241 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4242 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4243 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4244 | status); |
| 4245 | return -EINVAL; |
| 4246 | } |
| 4247 | } |
| 4248 | } |
| 4249 | |
| 4250 | /* In SoftAp mode setting key direction for default mode */ |
| 4251 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 4252 | { |
| 4253 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 4254 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 4255 | (eCSR_ENCRYPT_TYPE_AES != |
| 4256 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 4257 | ) |
| 4258 | { |
| 4259 | /* Saving key direction for default key index to TX default */ |
| 4260 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 4261 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 4262 | } |
| 4263 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4265 | return status; |
| 4266 | } |
| 4267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4268 | /* |
| 4269 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 4270 | * This function is used to inform the BSS details to nl80211 interface. |
| 4271 | */ |
| 4272 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 4273 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 4274 | { |
| 4275 | struct net_device *dev = pAdapter->dev; |
| 4276 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4277 | struct wiphy *wiphy = wdev->wiphy; |
| 4278 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 4279 | int chan_no; |
| 4280 | int ie_length; |
| 4281 | const char *ie; |
| 4282 | unsigned int freq; |
| 4283 | struct ieee80211_channel *chan; |
| 4284 | int rssi = 0; |
| 4285 | struct cfg80211_bss *bss = NULL; |
| 4286 | |
| 4287 | ENTER(); |
| 4288 | |
| 4289 | if( NULL == pBssDesc ) |
| 4290 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4291 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | return bss; |
| 4293 | } |
| 4294 | |
| 4295 | chan_no = pBssDesc->channelId; |
| 4296 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 4297 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 4298 | |
| 4299 | if( NULL == ie ) |
| 4300 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4301 | 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] | 4302 | return bss; |
| 4303 | } |
| 4304 | |
| 4305 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 4306 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 4307 | { |
| 4308 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 4309 | } |
| 4310 | else |
| 4311 | { |
| 4312 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 4313 | } |
| 4314 | #else |
| 4315 | freq = ieee80211_channel_to_frequency(chan_no); |
| 4316 | #endif |
| 4317 | |
| 4318 | chan = __ieee80211_get_channel(wiphy, freq); |
| 4319 | |
| 4320 | bss = cfg80211_get_bss(wiphy, chan, pBssDesc->bssId, |
| 4321 | &roamProfile->SSID.ssId[0], roamProfile->SSID.length, |
| 4322 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
| 4323 | if (bss == NULL) |
| 4324 | { |
| 4325 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
| 4326 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4327 | return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
| 4328 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4329 | pBssDesc->capabilityInfo, |
| 4330 | pBssDesc->beaconInterval, ie, ie_length, |
| 4331 | rssi, GFP_KERNEL )); |
| 4332 | } |
| 4333 | else |
| 4334 | { |
| 4335 | return bss; |
| 4336 | } |
| 4337 | } |
| 4338 | |
| 4339 | |
| 4340 | |
| 4341 | /* |
| 4342 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 4343 | * This function is used to inform the BSS details to nl80211 interface. |
| 4344 | */ |
| 4345 | struct cfg80211_bss* |
| 4346 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 4347 | tSirBssDescription *bss_desc |
| 4348 | ) |
| 4349 | { |
| 4350 | /* |
| 4351 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 4352 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 4353 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 4354 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 4355 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 4356 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 4357 | cfg80211_inform_bss_frame. |
| 4358 | */ |
| 4359 | struct net_device *dev = pAdapter->dev; |
| 4360 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4361 | struct wiphy *wiphy = wdev->wiphy; |
| 4362 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 4363 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 4364 | qcom_ie_age *qie_age = NULL; |
| 4365 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 4366 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4367 | 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] | 4368 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4369 | const char *ie = |
| 4370 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 4371 | unsigned int freq; |
| 4372 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 4373 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4374 | struct cfg80211_bss *bss_status = NULL; |
| 4375 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 4376 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4377 | hdd_context_t *pHddCtx; |
| 4378 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4379 | #ifdef WLAN_OPEN_SOURCE |
| 4380 | struct timespec ts; |
| 4381 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4382 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4383 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4384 | status = wlan_hdd_validate_context(pHddCtx); |
| 4385 | |
| 4386 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 4387 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4388 | { |
| 4389 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4390 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 4391 | return NULL; |
| 4392 | } |
| 4393 | |
| 4394 | |
| 4395 | if (0 != status) |
| 4396 | { |
| 4397 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4398 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 4399 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4400 | } |
| 4401 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 4402 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4403 | if (!mgmt) |
| 4404 | { |
| 4405 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4406 | "%s: memory allocation failed ", __func__); |
| 4407 | return NULL; |
| 4408 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 4409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4410 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4411 | |
| 4412 | #ifdef WLAN_OPEN_SOURCE |
| 4413 | /* Android does not want the timestamp from the frame. |
| 4414 | Instead it wants a monotonic increasing value */ |
| 4415 | get_monotonic_boottime(&ts); |
| 4416 | mgmt->u.probe_resp.timestamp = |
| 4417 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 4418 | #else |
| 4419 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4420 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 4421 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4422 | |
| 4423 | #endif |
| 4424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4425 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 4426 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 4427 | |
| 4428 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 4429 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 4430 | /* Assuming this is the last IE, copy at the end */ |
| 4431 | ie_length -=sizeof(qcom_ie_age); |
| 4432 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 4433 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 4434 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 4435 | qie_age->oui_1 = QCOM_OUI1; |
| 4436 | qie_age->oui_2 = QCOM_OUI2; |
| 4437 | qie_age->oui_3 = QCOM_OUI3; |
| 4438 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 4439 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 4440 | #endif |
| 4441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4442 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 4443 | if (bss_desc->fProbeRsp) |
| 4444 | { |
| 4445 | mgmt->frame_control |= |
| 4446 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 4447 | } |
| 4448 | else |
| 4449 | { |
| 4450 | mgmt->frame_control |= |
| 4451 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 4452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4453 | |
| 4454 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4455 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4456 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 4457 | { |
| 4458 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 4459 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4460 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4461 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 4462 | |
| 4463 | { |
| 4464 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 4465 | } |
| 4466 | else |
| 4467 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 4468 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 4469 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4470 | kfree(mgmt); |
| 4471 | return NULL; |
| 4472 | } |
| 4473 | #else |
| 4474 | freq = ieee80211_channel_to_frequency(chan_no); |
| 4475 | #endif |
| 4476 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 4477 | /*when the band is changed on the fly using the GUI, three things are done |
| 4478 | * 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) |
| 4479 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 4480 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 4481 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 4482 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 4483 | * 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 |
| 4484 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 4485 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 4486 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 4487 | * So drop the bss and continue to next bss. |
| 4488 | */ |
| 4489 | if(chan == NULL) |
| 4490 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 4491 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 4492 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 4493 | return NULL; |
| 4494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4495 | /*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] | 4496 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | * */ |
| 4498 | if (( eConnectionState_Associated == |
| 4499 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 4500 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 4501 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 4502 | WNI_CFG_BSSID_LEN))) |
| 4503 | { |
| 4504 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 4505 | rssi = (pAdapter->rssi * 100); |
| 4506 | } |
| 4507 | else |
| 4508 | { |
| 4509 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 4510 | } |
| 4511 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 4512 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 4513 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 4514 | chan->center_freq, (int)(rssi/100)); |
| 4515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4516 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 4517 | frame_len, rssi, GFP_KERNEL); |
| 4518 | kfree(mgmt); |
| 4519 | return bss_status; |
| 4520 | } |
| 4521 | |
| 4522 | /* |
| 4523 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 4524 | * This function is used to update the BSS data base of CFG8011 |
| 4525 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4526 | 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] | 4527 | tCsrRoamInfo *pRoamInfo |
| 4528 | ) |
| 4529 | { |
| 4530 | tCsrRoamConnectedProfile roamProfile; |
| 4531 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4532 | struct cfg80211_bss *bss = NULL; |
| 4533 | |
| 4534 | ENTER(); |
| 4535 | |
| 4536 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 4537 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 4538 | |
| 4539 | if (NULL != roamProfile.pBssDesc) |
| 4540 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4541 | bss = wlan_hdd_cfg80211_inform_bss(pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4542 | &roamProfile); |
| 4543 | |
| 4544 | if (NULL == bss) |
| 4545 | { |
| 4546 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 4547 | __func__); |
| 4548 | } |
| 4549 | |
| 4550 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 4551 | } |
| 4552 | else |
| 4553 | { |
| 4554 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 4555 | __func__); |
| 4556 | } |
| 4557 | return bss; |
| 4558 | } |
| 4559 | |
| 4560 | /* |
| 4561 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 4562 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4563 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 4564 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4565 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4566 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4567 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4568 | tCsrScanResultInfo *pScanResult; |
| 4569 | eHalStatus status = 0; |
| 4570 | tScanResultHandle pResult; |
| 4571 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4572 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4573 | |
| 4574 | ENTER(); |
| 4575 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4576 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4577 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 4578 | NO_SESSION, pAdapter->sessionId)); |
| 4579 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4580 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4581 | |
| 4582 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4583 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4585 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 4586 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | } |
| 4588 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4589 | |
| 4590 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 4591 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 4592 | { |
| 4593 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4594 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 4595 | return VOS_STATUS_E_PERM; |
| 4596 | } |
| 4597 | |
| 4598 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4599 | /* |
| 4600 | * start getting scan results and populate cgf80211 BSS database |
| 4601 | */ |
| 4602 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 4603 | |
| 4604 | /* no scan results */ |
| 4605 | if (NULL == pResult) |
| 4606 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 4607 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 4608 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | return status; |
| 4610 | } |
| 4611 | |
| 4612 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 4613 | |
| 4614 | while (pScanResult) |
| 4615 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4616 | /* |
| 4617 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 4618 | * entry already exists in bss data base of cfg80211 for that |
| 4619 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 4620 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 4621 | * mgmt packet as input. As of now there is no possibility to get |
| 4622 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4623 | * ieee80211_mgmt(probe response) and passing to c |
| 4624 | * fg80211_inform_bss_frame. |
| 4625 | * */ |
| 4626 | |
| 4627 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4628 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4630 | |
| 4631 | if (NULL == bss_status) |
| 4632 | { |
| 4633 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4634 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4635 | } |
| 4636 | else |
| 4637 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 4638 | cfg80211_put_bss( |
| 4639 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 4640 | wiphy, |
| 4641 | #endif |
| 4642 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | } |
| 4644 | |
| 4645 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 4646 | } |
| 4647 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4648 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4649 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4650 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4651 | } |
| 4652 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4653 | void |
| 4654 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 4655 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4656 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 4657 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4658 | } /****** end hddPrintMacAddr() ******/ |
| 4659 | |
| 4660 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 4661 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4662 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4663 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4664 | "%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] | 4665 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 4666 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 4667 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4668 | } /****** end hddPrintPmkId() ******/ |
| 4669 | |
| 4670 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 4671 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 4672 | |
| 4673 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 4674 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 4675 | |
| 4676 | #define dump_bssid(bssid) \ |
| 4677 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4678 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 4679 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4680 | } |
| 4681 | |
| 4682 | #define dump_pmkid(pMac, pmkid) \ |
| 4683 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4684 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 4685 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4686 | } |
| 4687 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4688 | #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] | 4689 | /* |
| 4690 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 4691 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 4692 | */ |
| 4693 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4694 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4695 | int index, bool preauth ) |
| 4696 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4697 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4698 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4699 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4700 | |
| 4701 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4702 | 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] | 4703 | |
| 4704 | if( NULL == pRoamInfo ) |
| 4705 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4706 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4707 | return -EINVAL; |
| 4708 | } |
| 4709 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4710 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 4711 | { |
| 4712 | dump_bssid(pRoamInfo->bssid); |
| 4713 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4714 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 4715 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4716 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4717 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4718 | } |
| 4719 | #endif //FEATURE_WLAN_LFR |
| 4720 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4721 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4722 | /* |
| 4723 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 4724 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 4725 | * |
| 4726 | */ |
| 4727 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 4728 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 4729 | tCsrRoamInfo *pRoamInfo) |
| 4730 | { |
| 4731 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4732 | union iwreq_data wrqu; |
| 4733 | |
| 4734 | ENTER(); |
| 4735 | |
| 4736 | if (NULL == pAdapter) |
| 4737 | { |
| 4738 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4739 | return VOS_STATUS_E_FAILURE; |
| 4740 | } |
| 4741 | |
| 4742 | /* create the event */ |
| 4743 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4744 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4745 | |
| 4746 | wrqu.data.pointer = metrics_notification; |
| 4747 | wrqu.data.length = scnprintf(metrics_notification, |
| 4748 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 4749 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4750 | |
| 4751 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4752 | |
| 4753 | EXIT(); |
| 4754 | |
| 4755 | return VOS_STATUS_SUCCESS; |
| 4756 | } |
| 4757 | |
| 4758 | /* |
| 4759 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 4760 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 4761 | * or failure |
| 4762 | */ |
| 4763 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 4764 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 4765 | { |
| 4766 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4767 | union iwreq_data wrqu; |
| 4768 | |
| 4769 | ENTER(); |
| 4770 | |
| 4771 | if (NULL == pAdapter) |
| 4772 | { |
| 4773 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4774 | return VOS_STATUS_E_FAILURE; |
| 4775 | } |
| 4776 | |
| 4777 | /* create the event */ |
| 4778 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4779 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4780 | |
| 4781 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 4782 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 4783 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4784 | |
| 4785 | if (1 == preauth_status) |
| 4786 | strncat(metrics_notification, " TRUE", 5); |
| 4787 | else |
| 4788 | strncat(metrics_notification, " FALSE", 6); |
| 4789 | |
| 4790 | wrqu.data.pointer = metrics_notification; |
| 4791 | wrqu.data.length = strlen(metrics_notification); |
| 4792 | |
| 4793 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4794 | |
| 4795 | EXIT(); |
| 4796 | |
| 4797 | return VOS_STATUS_SUCCESS; |
| 4798 | } |
| 4799 | |
| 4800 | /* |
| 4801 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 4802 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 4803 | * |
| 4804 | */ |
| 4805 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 4806 | tCsrRoamInfo *pRoamInfo) |
| 4807 | { |
| 4808 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 4809 | union iwreq_data wrqu; |
| 4810 | |
| 4811 | ENTER(); |
| 4812 | |
| 4813 | if (NULL == pAdapter) |
| 4814 | { |
| 4815 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 4816 | return VOS_STATUS_E_FAILURE; |
| 4817 | } |
| 4818 | |
| 4819 | /* create the event */ |
| 4820 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4821 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 4822 | |
| 4823 | wrqu.data.pointer = metrics_notification; |
| 4824 | wrqu.data.length = scnprintf(metrics_notification, |
| 4825 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 4826 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 4827 | |
| 4828 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 4829 | |
| 4830 | EXIT(); |
| 4831 | |
| 4832 | return VOS_STATUS_SUCCESS; |
| 4833 | } |
| 4834 | #endif |
| 4835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4836 | /* |
| 4837 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 4838 | * scanning callback function, called after finishing scan |
| 4839 | * |
| 4840 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4841 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 4843 | { |
| 4844 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4845 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4846 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4847 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4848 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | struct cfg80211_scan_request *req = NULL; |
| 4850 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 4851 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4852 | long waitRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4853 | |
| 4854 | ENTER(); |
| 4855 | |
| 4856 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4857 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4858 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 4860 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 4861 | pScanInfo->mScanPendingCounter = 0; |
| 4862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4864 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4865 | &pScanInfo->scan_req_completion_event, |
| 4866 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4867 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4868 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4869 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4870 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4871 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4872 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | } |
| 4874 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4875 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | { |
| 4877 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4878 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4879 | } |
| 4880 | |
| 4881 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4882 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4883 | { |
| 4884 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4885 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4886 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4887 | (int) scanId); |
| 4888 | } |
| 4889 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4890 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4891 | pAdapter); |
| 4892 | |
| 4893 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4894 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | |
| 4896 | |
| 4897 | /* If any client wait scan result through WEXT |
| 4898 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4899 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4900 | { |
| 4901 | /* The other scan request waiting for current scan finish |
| 4902 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4903 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4905 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4906 | } |
| 4907 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4908 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4909 | { |
| 4910 | struct net_device *dev = pAdapter->dev; |
| 4911 | union iwreq_data wrqu; |
| 4912 | int we_event; |
| 4913 | char *msg; |
| 4914 | |
| 4915 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4916 | we_event = SIOCGIWSCAN; |
| 4917 | msg = NULL; |
| 4918 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 4919 | } |
| 4920 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 4921 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4922 | |
| 4923 | /* Get the Scan Req */ |
| 4924 | req = pAdapter->request; |
| 4925 | |
| 4926 | if (!req) |
| 4927 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4928 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4929 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4930 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4931 | } |
| 4932 | |
| 4933 | /* |
| 4934 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4935 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4936 | req->n_ssids = 0; |
| 4937 | req->n_channels = 0; |
| 4938 | req->ie = 0; |
| 4939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4940 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4941 | /* Scan is no longer pending */ |
| 4942 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4943 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 4944 | /* |
| 4945 | * cfg80211_scan_done informing NL80211 about completion |
| 4946 | * of scanning |
| 4947 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 4948 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 4949 | { |
| 4950 | aborted = true; |
| 4951 | } |
| 4952 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 4953 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4954 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4955 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 4956 | /* release the wake lock at the end of the scan*/ |
| 4957 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4958 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4959 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 4960 | * immediatly after the driver gets connect request(i.e after scan) |
| 4961 | * from supplicant, this result in app's is suspending and not able |
| 4962 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 4963 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 4964 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 4965 | #ifdef FEATURE_WLAN_TDLS |
| 4966 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 4967 | #endif |
| 4968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | EXIT(); |
| 4970 | return 0; |
| 4971 | } |
| 4972 | |
| 4973 | /* |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4974 | * FUNCTION: hdd_isScanAllowed |
| 4975 | * Go through each adapter and check if scan allowed |
| 4976 | * |
| 4977 | */ |
| 4978 | v_BOOL_t hdd_isScanAllowed( hdd_context_t *pHddCtx ) |
| 4979 | { |
| 4980 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 4981 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 4982 | hdd_adapter_t *pAdapter = NULL; |
| 4983 | VOS_STATUS status = 0; |
| 4984 | v_U8_t staId = 0; |
| 4985 | v_U8_t *staMac = NULL; |
| 4986 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 4987 | if (TRUE == pHddCtx->btCoexModeSet) |
| 4988 | { |
| 4989 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4990 | FL("BTCoex Mode operation in progress, Do not allow scan")); |
| 4991 | return VOS_FALSE; |
| 4992 | } |
| 4993 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 4994 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 4995 | |
| 4996 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 4997 | { |
| 4998 | pAdapter = pAdapterNode->pAdapter; |
| 4999 | |
| 5000 | if( pAdapter ) |
| 5001 | { |
| 5002 | hddLog(VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5003 | "%s: Adapter with device mode %d exists", |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5004 | __func__, pAdapter->device_mode); |
| 5005 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 5006 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 5007 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
| 5008 | { |
| 5009 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5010 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 5011 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 5012 | { |
| 5013 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 5014 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5015 | "%s: client " MAC_ADDRESS_STR |
| 5016 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 5017 | MAC_ADDR_ARRAY(staMac)); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5018 | return VOS_FALSE; |
| 5019 | } |
| 5020 | } |
| 5021 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 5022 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 5023 | { |
| 5024 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 5025 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5026 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5027 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 5028 | { |
| 5029 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 5030 | |
| 5031 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5032 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 5033 | "middle of WPS/EAPOL exchange.", __func__, |
| 5034 | MAC_ADDR_ARRAY(staMac)); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5035 | return VOS_FALSE; |
| 5036 | } |
| 5037 | } |
| 5038 | } |
| 5039 | } |
| 5040 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 5041 | pAdapterNode = pNext; |
| 5042 | } |
| 5043 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5044 | "%s: Scan allowed", __func__); |
| 5045 | return VOS_TRUE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5046 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5047 | |
| 5048 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5049 | * FUNCTION: wlan_hdd_cfg80211_scan |
| 5050 | * this scan respond to scan trigger and update cfg80211 scan database |
| 5051 | * later, scan dump command can be used to recieve scan results |
| 5052 | */ |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 5053 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 5054 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 5055 | struct net_device *dev, |
| 5056 | #endif |
| 5057 | struct cfg80211_scan_request *request) |
| 5058 | { |
| 5059 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 5060 | struct net_device *dev = request->wdev->netdev; |
| 5061 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5062 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5063 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 5064 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5065 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5066 | tCsrScanRequest scanRequest; |
| 5067 | tANI_U8 *channelList = NULL, i; |
| 5068 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5069 | int status; |
| 5070 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5071 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5072 | |
| 5073 | ENTER(); |
| 5074 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5075 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5076 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 5077 | pAdapter->sessionId, request->n_channels)); |
| 5078 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5079 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5080 | __func__,pAdapter->device_mode); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5081 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5082 | status = wlan_hdd_validate_context(pHddCtx); |
| 5083 | |
| 5084 | if (0 != status) |
| 5085 | { |
| 5086 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5087 | "%s: HDD context is not valid", __func__); |
| 5088 | return status; |
| 5089 | } |
| 5090 | |
| 5091 | cfg_param = pHddCtx->cfg_ini; |
| 5092 | pScanInfo = &pHddCtx->scan_info; |
| 5093 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5094 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5095 | (eConnectionState_Connecting == |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5096 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5097 | { |
| 5098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5099 | "%s: %p(%d) Connection in progress: Scan request denied (EBUSY)", __func__, \ |
| 5100 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5101 | return -EBUSY; |
| 5102 | } |
| 5103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5104 | #ifdef WLAN_BTAMP_FEATURE |
| 5105 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5106 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5107 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5108 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5109 | "%s: No scanning when AMP is on", __func__); |
| 5110 | return -EOPNOTSUPP; |
| 5111 | } |
| 5112 | #endif |
| 5113 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5114 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5115 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5116 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5117 | "%s: Not scanning on device_mode = %d", |
| 5118 | __func__, pAdapter->device_mode); |
| 5119 | return -EOPNOTSUPP; |
| 5120 | } |
| 5121 | |
| 5122 | if (TRUE == pScanInfo->mScanPending) |
| 5123 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 5124 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 5125 | { |
| 5126 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 5127 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5128 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5129 | } |
| 5130 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5131 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5132 | //Channel and action frame is pending |
| 5133 | //Otherwise Cancel Remain On Channel and allow Scan |
| 5134 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5135 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5136 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 5137 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5138 | return -EBUSY; |
| 5139 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5140 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 5141 | /* if tdls disagree scan right now, return immediately. |
| 5142 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 5143 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 5144 | */ |
| 5145 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 5146 | wiphy, |
| 5147 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 5148 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 5149 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 5150 | request); |
| 5151 | if(status <= 0) |
| 5152 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5153 | if(!status) |
| 5154 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 5155 | "scan rejected %d", __func__, status); |
| 5156 | else |
| 5157 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 5158 | __func__, status); |
| 5159 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 5160 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5161 | } |
| 5162 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5164 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 5165 | { |
| 5166 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 5167 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5168 | return -EAGAIN; |
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 (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 5171 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5172 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5173 | "%s: MAX TM Level Scan not allowed", __func__); |
| 5174 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5175 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5176 | } |
| 5177 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 5178 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 5179 | /* Check if scan is allowed at this point of time. |
| 5180 | */ |
| 5181 | if (!hdd_isScanAllowed(pHddCtx)) |
| 5182 | { |
| 5183 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 5184 | return -EBUSY; |
| 5185 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5187 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 5188 | |
| 5189 | if (NULL != request) |
| 5190 | { |
| 5191 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5192 | (int)request->n_ssids); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | |
| 5194 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 5195 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 5196 | * is not aging out the scan results. |
| 5197 | */ |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5198 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5199 | { |
| 5200 | request->n_ssids = 0; |
| 5201 | } |
| 5202 | |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 5203 | if ((request->ssids) && (0 < request->n_ssids)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5204 | { |
| 5205 | tCsrSSIDInfo *SsidInfo; |
| 5206 | int j; |
| 5207 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 5208 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 5209 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 5210 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 5211 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 5212 | |
| 5213 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 5214 | { |
| 5215 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5216 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | return -ENOMEM; |
| 5218 | } |
| 5219 | |
| 5220 | /* copy all the ssid's and their length */ |
| 5221 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 5222 | { |
| 5223 | /* get the ssid length */ |
| 5224 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 5225 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 5226 | SsidInfo->SSID.length); |
| 5227 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5228 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5229 | j, SsidInfo->SSID.ssId); |
| 5230 | } |
| 5231 | /* set the scan type to active */ |
| 5232 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 5233 | } |
| 5234 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5235 | { |
| 5236 | /* set the scan type to active */ |
| 5237 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 5238 | } |
| 5239 | else |
| 5240 | { |
| 5241 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 5242 | scanRequest.scanType = pScanInfo->scan_mode; |
| 5243 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5244 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5245 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
| 5246 | } |
| 5247 | else |
| 5248 | { |
| 5249 | /* set the scan type to active */ |
| 5250 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 5251 | vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); |
| 5252 | |
| 5253 | /* set min and max channel time to zero */ |
| 5254 | scanRequest.minChnTime = 0; |
| 5255 | scanRequest.maxChnTime = 0; |
| 5256 | } |
| 5257 | |
| 5258 | /* set BSSType to default type */ |
| 5259 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 5260 | |
| 5261 | /*TODO: scan the requested channels only*/ |
| 5262 | |
| 5263 | /*Right now scanning all the channels */ |
| 5264 | if( request ) |
| 5265 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5266 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5267 | "No of Scan Channels: %d", request->n_channels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5268 | if( request->n_channels ) |
| 5269 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5270 | char chList [(request->n_channels*5)+1]; |
| 5271 | int len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5272 | channelList = vos_mem_malloc( request->n_channels ); |
| 5273 | if( NULL == channelList ) |
| 5274 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5275 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5276 | "%s: memory alloc failed channelList", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | status = -ENOMEM; |
| 5278 | goto free_mem; |
| 5279 | } |
| 5280 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5281 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 5282 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | channelList[i] = request->channels[i]->hw_value; |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5284 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 5285 | } |
| 5286 | |
| 5287 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5288 | "Channel-List: %s ", chList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5289 | } |
| 5290 | |
| 5291 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 5292 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 5293 | |
| 5294 | /* set requestType to full scan */ |
| 5295 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5296 | |
| 5297 | /* 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] | 5298 | * 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] | 5299 | * 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] | 5300 | */ |
| 5301 | |
| 5302 | /* Supplicant does single channel scan after 8-way handshake |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5303 | * and in that case driver shoudnt flush scan results. If |
| 5304 | * driver flushes the scan results here and unfortunately if |
| 5305 | * the AP doesnt respond to our probe req then association |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 5306 | * fails which is not desired |
| 5307 | */ |
| 5308 | |
| 5309 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 5310 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5311 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
Madan Mohan Koyyalamudi | 8d50f31 | 2012-11-27 15:48:57 -0800 | [diff] [blame] | 5312 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5313 | pAdapter->sessionId ); |
| 5314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5315 | |
| 5316 | if( request->ie_len ) |
| 5317 | { |
| 5318 | /* save this for future association (join requires this) */ |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5319 | /*TODO: Array needs to be converted to dynamic allocation, |
| 5320 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 5321 | * CR 597966 |
| 5322 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 5324 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 5325 | pScanInfo->scanAddIE.length = request->ie_len; |
| 5326 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5327 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5328 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5329 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5330 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5331 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
| 5332 | { |
| 5333 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 5334 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 5335 | request->ie, request->ie_len); |
| 5336 | } |
| 5337 | else |
| 5338 | { |
| 5339 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
Arun Kumar Khandavalli | 75eeb12 | 2014-03-27 21:43:12 +0530 | [diff] [blame] | 5340 | "%zu", request->ie_len); |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5342 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 5343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5344 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 5345 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 5346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5347 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 5348 | request->ie_len); |
| 5349 | if (pP2pIe != NULL) |
| 5350 | { |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 5351 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 5352 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 5353 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 5354 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5355 | { |
| 5356 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 5357 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 5358 | "Go nego completed to Connection is started"); |
| 5359 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 5360 | "for 8way Handshake"); |
| 5361 | } |
| 5362 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 5363 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5364 | { |
| 5365 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 5366 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 5367 | "Disconnected state to Connection is started"); |
| 5368 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 5369 | "for 4way Handshake"); |
| 5370 | } |
| 5371 | #endif |
| 5372 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5373 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 5374 | if(TRUE == request->no_cck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5375 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5376 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5377 | "%s: This is a P2P Search", __func__); |
| 5378 | scanRequest.p2pSearch = 1; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5379 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5380 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
| 5381 | { |
Madan Mohan Koyyalamudi | 1b1d9e8 | 2012-10-21 11:38:33 -0700 | [diff] [blame] | 5382 | /* set requestType to P2P Discovery */ |
| 5383 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5384 | } |
| 5385 | |
| 5386 | /* |
| 5387 | Skip Dfs Channel in case of P2P Search |
| 5388 | if it is set in ini file |
| 5389 | */ |
| 5390 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 5391 | { |
| 5392 | scanRequest.skipDfsChnlInP2pSearch = 1; |
| 5393 | } |
| 5394 | else |
| 5395 | { |
| 5396 | scanRequest.skipDfsChnlInP2pSearch = 0; |
| 5397 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5399 | } |
| 5400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5401 | } |
| 5402 | } |
| 5403 | |
| 5404 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 5405 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 5406 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 5407 | * address the following issues. |
| 5408 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 5409 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 5410 | * for long time, this result in apps running at full power for long time. |
| 5411 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 5412 | * be stuck in full power because of resume BMPS |
| 5413 | */ |
| 5414 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5415 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5416 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5417 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
| 5418 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", scanRequest.requestType, |
| 5419 | scanRequest.scanType, scanRequest.minChnTime, scanRequest.maxChnTime, |
| 5420 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 5421 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5422 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | pAdapter->sessionId, &scanRequest, &scanId, |
| 5424 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | if (eHAL_STATUS_SUCCESS != status) |
| 5427 | { |
| 5428 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5429 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 5430 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 5431 | if(eHAL_STATUS_RESOURCES == status) |
| 5432 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5433 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 5434 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 5435 | status = -EBUSY; |
| 5436 | } else { |
| 5437 | status = -EIO; |
| 5438 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 5439 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5440 | goto free_mem; |
| 5441 | } |
| 5442 | |
| 5443 | pScanInfo->mScanPending = TRUE; |
| 5444 | pAdapter->request = request; |
| 5445 | pScanInfo->scanId = scanId; |
| 5446 | |
| 5447 | complete(&pScanInfo->scan_req_completion_event); |
| 5448 | |
| 5449 | free_mem: |
| 5450 | if( scanRequest.SSIDs.SSIDList ) |
| 5451 | { |
| 5452 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 5453 | } |
| 5454 | |
| 5455 | if( channelList ) |
| 5456 | vos_mem_free( channelList ); |
| 5457 | |
| 5458 | EXIT(); |
| 5459 | |
| 5460 | return status; |
| 5461 | } |
| 5462 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5463 | |
| 5464 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 5465 | { |
| 5466 | v_U8_t iniDot11Mode = |
| 5467 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 5468 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 5469 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 5470 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 5471 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5472 | switch ( iniDot11Mode ) |
| 5473 | { |
| 5474 | case eHDD_DOT11_MODE_AUTO: |
| 5475 | case eHDD_DOT11_MODE_11ac: |
| 5476 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 5477 | #ifdef WLAN_FEATURE_11AC |
| 5478 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 5479 | #else |
| 5480 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 5481 | #endif |
| 5482 | break; |
| 5483 | case eHDD_DOT11_MODE_11n: |
| 5484 | case eHDD_DOT11_MODE_11n_ONLY: |
| 5485 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 5486 | break; |
| 5487 | default: |
| 5488 | hddDot11Mode = iniDot11Mode; |
| 5489 | break; |
| 5490 | } |
| 5491 | /* This call decides required channel bonding mode */ |
| 5492 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 5493 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 5494 | operationChannel); |
| 5495 | } |
| 5496 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5497 | /* |
| 5498 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5499 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5501 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5502 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | { |
| 5504 | int status = 0; |
| 5505 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 5506 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | v_U32_t roamId; |
| 5508 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5509 | eCsrAuthType RSNAuthType; |
| 5510 | |
| 5511 | ENTER(); |
| 5512 | |
| 5513 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 5514 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5515 | |
| 5516 | status = wlan_hdd_validate_context(pHddCtx); |
| 5517 | if (status) |
| 5518 | { |
| 5519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5520 | "%s: HDD context is not valid!", __func__); |
| 5521 | return status; |
| 5522 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5524 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 5525 | { |
| 5526 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 5527 | return -EINVAL; |
| 5528 | } |
| 5529 | |
| 5530 | pRoamProfile = &pWextState->roamProfile; |
| 5531 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5532 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5534 | hdd_station_ctx_t *pHddStaCtx; |
| 5535 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5537 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5538 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 5539 | { |
| 5540 | /*QoS not enabled in cfg file*/ |
| 5541 | pRoamProfile->uapsd_mask = 0; |
| 5542 | } |
| 5543 | else |
| 5544 | { |
| 5545 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5546 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5547 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 5548 | } |
| 5549 | |
| 5550 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 5551 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 5552 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5553 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5554 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 5555 | ssid, ssid_len); |
| 5556 | |
| 5557 | if (bssid) |
| 5558 | { |
| 5559 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 5560 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 5561 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5562 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 5563 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | case of join failure we should send valid BSSID to supplicant |
| 5565 | */ |
| 5566 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 5567 | WNI_CFG_BSSID_LEN); |
| 5568 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 5569 | else |
| 5570 | { |
| 5571 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 5572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5573 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 5574 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 5575 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5576 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 5577 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5578 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5579 | /*set gen ie*/ |
| 5580 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5581 | /*set auth*/ |
| 5582 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | #ifdef FEATURE_WLAN_WAPI |
| 5585 | if (pAdapter->wapi_info.nWapiMode) |
| 5586 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5587 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5588 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5589 | { |
| 5590 | case WAPI_AUTH_MODE_PSK: |
| 5591 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5592 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | pAdapter->wapi_info.wapiAuthMode); |
| 5594 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5595 | break; |
| 5596 | } |
| 5597 | case WAPI_AUTH_MODE_CERT: |
| 5598 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5599 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5600 | pAdapter->wapi_info.wapiAuthMode); |
| 5601 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5602 | break; |
| 5603 | } |
| 5604 | } // End of switch |
| 5605 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5606 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5607 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5608 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | pRoamProfile->AuthType.numEntries = 1; |
| 5610 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5611 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5612 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5613 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5614 | } |
| 5615 | } |
| 5616 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5617 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 5618 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5619 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 5620 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5621 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 5622 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 5623 | sizeof (tSirGtkOffloadParams)); |
| 5624 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 5625 | } |
| 5626 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5627 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 5628 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5629 | if( operatingChannel ) |
| 5630 | { |
| 5631 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 5632 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5633 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5634 | else |
| 5635 | { |
| 5636 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5637 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5638 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5639 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 5640 | { |
| 5641 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 5642 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 5643 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5644 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 5645 | * 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] | 5646 | * 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] | 5647 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5648 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 5649 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 5650 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5651 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5652 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5653 | eConnectionState_Connecting); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5654 | |
| 5655 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5656 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 5657 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 5658 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5659 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5660 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5661 | |
| 5662 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5663 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 5664 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 5665 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5666 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 5667 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 5668 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 5669 | |
| 5670 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5671 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5672 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5673 | } |
| 5674 | else |
| 5675 | { |
| 5676 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 5677 | return -EINVAL; |
| 5678 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 5679 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | return status; |
| 5681 | } |
| 5682 | |
| 5683 | /* |
| 5684 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 5685 | * This function is used to set the authentication type (OPEN/SHARED). |
| 5686 | * |
| 5687 | */ |
| 5688 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 5689 | enum nl80211_auth_type auth_type) |
| 5690 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5691 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5692 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5693 | |
| 5694 | ENTER(); |
| 5695 | |
| 5696 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5697 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5698 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5699 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5700 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5701 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 5702 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 5703 | break; |
| 5704 | |
| 5705 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5706 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5707 | case NL80211_AUTHTYPE_FT: |
| 5708 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5709 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5710 | "%s: set authentication type to OPEN", __func__); |
| 5711 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5712 | break; |
| 5713 | |
| 5714 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5715 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5716 | "%s: set authentication type to SHARED", __func__); |
| 5717 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5718 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5719 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5721 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | "%s: set authentication type to CCKM WPA", __func__); |
| 5723 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 5724 | break; |
| 5725 | #endif |
| 5726 | |
| 5727 | |
| 5728 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5729 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5730 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5731 | auth_type); |
| 5732 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 5733 | return -EINVAL; |
| 5734 | } |
| 5735 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5736 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5737 | pHddStaCtx->conn_info.authType; |
| 5738 | return 0; |
| 5739 | } |
| 5740 | |
| 5741 | /* |
| 5742 | * FUNCTION: wlan_hdd_set_akm_suite |
| 5743 | * This function is used to set the key mgmt type(PSK/8021x). |
| 5744 | * |
| 5745 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5746 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5747 | u32 key_mgmt |
| 5748 | ) |
| 5749 | { |
| 5750 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5751 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5753 | /*set key mgmt type*/ |
| 5754 | switch(key_mgmt) |
| 5755 | { |
| 5756 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5757 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5758 | case WLAN_AKM_SUITE_FT_PSK: |
| 5759 | #endif |
| 5760 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5761 | __func__); |
| 5762 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5763 | break; |
| 5764 | |
| 5765 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 5766 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5767 | case WLAN_AKM_SUITE_FT_8021X: |
| 5768 | #endif |
| 5769 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5770 | __func__); |
| 5771 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5772 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5773 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5774 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 5775 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5776 | case WLAN_AKM_SUITE_CCKM: |
| 5777 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 5778 | __func__); |
| 5779 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5780 | break; |
| 5781 | #endif |
| 5782 | |
| 5783 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5784 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | __func__, key_mgmt); |
| 5786 | return -EINVAL; |
| 5787 | |
| 5788 | } |
| 5789 | return 0; |
| 5790 | } |
| 5791 | |
| 5792 | /* |
| 5793 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5794 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5795 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 5796 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5797 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 5798 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | bool ucast |
| 5800 | ) |
| 5801 | { |
| 5802 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5803 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5804 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5805 | |
| 5806 | ENTER(); |
| 5807 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5808 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5809 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5810 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | __func__, cipher); |
| 5812 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5813 | } |
| 5814 | else |
| 5815 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5818 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5819 | { |
| 5820 | case IW_AUTH_CIPHER_NONE: |
| 5821 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5822 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5824 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5825 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5826 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5828 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5829 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5830 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5832 | case WLAN_CIPHER_SUITE_TKIP: |
| 5833 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5834 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5836 | case WLAN_CIPHER_SUITE_CCMP: |
| 5837 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5838 | break; |
| 5839 | #ifdef FEATURE_WLAN_WAPI |
| 5840 | case WLAN_CIPHER_SUITE_SMS4: |
| 5841 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 5842 | break; |
| 5843 | #endif |
| 5844 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5845 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | case WLAN_CIPHER_SUITE_KRK: |
| 5847 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 5848 | break; |
| 5849 | #endif |
| 5850 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5851 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5852 | __func__, cipher); |
| 5853 | return -EOPNOTSUPP; |
| 5854 | } |
| 5855 | } |
| 5856 | |
| 5857 | if (ucast) |
| 5858 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5859 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | __func__, encryptionType); |
| 5861 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 5862 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5863 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5864 | encryptionType; |
| 5865 | } |
| 5866 | else |
| 5867 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5868 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | __func__, encryptionType); |
| 5870 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 5871 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5872 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 5873 | } |
| 5874 | |
| 5875 | return 0; |
| 5876 | } |
| 5877 | |
| 5878 | |
| 5879 | /* |
| 5880 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 5881 | * This function is used to parse WPA/RSN IE's. |
| 5882 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5883 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 5884 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | size_t ie_len |
| 5886 | ) |
| 5887 | { |
| 5888 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5889 | u8 *genie = ie; |
| 5890 | v_U16_t remLen = ie_len; |
| 5891 | #ifdef FEATURE_WLAN_WAPI |
| 5892 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 5893 | u16 *tmp; |
| 5894 | v_U16_t akmsuiteCount; |
| 5895 | int *akmlist; |
| 5896 | #endif |
| 5897 | ENTER(); |
| 5898 | |
| 5899 | /* clear previous assocAddIE */ |
| 5900 | pWextState->assocAddIE.length = 0; |
| 5901 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
| 5902 | |
| 5903 | while (remLen >= 2) |
| 5904 | { |
| 5905 | v_U16_t eLen = 0; |
| 5906 | v_U8_t elementId; |
| 5907 | elementId = *genie++; |
| 5908 | eLen = *genie++; |
| 5909 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5910 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5911 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5912 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5913 | |
| 5914 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5916 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5917 | 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] | 5918 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | "%s: Invalid WPA IE", __func__); |
| 5921 | return -EINVAL; |
| 5922 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5923 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | { |
| 5925 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5926 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5927 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5929 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5930 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5931 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 5932 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5933 | VOS_ASSERT(0); |
| 5934 | return -ENOMEM; |
| 5935 | } |
| 5936 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5937 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5938 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 5941 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5942 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5943 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5944 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 5945 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5946 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 5947 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 5948 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 5949 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 5950 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 5951 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5952 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 5953 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5954 | { |
| 5955 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5956 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5957 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5960 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5961 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5962 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5963 | VOS_ASSERT(0); |
| 5964 | return -ENOMEM; |
| 5965 | } |
| 5966 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 5967 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5968 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5970 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5971 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5972 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5974 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 5975 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | /*Consider WFD IE, only for P2P Client */ |
| 5977 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 5978 | { |
| 5979 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5980 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 5984 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 5985 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 5986 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | VOS_ASSERT(0); |
| 5988 | return -ENOMEM; |
| 5989 | } |
| 5990 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 5991 | // WPS IE + P2P IE + WFD IE |
| 5992 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 5993 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5995 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5996 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5997 | } |
| 5998 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 5999 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6000 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6001 | HS20_OUI_TYPE_SIZE)) ) |
| 6002 | { |
| 6003 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6004 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6005 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6006 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6007 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 6008 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 6009 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 6010 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6011 | VOS_ASSERT(0); |
| 6012 | return -ENOMEM; |
| 6013 | } |
| 6014 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 6015 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6016 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6017 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 6018 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 6019 | } |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6020 | |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 6021 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 6022 | |
| 6023 | /* populating as ADDIE in beacon frames */ |
| 6024 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6025 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 6026 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 6027 | { |
| 6028 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6029 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6030 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6031 | { |
| 6032 | hddLog(LOGE, |
| 6033 | "Coldn't pass " |
| 6034 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 6035 | } |
| 6036 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 6037 | else |
| 6038 | hddLog(LOGE, |
| 6039 | "Could not pass on " |
| 6040 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 6041 | |
| 6042 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 6043 | beaconIE's need to be populated in probe response frames */ |
| 6044 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 6045 | { |
| 6046 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 6047 | u8 probe_rsp_ie_len[3] = {0}; |
| 6048 | u8 counter = 0; |
| 6049 | |
| 6050 | /* Check Probe Resp Length if it is greater then 255 then |
| 6051 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 6052 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 6053 | not able Store More then 255 bytes into One Variable */ |
| 6054 | |
| 6055 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6056 | { |
| 6057 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6058 | { |
| 6059 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6060 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6061 | } |
| 6062 | else |
| 6063 | { |
| 6064 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6065 | rem_probe_resp_ie_len = 0; |
| 6066 | } |
| 6067 | } |
| 6068 | |
| 6069 | rem_probe_resp_ie_len = 0; |
| 6070 | |
| 6071 | if (probe_rsp_ie_len[0] > 0) |
| 6072 | { |
| 6073 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6074 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6075 | (tANI_U8*)(genie - 2), |
| 6076 | probe_rsp_ie_len[0], NULL, |
| 6077 | eANI_BOOLEAN_FALSE) |
| 6078 | == eHAL_STATUS_FAILURE) |
| 6079 | { |
| 6080 | hddLog(LOGE, |
| 6081 | "Could not pass" |
| 6082 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 6083 | } |
| 6084 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6085 | } |
| 6086 | |
| 6087 | if (probe_rsp_ie_len[1] > 0) |
| 6088 | { |
| 6089 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6090 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6091 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 6092 | probe_rsp_ie_len[1], NULL, |
| 6093 | eANI_BOOLEAN_FALSE) |
| 6094 | == eHAL_STATUS_FAILURE) |
| 6095 | { |
| 6096 | hddLog(LOGE, |
| 6097 | "Could not pass" |
| 6098 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 6099 | } |
| 6100 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6101 | } |
| 6102 | |
| 6103 | if (probe_rsp_ie_len[2] > 0) |
| 6104 | { |
| 6105 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6106 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6107 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 6108 | probe_rsp_ie_len[2], NULL, |
| 6109 | eANI_BOOLEAN_FALSE) |
| 6110 | == eHAL_STATUS_FAILURE) |
| 6111 | { |
| 6112 | hddLog(LOGE, |
| 6113 | "Could not pass" |
| 6114 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 6115 | } |
| 6116 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6117 | } |
| 6118 | |
| 6119 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6120 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6121 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6122 | { |
| 6123 | hddLog(LOGE, |
| 6124 | "Could not pass" |
| 6125 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 6126 | } |
| 6127 | } |
| 6128 | else |
| 6129 | { |
| 6130 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6131 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 6132 | |
| 6133 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6134 | "%s: No Probe Response IE received in set beacon", |
| 6135 | __func__); |
| 6136 | } |
| 6137 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6138 | break; |
| 6139 | case DOT11F_EID_RSN: |
| 6140 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 6141 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 6142 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 6143 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 6144 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 6145 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6146 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 6147 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6148 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6149 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6150 | 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] | 6151 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6152 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6153 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 6154 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 6155 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 6156 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6157 | VOS_ASSERT(0); |
| 6158 | return -ENOMEM; |
| 6159 | } |
| 6160 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 6161 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6162 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6163 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 6164 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 6165 | break; |
| 6166 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6167 | #ifdef FEATURE_WLAN_WAPI |
| 6168 | case WLAN_EID_WAPI: |
| 6169 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 6170 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6171 | pAdapter->wapi_info.nWapiMode); |
| 6172 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6173 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6174 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 6175 | tmp = tmp + 1; |
| 6176 | akmlist = (int *)(tmp); |
| 6177 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 6178 | { |
| 6179 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 6180 | } |
| 6181 | else |
| 6182 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6183 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | VOS_ASSERT(0); |
| 6185 | return -EINVAL; |
| 6186 | } |
| 6187 | |
| 6188 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 6189 | { |
| 6190 | 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] | 6191 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6192 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6193 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6194 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6195 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6196 | 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] | 6197 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6198 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 6199 | } |
| 6200 | break; |
| 6201 | #endif |
| 6202 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6203 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6204 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 6205 | /* when Unknown IE is received we should break and continue |
| 6206 | * to the next IE in the buffer instead we were returning |
| 6207 | * so changing this to break */ |
| 6208 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6209 | } |
| 6210 | genie += eLen; |
| 6211 | remLen -= eLen; |
| 6212 | } |
| 6213 | EXIT(); |
| 6214 | return 0; |
| 6215 | } |
| 6216 | |
| 6217 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 6218 | * FUNCTION: hdd_isWPAIEPresent |
| 6219 | * Parse the received IE to find the WPA IE |
| 6220 | * |
| 6221 | */ |
| 6222 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 6223 | { |
| 6224 | v_U8_t eLen = 0; |
| 6225 | v_U16_t remLen = ie_len; |
| 6226 | v_U8_t elementId = 0; |
| 6227 | |
| 6228 | while (remLen >= 2) |
| 6229 | { |
| 6230 | elementId = *ie++; |
| 6231 | eLen = *ie++; |
| 6232 | remLen -= 2; |
| 6233 | if (eLen > remLen) |
| 6234 | { |
| 6235 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6236 | "%s: IE length is wrong %d", __func__, eLen); |
| 6237 | return FALSE; |
| 6238 | } |
| 6239 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 6240 | { |
| 6241 | /* OUI - 0x00 0X50 0XF2 |
| 6242 | WPA Information Element - 0x01 |
| 6243 | WPA version - 0x01*/ |
| 6244 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 6245 | return TRUE; |
| 6246 | } |
| 6247 | ie += eLen; |
| 6248 | remLen -= eLen; |
| 6249 | } |
| 6250 | return FALSE; |
| 6251 | } |
| 6252 | |
| 6253 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6254 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6255 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6256 | * parameters during connect operation. |
| 6257 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6258 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6259 | struct cfg80211_connect_params *req |
| 6260 | ) |
| 6261 | { |
| 6262 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6263 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6264 | ENTER(); |
| 6265 | |
| 6266 | /*set wpa version*/ |
| 6267 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 6268 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6269 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 6271 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | { |
| 6273 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 6274 | } |
| 6275 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 6276 | { |
| 6277 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 6278 | } |
| 6279 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6280 | |
| 6281 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6282 | pWextState->wpaVersion); |
| 6283 | |
| 6284 | /*set authentication type*/ |
| 6285 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 6286 | |
| 6287 | if (0 > status) |
| 6288 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6289 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6290 | "%s: failed to set authentication type ", __func__); |
| 6291 | return status; |
| 6292 | } |
| 6293 | |
| 6294 | /*set key mgmt type*/ |
| 6295 | if (req->crypto.n_akm_suites) |
| 6296 | { |
| 6297 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 6298 | if (0 > status) |
| 6299 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6300 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6301 | __func__); |
| 6302 | return status; |
| 6303 | } |
| 6304 | } |
| 6305 | |
| 6306 | /*set pairwise cipher type*/ |
| 6307 | if (req->crypto.n_ciphers_pairwise) |
| 6308 | { |
| 6309 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 6310 | req->crypto.ciphers_pairwise[0], true); |
| 6311 | if (0 > status) |
| 6312 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6313 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6314 | "%s: failed to set unicast cipher type", __func__); |
| 6315 | return status; |
| 6316 | } |
| 6317 | } |
| 6318 | else |
| 6319 | { |
| 6320 | /*Reset previous cipher suite to none*/ |
| 6321 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 6322 | if (0 > status) |
| 6323 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6324 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | "%s: failed to set unicast cipher type", __func__); |
| 6326 | return status; |
| 6327 | } |
| 6328 | } |
| 6329 | |
| 6330 | /*set group cipher type*/ |
| 6331 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 6332 | false); |
| 6333 | |
| 6334 | if (0 > status) |
| 6335 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6336 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6337 | __func__); |
| 6338 | return status; |
| 6339 | } |
| 6340 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6341 | #ifdef WLAN_FEATURE_11W |
| 6342 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 6343 | #endif |
| 6344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6345 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 6346 | if (req->ie_len) |
| 6347 | { |
| 6348 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 6349 | if ( 0 > status) |
| 6350 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6351 | 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] | 6352 | __func__); |
| 6353 | return status; |
| 6354 | } |
| 6355 | } |
| 6356 | |
| 6357 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6358 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6359 | { |
| 6360 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 6361 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 6362 | ) |
| 6363 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6364 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6365 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 6366 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6367 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6368 | __func__); |
| 6369 | return -EOPNOTSUPP; |
| 6370 | } |
| 6371 | else |
| 6372 | { |
| 6373 | u8 key_len = req->key_len; |
| 6374 | u8 key_idx = req->key_idx; |
| 6375 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6376 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | && (CSR_MAX_NUM_KEY > key_idx) |
| 6378 | ) |
| 6379 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6380 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6381 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | __func__, key_idx, key_len); |
| 6383 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6384 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6386 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6387 | (u8)key_len; |
| 6388 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 6389 | } |
| 6390 | } |
| 6391 | } |
| 6392 | } |
| 6393 | |
| 6394 | return status; |
| 6395 | } |
| 6396 | |
| 6397 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 6398 | * FUNCTION: wlan_hdd_try_disconnect |
| 6399 | * This function is used to disconnect from previous |
| 6400 | * connection |
| 6401 | */ |
| 6402 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 6403 | { |
| 6404 | long ret = 0; |
| 6405 | hdd_station_ctx_t *pHddStaCtx; |
| 6406 | eMib_dot11DesiredBssType connectedBssType; |
| 6407 | |
| 6408 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6409 | |
| 6410 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 6411 | |
| 6412 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 6413 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 6414 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 6415 | { |
| 6416 | /* Issue disconnect to CSR */ |
| 6417 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 6418 | if( eHAL_STATUS_SUCCESS == |
| 6419 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6420 | pAdapter->sessionId, |
| 6421 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 6422 | { |
| 6423 | ret = wait_for_completion_interruptible_timeout( |
| 6424 | &pAdapter->disconnect_comp_var, |
| 6425 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 6426 | if (0 >= ret) |
| 6427 | { |
| 6428 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 6429 | return -EALREADY; |
| 6430 | } |
| 6431 | } |
| 6432 | } |
| 6433 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 6434 | { |
| 6435 | ret = wait_for_completion_interruptible_timeout( |
| 6436 | &pAdapter->disconnect_comp_var, |
| 6437 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 6438 | if (0 >= ret) |
| 6439 | { |
| 6440 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 6441 | return -EALREADY; |
| 6442 | } |
| 6443 | } |
| 6444 | |
| 6445 | return 0; |
| 6446 | } |
| 6447 | |
| 6448 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6449 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6450 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6451 | * parameters during connect operation. |
| 6452 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6453 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6454 | struct net_device *ndev, |
| 6455 | struct cfg80211_connect_params *req |
| 6456 | ) |
| 6457 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6458 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6459 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6460 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6461 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6462 | |
| 6463 | ENTER(); |
| 6464 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6465 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6466 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 6467 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6468 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6469 | "%s: device_mode = %d",__func__,pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6470 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6471 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6472 | if (!pHddCtx) |
| 6473 | { |
| 6474 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6475 | "%s: HDD context is null", __func__); |
| 6476 | return VOS_STATUS_E_FAILURE; |
| 6477 | } |
| 6478 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6479 | status = wlan_hdd_validate_context(pHddCtx); |
| 6480 | |
| 6481 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6482 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6483 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6484 | "%s: HDD context is not valid", __func__); |
| 6485 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6486 | } |
| 6487 | |
| 6488 | #ifdef WLAN_BTAMP_FEATURE |
| 6489 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6490 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6491 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6492 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6493 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 6494 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6495 | } |
| 6496 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 6497 | |
| 6498 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 6499 | //P2P Mode will be taken care in Open/close adapter |
| 6500 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 6501 | (vos_concurrent_sessions_running())) |
| 6502 | { |
| 6503 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6504 | } |
| 6505 | |
| 6506 | /*Try disconnecting if already in connected state*/ |
| 6507 | status = wlan_hdd_try_disconnect(pAdapter); |
| 6508 | if ( 0 > status) |
| 6509 | { |
| 6510 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 6511 | " connection")); |
| 6512 | return -EALREADY; |
| 6513 | } |
| 6514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6515 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6516 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6517 | |
| 6518 | if ( 0 > status) |
| 6519 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6520 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6521 | __func__); |
| 6522 | return status; |
| 6523 | } |
| 6524 | |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 6525 | if ( req->channel ) |
| 6526 | { |
| 6527 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 6528 | req->ssid_len, req->bssid, |
| 6529 | req->channel->hw_value); |
| 6530 | } |
| 6531 | else |
| 6532 | { |
| 6533 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6534 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 6535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6536 | |
| 6537 | if (0 > status) |
| 6538 | { |
| 6539 | //ReEnable BMPS if disabled |
| 6540 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 6541 | (NULL != pHddCtx)) |
| 6542 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 6543 | if (pHddCtx->hdd_wlan_suspended) |
| 6544 | { |
| 6545 | hdd_set_pwrparams(pHddCtx); |
| 6546 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6547 | //ReEnable Bmps and Imps back |
| 6548 | hdd_enable_bmps_imps(pHddCtx); |
| 6549 | } |
| 6550 | |
| 6551 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 6552 | return status; |
| 6553 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6554 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6555 | EXIT(); |
| 6556 | return status; |
| 6557 | } |
| 6558 | |
| 6559 | |
| 6560 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6561 | * FUNCTION: wlan_hdd_disconnect |
| 6562 | * This function is used to issue a disconnect request to SME |
| 6563 | */ |
| 6564 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 6565 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6566 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6567 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6568 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6569 | |
| 6570 | status = wlan_hdd_validate_context(pHddCtx); |
| 6571 | |
| 6572 | if (0 != status) |
| 6573 | { |
| 6574 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6575 | "%s: HDD context is not valid", __func__); |
| 6576 | return status; |
| 6577 | } |
| 6578 | |
| 6579 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Vinay Krishna Eranna | b09d3e7 | 2014-03-26 21:23:55 +0530 | [diff] [blame] | 6580 | pHddStaCtx->conn_info.connState = eConnectionState_Disconnecting; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6581 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6582 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6583 | /*issue disconnect*/ |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 6584 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6585 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6586 | pAdapter->sessionId, reason); |
| 6587 | |
| 6588 | if ( 0 != status ) |
| 6589 | { |
| 6590 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6591 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6592 | __func__, (int)status ); |
| 6593 | return -EINVAL; |
| 6594 | } |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6595 | status = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6596 | &pAdapter->disconnect_comp_var, |
| 6597 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6598 | if (!status) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6599 | { |
| 6600 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6601 | "%s: Failed to disconnect, timed out", __func__); |
| 6602 | return -ETIMEDOUT; |
| 6603 | } |
| 6604 | else if (status == -ERESTARTSYS) |
| 6605 | { |
| 6606 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6607 | "%s: Failed to disconnect, wait interrupted", __func__); |
| 6608 | return status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6609 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6610 | /*stop tx queues*/ |
| 6611 | netif_tx_disable(pAdapter->dev); |
| 6612 | netif_carrier_off(pAdapter->dev); |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6613 | return 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6614 | } |
| 6615 | |
| 6616 | |
| 6617 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | * FUNCTION: wlan_hdd_cfg80211_disconnect |
| 6619 | * This function is used to issue a disconnect request to SME |
| 6620 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6621 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6622 | struct net_device *dev, |
| 6623 | u16 reason |
| 6624 | ) |
| 6625 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6626 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 6627 | tCsrRoamProfile *pRoamProfile = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6628 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6629 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6631 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6632 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6633 | tANI_U8 staIdx; |
| 6634 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6637 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6638 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6639 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 6640 | pAdapter->sessionId, reason)); |
| 6641 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | __func__,pAdapter->device_mode); |
| 6643 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6644 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 6645 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6647 | status = wlan_hdd_validate_context(pHddCtx); |
| 6648 | |
| 6649 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6651 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6652 | "%s: HDD context is not valid", __func__); |
| 6653 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6655 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | if (NULL != pRoamProfile) |
| 6657 | { |
| 6658 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 6659 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 6660 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6661 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6662 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6664 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | switch(reason) |
| 6666 | { |
| 6667 | case WLAN_REASON_MIC_FAILURE: |
| 6668 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 6669 | break; |
| 6670 | |
| 6671 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 6672 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 6673 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 6674 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 6675 | break; |
| 6676 | |
| 6677 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 6678 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
| 6679 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 6680 | break; |
| 6681 | |
| 6682 | case WLAN_REASON_DEAUTH_LEAVING: |
| 6683 | default: |
| 6684 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 6685 | break; |
| 6686 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6687 | pScanInfo = &pHddCtx->scan_info; |
| 6688 | if (pScanInfo->mScanPending) |
| 6689 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 6690 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6691 | "Aborting Scan"); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 6692 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 6693 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 6694 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6695 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6696 | #ifdef FEATURE_WLAN_TDLS |
| 6697 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6698 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6699 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6700 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 6701 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6702 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6703 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6704 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 6705 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6706 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6707 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6708 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6709 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 6710 | pAdapter->sessionId, |
| 6711 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 6712 | } |
| 6713 | } |
| 6714 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 6715 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6716 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 6717 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6718 | { |
| 6719 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6720 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6721 | __func__, (int)status ); |
| 6722 | return -EINVAL; |
| 6723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6724 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 6725 | else |
| 6726 | { |
| 6727 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 6728 | "called while in %d state", __func__, |
| 6729 | pHddStaCtx->conn_info.connState); |
| 6730 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | } |
| 6732 | else |
| 6733 | { |
| 6734 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 6735 | } |
| 6736 | |
| 6737 | return status; |
| 6738 | } |
| 6739 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 6740 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6741 | /* |
| 6742 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6743 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6744 | * settings in IBSS mode. |
| 6745 | */ |
| 6746 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6747 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6748 | struct cfg80211_ibss_params *params |
| 6749 | ) |
| 6750 | { |
| 6751 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6752 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6753 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6754 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6755 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6756 | ENTER(); |
| 6757 | |
| 6758 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 6759 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6760 | |
| 6761 | if (params->ie_len && ( NULL != params->ie) ) |
| 6762 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6763 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 6764 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6765 | { |
| 6766 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 6767 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6768 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6769 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6770 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6771 | tDot11fIEWPA dot11WPAIE; |
| 6772 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6773 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6774 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 6775 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6776 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 6777 | params->ie_len, DOT11F_EID_WPA); |
| 6778 | if ( NULL != ie ) |
| 6779 | { |
| 6780 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 6781 | // Unpack the WPA IE |
| 6782 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 6783 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 6784 | &ie[2+4], |
| 6785 | ie[1] - 4, |
| 6786 | &dot11WPAIE); |
| 6787 | /*Extract the multicast cipher, the encType for unicast |
| 6788 | cipher for wpa-none is none*/ |
| 6789 | encryptionType = |
| 6790 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 6791 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6792 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 6793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6794 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 6795 | |
| 6796 | if (0 > status) |
| 6797 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6798 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6799 | __func__); |
| 6800 | return status; |
| 6801 | } |
| 6802 | } |
| 6803 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6804 | pWextState->roamProfile.AuthType.authType[0] = |
| 6805 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6806 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6807 | |
| 6808 | if (params->privacy) |
| 6809 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6810 | /* Security enabled IBSS, At this time there is no information available |
| 6811 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6812 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6813 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6814 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6815 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6816 | *enable privacy bit in beacons */ |
| 6817 | |
| 6818 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6819 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 6820 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6821 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6822 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 6823 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 6824 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6825 | return status; |
| 6826 | } |
| 6827 | |
| 6828 | /* |
| 6829 | * FUNCTION: wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6830 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6831 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6832 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6833 | struct net_device *dev, |
| 6834 | struct cfg80211_ibss_params *params |
| 6835 | ) |
| 6836 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6837 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6838 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6839 | tCsrRoamProfile *pRoamProfile; |
| 6840 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6841 | bool alloc_bssid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6842 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6843 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6844 | |
| 6845 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6846 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6847 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6848 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 6849 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6850 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6851 | "%s: device_mode = %d",__func__,pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6852 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6853 | status = wlan_hdd_validate_context(pHddCtx); |
| 6854 | |
| 6855 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6856 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6857 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6858 | "%s: HDD context is not valid", __func__); |
| 6859 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6860 | } |
| 6861 | |
| 6862 | if (NULL == pWextState) |
| 6863 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6864 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6865 | __func__); |
| 6866 | return -EIO; |
| 6867 | } |
| 6868 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 6869 | /*Try disconnecting if already in connected state*/ |
| 6870 | status = wlan_hdd_try_disconnect(pAdapter); |
| 6871 | if ( 0 > status) |
| 6872 | { |
| 6873 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 6874 | " IBSS connection")); |
| 6875 | return -EALREADY; |
| 6876 | } |
| 6877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | pRoamProfile = &pWextState->roamProfile; |
| 6879 | |
| 6880 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 6881 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6882 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6883 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6884 | return -EINVAL; |
| 6885 | } |
| 6886 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 6887 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 6888 | if (NULL != params->bssid) { |
| 6889 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 6890 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 6891 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6892 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 6893 | return -EIO; |
| 6894 | } |
| 6895 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6896 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 6897 | { |
| 6898 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 6899 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6900 | { |
| 6901 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6902 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 6903 | return -EIO; |
| 6904 | } |
| 6905 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 6906 | if (!params->bssid) |
| 6907 | { |
| 6908 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 6909 | "%s:Failed memory allocation", __func__); |
| 6910 | return -EIO; |
| 6911 | } |
| 6912 | vos_mem_copy((v_U8_t *)params->bssid, |
| 6913 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 6914 | VOS_MAC_ADDR_SIZE); |
| 6915 | alloc_bssid = VOS_TRUE; |
| 6916 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 6917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6918 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6919 | if (NULL != |
| 6920 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 6921 | params->chandef.chan) |
| 6922 | #else |
| 6923 | params->channel) |
| 6924 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6925 | { |
| 6926 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6927 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6928 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6929 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6930 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6931 | |
| 6932 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6933 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6934 | ieee80211_frequency_to_channel( |
| 6935 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 6936 | params->chandef.chan->center_freq); |
| 6937 | #else |
| 6938 | params->channel->center_freq); |
| 6939 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6940 | |
| 6941 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6942 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6943 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6944 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 6945 | __func__); |
| 6946 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6947 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6948 | |
| 6949 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6950 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6951 | if (channelNum == validChan[indx]) |
| 6952 | { |
| 6953 | break; |
| 6954 | } |
| 6955 | } |
| 6956 | if (indx >= numChans) |
| 6957 | { |
| 6958 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6959 | __func__, channelNum); |
| 6960 | return -EINVAL; |
| 6961 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6962 | /* Set the Operational Channel */ |
| 6963 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 6964 | channelNum); |
| 6965 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6966 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 6967 | pRoamProfile->ChannelInfo.ChannelList = |
| 6968 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6969 | } |
| 6970 | |
| 6971 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6972 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6973 | if (status < 0) |
| 6974 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6975 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6976 | __func__); |
| 6977 | return status; |
| 6978 | } |
| 6979 | |
| 6980 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6981 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6982 | params->ssid_len, params->bssid, |
| 6983 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6984 | |
| 6985 | if (0 > status) |
| 6986 | { |
| 6987 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 6988 | return status; |
| 6989 | } |
| 6990 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 6991 | if (NULL != params->bssid && |
| 6992 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 6993 | alloc_bssid == VOS_TRUE) |
| 6994 | { |
| 6995 | vos_mem_free(params->bssid); |
| 6996 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | return 0; |
| 6998 | } |
| 6999 | |
| 7000 | /* |
| 7001 | * FUNCTION: wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7002 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7003 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7004 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7005 | struct net_device *dev |
| 7006 | ) |
| 7007 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7008 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7009 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7010 | tCsrRoamProfile *pRoamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7011 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7012 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7013 | |
| 7014 | ENTER(); |
| 7015 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7016 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7017 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 7018 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7019 | status = wlan_hdd_validate_context(pHddCtx); |
| 7020 | |
| 7021 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7022 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7023 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7024 | "%s: HDD context is not valid", __func__); |
| 7025 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7026 | } |
| 7027 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7028 | 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] | 7029 | if (NULL == pWextState) |
| 7030 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7031 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7032 | __func__); |
| 7033 | return -EIO; |
| 7034 | } |
| 7035 | |
| 7036 | pRoamProfile = &pWextState->roamProfile; |
| 7037 | |
| 7038 | /* Issue disconnect only if interface type is set to IBSS */ |
| 7039 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 7040 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7041 | 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] | 7042 | __func__); |
| 7043 | return -EINVAL; |
| 7044 | } |
| 7045 | |
| 7046 | /* Issue Disconnect request */ |
| 7047 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7048 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 7049 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 7050 | |
| 7051 | return 0; |
| 7052 | } |
| 7053 | |
| 7054 | /* |
| 7055 | * FUNCTION: wlan_hdd_cfg80211_set_wiphy_params |
| 7056 | * This function is used to set the phy parameters |
| 7057 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 7058 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7059 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7060 | u32 changed) |
| 7061 | { |
| 7062 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7063 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7064 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7065 | |
| 7066 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7067 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7068 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 7069 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7070 | status = wlan_hdd_validate_context(pHddCtx); |
| 7071 | |
| 7072 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7073 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7074 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7075 | "%s: HDD context is not valid", __func__); |
| 7076 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7077 | } |
| 7078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 7080 | { |
| 7081 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 7082 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 7083 | wiphy->rts_threshold; |
| 7084 | |
| 7085 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7086 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7087 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7088 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7089 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7090 | __func__, rts_threshold); |
| 7091 | return -EINVAL; |
| 7092 | } |
| 7093 | |
| 7094 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 7095 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7096 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7097 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7099 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7100 | __func__, rts_threshold); |
| 7101 | return -EIO; |
| 7102 | } |
| 7103 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7104 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | rts_threshold); |
| 7106 | } |
| 7107 | |
| 7108 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 7109 | { |
| 7110 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 7111 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 7112 | wiphy->frag_threshold; |
| 7113 | |
| 7114 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7115 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7116 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7117 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7118 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7119 | frag_threshold); |
| 7120 | return -EINVAL; |
| 7121 | } |
| 7122 | |
| 7123 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 7124 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7125 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7126 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7127 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7128 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7129 | __func__, frag_threshold); |
| 7130 | return -EIO; |
| 7131 | } |
| 7132 | |
| 7133 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 7134 | frag_threshold); |
| 7135 | } |
| 7136 | |
| 7137 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 7138 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 7139 | { |
| 7140 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 7141 | wiphy->retry_short : |
| 7142 | wiphy->retry_long; |
| 7143 | |
| 7144 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 7145 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 7146 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7147 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7148 | __func__, retry_value); |
| 7149 | return -EINVAL; |
| 7150 | } |
| 7151 | |
| 7152 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 7153 | { |
| 7154 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 7155 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7156 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7157 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7158 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7159 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7160 | __func__, retry_value); |
| 7161 | return -EIO; |
| 7162 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7163 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7164 | __func__, retry_value); |
| 7165 | } |
| 7166 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 7167 | { |
| 7168 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 7169 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7170 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7171 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7172 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7173 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7174 | __func__, retry_value); |
| 7175 | return -EIO; |
| 7176 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7177 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7178 | __func__, retry_value); |
| 7179 | } |
| 7180 | } |
| 7181 | |
| 7182 | return 0; |
| 7183 | } |
| 7184 | |
| 7185 | /* |
| 7186 | * FUNCTION: wlan_hdd_cfg80211_set_txpower |
| 7187 | * This function is used to set the txpower |
| 7188 | */ |
| 7189 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7190 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 7191 | struct wireless_dev *wdev, |
| 7192 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7193 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7194 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7195 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7196 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7197 | #endif |
| 7198 | int dbm) |
| 7199 | { |
| 7200 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7201 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 7203 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7204 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | |
| 7206 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7207 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7208 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 7209 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7210 | status = wlan_hdd_validate_context(pHddCtx); |
| 7211 | |
| 7212 | if (0 != status) |
| 7213 | { |
| 7214 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7215 | "%s: HDD context is not valid", __func__); |
| 7216 | return status; |
| 7217 | } |
| 7218 | |
| 7219 | hHal = pHddCtx->hHal; |
| 7220 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7221 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 7222 | dbm, ccmCfgSetCallback, |
| 7223 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7224 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7225 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 7227 | return -EIO; |
| 7228 | } |
| 7229 | |
| 7230 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 7231 | dbm); |
| 7232 | |
| 7233 | switch(type) |
| 7234 | { |
| 7235 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 7236 | /* Fall through */ |
| 7237 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 7238 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 7239 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7240 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 7241 | __func__); |
| 7242 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7243 | } |
| 7244 | break; |
| 7245 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7246 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7247 | __func__); |
| 7248 | return -EOPNOTSUPP; |
| 7249 | break; |
| 7250 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7251 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 7252 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7253 | return -EIO; |
| 7254 | } |
| 7255 | |
| 7256 | return 0; |
| 7257 | } |
| 7258 | |
| 7259 | /* |
| 7260 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 7261 | * This function is used to read the txpower |
| 7262 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7263 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 7264 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 7265 | struct wireless_dev *wdev, |
| 7266 | #endif |
| 7267 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7268 | { |
| 7269 | |
| 7270 | hdd_adapter_t *pAdapter; |
| 7271 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7272 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7273 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7274 | ENTER(); |
| 7275 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7276 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7277 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7278 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7279 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7280 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7281 | "%s: HDD context is not valid", __func__); |
| 7282 | *dbm = 0; |
| 7283 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7284 | } |
| 7285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7286 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 7287 | if (NULL == pAdapter) |
| 7288 | { |
| 7289 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 7290 | return -ENOENT; |
| 7291 | } |
| 7292 | |
| 7293 | wlan_hdd_get_classAstats(pAdapter); |
| 7294 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 7295 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7296 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7297 | return 0; |
| 7298 | } |
| 7299 | |
| 7300 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 7301 | u8* mac, struct station_info *sinfo) |
| 7302 | { |
| 7303 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 7304 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7305 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 7306 | tANI_U8 rate_flags; |
| 7307 | |
| 7308 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 7309 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7310 | |
| 7311 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 7312 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 7313 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 7314 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 7315 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 7316 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 7317 | tANI_U16 maxRate = 0; |
| 7318 | tANI_U16 myRate; |
| 7319 | tANI_U16 currentRate = 0; |
| 7320 | tANI_U8 maxSpeedMCS = 0; |
| 7321 | tANI_U8 maxMCSIdx = 0; |
| 7322 | tANI_U8 rateFlag = 1; |
| 7323 | tANI_U8 i, j, rssidx; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 7324 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7325 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7327 | #ifdef WLAN_FEATURE_11AC |
| 7328 | tANI_U32 vht_mcs_map; |
| 7329 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 7330 | #endif /* WLAN_FEATURE_11AC */ |
| 7331 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7332 | ENTER(); |
| 7333 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7334 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 7335 | (0 == ssidlen)) |
| 7336 | { |
| 7337 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 7338 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 7339 | /*To keep GUI happy*/ |
| 7340 | return 0; |
| 7341 | } |
| 7342 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7343 | status = wlan_hdd_validate_context(pHddCtx); |
| 7344 | |
| 7345 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7346 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7347 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7348 | "%s: HDD context is not valid", __func__); |
| 7349 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7350 | } |
| 7351 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 7352 | wlan_hdd_get_station_stats(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7353 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 7354 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 7355 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 7356 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 7357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7358 | //convert to the UI units of 100kbps |
| 7359 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 7360 | |
| 7361 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7362 | 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] | 7363 | sinfo->signal, |
| 7364 | pCfg->reportMaxLinkSpeed, |
| 7365 | myRate, |
| 7366 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 7367 | (int) pCfg->linkSpeedRssiMid, |
| 7368 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7369 | (int) rate_flags, |
| 7370 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7371 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7372 | |
| 7373 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 7374 | { |
| 7375 | // we do not want to necessarily report the current speed |
| 7376 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 7377 | { |
| 7378 | // report the max possible speed |
| 7379 | rssidx = 0; |
| 7380 | } |
| 7381 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 7382 | { |
| 7383 | // report the max possible speed with RSSI scaling |
| 7384 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 7385 | { |
| 7386 | // report the max possible speed |
| 7387 | rssidx = 0; |
| 7388 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 7389 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7390 | { |
| 7391 | // report middle speed |
| 7392 | rssidx = 1; |
| 7393 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 7394 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 7395 | { |
| 7396 | // report middle speed |
| 7397 | rssidx = 2; |
| 7398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7399 | else |
| 7400 | { |
| 7401 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 7402 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7403 | } |
| 7404 | } |
| 7405 | else |
| 7406 | { |
| 7407 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 7408 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7409 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 7410 | __func__, pCfg->reportMaxLinkSpeed); |
| 7411 | rssidx = 0; |
| 7412 | } |
| 7413 | |
| 7414 | maxRate = 0; |
| 7415 | |
| 7416 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 7417 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 7418 | OperationalRates, &ORLeng)) |
| 7419 | { |
| 7420 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 7421 | /*To keep GUI happy*/ |
| 7422 | return 0; |
| 7423 | } |
| 7424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7425 | for (i = 0; i < ORLeng; i++) |
| 7426 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7427 | 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] | 7428 | { |
| 7429 | /* Validate Rate Set */ |
| 7430 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 7431 | { |
| 7432 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 7433 | break; |
| 7434 | } |
| 7435 | } |
| 7436 | /* Update MAX rate */ |
| 7437 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 7438 | } |
| 7439 | |
| 7440 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 7441 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 7442 | ExtendedRates, &ERLeng)) |
| 7443 | { |
| 7444 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 7445 | /*To keep GUI happy*/ |
| 7446 | return 0; |
| 7447 | } |
| 7448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7449 | for (i = 0; i < ERLeng; i++) |
| 7450 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7451 | 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] | 7452 | { |
| 7453 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 7454 | { |
| 7455 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 7456 | break; |
| 7457 | } |
| 7458 | } |
| 7459 | /* Update MAX rate */ |
| 7460 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 7461 | } |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 7462 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 7463 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 7464 | if we have good rssi */ |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 7465 | if ((0 == rssidx) || |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 7466 | (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7467 | { |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 7468 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 7469 | MCSRates, &MCSLeng)) |
| 7470 | { |
| 7471 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 7472 | /*To keep GUI happy*/ |
| 7473 | return 0; |
| 7474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7475 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7476 | #ifdef WLAN_FEATURE_11AC |
| 7477 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7478 | 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] | 7479 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7480 | 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] | 7481 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7482 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7483 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7484 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7485 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7486 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7487 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7488 | maxMCSIdx = 7; |
| 7489 | } |
| 7490 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 7491 | { |
| 7492 | maxMCSIdx = 8; |
| 7493 | } |
| 7494 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 7495 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7496 | //VHT20 is supporting 0~8 |
| 7497 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7498 | maxMCSIdx = 8; |
| 7499 | else |
| 7500 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7501 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7502 | |
| 7503 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7504 | { |
| 7505 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 7506 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 7507 | } |
| 7508 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 7509 | { |
| 7510 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 7511 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 7512 | } |
| 7513 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7514 | { |
| 7515 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 7516 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 7517 | } |
| 7518 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7519 | maxSpeedMCS = 1; |
| 7520 | if (currentRate > maxRate) |
| 7521 | { |
| 7522 | maxRate = currentRate; |
| 7523 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7524 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7525 | } |
| 7526 | else |
| 7527 | #endif /* WLAN_FEATURE_11AC */ |
| 7528 | { |
| 7529 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7530 | { |
| 7531 | rateFlag |= 1; |
| 7532 | } |
| 7533 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7534 | { |
| 7535 | rateFlag |= 2; |
| 7536 | } |
| 7537 | |
| 7538 | for (i = 0; i < MCSLeng; i++) |
| 7539 | { |
| 7540 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
| 7541 | for (j = 0; j < temp; j++) |
| 7542 | { |
| 7543 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 7544 | { |
| 7545 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 7546 | break; |
| 7547 | } |
| 7548 | } |
| 7549 | if ((j < temp) && (currentRate > maxRate)) |
| 7550 | { |
| 7551 | maxRate = currentRate; |
| 7552 | maxSpeedMCS = 1; |
| 7553 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 7554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7555 | } |
| 7556 | } |
| 7557 | } |
| 7558 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7559 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 7560 | { |
| 7561 | maxRate = myRate; |
| 7562 | maxSpeedMCS = 1; |
| 7563 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 7564 | } |
| 7565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7566 | // 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] | 7567 | if (((maxRate < myRate) && (0 == rssidx)) || |
| 7568 | (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7569 | { |
| 7570 | maxRate = myRate; |
| 7571 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 7572 | { |
| 7573 | maxSpeedMCS = 0; |
| 7574 | } |
| 7575 | else |
| 7576 | { |
| 7577 | maxSpeedMCS = 1; |
| 7578 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 7579 | } |
| 7580 | } |
| 7581 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7582 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7583 | { |
| 7584 | sinfo->txrate.legacy = maxRate; |
| 7585 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7586 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 7587 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7588 | } |
| 7589 | else |
| 7590 | { |
| 7591 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7592 | #ifdef WLAN_FEATURE_11AC |
| 7593 | sinfo->txrate.nss = 1; |
| 7594 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7595 | { |
| 7596 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7597 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7598 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7599 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7600 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7601 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7602 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7603 | } |
| 7604 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 7605 | { |
| 7606 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7607 | } |
| 7608 | #endif /* WLAN_FEATURE_11AC */ |
| 7609 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 7610 | { |
| 7611 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 7612 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7613 | { |
| 7614 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7615 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7616 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7617 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7618 | { |
| 7619 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7620 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 7621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7622 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7623 | pr_info("Reporting MCS rate %d flags %x\n", |
| 7624 | sinfo->txrate.mcs, |
| 7625 | sinfo->txrate.flags ); |
| 7626 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7627 | } |
| 7628 | } |
| 7629 | else |
| 7630 | { |
| 7631 | // report current rate instead of max rate |
| 7632 | |
| 7633 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 7634 | { |
| 7635 | //provide to the UI in units of 100kbps |
| 7636 | sinfo->txrate.legacy = myRate; |
| 7637 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7638 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 7639 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7640 | } |
| 7641 | else |
| 7642 | { |
| 7643 | //must be MCS |
| 7644 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7645 | #ifdef WLAN_FEATURE_11AC |
| 7646 | sinfo->txrate.nss = 1; |
| 7647 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7648 | { |
| 7649 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7650 | } |
| 7651 | else |
| 7652 | #endif /* WLAN_FEATURE_11AC */ |
| 7653 | { |
| 7654 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 7655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7656 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 7657 | { |
| 7658 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7659 | } |
| 7660 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7661 | { |
| 7662 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7663 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 7664 | #ifdef WLAN_FEATURE_11AC |
| 7665 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 7666 | { |
| 7667 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 7668 | } |
| 7669 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7670 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 7671 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 7672 | sinfo->txrate.mcs, |
| 7673 | sinfo->txrate.flags ); |
| 7674 | #endif //LINKSPEED_DEBUG_ENABLED |
| 7675 | } |
| 7676 | } |
| 7677 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 7678 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 7679 | sinfo->tx_packets = |
| 7680 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 7681 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 7682 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 7683 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 7684 | |
| 7685 | sinfo->tx_retries = |
| 7686 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 7687 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 7688 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 7689 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 7690 | |
| 7691 | sinfo->tx_failed = |
| 7692 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 7693 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 7694 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 7695 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 7696 | |
| 7697 | sinfo->filled |= |
| 7698 | STATION_INFO_TX_PACKETS | |
| 7699 | STATION_INFO_TX_RETRIES | |
| 7700 | STATION_INFO_TX_FAILED; |
| 7701 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7702 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7703 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 7704 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 7705 | EXIT(); |
| 7706 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7707 | } |
| 7708 | |
| 7709 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 7710 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7711 | { |
| 7712 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7713 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7714 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7715 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7716 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7717 | ENTER(); |
| 7718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7719 | if (NULL == pAdapter) |
| 7720 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7721 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7722 | return -ENODEV; |
| 7723 | } |
| 7724 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7725 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7726 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 7727 | pAdapter->sessionId, timeout)); |
| 7728 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7729 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7730 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7731 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7732 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7733 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7734 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7735 | "%s: HDD context is not valid", __func__); |
| 7736 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7737 | } |
| 7738 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7739 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 7740 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 7741 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 7742 | (eConnectionState_Associated == |
| 7743 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 7744 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 7745 | |
| 7746 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7747 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 7748 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7749 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7750 | { |
| 7751 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7752 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 7753 | __func__, vos_status); |
| 7754 | } |
| 7755 | } |
| 7756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7757 | /**The get power cmd from the supplicant gets updated by the nl only |
| 7758 | *on successful execution of the function call |
| 7759 | *we are oppositely mapped w.r.t mode in the driver |
| 7760 | **/ |
| 7761 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 7762 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7763 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7764 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 7765 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7766 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7767 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7768 | return -EINVAL; |
| 7769 | } |
| 7770 | return 0; |
| 7771 | } |
| 7772 | |
| 7773 | |
| 7774 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7775 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 7776 | struct net_device *netdev, |
| 7777 | u8 key_index) |
| 7778 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7779 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7780 | return 0; |
| 7781 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7782 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7783 | |
| 7784 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 7785 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 7786 | struct net_device *dev, |
| 7787 | struct ieee80211_txq_params *params) |
| 7788 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7789 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7790 | return 0; |
| 7791 | } |
| 7792 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7793 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 7794 | struct ieee80211_txq_params *params) |
| 7795 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7796 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | return 0; |
| 7798 | } |
| 7799 | #endif //LINUX_VERSION_CODE |
| 7800 | |
| 7801 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 7802 | struct net_device *dev, u8 *mac) |
| 7803 | { |
| 7804 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7805 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7806 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7807 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7808 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7810 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7811 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7812 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7813 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7814 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7815 | return -EINVAL; |
| 7816 | } |
| 7817 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7818 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7819 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 7820 | pAdapter->sessionId, pAdapter->device_mode)); |
| 7821 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7822 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7823 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7824 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7825 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7826 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7827 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7828 | "%s: HDD context is not valid", __func__); |
| 7829 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7830 | } |
| 7831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7832 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7833 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7834 | ) |
| 7835 | { |
| 7836 | if( NULL == mac ) |
| 7837 | { |
| 7838 | v_U16_t i; |
| 7839 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 7840 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 7841 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 7842 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | { |
| 7844 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 7845 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7846 | "%s: Delete STA with MAC::" |
| 7847 | MAC_ADDRESS_STR, |
| 7848 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 7849 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 7850 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7851 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7852 | } |
| 7853 | } |
| 7854 | } |
| 7855 | else |
| 7856 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7857 | |
| 7858 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 7859 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7860 | { |
| 7861 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7862 | "%s: Skip this DEL STA as this is not used::" |
| 7863 | MAC_ADDRESS_STR, |
| 7864 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7865 | return -ENOENT; |
| 7866 | } |
| 7867 | |
| 7868 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 7869 | { |
| 7870 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7871 | "%s: Skip this DEL STA as deauth is in progress::" |
| 7872 | MAC_ADDRESS_STR, |
| 7873 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7874 | return -ENOENT; |
| 7875 | } |
| 7876 | |
| 7877 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 7878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7879 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7880 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7881 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7882 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7883 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7884 | |
| 7885 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 7886 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7887 | { |
| 7888 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 7889 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7890 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7891 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7892 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7893 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 7894 | return -ENOENT; |
| 7895 | } |
| 7896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7897 | } |
| 7898 | } |
| 7899 | |
| 7900 | EXIT(); |
| 7901 | |
| 7902 | return 0; |
| 7903 | } |
| 7904 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7905 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 7906 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 7907 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7908 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7909 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7910 | #ifdef FEATURE_WLAN_TDLS |
| 7911 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 7912 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7913 | |
| 7914 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7915 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 7916 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7917 | mask = params->sta_flags_mask; |
| 7918 | |
| 7919 | set = params->sta_flags_set; |
| 7920 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7921 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 7922 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7923 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 7924 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 7925 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7926 | |
| 7927 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 7928 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7929 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7930 | } |
| 7931 | } |
| 7932 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 7933 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7934 | } |
| 7935 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7936 | |
| 7937 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7938 | #define MAX_PMKSAIDS_IN_CACHE 8 |
| 7939 | |
| 7940 | static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD local cache |
| 7941 | static tANI_U32 PMKIDCacheIndex; // HDD local Cache index |
| 7942 | |
| 7943 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7944 | 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] | 7945 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7946 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7947 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7948 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7949 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7950 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7951 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7952 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7953 | hdd_context_t *pHddCtx; |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7954 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 7955 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7956 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7957 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7958 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7959 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7960 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7961 | return -EINVAL; |
| 7962 | } |
| 7963 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7964 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7965 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7966 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7967 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7968 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7969 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7970 | "%s: HDD context is not valid", __func__); |
| 7971 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7972 | } |
| 7973 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7974 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7975 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7976 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7977 | for (j = 0; j < PMKIDCacheIndex; j++) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7978 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7979 | if(vos_mem_compare(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7980 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 7981 | { |
| 7982 | /* BSSID matched previous entry. Overwrite it. */ |
| 7983 | BSSIDMatched = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7984 | vos_mem_copy(PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7985 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7986 | vos_mem_copy(PMKIDCache[j].PMKID, |
| 7987 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7988 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7989 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7990 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7991 | dump_bssid(pmksa->bssid); |
| 7992 | dump_pmkid(halHandle, pmksa->pmkid); |
| 7993 | break; |
| 7994 | } |
| 7995 | } |
| 7996 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 7997 | /* Check we compared all entries,if then take the first slot now */ |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 7998 | if(j == MAX_PMKSAIDS_IN_CACHE) PMKIDCacheIndex=0; |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 7999 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8000 | if (!BSSIDMatched) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8001 | { |
| 8002 | // 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] | 8003 | vos_mem_copy(PMKIDCache[PMKIDCacheIndex].BSSID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8004 | pmksa->bssid, ETHER_ADDR_LEN); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8005 | vos_mem_copy(PMKIDCache[PMKIDCacheIndex].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8006 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8007 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8008 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Adding a new cache entry %d.", |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8009 | __func__, PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8010 | dump_bssid(pmksa->bssid); |
| 8011 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8012 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8013 | // 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] | 8014 | if (PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) PMKIDCacheIndex++; else PMKIDCacheIndex = 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8015 | } |
| 8016 | |
| 8017 | |
| 8018 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8019 | //hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with %d cache entries."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8020 | // __func__, i ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8021 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8022 | __func__, PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8023 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8024 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 8025 | PMKIDCache, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8026 | PMKIDCacheIndex); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8027 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8028 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 8029 | pAdapter->sessionId, result)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8030 | return 0; |
| 8031 | } |
| 8032 | |
| 8033 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8034 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8035 | 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] | 8036 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8037 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8038 | tANI_U32 j=0; |
| 8039 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8040 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8041 | tANI_U8 BSSIDMatched = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8042 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8043 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8044 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8045 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 8046 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8047 | |
| 8048 | /* Validate pAdapter */ |
| 8049 | if (NULL == pAdapter) |
| 8050 | { |
| 8051 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 8052 | return -EINVAL; |
| 8053 | } |
| 8054 | |
| 8055 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8056 | status = wlan_hdd_validate_context(pHddCtx); |
| 8057 | |
| 8058 | if (0 != status) |
| 8059 | { |
| 8060 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8061 | "%s: HDD context is not valid", __func__); |
| 8062 | return status; |
| 8063 | } |
| 8064 | |
| 8065 | /*Retrieve halHandle*/ |
| 8066 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8067 | |
| 8068 | /*in case index is 0,no entry to delete*/ |
| 8069 | if (0 == PMKIDCacheIndex) |
| 8070 | { |
| 8071 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid entry to delete" , |
| 8072 | __func__); |
| 8073 | return -EINVAL; |
| 8074 | } |
| 8075 | |
| 8076 | /*find the matching PMKSA entry from j=0 to (index-1), |
| 8077 | * and delete the matched one |
| 8078 | */ |
| 8079 | for (j = 0; j<PMKIDCacheIndex; j++) |
| 8080 | { |
| 8081 | if (vos_mem_compare(PMKIDCache[j].BSSID, |
| 8082 | pmksa->bssid, |
| 8083 | WNI_CFG_BSSID_LEN)) |
| 8084 | { |
| 8085 | /* BSSID matched entry */ |
| 8086 | BSSIDMatched = 1; |
| 8087 | |
| 8088 | if (j<PMKIDCacheIndex-1) |
| 8089 | { |
| 8090 | /*replace the matching entry with the last entry in HDD local cache*/ |
| 8091 | vos_mem_copy(PMKIDCache[j].BSSID, |
| 8092 | PMKIDCache[PMKIDCacheIndex-1].BSSID, |
| 8093 | WNI_CFG_BSSID_LEN); |
| 8094 | vos_mem_copy(PMKIDCache[j].PMKID, |
| 8095 | PMKIDCache[PMKIDCacheIndex-1].PMKID, |
| 8096 | CSR_RSN_PMKID_SIZE); |
| 8097 | } |
| 8098 | |
| 8099 | /*clear the last entry in HDD cache ---[index-1]*/ |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8100 | vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].BSSID, WNI_CFG_BSSID_LEN); |
| 8101 | vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].PMKID, CSR_RSN_PMKID_SIZE); |
| 8102 | |
| 8103 | /*reduce the PMKID array index*/ |
| 8104 | PMKIDCacheIndex--; |
| 8105 | |
| 8106 | /*delete the last PMKID cache in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8107 | if (eHAL_STATUS_SUCCESS != |
| 8108 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8109 | { |
| 8110 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", |
| 8111 | __func__,PMKIDCacheIndex); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8112 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8113 | } |
| 8114 | |
| 8115 | dump_bssid(pmksa->bssid); |
| 8116 | dump_pmkid(halHandle,pmksa->pmkid); |
| 8117 | |
| 8118 | break; |
| 8119 | } |
| 8120 | } |
| 8121 | |
| 8122 | /* we compare all entries,but cannot find matching entry */ |
| 8123 | if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched) |
| 8124 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8125 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8126 | "%s: No such PMKSA entry existed " MAC_ADDRESS_STR, |
| 8127 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8128 | dump_bssid(pmksa->bssid); |
| 8129 | dump_pmkid(halHandle, pmksa->pmkid); |
| 8130 | return -EINVAL; |
| 8131 | } |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8132 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8133 | } |
| 8134 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8135 | |
| 8136 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8137 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 8138 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8139 | tANI_U32 j=0; |
| 8140 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8141 | tHalHandle halHandle; |
| 8142 | hdd_context_t *pHddCtx; |
| 8143 | tANI_U8 *pBSSId; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8144 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8145 | |
| 8146 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 8147 | |
| 8148 | /* Validate pAdapter */ |
| 8149 | if (NULL == pAdapter) |
| 8150 | { |
| 8151 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8152 | "%s: Invalid Adapter" ,__func__); |
| 8153 | return -EINVAL; |
| 8154 | } |
| 8155 | |
| 8156 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8157 | status = wlan_hdd_validate_context(pHddCtx); |
| 8158 | |
| 8159 | if (0 != status) |
| 8160 | { |
| 8161 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8162 | "%s: HDD context is not valid", __func__); |
| 8163 | return status; |
| 8164 | } |
| 8165 | |
| 8166 | /*Retrieve halHandle*/ |
| 8167 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8168 | |
| 8169 | /*in case index is 0,no entry to delete*/ |
| 8170 | if (0 == PMKIDCacheIndex) |
| 8171 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 8172 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("No entries to flush")); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8173 | return -EINVAL; |
| 8174 | } |
| 8175 | |
| 8176 | /*delete all the PMKSA one by one */ |
| 8177 | for (j = 0; j<PMKIDCacheIndex; j++) |
| 8178 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8179 | pBSSId =(tANI_U8 *)(PMKIDCache[j].BSSID); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8180 | |
| 8181 | /*delete the PMKID in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8182 | if (eHAL_STATUS_SUCCESS != |
| 8183 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8184 | { |
| 8185 | hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.", |
| 8186 | __func__,j); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8187 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8188 | } |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 8189 | /*clear the entry in HDD cache 0--index-1 */ |
| 8190 | vos_mem_zero(PMKIDCache[j].BSSID, WNI_CFG_BSSID_LEN); |
| 8191 | vos_mem_zero(PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 8192 | } |
| 8193 | |
| 8194 | PMKIDCacheIndex = 0; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 8195 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8196 | } |
| 8197 | #endif |
| 8198 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8199 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8200 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8201 | struct net_device *dev, struct cfg80211_update_ft_ies_params *ftie) |
| 8202 | { |
| 8203 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8204 | hdd_station_ctx_t *pHddStaCtx; |
| 8205 | |
| 8206 | if (NULL == pAdapter) |
| 8207 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8208 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8209 | return -ENODEV; |
| 8210 | } |
| 8211 | |
| 8212 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8213 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8214 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8215 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 8216 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8217 | // Added for debug on reception of Re-assoc Req. |
| 8218 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 8219 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8220 | 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] | 8221 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8222 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8223 | } |
| 8224 | |
| 8225 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8226 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8227 | ftie->ie_len); |
| 8228 | #endif |
| 8229 | |
| 8230 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 8231 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 8232 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8233 | ftie->ie_len); |
| 8234 | return 0; |
| 8235 | } |
| 8236 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8237 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8238 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 8239 | |
| 8240 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 8241 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 8242 | { |
| 8243 | int ret; |
| 8244 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 8245 | hdd_context_t *pHddCtx; |
| 8246 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8247 | ENTER(); |
| 8248 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8249 | if (NULL == pAdapter) |
| 8250 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 8251 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8252 | "%s: HDD adapter is Null", __func__); |
| 8253 | return ; |
| 8254 | } |
| 8255 | |
| 8256 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8257 | if (NULL == pHddCtx) |
| 8258 | { |
| 8259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8260 | "%s: HDD context is Null!!!", __func__); |
| 8261 | return ; |
| 8262 | } |
| 8263 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8264 | spin_lock(&pHddCtx->schedScan_lock); |
| 8265 | if (TRUE == pHddCtx->isWiphySuspended) |
| 8266 | { |
| 8267 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 8268 | spin_unlock(&pHddCtx->schedScan_lock); |
| 8269 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8270 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 8271 | return ; |
| 8272 | } |
| 8273 | spin_unlock(&pHddCtx->schedScan_lock); |
| 8274 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8275 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 8276 | |
| 8277 | if (0 > ret) |
| 8278 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 8279 | |
| 8280 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8281 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8282 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8283 | } |
| 8284 | |
| 8285 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8286 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 8287 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8288 | */ |
| 8289 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 8290 | { |
| 8291 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 8292 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8293 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8294 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8295 | int status = 0; |
| 8296 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 8297 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 8298 | /* The current firmware design does not allow PNO during any |
| 8299 | * active sessions. Hence, determine the active sessions |
| 8300 | * and return a failure. |
| 8301 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8302 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 8303 | { |
| 8304 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8305 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8306 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8307 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 8308 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 8309 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 8310 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 8311 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
| 8312 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8313 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8314 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8315 | } |
| 8316 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 8317 | pAdapterNode = pNext; |
| 8318 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8319 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8320 | } |
| 8321 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8322 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 8323 | { |
| 8324 | hdd_adapter_t *pAdapter = callbackContext; |
| 8325 | hdd_context_t *pHddCtx; |
| 8326 | |
| 8327 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 8328 | { |
| 8329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8330 | FL("Invalid adapter or adapter has invalid magic")); |
| 8331 | return; |
| 8332 | } |
| 8333 | |
| 8334 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8335 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 8336 | { |
| 8337 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8338 | FL("HDD context is not valid")); |
| 8339 | return; |
| 8340 | } |
| 8341 | |
| 8342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8343 | FL("PNO enable response status = %d"), status); |
| 8344 | |
| 8345 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 8346 | complete(&pAdapter->pno_comp_var); |
| 8347 | } |
| 8348 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8349 | /* |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8350 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 8351 | * NL interface to enable PNO |
| 8352 | */ |
| 8353 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 8354 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 8355 | { |
| 8356 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8357 | tpSirPNOScanReq pPnoRequest = NULL; |
| 8358 | hdd_context_t *pHddCtx; |
| 8359 | tHalHandle hHal; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 8360 | v_U32_t i, indx, num_ch, tempInterval; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 8361 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 8362 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8363 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 8364 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8365 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8366 | |
| 8367 | if (NULL == pAdapter) |
| 8368 | { |
| 8369 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8370 | "%s: HDD adapter is Null", __func__); |
| 8371 | return -ENODEV; |
| 8372 | } |
| 8373 | |
| 8374 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8375 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8376 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8377 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8378 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8379 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8380 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8381 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8382 | } |
| 8383 | |
| 8384 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8385 | if (NULL == hHal) |
| 8386 | { |
| 8387 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8388 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8389 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8390 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8391 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8392 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8393 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 8394 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 8395 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 8396 | return -EBUSY; |
| 8397 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8398 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 8399 | if (TRUE == pHddCtx->isPnoEnable) |
| 8400 | { |
| 8401 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 8402 | FL("already PNO is enabled")); |
| 8403 | return -EBUSY; |
| 8404 | } |
| 8405 | pHddCtx->isPnoEnable = TRUE; |
| 8406 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8407 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 8408 | if (NULL == pPnoRequest) |
| 8409 | { |
| 8410 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8411 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 8412 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8413 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8414 | } |
| 8415 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 8416 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8417 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 8418 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 8419 | |
| 8420 | if (( !pPnoRequest->ucNetworksCount ) || |
| 8421 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 8422 | { |
| 8423 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8424 | "%s: Network input is not correct %d", |
| 8425 | __func__, pPnoRequest->ucNetworksCount); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8426 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8427 | goto error; |
| 8428 | } |
| 8429 | |
| 8430 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 8431 | { |
| 8432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8433 | "%s: Incorrect number of channels %d", |
| 8434 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8435 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8436 | goto error; |
| 8437 | } |
| 8438 | |
| 8439 | /* Framework provides one set of channels(all) |
| 8440 | * common for all saved profile */ |
| 8441 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 8442 | channels_allowed, &num_channels_allowed)) |
| 8443 | { |
| 8444 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8445 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8446 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8447 | goto error; |
| 8448 | } |
| 8449 | /* Checking each channel against allowed channel list */ |
| 8450 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8451 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8452 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8453 | char chList [(request->n_channels*5)+1]; |
| 8454 | int len; |
| 8455 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8456 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8457 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8458 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8459 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 8460 | { |
| 8461 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 8462 | len += snprintf(chList+len, 5, "%d ", |
| 8463 | request->channels[i]->hw_value); |
| 8464 | break ; |
| 8465 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8466 | } |
| 8467 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8468 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
| 8469 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8470 | |
| 8471 | /* Filling per profile params */ |
| 8472 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 8473 | { |
| 8474 | pPnoRequest->aNetworks[i].ssId.length = |
| 8475 | request->match_sets[i].ssid.ssid_len; |
| 8476 | |
| 8477 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 8478 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 8479 | { |
| 8480 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8481 | "%s: SSID Len %d is not correct for network %d", |
| 8482 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8483 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8484 | goto error; |
| 8485 | } |
| 8486 | |
| 8487 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 8488 | request->match_sets[i].ssid.ssid, |
| 8489 | request->match_sets[i].ssid.ssid_len); |
| 8490 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 8491 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 8492 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 8493 | |
| 8494 | /*Copying list of valid channel into request */ |
| 8495 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 8496 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 8497 | |
| 8498 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 8499 | } |
| 8500 | |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 8501 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 8502 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 8503 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 8504 | { |
| 8505 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 8506 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 8507 | pPnoRequest->us24GProbeTemplateLen); |
| 8508 | |
| 8509 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 8510 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 8511 | pPnoRequest->us5GProbeTemplateLen); |
| 8512 | } |
| 8513 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 8514 | /* Driver gets only one time interval which is hardcoded in |
| 8515 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 8516 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 8517 | * 80,160,320 secs. And number of scan cycle for each timer |
| 8518 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 8519 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 8520 | * will be repeated after each interval specified by supplicant |
| 8521 | * till PNO is disabled. |
| 8522 | */ |
| 8523 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 8524 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 8525 | else |
| 8526 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 8527 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 8528 | |
| 8529 | tempInterval = (request->interval)/1000; |
| 8530 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8531 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 8532 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 8533 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 8534 | { |
| 8535 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 8536 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 8537 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 8538 | tempInterval *= 2; |
| 8539 | } |
| 8540 | //Repeat last timer until pno disabled. |
| 8541 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 8542 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 8543 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8544 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8545 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 8546 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 8547 | pPnoRequest->callbackContext = pAdapter; |
| 8548 | pAdapter->pno_req_status = 0; |
| 8549 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8551 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 8552 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 8553 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 8554 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8555 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8556 | pPnoRequest, pAdapter->sessionId, |
| 8557 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 8558 | if (eHAL_STATUS_SUCCESS != status) |
| 8559 | { |
| 8560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 8561 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8562 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8563 | goto error; |
| 8564 | } |
| 8565 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8566 | ret = wait_for_completion_timeout( |
| 8567 | &pAdapter->pno_comp_var, |
| 8568 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 8569 | if (0 >= ret) |
| 8570 | { |
| 8571 | // Did not receive the response for PNO enable in time. |
| 8572 | // Assuming the PNO enable was success. |
| 8573 | // Returning error from here, because we timeout, results |
| 8574 | // in side effect of Wifi (Wifi Setting) not to work. |
| 8575 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8576 | FL("Timed out waiting for PNO to be Enabled")); |
| 8577 | ret = 0; |
| 8578 | goto error; |
| 8579 | } |
| 8580 | |
| 8581 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 8582 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8583 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8584 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8585 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8586 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8587 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 8588 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8589 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8590 | } |
| 8591 | |
| 8592 | /* |
| 8593 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 8594 | * NL interface to disable PNO |
| 8595 | */ |
| 8596 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 8597 | struct net_device *dev) |
| 8598 | { |
| 8599 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 8600 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8601 | hdd_context_t *pHddCtx; |
| 8602 | tHalHandle hHal; |
| 8603 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8604 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8605 | |
| 8606 | ENTER(); |
| 8607 | |
| 8608 | if (NULL == pAdapter) |
| 8609 | { |
| 8610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8611 | "%s: HDD adapter is Null", __func__); |
| 8612 | return -ENODEV; |
| 8613 | } |
| 8614 | |
| 8615 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8616 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8617 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8618 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8619 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8620 | "%s: HDD context is Null", __func__); |
| 8621 | return -ENODEV; |
| 8622 | } |
| 8623 | |
| 8624 | /* The return 0 is intentional when isLogpInProgress and |
| 8625 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 8626 | * failure in sched_scan_stop , especially for a case where the unload |
| 8627 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 8628 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 8629 | * success. If it returns a failure , then its next invocation due to the |
| 8630 | * clean up of the second interface will have the dev pointer corresponding |
| 8631 | * to the first one leading to a crash. |
| 8632 | */ |
| 8633 | if (pHddCtx->isLogpInProgress) |
| 8634 | { |
| 8635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8636 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8637 | return ret; |
| 8638 | } |
| 8639 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8640 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8641 | { |
| 8642 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8643 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 8644 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8645 | } |
| 8646 | |
| 8647 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8648 | if (NULL == hHal) |
| 8649 | { |
| 8650 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8651 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8652 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8653 | } |
| 8654 | |
| 8655 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 8656 | if (NULL == pPnoRequest) |
| 8657 | { |
| 8658 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8659 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8660 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8661 | } |
| 8662 | |
| 8663 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 8664 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 8665 | pPnoRequest->ucNetworksCount = 0; |
| 8666 | |
| 8667 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 8668 | pAdapter->sessionId, |
| 8669 | NULL, pAdapter); |
| 8670 | if (eHAL_STATUS_SUCCESS != status) |
| 8671 | { |
| 8672 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8673 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8674 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8675 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8676 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 8677 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8678 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8679 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 8680 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 8681 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8682 | vos_mem_free(pPnoRequest); |
| 8683 | |
| 8684 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 8685 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8686 | } |
| 8687 | |
| 8688 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 8689 | |
| 8690 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8691 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 8692 | #if TDLS_MGMT_VERSION2 |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8693 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 8694 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 8695 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 8696 | #else |
| 8697 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 8698 | u8 *peer, u8 action_code, u8 dialog_token, |
| 8699 | u16 status_code, const u8 *buf, size_t len) |
| 8700 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8701 | { |
| 8702 | |
| 8703 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8704 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8705 | u8 peerMac[6]; |
| 8706 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8707 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8708 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8709 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 8710 | #if !(TDLS_MGMT_VERSION2) |
| 8711 | u32 peer_capability = 0; |
| 8712 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8713 | tANI_U16 numCurrTdlsPeers; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8714 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8715 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8716 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 8717 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8718 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8719 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8720 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8721 | "Invalid arguments"); |
| 8722 | return -EINVAL; |
| 8723 | } |
| 8724 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8725 | if (pHddCtx->isLogpInProgress) |
| 8726 | { |
| 8727 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8728 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8729 | wlan_hdd_tdls_set_link_status(pAdapter, peer, eTDLS_LINK_IDLE); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8730 | return -EBUSY; |
| 8731 | } |
| 8732 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8733 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8734 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8735 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8736 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8737 | MAC_ADDRESS_STR " action %d declined.", |
| 8738 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8739 | return -ENOTSUPP; |
| 8740 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8741 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8742 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 8743 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 8744 | { |
| 8745 | /* if tdls_mode is disabled to respond to peer's request */ |
| 8746 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 8747 | { |
| 8748 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8749 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8750 | " TDLS mode is disabled. action %d declined.", |
| 8751 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8752 | |
| 8753 | return -ENOTSUPP; |
| 8754 | } |
| 8755 | } |
| 8756 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8757 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 8758 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8759 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8760 | { |
| 8761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8762 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8763 | " TDLS setup is ongoing. action %d declined.", |
| 8764 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 8765 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8766 | } |
| 8767 | } |
| 8768 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8769 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 8770 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8771 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8772 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8773 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8774 | { |
| 8775 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 8776 | we return error code at 'add_station()'. Hence we have this |
| 8777 | check again in addtion to add_station(). |
| 8778 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8779 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8780 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8781 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8782 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8783 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 8784 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 8785 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 8786 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8787 | } |
| 8788 | else |
| 8789 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8790 | /* maximum reached. tweak to send error code to peer and return |
| 8791 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8792 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8793 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8794 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8795 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 8796 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 8797 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8798 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8799 | /* fall through to send setup resp with failure status |
| 8800 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8801 | } |
| 8802 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8803 | else |
| 8804 | { |
| 8805 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8806 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8807 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8808 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8809 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8810 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 8811 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8812 | return -EPERM; |
| 8813 | } |
| 8814 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 8815 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8816 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8817 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8818 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 8819 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 8820 | "%s: " MAC_ADDRESS_STR " action %d, dialog_token %d status %d, len = %zu", |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8821 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 8822 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8823 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8824 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8825 | /*Except teardown responder will not be used so just make 0*/ |
| 8826 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8827 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8828 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8829 | |
| 8830 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8831 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8832 | |
| 8833 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 8834 | responder = pTdlsPeer->is_responder; |
| 8835 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8836 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8837 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 8838 | "%s: " MAC_ADDRESS_STR " peer doesn't exist or not connected %d dialog_token %d status %d, len = %zu", |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 8839 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 8840 | dialog_token, status_code, len); |
| 8841 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8842 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8843 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8844 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8845 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 8846 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8847 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8848 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 8849 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8850 | { |
| 8851 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 8852 | { |
| 8853 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8854 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8855 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 8856 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 8857 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 8858 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8859 | } |
| 8860 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8861 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 8862 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 8863 | { |
| 8864 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8865 | "%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] | 8866 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 8867 | return -EBUSY; |
| 8868 | } |
| 8869 | |
| 8870 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8871 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 8872 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8873 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 8874 | peerMac, action_code, dialog_token, status_code, peer_capability, (tANI_U8 *)buf, len, responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8875 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8876 | if (VOS_STATUS_SUCCESS != status) |
| 8877 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8879 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8880 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8881 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 8882 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8883 | } |
| 8884 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8885 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 8886 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 8887 | |
| 8888 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8889 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8890 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8891 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8892 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8893 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8894 | |
| 8895 | if (pHddCtx->isLogpInProgress) |
| 8896 | { |
| 8897 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8898 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8899 | return -EAGAIN; |
| 8900 | } |
| 8901 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 8902 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 8903 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8904 | } |
| 8905 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8906 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8907 | { |
| 8908 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8909 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 8910 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8911 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8912 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 8913 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8914 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8915 | } |
| 8916 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 8917 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8918 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8919 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8920 | |
| 8921 | return 0; |
| 8922 | } |
| 8923 | |
| 8924 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 8925 | u8 *peer, enum nl80211_tdls_operation oper) |
| 8926 | { |
| 8927 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8928 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8929 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8930 | hddTdlsPeer_t *pTdlsPeer; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8931 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8932 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8933 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 8934 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8935 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8936 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 8937 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8938 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8939 | return -EINVAL; |
| 8940 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8941 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8942 | status = wlan_hdd_validate_context(pHddCtx); |
| 8943 | |
| 8944 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8945 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8946 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8947 | "%s: HDD context is not valid", __func__); |
| 8948 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8949 | } |
| 8950 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8951 | |
| 8952 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8953 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8954 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 8955 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8956 | "TDLS Disabled in INI OR not enabled in FW. " |
| 8957 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8958 | return -ENOTSUPP; |
| 8959 | } |
| 8960 | |
| 8961 | switch (oper) { |
| 8962 | case NL80211_TDLS_ENABLE_LINK: |
| 8963 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8964 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8965 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8966 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8967 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 8968 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 8969 | |
| 8970 | if ( NULL == pTdlsPeer ) { |
| 8971 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 8972 | " (oper %d) not exsting. ignored", |
| 8973 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 8974 | return -EINVAL; |
| 8975 | } |
| 8976 | |
| 8977 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8978 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 8979 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 8980 | "NL80211_TDLS_ENABLE_LINK"); |
| 8981 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 8982 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 8983 | { |
| 8984 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 8985 | MAC_ADDRESS_STR " failed", |
| 8986 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 8987 | return -EINVAL; |
| 8988 | } |
| 8989 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8990 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8991 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 8992 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 8993 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 8994 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 8995 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 8996 | return -EINVAL; |
| 8997 | } |
| 8998 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8999 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 9000 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9001 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 9002 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 9003 | * register with the TL on after the response for this operation |
| 9004 | * is received . |
| 9005 | */ |
| 9006 | ret = wait_for_completion_interruptible_timeout( |
| 9007 | &pAdapter->tdls_link_establish_req_comp, |
| 9008 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 9009 | if (ret <= 0) |
| 9010 | { |
| 9011 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9012 | "%s: Link Establish Request Faled Status %ld", |
| 9013 | __func__, ret); |
| 9014 | return -EINVAL; |
| 9015 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 9016 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 9017 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 9018 | /* Mark TDLS client Authenticated .*/ |
| 9019 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 9020 | pTdlsPeer->staId, |
| 9021 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 9022 | if (VOS_STATUS_SUCCESS == status) |
| 9023 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 9024 | if (pTdlsPeer->is_responder == 0) |
| 9025 | { |
| 9026 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 9027 | |
| 9028 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 9029 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 9030 | WAIT_TIME_TDLS_INITIATOR); |
| 9031 | /* suspend initiator TX until it receives direct packet from the |
| 9032 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 9033 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 9034 | &staId, NULL); |
| 9035 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 9036 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 9037 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 9038 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 9039 | |
| 9040 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 9041 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 9042 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 9043 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 9044 | int ac; |
| 9045 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 9046 | WLANTL_AC_VI, |
| 9047 | WLANTL_AC_BK, |
| 9048 | WLANTL_AC_BE }; |
| 9049 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 9050 | for(ac=0; ac < 4; ac++) |
| 9051 | { |
| 9052 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 9053 | pTdlsPeer->staId, ucAc[ac], |
| 9054 | tlTid[ac], tlTid[ac], 0, 0, |
| 9055 | WLANTL_BI_DIR ); |
| 9056 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 9057 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 9058 | } |
| 9059 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9060 | } |
| 9061 | break; |
| 9062 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9063 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9064 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 9065 | |
| 9066 | if ( NULL == pTdlsPeer ) { |
| 9067 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 9068 | " (oper %d) not exsting. ignored", |
| 9069 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 9070 | return -EINVAL; |
| 9071 | } |
| 9072 | |
| 9073 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9074 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 9075 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 9076 | "NL80211_TDLS_DISABLE_LINK"); |
| 9077 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 9078 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9079 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9080 | long status; |
| 9081 | |
| 9082 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 9083 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9084 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9085 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9086 | |
| 9087 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 9088 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
| 9089 | if (status <= 0) |
| 9090 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 9091 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9093 | "%s: Del station failed status %ld", |
| 9094 | __func__, status); |
| 9095 | return -EPERM; |
| 9096 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 9097 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9098 | } |
| 9099 | else |
| 9100 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 9101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9102 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9103 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 9104 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 9105 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9106 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9107 | { |
| 9108 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9109 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 9110 | __func__, MAC_ADDR_ARRAY(peer)); |
| 9111 | |
| 9112 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 9113 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 9114 | |
| 9115 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9116 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 9117 | __func__); |
| 9118 | return -ENOTSUPP; |
| 9119 | } |
| 9120 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9121 | |
| 9122 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 9123 | |
| 9124 | if ( NULL == pTdlsPeer ) { |
| 9125 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 9126 | " peer not exsting", |
| 9127 | __func__, MAC_ADDR_ARRAY(peer)); |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 9128 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9129 | } |
| 9130 | else { |
| 9131 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 9132 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 9133 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 9134 | |
| 9135 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 9136 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9137 | break; |
| 9138 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9139 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9140 | { |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 9141 | hddTdlsPeer_t *pTdlsPeer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9143 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 9144 | __func__, MAC_ADDR_ARRAY(peer)); |
| 9145 | |
| 9146 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 9147 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 9148 | |
| 9149 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9150 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 9151 | __func__); |
| 9152 | return -ENOTSUPP; |
| 9153 | } |
| 9154 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 9155 | /* To cater the requirement of establishing the TDLS link |
| 9156 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 9157 | */ |
| 9158 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 9159 | if (pTdlsPeer == NULL) { |
| 9160 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9161 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 9162 | __func__, MAC_ADDR_ARRAY(peer)); |
| 9163 | return -EINVAL; |
| 9164 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 9165 | |
| 9166 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 9167 | |
| 9168 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9169 | " %s TDLS Add Force Peer Failed", |
| 9170 | __func__); |
| 9171 | return -EINVAL; |
| 9172 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 9173 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 9174 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9175 | case NL80211_TDLS_DISCOVERY_REQ: |
| 9176 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9177 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 9178 | "%s: We don't support in-driver setup/teardown/discovery " |
| 9179 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9180 | return -ENOTSUPP; |
| 9181 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9182 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9183 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9184 | return -ENOTSUPP; |
| 9185 | } |
| 9186 | return 0; |
| 9187 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 9188 | |
| 9189 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 9190 | struct net_device *dev, u8 *peer) |
| 9191 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9192 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9193 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 9194 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 9195 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 9196 | #if TDLS_MGMT_VERSION2 |
| 9197 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 9198 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 9199 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 9200 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 9201 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 9202 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 9203 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9204 | #endif |
| 9205 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9206 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 9207 | /* |
| 9208 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 9209 | * Callback rountine called upon receiving response for |
| 9210 | * get offload info |
| 9211 | */ |
| 9212 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 9213 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 9214 | { |
| 9215 | |
| 9216 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9217 | tANI_U8 tempReplayCounter[8]; |
| 9218 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9219 | |
| 9220 | ENTER(); |
| 9221 | |
| 9222 | if (NULL == pAdapter) |
| 9223 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 9224 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9225 | "%s: HDD adapter is Null", __func__); |
| 9226 | return ; |
| 9227 | } |
| 9228 | |
| 9229 | if (NULL == pGtkOffloadGetInfoRsp) |
| 9230 | { |
| 9231 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9232 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 9233 | return ; |
| 9234 | } |
| 9235 | |
| 9236 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 9237 | { |
| 9238 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9239 | "%s: wlan Failed to get replay counter value", |
| 9240 | __func__); |
| 9241 | return ; |
| 9242 | } |
| 9243 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9244 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9245 | /* Update replay counter */ |
| 9246 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 9247 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 9248 | |
| 9249 | { |
| 9250 | /* changing from little to big endian since supplicant |
| 9251 | * works on big endian format |
| 9252 | */ |
| 9253 | int i; |
| 9254 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 9255 | |
| 9256 | for (i = 0; i < 8; i++) |
| 9257 | { |
| 9258 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 9259 | } |
| 9260 | } |
| 9261 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9262 | /* Update replay counter to NL */ |
| 9263 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9264 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9265 | } |
| 9266 | |
| 9267 | /* |
| 9268 | * FUNCTION: wlan_hdd_cfg80211_set_rekey_data |
| 9269 | * This function is used to offload GTK rekeying job to the firmware. |
| 9270 | */ |
| 9271 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 9272 | struct cfg80211_gtk_rekey_data *data) |
| 9273 | { |
| 9274 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9275 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9276 | hdd_station_ctx_t *pHddStaCtx; |
| 9277 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9278 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9279 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9280 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 9281 | |
| 9282 | ENTER(); |
| 9283 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9284 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9285 | if (NULL == pAdapter) |
| 9286 | { |
| 9287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9288 | "%s: HDD adapter is Null", __func__); |
| 9289 | return -ENODEV; |
| 9290 | } |
| 9291 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9292 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9293 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 9294 | pAdapter->sessionId, pAdapter->device_mode)); |
| 9295 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9296 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9297 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9298 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9299 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9300 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9301 | "%s: HDD context is not valid", __func__); |
| 9302 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9303 | } |
| 9304 | |
| 9305 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9306 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9307 | if (NULL == hHal) |
| 9308 | { |
| 9309 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9310 | "%s: HAL context is Null!!!", __func__); |
| 9311 | return -EAGAIN; |
| 9312 | } |
| 9313 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9314 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 9315 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 9316 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 9317 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9318 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9319 | { |
| 9320 | /* changing from big to little endian since driver |
| 9321 | * works on little endian format |
| 9322 | */ |
| 9323 | tANI_U8 *p = |
| 9324 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 9325 | int i; |
| 9326 | |
| 9327 | for (i = 0; i < 8; i++) |
| 9328 | { |
| 9329 | p[7-i] = data->replay_ctr[i]; |
| 9330 | } |
| 9331 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9332 | |
| 9333 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 9334 | { |
| 9335 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9336 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 9337 | sizeof (tSirGtkOffloadParams)); |
| 9338 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9339 | pAdapter->sessionId); |
| 9340 | |
| 9341 | if (eHAL_STATUS_SUCCESS != status) |
| 9342 | { |
| 9343 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9344 | "%s: sme_SetGTKOffload failed, returned %d", |
| 9345 | __func__, status); |
| 9346 | return status; |
| 9347 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9349 | "%s: sme_SetGTKOffload successfull", __func__); |
| 9350 | } |
| 9351 | else |
| 9352 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9353 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9354 | "%s: wlan not suspended GTKOffload request is stored", |
| 9355 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9356 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9357 | |
| 9358 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9359 | } |
| 9360 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
| 9361 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9362 | /* |
| 9363 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 9364 | * This function is used to set access control policy |
| 9365 | */ |
| 9366 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 9367 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 9368 | { |
| 9369 | int i; |
| 9370 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9371 | hdd_hostapd_state_t *pHostapdState; |
| 9372 | tsap_Config_t *pConfig; |
| 9373 | v_CONTEXT_t pVosContext = NULL; |
| 9374 | hdd_context_t *pHddCtx; |
| 9375 | int status; |
| 9376 | |
| 9377 | ENTER(); |
| 9378 | |
| 9379 | if (NULL == pAdapter) |
| 9380 | { |
| 9381 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9382 | "%s: HDD adapter is Null", __func__); |
| 9383 | return -ENODEV; |
| 9384 | } |
| 9385 | |
| 9386 | if (NULL == params) |
| 9387 | { |
| 9388 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9389 | "%s: params is Null", __func__); |
| 9390 | return -EINVAL; |
| 9391 | } |
| 9392 | |
| 9393 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9394 | status = wlan_hdd_validate_context(pHddCtx); |
| 9395 | |
| 9396 | if (0 != status) |
| 9397 | { |
| 9398 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9399 | "%s: HDD context is not valid", __func__); |
| 9400 | return status; |
| 9401 | } |
| 9402 | |
| 9403 | pVosContext = pHddCtx->pvosContext; |
| 9404 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9405 | |
| 9406 | if (NULL == pHostapdState) |
| 9407 | { |
| 9408 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9409 | "%s: pHostapdState is Null", __func__); |
| 9410 | return -EINVAL; |
| 9411 | } |
| 9412 | |
| 9413 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 9414 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 9415 | |
| 9416 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 9417 | { |
| 9418 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 9419 | |
| 9420 | /* default value */ |
| 9421 | pConfig->num_accept_mac = 0; |
| 9422 | pConfig->num_deny_mac = 0; |
| 9423 | |
| 9424 | /** |
| 9425 | * access control policy |
| 9426 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 9427 | * listed in hostapd.deny file. |
| 9428 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 9429 | * listed in hostapd.accept file. |
| 9430 | */ |
| 9431 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 9432 | { |
| 9433 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 9434 | } |
| 9435 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 9436 | { |
| 9437 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 9438 | } |
| 9439 | else |
| 9440 | { |
| 9441 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9442 | "%s:Acl Policy : %d is not supported", |
| 9443 | __func__, params->acl_policy); |
| 9444 | return -ENOTSUPP; |
| 9445 | } |
| 9446 | |
| 9447 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 9448 | { |
| 9449 | pConfig->num_accept_mac = params->n_acl_entries; |
| 9450 | for (i = 0; i < params->n_acl_entries; i++) |
| 9451 | { |
| 9452 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9453 | "** Add ACL MAC entry %i in WhiletList :" |
| 9454 | MAC_ADDRESS_STR, i, |
| 9455 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 9456 | |
| 9457 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 9458 | sizeof(qcmacaddr)); |
| 9459 | } |
| 9460 | } |
| 9461 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 9462 | { |
| 9463 | pConfig->num_deny_mac = params->n_acl_entries; |
| 9464 | for (i = 0; i < params->n_acl_entries; i++) |
| 9465 | { |
| 9466 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9467 | "** Add ACL MAC entry %i in BlackList :" |
| 9468 | MAC_ADDRESS_STR, i, |
| 9469 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 9470 | |
| 9471 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 9472 | sizeof(qcmacaddr)); |
| 9473 | } |
| 9474 | } |
| 9475 | |
| 9476 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 9477 | { |
| 9478 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9479 | "%s: SAP Set Mac Acl fail", __func__); |
| 9480 | return -EINVAL; |
| 9481 | } |
| 9482 | } |
| 9483 | else |
| 9484 | { |
| 9485 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9486 | "%s: Invalid device_mode = %d", |
| 9487 | __func__, pAdapter->device_mode); |
| 9488 | return -EINVAL; |
| 9489 | } |
| 9490 | |
| 9491 | return 0; |
| 9492 | } |
| 9493 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9494 | #ifdef WLAN_NL80211_TESTMODE |
| 9495 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9496 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9497 | ( |
| 9498 | void *pAdapter, |
| 9499 | void *indCont |
| 9500 | ) |
| 9501 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9502 | tSirLPHBInd *lphbInd; |
| 9503 | struct sk_buff *skb; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9504 | |
| 9505 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9506 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9507 | |
| 9508 | if (NULL == indCont) |
| 9509 | { |
| 9510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9511 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9512 | return; |
| 9513 | } |
| 9514 | |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9515 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9516 | skb = cfg80211_testmode_alloc_event_skb( |
| 9517 | ((hdd_adapter_t *)pAdapter)->wdev.wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9518 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9519 | GFP_ATOMIC); |
| 9520 | if (!skb) |
| 9521 | { |
| 9522 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9523 | "LPHB timeout, NL buffer alloc fail"); |
| 9524 | return; |
| 9525 | } |
| 9526 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 9527 | 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] | 9528 | { |
| 9529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9530 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 9531 | goto nla_put_failure; |
| 9532 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 9533 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9534 | { |
| 9535 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9536 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 9537 | goto nla_put_failure; |
| 9538 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 9539 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9540 | sizeof(tSirLPHBInd), lphbInd)) |
| 9541 | { |
| 9542 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9543 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 9544 | goto nla_put_failure; |
| 9545 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9546 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 9547 | return; |
| 9548 | |
| 9549 | nla_put_failure: |
| 9550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9551 | "NLA Put fail"); |
| 9552 | kfree_skb(skb); |
| 9553 | |
| 9554 | return; |
| 9555 | } |
| 9556 | #endif /* FEATURE_WLAN_LPHB */ |
| 9557 | |
| 9558 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 9559 | { |
| 9560 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 9561 | int err = 0; |
| 9562 | #ifdef FEATURE_WLAN_LPHB |
| 9563 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9564 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9565 | #endif /* FEATURE_WLAN_LPHB */ |
| 9566 | |
| 9567 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 9568 | if (err) |
| 9569 | { |
| 9570 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9571 | "%s Testmode INV ATTR", __func__); |
| 9572 | return err; |
| 9573 | } |
| 9574 | |
| 9575 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 9576 | { |
| 9577 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9578 | "%s Testmode INV CMD", __func__); |
| 9579 | return -EINVAL; |
| 9580 | } |
| 9581 | |
| 9582 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 9583 | { |
| 9584 | #ifdef FEATURE_WLAN_LPHB |
| 9585 | /* Low Power Heartbeat configuration request */ |
| 9586 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 9587 | { |
| 9588 | int buf_len; |
| 9589 | void *buf; |
| 9590 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 9591 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9592 | |
| 9593 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 9594 | { |
| 9595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9596 | "%s Testmode INV DATA", __func__); |
| 9597 | return -EINVAL; |
| 9598 | } |
| 9599 | |
| 9600 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 9601 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 9602 | |
| 9603 | hb_params_temp =(tSirLPHBReq *)buf; |
| 9604 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 9605 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 9606 | return -EINVAL; |
| 9607 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9608 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 9609 | if (NULL == hb_params) |
| 9610 | { |
| 9611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9612 | "%s Request Buffer Alloc Fail", __func__); |
| 9613 | return -EINVAL; |
| 9614 | } |
| 9615 | |
| 9616 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9617 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 9618 | hb_params, |
| 9619 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 9620 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9621 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 9622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9623 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9624 | vos_mem_free(hb_params); |
| 9625 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9626 | return 0; |
| 9627 | } |
| 9628 | #endif /* FEATURE_WLAN_LPHB */ |
| 9629 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9631 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9632 | return -EOPNOTSUPP; |
| 9633 | } |
| 9634 | |
| 9635 | return err; |
| 9636 | } |
| 9637 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 9638 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9639 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 9640 | struct net_device *dev, |
| 9641 | int idx, struct survey_info *survey) |
| 9642 | { |
| 9643 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9644 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9645 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9646 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9647 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9648 | v_S7_t snr,rssi; |
| 9649 | int status, i, j, filled = 0; |
| 9650 | |
| 9651 | ENTER(); |
| 9652 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9653 | if (NULL == pAdapter) |
| 9654 | { |
| 9655 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9656 | "%s: HDD adapter is Null", __func__); |
| 9657 | return -ENODEV; |
| 9658 | } |
| 9659 | |
| 9660 | if (NULL == wiphy) |
| 9661 | { |
| 9662 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9663 | "%s: wiphy is Null", __func__); |
| 9664 | return -ENODEV; |
| 9665 | } |
| 9666 | |
| 9667 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9668 | status = wlan_hdd_validate_context(pHddCtx); |
| 9669 | |
| 9670 | if (0 != status) |
| 9671 | { |
| 9672 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9673 | "%s: HDD context is not valid", __func__); |
| 9674 | return status; |
| 9675 | } |
| 9676 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9677 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9678 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9679 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 9680 | 0 != pAdapter->survey_idx || |
| 9681 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9682 | { |
| 9683 | /* The survey dump ops when implemented completely is expected to |
| 9684 | * return a survey of all channels and the ops is called by the |
| 9685 | * kernel with incremental values of the argument 'idx' till it |
| 9686 | * returns -ENONET. But we can only support the survey for the |
| 9687 | * operating channel for now. survey_idx is used to track |
| 9688 | * that the ops is called only once and then return -ENONET for |
| 9689 | * the next iteration |
| 9690 | */ |
| 9691 | pAdapter->survey_idx = 0; |
| 9692 | return -ENONET; |
| 9693 | } |
| 9694 | |
| 9695 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9696 | |
| 9697 | wlan_hdd_get_snr(pAdapter, &snr); |
| 9698 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 9699 | |
| 9700 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 9701 | hdd_wlan_get_freq(channel, &freq); |
| 9702 | |
| 9703 | |
| 9704 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 9705 | { |
| 9706 | if (NULL == wiphy->bands[i]) |
| 9707 | { |
| 9708 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 9709 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 9710 | continue; |
| 9711 | } |
| 9712 | |
| 9713 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 9714 | { |
| 9715 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 9716 | |
| 9717 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 9718 | { |
| 9719 | survey->channel = &band->channels[j]; |
| 9720 | /* The Rx BDs contain SNR values in dB for the received frames |
| 9721 | * while the supplicant expects noise. So we calculate and |
| 9722 | * return the value of noise (dBm) |
| 9723 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 9724 | */ |
| 9725 | survey->noise = rssi - snr; |
| 9726 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 9727 | filled = 1; |
| 9728 | } |
| 9729 | } |
| 9730 | } |
| 9731 | |
| 9732 | if (filled) |
| 9733 | pAdapter->survey_idx = 1; |
| 9734 | else |
| 9735 | { |
| 9736 | pAdapter->survey_idx = 0; |
| 9737 | return -ENONET; |
| 9738 | } |
| 9739 | |
| 9740 | return 0; |
| 9741 | } |
| 9742 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9743 | /* |
| 9744 | * FUNCTION: wlan_hdd_cfg80211_resume_wlan |
| 9745 | * this is called when cfg80211 driver resume |
| 9746 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 9747 | */ |
| 9748 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 9749 | { |
| 9750 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9751 | hdd_adapter_t *pAdapter; |
| 9752 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 9753 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 9754 | |
| 9755 | ENTER(); |
| 9756 | |
| 9757 | if ( NULL == pHddCtx ) |
| 9758 | { |
| 9759 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9760 | "%s: HddCtx validation failed", __func__); |
| 9761 | return 0; |
| 9762 | } |
| 9763 | |
| 9764 | if (pHddCtx->isLogpInProgress) |
| 9765 | { |
| 9766 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9767 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 9768 | return 0; |
| 9769 | } |
| 9770 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9771 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9772 | { |
| 9773 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9774 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 9775 | return 0; |
| 9776 | } |
| 9777 | |
| 9778 | spin_lock(&pHddCtx->schedScan_lock); |
| 9779 | pHddCtx->isWiphySuspended = FALSE; |
| 9780 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 9781 | { |
| 9782 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9783 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9784 | "%s: Return resume is not due to PNO indication", __func__); |
| 9785 | return 0; |
| 9786 | } |
| 9787 | // Reset flag to avoid updatating cfg80211 data old results again |
| 9788 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 9789 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9790 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9791 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9792 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 9793 | |
| 9794 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 9795 | { |
| 9796 | pAdapter = pAdapterNode->pAdapter; |
| 9797 | if ( (NULL != pAdapter) && |
| 9798 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 9799 | { |
| 9800 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9801 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9802 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 9803 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9804 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9805 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9806 | { |
| 9807 | /* Acquire wakelock to handle the case where APP's tries to |
| 9808 | * suspend immediately after updating the scan results. Whis |
| 9809 | * results in app's is in suspended state and not able to |
| 9810 | * process the connect request to AP |
| 9811 | */ |
| 9812 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9813 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9814 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9815 | |
| 9816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9817 | "%s : cfg80211 scan result database updated", __func__); |
| 9818 | |
| 9819 | return 0; |
| 9820 | |
| 9821 | } |
| 9822 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 9823 | pAdapterNode = pNext; |
| 9824 | } |
| 9825 | |
| 9826 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9827 | "%s: Failed to find Adapter", __func__); |
| 9828 | return 0; |
| 9829 | } |
| 9830 | |
| 9831 | /* |
| 9832 | * FUNCTION: wlan_hdd_cfg80211_suspend_wlan |
| 9833 | * this is called when cfg80211 driver suspends |
| 9834 | */ |
| 9835 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 9836 | struct cfg80211_wowlan *wow) |
| 9837 | { |
| 9838 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9839 | |
| 9840 | ENTER(); |
| 9841 | if (NULL == pHddCtx) |
| 9842 | { |
| 9843 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9844 | "%s: HddCtx validation failed", __func__); |
| 9845 | return 0; |
| 9846 | } |
| 9847 | |
| 9848 | pHddCtx->isWiphySuspended = TRUE; |
| 9849 | |
| 9850 | EXIT(); |
| 9851 | |
| 9852 | return 0; |
| 9853 | } |
| 9854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9855 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9856 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9857 | { |
| 9858 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 9859 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 9860 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 9861 | .change_station = wlan_hdd_change_station, |
| 9862 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9863 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 9864 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 9865 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9866 | #else |
| 9867 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 9868 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 9869 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9870 | #endif |
| 9871 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 9872 | .add_key = wlan_hdd_cfg80211_add_key, |
| 9873 | .get_key = wlan_hdd_cfg80211_get_key, |
| 9874 | .del_key = wlan_hdd_cfg80211_del_key, |
| 9875 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9876 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9877 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9878 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9879 | .scan = wlan_hdd_cfg80211_scan, |
| 9880 | .connect = wlan_hdd_cfg80211_connect, |
| 9881 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 9882 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 9883 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 9884 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 9885 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 9886 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9887 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 9888 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 9889 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9890 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9891 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 9892 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 9893 | .set_txq_params = wlan_hdd_set_txq_params, |
| 9894 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9895 | .get_station = wlan_hdd_cfg80211_get_station, |
| 9896 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 9897 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9898 | .add_station = wlan_hdd_cfg80211_add_station, |
| 9899 | #ifdef FEATURE_WLAN_LFR |
| 9900 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 9901 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 9902 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 9903 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9904 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 9905 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 9906 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9907 | #ifdef FEATURE_WLAN_TDLS |
| 9908 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 9909 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 9910 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9911 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 9912 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 9913 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9914 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 9915 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 9916 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 9917 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9918 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 9919 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9920 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 9921 | #ifdef WLAN_NL80211_TESTMODE |
| 9922 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 9923 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9924 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9925 | }; |
| 9926 | |