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 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 146 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 147 | /* |
| 148 | * Used to allocate the size of 4096 for the link layer stats. |
| 149 | * The size of 4096 is considered assuming that all data per |
| 150 | * respective event fit with in the limit.Please take a call |
| 151 | * on the limit based on the data requirements on link layer |
| 152 | * statistics. |
| 153 | */ |
| 154 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 155 | #endif |
| 156 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 157 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | { |
| 159 | WLAN_CIPHER_SUITE_WEP40, |
| 160 | WLAN_CIPHER_SUITE_WEP104, |
| 161 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 162 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 164 | WLAN_CIPHER_SUITE_KRK, |
| 165 | WLAN_CIPHER_SUITE_CCMP, |
| 166 | #else |
| 167 | WLAN_CIPHER_SUITE_CCMP, |
| 168 | #endif |
| 169 | #ifdef FEATURE_WLAN_WAPI |
| 170 | WLAN_CIPHER_SUITE_SMS4, |
| 171 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 172 | #ifdef WLAN_FEATURE_11W |
| 173 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 174 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | }; |
| 176 | |
| 177 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 178 | { |
| 179 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 180 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 181 | } |
| 182 | |
| 183 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 184 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 185 | HDD2GHZCHAN(2412, 1, 0) , |
| 186 | HDD2GHZCHAN(2417, 2, 0) , |
| 187 | HDD2GHZCHAN(2422, 3, 0) , |
| 188 | HDD2GHZCHAN(2427, 4, 0) , |
| 189 | HDD2GHZCHAN(2432, 5, 0) , |
| 190 | HDD2GHZCHAN(2437, 6, 0) , |
| 191 | HDD2GHZCHAN(2442, 7, 0) , |
| 192 | HDD2GHZCHAN(2447, 8, 0) , |
| 193 | HDD2GHZCHAN(2452, 9, 0) , |
| 194 | HDD2GHZCHAN(2457, 10, 0) , |
| 195 | HDD2GHZCHAN(2462, 11, 0) , |
| 196 | HDD2GHZCHAN(2467, 12, 0) , |
| 197 | HDD2GHZCHAN(2472, 13, 0) , |
| 198 | HDD2GHZCHAN(2484, 14, 0) , |
| 199 | }; |
| 200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 202 | { |
| 203 | HDD2GHZCHAN(2412, 1, 0) , |
| 204 | HDD2GHZCHAN(2437, 6, 0) , |
| 205 | HDD2GHZCHAN(2462, 11, 0) , |
| 206 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | |
| 208 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 209 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 210 | HDD5GHZCHAN(4920, 240, 0) , |
| 211 | HDD5GHZCHAN(4940, 244, 0) , |
| 212 | HDD5GHZCHAN(4960, 248, 0) , |
| 213 | HDD5GHZCHAN(4980, 252, 0) , |
| 214 | HDD5GHZCHAN(5040, 208, 0) , |
| 215 | HDD5GHZCHAN(5060, 212, 0) , |
| 216 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 217 | HDD5GHZCHAN(5180, 36, 0) , |
| 218 | HDD5GHZCHAN(5200, 40, 0) , |
| 219 | HDD5GHZCHAN(5220, 44, 0) , |
| 220 | HDD5GHZCHAN(5240, 48, 0) , |
| 221 | HDD5GHZCHAN(5260, 52, 0) , |
| 222 | HDD5GHZCHAN(5280, 56, 0) , |
| 223 | HDD5GHZCHAN(5300, 60, 0) , |
| 224 | HDD5GHZCHAN(5320, 64, 0) , |
| 225 | HDD5GHZCHAN(5500,100, 0) , |
| 226 | HDD5GHZCHAN(5520,104, 0) , |
| 227 | HDD5GHZCHAN(5540,108, 0) , |
| 228 | HDD5GHZCHAN(5560,112, 0) , |
| 229 | HDD5GHZCHAN(5580,116, 0) , |
| 230 | HDD5GHZCHAN(5600,120, 0) , |
| 231 | HDD5GHZCHAN(5620,124, 0) , |
| 232 | HDD5GHZCHAN(5640,128, 0) , |
| 233 | HDD5GHZCHAN(5660,132, 0) , |
| 234 | HDD5GHZCHAN(5680,136, 0) , |
| 235 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 236 | #ifdef FEATURE_WLAN_CH144 |
| 237 | HDD5GHZCHAN(5720,144, 0) , |
| 238 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 239 | HDD5GHZCHAN(5745,149, 0) , |
| 240 | HDD5GHZCHAN(5765,153, 0) , |
| 241 | HDD5GHZCHAN(5785,157, 0) , |
| 242 | HDD5GHZCHAN(5805,161, 0) , |
| 243 | HDD5GHZCHAN(5825,165, 0) , |
| 244 | }; |
| 245 | |
| 246 | static struct ieee80211_rate g_mode_rates[] = |
| 247 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 248 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 249 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 250 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 251 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 252 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 253 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 254 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 255 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 256 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 257 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 258 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 260 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | |
| 262 | static struct ieee80211_rate a_mode_rates[] = |
| 263 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 264 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 265 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 266 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 267 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 268 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 269 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 270 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 272 | }; |
| 273 | |
| 274 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 275 | { |
| 276 | .channels = hdd_channels_2_4_GHZ, |
| 277 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 278 | .band = IEEE80211_BAND_2GHZ, |
| 279 | .bitrates = g_mode_rates, |
| 280 | .n_bitrates = g_mode_rates_size, |
| 281 | .ht_cap.ht_supported = 1, |
| 282 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 283 | | IEEE80211_HT_CAP_GRN_FLD |
| 284 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 285 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 286 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 287 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 288 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 289 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 290 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 291 | }; |
| 292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 294 | { |
| 295 | .channels = hdd_social_channels_2_4_GHZ, |
| 296 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 297 | .band = IEEE80211_BAND_2GHZ, |
| 298 | .bitrates = g_mode_rates, |
| 299 | .n_bitrates = g_mode_rates_size, |
| 300 | .ht_cap.ht_supported = 1, |
| 301 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 302 | | IEEE80211_HT_CAP_GRN_FLD |
| 303 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 304 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 305 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 306 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 307 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 308 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 309 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 310 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | |
| 312 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 313 | { |
| 314 | .channels = hdd_channels_5_GHZ, |
| 315 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 316 | .band = IEEE80211_BAND_5GHZ, |
| 317 | .bitrates = a_mode_rates, |
| 318 | .n_bitrates = a_mode_rates_size, |
| 319 | .ht_cap.ht_supported = 1, |
| 320 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 321 | | IEEE80211_HT_CAP_GRN_FLD |
| 322 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 323 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 324 | | IEEE80211_HT_CAP_SGI_40 |
| 325 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 326 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 327 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 328 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 329 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 330 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 331 | }; |
| 332 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 333 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 334 | TX/RX direction for each kind of interface */ |
| 335 | static const struct ieee80211_txrx_stypes |
| 336 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 337 | [NL80211_IFTYPE_STATION] = { |
| 338 | .tx = 0xffff, |
| 339 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 340 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 341 | }, |
| 342 | [NL80211_IFTYPE_AP] = { |
| 343 | .tx = 0xffff, |
| 344 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 345 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 346 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 347 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 348 | BIT(SIR_MAC_MGMT_AUTH) | |
| 349 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 350 | BIT(SIR_MAC_MGMT_ACTION), |
| 351 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 352 | [NL80211_IFTYPE_ADHOC] = { |
| 353 | .tx = 0xffff, |
| 354 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 355 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 356 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 357 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 358 | BIT(SIR_MAC_MGMT_AUTH) | |
| 359 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 360 | BIT(SIR_MAC_MGMT_ACTION), |
| 361 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 363 | .tx = 0xffff, |
| 364 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 365 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 366 | }, |
| 367 | [NL80211_IFTYPE_P2P_GO] = { |
| 368 | /* This is also same as for SoftAP */ |
| 369 | .tx = 0xffff, |
| 370 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 371 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 372 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 373 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 374 | BIT(SIR_MAC_MGMT_AUTH) | |
| 375 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 376 | BIT(SIR_MAC_MGMT_ACTION), |
| 377 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | }; |
| 379 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 380 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 381 | static const struct ieee80211_iface_limit |
| 382 | wlan_hdd_iface_limit[] = { |
| 383 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 384 | /* max = 3 ; Our driver create two interfaces during driver init |
| 385 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 386 | * interface until a group is formed. In JB architecture, once the |
| 387 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 388 | * Client. |
| 389 | * When supplicant remove the group, it first issue a set interface |
| 390 | * cmd to change the mode back to Station. In JB this works fine as |
| 391 | * we advertize two station type interface during driver init. |
| 392 | * Some vendors create separate interface for P2P GO/Client, |
| 393 | * after group formation(Third one). But while group remove |
| 394 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 395 | * But as we advertized only two sta type interfaces nl80211 was |
| 396 | * returning error for the third one which was leading to failure in |
| 397 | * delete interface. Ideally while removing the group, supplicant |
| 398 | * should not try to change the 3rd interface mode to Station type. |
| 399 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 400 | * interface type to 3 |
| 401 | */ |
| 402 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 403 | .types = BIT(NL80211_IFTYPE_STATION), |
| 404 | }, |
| 405 | { |
| 406 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 407 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 408 | }, |
| 409 | { |
| 410 | .max = 1, |
| 411 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 412 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 413 | }, |
| 414 | }; |
| 415 | |
| 416 | /* By default, only single channel concurrency is allowed */ |
| 417 | static struct ieee80211_iface_combination |
| 418 | wlan_hdd_iface_combination = { |
| 419 | .limits = wlan_hdd_iface_limit, |
| 420 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 421 | /* |
| 422 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 423 | * and p2p0 interfaces during driver init |
| 424 | * Some vendors create separate interface for P2P operations. |
| 425 | * wlan0: STA interface |
| 426 | * p2p0: P2P Device interface, action frames goes |
| 427 | * through this interface. |
| 428 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 429 | * created for p2p operations(GO/CLIENT interface). |
| 430 | */ |
| 431 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 432 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 433 | .beacon_int_infra_match = false, |
| 434 | }; |
| 435 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 437 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 438 | |
| 439 | /* Data rate 100KBPS based on IE Index */ |
| 440 | struct index_data_rate_type |
| 441 | { |
| 442 | v_U8_t beacon_rate_index; |
| 443 | v_U16_t supported_rate[4]; |
| 444 | }; |
| 445 | |
| 446 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 447 | The IDX field is the rate index |
| 448 | The HI field is the rate when RSSI is strong or being ignored |
| 449 | (in this case we report actual rate) |
| 450 | The MID field is the rate when RSSI is moderate |
| 451 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 452 | The LO field is the rate when RSSI is low |
| 453 | (in this case we don't report rates, actual current rate used) |
| 454 | */ |
| 455 | static const struct |
| 456 | { |
| 457 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 458 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | } supported_data_rate[] = |
| 460 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 461 | /* IDX HI HM LM LO (RSSI-based index */ |
| 462 | {2, { 10, 10, 10, 0}}, |
| 463 | {4, { 20, 20, 10, 0}}, |
| 464 | {11, { 55, 20, 10, 0}}, |
| 465 | {12, { 60, 55, 20, 0}}, |
| 466 | {18, { 90, 55, 20, 0}}, |
| 467 | {22, {110, 55, 20, 0}}, |
| 468 | {24, {120, 90, 60, 0}}, |
| 469 | {36, {180, 120, 60, 0}}, |
| 470 | {44, {220, 180, 60, 0}}, |
| 471 | {48, {240, 180, 90, 0}}, |
| 472 | {66, {330, 180, 90, 0}}, |
| 473 | {72, {360, 240, 90, 0}}, |
| 474 | {96, {480, 240, 120, 0}}, |
| 475 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | }; |
| 477 | |
| 478 | /* MCS Based rate table */ |
| 479 | static struct index_data_rate_type supported_mcs_rate[] = |
| 480 | { |
| 481 | /* MCS L20 L40 S20 S40 */ |
| 482 | {0, {65, 135, 72, 150}}, |
| 483 | {1, {130, 270, 144, 300}}, |
| 484 | {2, {195, 405, 217, 450}}, |
| 485 | {3, {260, 540, 289, 600}}, |
| 486 | {4, {390, 810, 433, 900}}, |
| 487 | {5, {520, 1080, 578, 1200}}, |
| 488 | {6, {585, 1215, 650, 1350}}, |
| 489 | {7, {650, 1350, 722, 1500}} |
| 490 | }; |
| 491 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 492 | #ifdef WLAN_FEATURE_11AC |
| 493 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 494 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 495 | |
| 496 | struct index_vht_data_rate_type |
| 497 | { |
| 498 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 499 | v_U16_t supported_VHT80_rate[2]; |
| 500 | v_U16_t supported_VHT40_rate[2]; |
| 501 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 502 | }; |
| 503 | |
| 504 | typedef enum |
| 505 | { |
| 506 | DATA_RATE_11AC_MAX_MCS_7, |
| 507 | DATA_RATE_11AC_MAX_MCS_8, |
| 508 | DATA_RATE_11AC_MAX_MCS_9, |
| 509 | DATA_RATE_11AC_MAX_MCS_NA |
| 510 | } eDataRate11ACMaxMcs; |
| 511 | |
| 512 | /* MCS Based VHT rate table */ |
| 513 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 514 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 515 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 516 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 517 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 518 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 519 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 520 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 521 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 522 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 523 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 524 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 525 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 526 | }; |
| 527 | #endif /* WLAN_FEATURE_11AC */ |
| 528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | extern struct net_device_ops net_ops_struct; |
| 530 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 531 | #ifdef WLAN_NL80211_TESTMODE |
| 532 | enum wlan_hdd_tm_attr |
| 533 | { |
| 534 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 535 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 536 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 537 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 538 | /* keep last */ |
| 539 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 540 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 541 | }; |
| 542 | |
| 543 | enum wlan_hdd_tm_cmd |
| 544 | { |
| 545 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 546 | }; |
| 547 | |
| 548 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 549 | |
| 550 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 551 | { |
| 552 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 553 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 554 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 555 | }; |
| 556 | #endif /* WLAN_NL80211_TESTMODE */ |
| 557 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 558 | #ifdef FEATURE_WLAN_CH_AVOID |
| 559 | /* |
| 560 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 561 | * This is called when wlan driver needs to send vendor specific |
| 562 | * avoid frequency range event to userspace |
| 563 | */ |
| 564 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 565 | tHddAvoidFreqList *pAvoidFreqList) |
| 566 | { |
| 567 | struct sk_buff *vendor_event; |
| 568 | |
| 569 | ENTER(); |
| 570 | |
| 571 | if (!pHddCtx) |
| 572 | { |
| 573 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 574 | "%s: HDD context is null", __func__); |
| 575 | return -1; |
| 576 | } |
| 577 | |
| 578 | if (!pAvoidFreqList) |
| 579 | { |
| 580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 581 | "%s: pAvoidFreqList is null", __func__); |
| 582 | return -1; |
| 583 | } |
| 584 | |
| 585 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 586 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 587 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 588 | GFP_KERNEL); |
| 589 | if (!vendor_event) |
| 590 | { |
| 591 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 592 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 593 | return -1; |
| 594 | } |
| 595 | |
| 596 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 597 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 598 | |
| 599 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 600 | |
| 601 | EXIT(); |
| 602 | return 0; |
| 603 | } |
| 604 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 605 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 606 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 607 | |
| 608 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 609 | struct sk_buff *vendor_event) |
| 610 | { |
| 611 | if (nla_put_u8(vendor_event, |
| 612 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 613 | stats->rate.preamble) || |
| 614 | nla_put_u8(vendor_event, |
| 615 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 616 | stats->rate.nss) || |
| 617 | nla_put_u8(vendor_event, |
| 618 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 619 | stats->rate.bw) || |
| 620 | nla_put_u8(vendor_event, |
| 621 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 622 | stats->rate.rateMcsIdx) || |
| 623 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 624 | stats->rate.bitrate ) || |
| 625 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 626 | stats->txMpdu ) || |
| 627 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 628 | stats->rxMpdu ) || |
| 629 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 630 | stats->mpduLost ) || |
| 631 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 632 | stats->retries) || |
| 633 | nla_put_u32(vendor_event, |
| 634 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 635 | stats->retriesShort ) || |
| 636 | nla_put_u32(vendor_event, |
| 637 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 638 | stats->retriesLong)) |
| 639 | { |
| 640 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 641 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 642 | return FALSE; |
| 643 | } |
| 644 | return TRUE; |
| 645 | } |
| 646 | |
| 647 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 648 | struct sk_buff *vendor_event) |
| 649 | { |
| 650 | u32 i = 0; |
| 651 | struct nlattr *rateInfo; |
| 652 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 653 | stats->type) || |
| 654 | nla_put(vendor_event, |
| 655 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 656 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 657 | nla_put_u32(vendor_event, |
| 658 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 659 | stats->capabilities) || |
| 660 | nla_put_u32(vendor_event, |
| 661 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 662 | stats->numRate)) |
| 663 | { |
| 664 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 665 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 666 | goto error; |
| 667 | } |
| 668 | |
| 669 | rateInfo = nla_nest_start(vendor_event, |
| 670 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
| 671 | for (i = 0; i < stats->numRate; i++) |
| 672 | { |
| 673 | struct nlattr *rates; |
| 674 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 675 | stats->rateStats + |
| 676 | (i * sizeof(tSirWifiRateStat))); |
| 677 | rates = nla_nest_start(vendor_event, i); |
| 678 | |
| 679 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 680 | { |
| 681 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 682 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 683 | return FALSE; |
| 684 | } |
| 685 | nla_nest_end(vendor_event, rates); |
| 686 | } |
| 687 | nla_nest_end(vendor_event, rateInfo); |
| 688 | |
| 689 | return TRUE; |
| 690 | error: |
| 691 | return FALSE; |
| 692 | } |
| 693 | |
| 694 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 695 | struct sk_buff *vendor_event) |
| 696 | { |
| 697 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 698 | stats->ac ) || |
| 699 | nla_put_u32(vendor_event, |
| 700 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 701 | stats->txMpdu ) || |
| 702 | nla_put_u32(vendor_event, |
| 703 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 704 | stats->rxMpdu ) || |
| 705 | nla_put_u32(vendor_event, |
| 706 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 707 | stats->txMcast ) || |
| 708 | nla_put_u32(vendor_event, |
| 709 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 710 | stats->rxMcast ) || |
| 711 | nla_put_u32(vendor_event, |
| 712 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 713 | stats->rxAmpdu ) || |
| 714 | nla_put_u32(vendor_event, |
| 715 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 716 | stats->txAmpdu ) || |
| 717 | nla_put_u32(vendor_event, |
| 718 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 719 | stats->mpduLost )|| |
| 720 | nla_put_u32(vendor_event, |
| 721 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 722 | stats->retries ) || |
| 723 | nla_put_u32(vendor_event, |
| 724 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 725 | stats->retriesShort ) || |
| 726 | nla_put_u32(vendor_event, |
| 727 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 728 | stats->retriesLong ) || |
| 729 | nla_put_u32(vendor_event, |
| 730 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 731 | stats->contentionTimeMin ) || |
| 732 | nla_put_u32(vendor_event, |
| 733 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 734 | stats->contentionTimeMax ) || |
| 735 | nla_put_u32(vendor_event, |
| 736 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 737 | stats->contentionTimeAvg ) || |
| 738 | nla_put_u32(vendor_event, |
| 739 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 740 | stats->contentionNumSamples )) |
| 741 | { |
| 742 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 743 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 744 | return FALSE; |
| 745 | } |
| 746 | return TRUE; |
| 747 | } |
| 748 | |
| 749 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 750 | struct sk_buff *vendor_event) |
| 751 | { |
| 752 | if (nla_put_u32(vendor_event, |
| 753 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 754 | nla_put(vendor_event, |
| 755 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 756 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 757 | nla_put_u32(vendor_event, |
| 758 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 759 | stats->state ) || |
| 760 | nla_put_u32(vendor_event, |
| 761 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 762 | stats->roaming ) || |
| 763 | nla_put_u32(vendor_event, |
| 764 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 765 | stats->capabilities ) || |
| 766 | nla_put(vendor_event, |
| 767 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 768 | strlen(stats->ssid), stats->ssid) || |
| 769 | nla_put(vendor_event, |
| 770 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 771 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 772 | nla_put(vendor_event, |
| 773 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 774 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 775 | nla_put(vendor_event, |
| 776 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 777 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 778 | ) |
| 779 | { |
| 780 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 781 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 782 | return FALSE; |
| 783 | } |
| 784 | return TRUE; |
| 785 | } |
| 786 | |
| 787 | static v_BOOL_t put_wifi_iface_stats(tpSirWifiIfaceStat pWifiIfaceStat, |
| 788 | struct sk_buff *vendor_event) |
| 789 | { |
| 790 | int i = 0; |
| 791 | struct nlattr *wmmInfo; |
| 792 | if (FALSE == put_wifi_interface_info( |
| 793 | &pWifiIfaceStat->info, |
| 794 | vendor_event)) |
| 795 | { |
| 796 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 797 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 798 | return FALSE; |
| 799 | |
| 800 | } |
| 801 | |
| 802 | if (nla_put_u32(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 804 | pWifiIfaceStat->beaconRx) || |
| 805 | nla_put_u32(vendor_event, |
| 806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 807 | pWifiIfaceStat->mgmtRx) || |
| 808 | nla_put_u32(vendor_event, |
| 809 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 810 | pWifiIfaceStat->mgmtActionRx) || |
| 811 | nla_put_u32(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 813 | pWifiIfaceStat->mgmtActionTx) || |
| 814 | nla_put_u32(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 816 | pWifiIfaceStat->rssiMgmt) || |
| 817 | nla_put_u32(vendor_event, |
| 818 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 819 | pWifiIfaceStat->rssiData) || |
| 820 | nla_put_u32(vendor_event, |
| 821 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 822 | pWifiIfaceStat->rssiAck)) |
| 823 | { |
| 824 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 825 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 826 | return FALSE; |
| 827 | } |
| 828 | |
| 829 | wmmInfo = nla_nest_start(vendor_event, |
| 830 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
| 831 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 832 | { |
| 833 | struct nlattr *wmmStats; |
| 834 | wmmStats = nla_nest_start(vendor_event, i); |
| 835 | if (FALSE == put_wifi_wmm_ac_stat( |
| 836 | &pWifiIfaceStat->AccessclassStats[i], |
| 837 | vendor_event)) |
| 838 | { |
| 839 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 840 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
| 841 | return FALSE; |
| 842 | } |
| 843 | |
| 844 | nla_nest_end(vendor_event, wmmStats); |
| 845 | } |
| 846 | nla_nest_end(vendor_event, wmmInfo); |
| 847 | return TRUE; |
| 848 | } |
| 849 | |
| 850 | static tSirWifiInterfaceMode |
| 851 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 852 | { |
| 853 | switch (deviceMode) |
| 854 | { |
| 855 | case WLAN_HDD_INFRA_STATION: |
| 856 | return WIFI_INTERFACE_STA; |
| 857 | case WLAN_HDD_SOFTAP: |
| 858 | return WIFI_INTERFACE_SOFTAP; |
| 859 | case WLAN_HDD_P2P_CLIENT: |
| 860 | return WIFI_INTERFACE_P2P_CLIENT; |
| 861 | case WLAN_HDD_P2P_GO: |
| 862 | return WIFI_INTERFACE_P2P_GO; |
| 863 | case WLAN_HDD_IBSS: |
| 864 | return WIFI_INTERFACE_IBSS; |
| 865 | default: |
| 866 | /* Return Interface Mode as STA for all the unsupported modes */ |
| 867 | return WIFI_INTERFACE_STA; |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 872 | tpSirWifiInterfaceInfo pInfo) |
| 873 | { |
| 874 | v_U8_t *staMac = NULL; |
| 875 | hdd_station_ctx_t *pHddStaCtx; |
| 876 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 877 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 878 | |
| 879 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 880 | |
| 881 | vos_mem_copy(pInfo->macAddr, |
| 882 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 883 | |
| 884 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 885 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 886 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 887 | { |
| 888 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 889 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 890 | { |
| 891 | pInfo->state = WIFI_DISCONNECTED; |
| 892 | } |
| 893 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 894 | { |
| 895 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 896 | "%s: Session ID %d, Connection is in progress", __func__, |
| 897 | pAdapter->sessionId); |
| 898 | pInfo->state = WIFI_ASSOCIATING; |
| 899 | } |
| 900 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 901 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 902 | { |
| 903 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 904 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 905 | "%s: client " MAC_ADDRESS_STR |
| 906 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 907 | MAC_ADDR_ARRAY(staMac)); |
| 908 | pInfo->state = WIFI_AUTHENTICATING; |
| 909 | } |
| 910 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 911 | { |
| 912 | pInfo->state = WIFI_ASSOCIATED; |
| 913 | vos_mem_copy(pInfo->bssid, |
| 914 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 915 | vos_mem_copy(pInfo->ssid, |
| 916 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 917 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 918 | //NULL Terminate the string. |
| 919 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 920 | } |
| 921 | } |
| 922 | vos_mem_copy(pInfo->countryStr, |
| 923 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 924 | |
| 925 | vos_mem_copy(pInfo->apCountryStr, |
| 926 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 927 | |
| 928 | return TRUE; |
| 929 | } |
| 930 | |
| 931 | /* |
| 932 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 933 | * receiving Link Layer Peer statistics from FW.This function converts |
| 934 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 935 | * layers. |
| 936 | */ |
| 937 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 938 | v_VOID_t *pData) |
| 939 | { |
| 940 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 941 | tpSirWifiRateStat pWifiRateStat; |
| 942 | tpSirWifiPeerStat pWifiPeerStat; |
| 943 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 944 | struct nlattr *peerInfo; |
| 945 | struct sk_buff *vendor_event; |
| 946 | int status, i; |
| 947 | |
| 948 | status = wlan_hdd_validate_context(pHddCtx); |
| 949 | if (0 != status) |
| 950 | { |
| 951 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 952 | FL("HDD context is not valid") ); |
| 953 | return; |
| 954 | } |
| 955 | |
| 956 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 957 | |
| 958 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 959 | "LL_STATS_PEER_ALL : numPeers %u", |
| 960 | pWifiPeerStat->numPeers); |
| 961 | { |
| 962 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 963 | { |
| 964 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 965 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 966 | ( i * sizeof(tSirWifiPeerInfo))); |
| 967 | |
| 968 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 969 | " %d) LL_STATS Channel Stats " |
| 970 | " Peer Type %u " |
| 971 | " peerMacAddress %pM " |
| 972 | " capabilities 0x%x " |
| 973 | " numRate %u ", |
| 974 | i, |
| 975 | pWifiPeerInfo->type, |
| 976 | pWifiPeerInfo->peerMacAddress, |
| 977 | pWifiPeerInfo->capabilities, |
| 978 | pWifiPeerInfo->numRate); |
| 979 | { |
| 980 | int j; |
| 981 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 982 | { |
| 983 | pWifiRateStat = (tpSirWifiRateStat) |
| 984 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 985 | ( j * sizeof(tSirWifiRateStat))); |
| 986 | |
| 987 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 988 | " peer Rate Stats " |
| 989 | " preamble %u " |
| 990 | " nss %u " |
| 991 | " bw %u " |
| 992 | " rateMcsIdx %u " |
| 993 | " reserved %u " |
| 994 | " bitrate %u " |
| 995 | " txMpdu %u " |
| 996 | " rxMpdu %u " |
| 997 | " mpduLost %u " |
| 998 | " retries %u " |
| 999 | " retriesShort %u " |
| 1000 | " retriesLong %u", |
| 1001 | pWifiRateStat->rate.preamble, |
| 1002 | pWifiRateStat->rate.nss, |
| 1003 | pWifiRateStat->rate.bw, |
| 1004 | pWifiRateStat->rate.rateMcsIdx, |
| 1005 | pWifiRateStat->rate.reserved, |
| 1006 | pWifiRateStat->rate.bitrate, |
| 1007 | pWifiRateStat->txMpdu, |
| 1008 | pWifiRateStat->rxMpdu, |
| 1009 | pWifiRateStat->mpduLost, |
| 1010 | pWifiRateStat->retries, |
| 1011 | pWifiRateStat->retriesShort, |
| 1012 | pWifiRateStat->retriesLong); |
| 1013 | } |
| 1014 | } |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | /* |
| 1019 | * Allocate a size of 4096 for the peer stats comprising |
| 1020 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1021 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1022 | * NL attribute.The size of 4096 is considered assuming |
| 1023 | * that number of rates shall not exceed beyond 50 with |
| 1024 | * the sizeof (tSirWifiRateStat) being 32. |
| 1025 | */ |
| 1026 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1027 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1028 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1029 | GFP_KERNEL); |
| 1030 | if (!vendor_event) |
| 1031 | { |
| 1032 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1033 | "%s: cfg80211_vendor_event_alloc failed", |
| 1034 | __func__); |
| 1035 | return; |
| 1036 | } |
| 1037 | if (nla_put_u32(vendor_event, |
| 1038 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1039 | pWifiPeerStat->numPeers)) |
| 1040 | { |
| 1041 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1042 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1043 | kfree_skb(vendor_event); |
| 1044 | return; |
| 1045 | } |
| 1046 | |
| 1047 | peerInfo = nla_nest_start(vendor_event, |
| 1048 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
| 1049 | |
| 1050 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1051 | pWifiPeerStat->peerInfo); |
| 1052 | |
| 1053 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1054 | { |
| 1055 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
| 1056 | int numRate = pWifiPeerInfo->numRate; |
| 1057 | |
| 1058 | if (FALSE == put_wifi_peer_info( |
| 1059 | pWifiPeerInfo, vendor_event)) |
| 1060 | { |
| 1061 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1062 | "%s: put_wifi_peer_info put fail", __func__); |
| 1063 | kfree_skb(vendor_event); |
| 1064 | return; |
| 1065 | } |
| 1066 | |
| 1067 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1068 | pWifiPeerStat->peerInfo + |
| 1069 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1070 | (numRate * sizeof (tSirWifiRateStat))); |
| 1071 | nla_nest_end(vendor_event, peers); |
| 1072 | } |
| 1073 | nla_nest_end(vendor_event, peerInfo); |
| 1074 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1075 | } |
| 1076 | |
| 1077 | /* |
| 1078 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1079 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1080 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1081 | * layers. |
| 1082 | */ |
| 1083 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1084 | v_VOID_t *pData) |
| 1085 | { |
| 1086 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1087 | struct sk_buff *vendor_event; |
| 1088 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1089 | int status; |
| 1090 | |
| 1091 | status = wlan_hdd_validate_context(pHddCtx); |
| 1092 | if (0 != status) |
| 1093 | { |
| 1094 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1095 | FL("HDD context is not valid") ); |
| 1096 | return; |
| 1097 | } |
| 1098 | /* |
| 1099 | * Allocate a size of 4096 for the interface stats comprising |
| 1100 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1101 | * assuming that all these fit with in the limit.Please take |
| 1102 | * a call on the limit based on the data requirements on |
| 1103 | * interface statistics. |
| 1104 | */ |
| 1105 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1106 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1107 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1108 | GFP_KERNEL); |
| 1109 | if (!vendor_event) |
| 1110 | { |
| 1111 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1112 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1113 | return; |
| 1114 | } |
| 1115 | |
| 1116 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1117 | |
| 1118 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1119 | "WMI_LINK_STATS_IFACE Data"); |
| 1120 | |
| 1121 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1122 | "LL_STATS_IFACE: " |
| 1123 | " Mode %u " |
| 1124 | " MAC %pM " |
| 1125 | " State %u " |
| 1126 | " Roaming %u " |
| 1127 | " capabilities 0x%x " |
| 1128 | " SSID %s " |
| 1129 | " BSSID %pM", |
| 1130 | pWifiIfaceStat->info.mode, |
| 1131 | pWifiIfaceStat->info.macAddr, |
| 1132 | pWifiIfaceStat->info.state, |
| 1133 | pWifiIfaceStat->info.roaming, |
| 1134 | pWifiIfaceStat->info.capabilities, |
| 1135 | pWifiIfaceStat->info.ssid, |
| 1136 | pWifiIfaceStat->info.bssid); |
| 1137 | |
| 1138 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1139 | " AP country str: %c%c%c", |
| 1140 | pWifiIfaceStat->info.apCountryStr[0], |
| 1141 | pWifiIfaceStat->info.apCountryStr[1], |
| 1142 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1143 | |
| 1144 | |
| 1145 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1146 | " Country Str Association: %c%c%c", |
| 1147 | pWifiIfaceStat->info.countryStr[0], |
| 1148 | pWifiIfaceStat->info.countryStr[1], |
| 1149 | pWifiIfaceStat->info.countryStr[2]); |
| 1150 | |
| 1151 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1152 | " beaconRx %u " |
| 1153 | " mgmtRx %u " |
| 1154 | " mgmtActionRx %u " |
| 1155 | " mgmtActionTx %u " |
| 1156 | " rssiMgmt %u " |
| 1157 | " rssiData %u " |
| 1158 | " rssiAck %u", |
| 1159 | pWifiIfaceStat->beaconRx, |
| 1160 | pWifiIfaceStat->mgmtRx, |
| 1161 | pWifiIfaceStat->mgmtActionRx, |
| 1162 | pWifiIfaceStat->mgmtActionTx, |
| 1163 | pWifiIfaceStat->rssiMgmt, |
| 1164 | pWifiIfaceStat->rssiData, |
| 1165 | pWifiIfaceStat->rssiAck ); |
| 1166 | |
| 1167 | |
| 1168 | { |
| 1169 | int i; |
| 1170 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1171 | { |
| 1172 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1173 | |
| 1174 | " %d) LL_STATS IFACE: " |
| 1175 | " ac: %u txMpdu: %u " |
| 1176 | " rxMpdu: %u txMcast: %u " |
| 1177 | " rxMcast: %u rxAmpdu: %u " |
| 1178 | " txAmpdu: %u mpduLost: %u " |
| 1179 | " retries: %u retriesShort: %u " |
| 1180 | " retriesLong: %u contentionTimeMin: %u " |
| 1181 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1182 | " contentionNumSamples: %u", |
| 1183 | i, |
| 1184 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1185 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1186 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1187 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1188 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1189 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1190 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1191 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1192 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1193 | pWifiIfaceStat-> |
| 1194 | AccessclassStats[i].retriesShort, |
| 1195 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1196 | pWifiIfaceStat-> |
| 1197 | AccessclassStats[i].contentionTimeMin, |
| 1198 | pWifiIfaceStat-> |
| 1199 | AccessclassStats[i].contentionTimeMax, |
| 1200 | pWifiIfaceStat-> |
| 1201 | AccessclassStats[i].contentionTimeAvg, |
| 1202 | pWifiIfaceStat-> |
| 1203 | AccessclassStats[i].contentionNumSamples); |
| 1204 | |
| 1205 | } |
| 1206 | } |
| 1207 | |
| 1208 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1209 | &pWifiIfaceStat->info)) |
| 1210 | { |
| 1211 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1212 | FL("hdd_get_interface_info get fail") ); |
| 1213 | kfree_skb(vendor_event); |
| 1214 | return; |
| 1215 | } |
| 1216 | |
| 1217 | if (FALSE == put_wifi_iface_stats( pWifiIfaceStat, |
| 1218 | vendor_event)) |
| 1219 | { |
| 1220 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1221 | FL("put_wifi_iface_stats fail") ); |
| 1222 | kfree_skb(vendor_event); |
| 1223 | return; |
| 1224 | } |
| 1225 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1226 | } |
| 1227 | |
| 1228 | /* |
| 1229 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1230 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1231 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1232 | * layers. |
| 1233 | */ |
| 1234 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1235 | v_VOID_t *pData) |
| 1236 | { |
| 1237 | int status, i; |
| 1238 | tpSirWifiRadioStat pWifiRadioStat; |
| 1239 | tpSirWifiChannelStats pWifiChannelStats; |
| 1240 | struct sk_buff *vendor_event; |
| 1241 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1242 | struct nlattr *chList; |
| 1243 | |
| 1244 | status = wlan_hdd_validate_context(pHddCtx); |
| 1245 | if (0 != status) |
| 1246 | { |
| 1247 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1248 | FL("HDD context is not valid") ); |
| 1249 | return; |
| 1250 | } |
| 1251 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1252 | |
| 1253 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1254 | "LL_STATS_RADIO" |
| 1255 | " radio is %d onTime is %u " |
| 1256 | " txTime is %u rxTime is %u " |
| 1257 | " onTimeScan is %u onTimeNbd is %u " |
| 1258 | " onTimeGscan is %u onTimeRoamScan is %u " |
| 1259 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1260 | " numChannels is %u", |
| 1261 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1262 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1263 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
| 1264 | pWifiRadioStat->onTimeGscan, |
| 1265 | pWifiRadioStat->onTimeRoamScan, |
| 1266 | pWifiRadioStat->onTimePnoScan, |
| 1267 | pWifiRadioStat->onTimeHs20, |
| 1268 | pWifiRadioStat->numChannels); |
| 1269 | /* |
| 1270 | * Allocate a size of 4096 for the Radio stats comprising |
| 1271 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1272 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1273 | * NL attribute.The size of 4096 is considered assuming that |
| 1274 | * number of channels shall not exceed beyond 60 with the |
| 1275 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1276 | */ |
| 1277 | |
| 1278 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1279 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1280 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1281 | GFP_KERNEL); |
| 1282 | |
| 1283 | if (!vendor_event) |
| 1284 | { |
| 1285 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1286 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1287 | return; |
| 1288 | } |
| 1289 | |
| 1290 | if (nla_put_u32(vendor_event, |
| 1291 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1292 | pWifiRadioStat->radio) || |
| 1293 | nla_put_u32(vendor_event, |
| 1294 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1295 | pWifiRadioStat->onTime) || |
| 1296 | nla_put_u32(vendor_event, |
| 1297 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1298 | pWifiRadioStat->txTime) || |
| 1299 | nla_put_u32(vendor_event, |
| 1300 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1301 | pWifiRadioStat->rxTime) || |
| 1302 | nla_put_u32(vendor_event, |
| 1303 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1304 | pWifiRadioStat->onTimeScan) || |
| 1305 | nla_put_u32(vendor_event, |
| 1306 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1307 | pWifiRadioStat->onTimeNbd) || |
| 1308 | nla_put_u32(vendor_event, |
| 1309 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_GSCAN, |
| 1310 | pWifiRadioStat->onTimeGscan)|| |
| 1311 | nla_put_u32(vendor_event, |
| 1312 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1313 | pWifiRadioStat->onTimeRoamScan) || |
| 1314 | nla_put_u32(vendor_event, |
| 1315 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1316 | pWifiRadioStat->onTimePnoScan) || |
| 1317 | nla_put_u32(vendor_event, |
| 1318 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1319 | pWifiRadioStat->onTimeHs20) || |
| 1320 | nla_put_u32(vendor_event, |
| 1321 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1322 | pWifiRadioStat->numChannels)) |
| 1323 | { |
| 1324 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1325 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1326 | kfree_skb(vendor_event); |
| 1327 | return ; |
| 1328 | } |
| 1329 | |
| 1330 | chList = nla_nest_start(vendor_event, |
| 1331 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
| 1332 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1333 | { |
| 1334 | struct nlattr *chInfo; |
| 1335 | |
| 1336 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1337 | pWifiRadioStat->channels + |
| 1338 | (i * sizeof(tSirWifiChannelStats))); |
| 1339 | |
| 1340 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1341 | " %d) Channel Info" |
| 1342 | " width is %u " |
| 1343 | " CenterFreq %u " |
| 1344 | " CenterFreq0 %u " |
| 1345 | " CenterFreq1 %u " |
| 1346 | " onTime %u " |
| 1347 | " ccaBusyTime %u", |
| 1348 | i, |
| 1349 | pWifiChannelStats->channel.width, |
| 1350 | pWifiChannelStats->channel.centerFreq, |
| 1351 | pWifiChannelStats->channel.centerFreq0, |
| 1352 | pWifiChannelStats->channel.centerFreq1, |
| 1353 | pWifiChannelStats->onTime, |
| 1354 | pWifiChannelStats->ccaBusyTime); |
| 1355 | |
| 1356 | |
| 1357 | chInfo = nla_nest_start(vendor_event, i); |
| 1358 | |
| 1359 | if (nla_put_u32(vendor_event, |
| 1360 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1361 | pWifiChannelStats->channel.width) || |
| 1362 | nla_put_u32(vendor_event, |
| 1363 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1364 | pWifiChannelStats->channel.centerFreq) || |
| 1365 | nla_put_u32(vendor_event, |
| 1366 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1367 | pWifiChannelStats->channel.centerFreq0) || |
| 1368 | nla_put_u32(vendor_event, |
| 1369 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1370 | pWifiChannelStats->channel.centerFreq1) || |
| 1371 | nla_put_u32(vendor_event, |
| 1372 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1373 | pWifiChannelStats->onTime) || |
| 1374 | nla_put_u32(vendor_event, |
| 1375 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1376 | pWifiChannelStats->ccaBusyTime)) |
| 1377 | { |
| 1378 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1379 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1380 | kfree_skb(vendor_event); |
| 1381 | return ; |
| 1382 | } |
| 1383 | nla_nest_end(vendor_event, chInfo); |
| 1384 | } |
| 1385 | nla_nest_end(vendor_event, chList); |
| 1386 | |
| 1387 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1388 | return; |
| 1389 | } |
| 1390 | |
| 1391 | /* |
| 1392 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1393 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1394 | * data to the NL data and send the same to the kernel/upper layers. |
| 1395 | */ |
| 1396 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1397 | int indType, |
| 1398 | void *pRsp ) |
| 1399 | { |
| 1400 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCtx; |
| 1401 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1402 | int status; |
| 1403 | |
| 1404 | status = wlan_hdd_validate_context(pHddCtx); |
| 1405 | |
| 1406 | if (0 != status) |
| 1407 | { |
| 1408 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1409 | FL("HDD context is not valid")); |
| 1410 | return; |
| 1411 | } |
| 1412 | |
| 1413 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1414 | "%s: Link Layer Indication indType: %d", __func__, indType); |
| 1415 | switch (indType) |
| 1416 | { |
| 1417 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1418 | { |
| 1419 | tpSirLLStatsResults linkLayerStatsResults = |
| 1420 | (tpSirLLStatsResults)pRsp; |
| 1421 | |
| 1422 | |
| 1423 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1424 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1425 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1426 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1427 | linkLayerStatsResults->paramId); |
| 1428 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1429 | "LL_STATS RESULTS RESPONSE ifaceId = %u", |
| 1430 | linkLayerStatsResults->ifaceId); |
| 1431 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1432 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1433 | linkLayerStatsResults->respId); |
| 1434 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1435 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1436 | linkLayerStatsResults->moreResultToFollow); |
| 1437 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1438 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1439 | linkLayerStatsResults->result); |
| 1440 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1441 | { |
| 1442 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1443 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1444 | } |
| 1445 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1446 | { |
| 1447 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1448 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1449 | } |
| 1450 | else if ( linkLayerStatsResults->paramId & |
| 1451 | WMI_LINK_STATS_ALL_PEER ) |
| 1452 | { |
| 1453 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1454 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1455 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1456 | else |
| 1457 | { |
| 1458 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1459 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1460 | } |
| 1461 | |
| 1462 | break; |
| 1463 | } |
| 1464 | default: |
| 1465 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1466 | break; |
| 1467 | } |
| 1468 | return; |
| 1469 | } |
| 1470 | |
| 1471 | const struct |
| 1472 | nla_policy |
| 1473 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1474 | { |
| 1475 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1476 | { .type = NLA_U32 }, |
| 1477 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1478 | { .type = NLA_U32 }, |
| 1479 | }; |
| 1480 | |
| 1481 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1482 | struct wireless_dev *wdev, |
| 1483 | void *data, |
| 1484 | int data_len) |
| 1485 | { |
| 1486 | int status; |
| 1487 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1]; |
| 1488 | tpSirLLStatsSetReq pLinkLayerStatsSetReq; |
| 1489 | struct net_device *dev = wdev->netdev; |
| 1490 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1491 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1492 | |
| 1493 | status = wlan_hdd_validate_context(pHddCtx); |
| 1494 | if (0 != status) |
| 1495 | { |
| 1496 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1497 | FL("HDD context is not valid")); |
| 1498 | return -EINVAL; |
| 1499 | } |
| 1500 | |
| 1501 | if (NULL == pAdapter) |
| 1502 | { |
| 1503 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1504 | FL("HDD adapter is Null")); |
| 1505 | return -ENODEV; |
| 1506 | } |
| 1507 | |
| 1508 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1509 | (struct nlattr *)data, |
| 1510 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1511 | { |
| 1512 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1513 | return -EINVAL; |
| 1514 | } |
| 1515 | if (!tb_vendor |
| 1516 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1517 | { |
| 1518 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1519 | return -EINVAL; |
| 1520 | } |
| 1521 | if (!tb_vendor[ |
| 1522 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1523 | { |
| 1524 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1525 | return -EINVAL; |
| 1526 | } |
| 1527 | pLinkLayerStatsSetReq = vos_mem_malloc(sizeof(tSirLLStatsSetReq)); |
| 1528 | if (NULL == pLinkLayerStatsSetReq) |
| 1529 | { |
| 1530 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1531 | FL(" Unable to allocate memory to pLinkLayerStatsSetReq") ); |
| 1532 | return -ENOMEM; |
| 1533 | } |
| 1534 | // Shall take the request Id if the Upper layers pass. 1 For now. |
| 1535 | pLinkLayerStatsSetReq->reqId = 1; |
| 1536 | |
| 1537 | pLinkLayerStatsSetReq->mpduSizeThreshold = |
| 1538 | nla_get_u32( |
| 1539 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1540 | |
| 1541 | pLinkLayerStatsSetReq->aggressiveStatisticsGathering = |
| 1542 | nla_get_u32( |
| 1543 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1544 | |
| 1545 | /* staId 0 in Firmware is reserved for Broadcast/Multicast data. |
| 1546 | * Hence the interface staId start from 1. Hence the staId matching the |
| 1547 | * interface in the firmware is sessionId + 1. |
| 1548 | */ |
| 1549 | pLinkLayerStatsSetReq->staId = pAdapter->sessionId + 1; |
| 1550 | |
| 1551 | |
| 1552 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1553 | "LL_STATS_SET reqId = %d", |
| 1554 | pLinkLayerStatsSetReq->reqId); |
| 1555 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1556 | "LL_STATS_SET staId = %d", pLinkLayerStatsSetReq->staId); |
| 1557 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1558 | "LL_STATS_SET mpduSizeThreshold = %d", |
| 1559 | pLinkLayerStatsSetReq->mpduSizeThreshold); |
| 1560 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1561 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
| 1562 | pLinkLayerStatsSetReq->aggressiveStatisticsGathering); |
| 1563 | |
| 1564 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1565 | pHddCtx->hHal, |
| 1566 | pAdapter->sessionId, |
| 1567 | hdd_link_layer_stats_ind_callback, |
| 1568 | pAdapter)) |
| 1569 | { |
| 1570 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1571 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
| 1572 | vos_mem_free(pLinkLayerStatsSetReq); |
| 1573 | return -EINVAL; |
| 1574 | |
| 1575 | } |
| 1576 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
| 1577 | pLinkLayerStatsSetReq)) |
| 1578 | { |
| 1579 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1580 | "sme_LLStatsSetReq Failed", __func__); |
| 1581 | vos_mem_free(pLinkLayerStatsSetReq); |
| 1582 | return -EINVAL; |
| 1583 | } |
| 1584 | |
| 1585 | pAdapter->isLinkLayerStatsSet = 1; |
| 1586 | |
| 1587 | return 0; |
| 1588 | } |
| 1589 | |
| 1590 | const struct |
| 1591 | nla_policy |
| 1592 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1593 | { |
| 1594 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1595 | * command. When reporting |
| 1596 | * the stats results, the driver uses the same value to indicate |
| 1597 | * which GET request the results |
| 1598 | * correspond to. |
| 1599 | */ |
| 1600 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1601 | |
| 1602 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1603 | requested for retrieval */ |
| 1604 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1605 | }; |
| 1606 | |
| 1607 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1608 | struct wireless_dev *wdev, |
| 1609 | void *data, |
| 1610 | int data_len) |
| 1611 | { |
| 1612 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1613 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1]; |
| 1614 | tpSirLLStatsGetReq pLinkLayerStatsGetReq; |
| 1615 | struct net_device *dev = wdev->netdev; |
| 1616 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1617 | int status; |
| 1618 | |
| 1619 | status = wlan_hdd_validate_context(pHddCtx); |
| 1620 | if (0 != status) |
| 1621 | { |
| 1622 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1623 | FL("HDD context is not valid")); |
| 1624 | return -EINVAL ; |
| 1625 | } |
| 1626 | |
| 1627 | if (NULL == pAdapter) |
| 1628 | { |
| 1629 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1630 | "%s: HDD adapter is Null", __func__); |
| 1631 | return -ENODEV; |
| 1632 | } |
| 1633 | |
| 1634 | if (!pAdapter->isLinkLayerStatsSet) |
| 1635 | { |
| 1636 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1637 | "%s: isLinkLayerStatsSet : %d", |
| 1638 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1639 | return -EINVAL; |
| 1640 | } |
| 1641 | |
| 1642 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1643 | (struct nlattr *)data, |
| 1644 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1645 | { |
| 1646 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1647 | return -EINVAL; |
| 1648 | } |
| 1649 | |
| 1650 | if (!tb_vendor |
| 1651 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1652 | { |
| 1653 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1654 | return -EINVAL; |
| 1655 | } |
| 1656 | |
| 1657 | if (!tb_vendor |
| 1658 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1659 | { |
| 1660 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1661 | return -EINVAL; |
| 1662 | } |
| 1663 | |
| 1664 | pLinkLayerStatsGetReq = vos_mem_malloc(sizeof(tSirLLStatsGetReq)); |
| 1665 | |
| 1666 | if (NULL == pLinkLayerStatsGetReq) |
| 1667 | { |
| 1668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1669 | FL("Unable to allocate memory to pLinkLayerStatsGetReq")); |
| 1670 | return -ENOMEM; |
| 1671 | } |
| 1672 | |
| 1673 | pLinkLayerStatsGetReq->reqId = |
| 1674 | nla_get_u32( tb_vendor[ |
| 1675 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
| 1676 | pLinkLayerStatsGetReq->paramIdMask = |
| 1677 | nla_get_u32( tb_vendor[ |
| 1678 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1679 | |
| 1680 | /* staId 0 in Firmware is reserved for Broadcast/Multicast data. |
| 1681 | * Hence the interface staId start from 1. Hence the staId matching the |
| 1682 | * interface in the firmware is sessionId + 1. |
| 1683 | */ |
| 1684 | pLinkLayerStatsGetReq->staId = pAdapter->sessionId + 1; |
| 1685 | |
| 1686 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1687 | "LL_STATS_GET reqId = %d", pLinkLayerStatsGetReq->reqId); |
| 1688 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1689 | "LL_STATS_GET staId = %d", pLinkLayerStatsGetReq->staId); |
| 1690 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1691 | "LL_STATS_GET paramIdMask = %d", |
| 1692 | pLinkLayerStatsGetReq->paramIdMask); |
| 1693 | |
| 1694 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
| 1695 | pLinkLayerStatsGetReq)) |
| 1696 | { |
| 1697 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1698 | "sme_LLStatsGetReq Failed", __func__); |
| 1699 | vos_mem_free(pLinkLayerStatsGetReq); |
| 1700 | return -EINVAL; |
| 1701 | } |
| 1702 | return 0; |
| 1703 | } |
| 1704 | |
| 1705 | const struct |
| 1706 | nla_policy |
| 1707 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1708 | { |
| 1709 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1710 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1711 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1712 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1713 | }; |
| 1714 | |
| 1715 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1716 | struct wireless_dev *wdev, |
| 1717 | void *data, |
| 1718 | int data_len) |
| 1719 | { |
| 1720 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1721 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX + 1]; |
| 1722 | tpSirLLStatsClearReq pLinkLayerStatsClearReq; |
| 1723 | struct net_device *dev = wdev->netdev; |
| 1724 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1725 | u32 statsClearReqMask; |
| 1726 | u8 stopReq; |
| 1727 | int status; |
| 1728 | |
| 1729 | status = wlan_hdd_validate_context(pHddCtx); |
| 1730 | if (0 != status) |
| 1731 | { |
| 1732 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1733 | FL("HDD context is not valid")); |
| 1734 | return -EINVAL; |
| 1735 | } |
| 1736 | |
| 1737 | if (NULL == pAdapter) |
| 1738 | { |
| 1739 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1740 | "%s: HDD adapter is Null", __func__); |
| 1741 | return -ENODEV; |
| 1742 | } |
| 1743 | |
| 1744 | if (!pAdapter->isLinkLayerStatsSet) |
| 1745 | { |
| 1746 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1747 | "%s: isLinkLayerStatsSet : %d", |
| 1748 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1749 | return -EINVAL; |
| 1750 | } |
| 1751 | |
| 1752 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1753 | (struct nlattr *)data, |
| 1754 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1755 | { |
| 1756 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1757 | return -EINVAL; |
| 1758 | } |
| 1759 | |
| 1760 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1761 | |
| 1762 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 1763 | { |
| 1764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 1765 | return -EINVAL; |
| 1766 | |
| 1767 | } |
| 1768 | |
| 1769 | pLinkLayerStatsClearReq = vos_mem_malloc(sizeof(tSirLLStatsClearReq)); |
| 1770 | if (NULL == pLinkLayerStatsClearReq) |
| 1771 | { |
| 1772 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1773 | FL("Unable to allocate memory to pLinkLayerStatsClearReq")); |
| 1774 | return -ENOMEM; |
| 1775 | } |
| 1776 | |
| 1777 | statsClearReqMask = pLinkLayerStatsClearReq->statsClearReqMask = |
| 1778 | nla_get_u32( |
| 1779 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 1780 | |
| 1781 | stopReq = pLinkLayerStatsClearReq->stopReq = |
| 1782 | nla_get_u8( |
| 1783 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 1784 | |
| 1785 | // Shall take the request Id if the Upper layers pass. 1 For now. |
| 1786 | pLinkLayerStatsClearReq->reqId = 1; |
| 1787 | |
| 1788 | /* staId 0 in Firmware is reserved for Broadcast/Multicast data. |
| 1789 | * Hence the interface staId start from 1. Hence the staId matching the |
| 1790 | * interface in the firmware is sessionId + 1. |
| 1791 | */ |
| 1792 | pLinkLayerStatsClearReq->staId = pAdapter->sessionId + 1; |
| 1793 | |
| 1794 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1795 | "LL_STATS_CLEAR reqId = %d", pLinkLayerStatsClearReq->reqId); |
| 1796 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1797 | "LL_STATS_CLEAR staId = %d", pLinkLayerStatsClearReq->staId); |
| 1798 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1799 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
| 1800 | pLinkLayerStatsClearReq->statsClearReqMask); |
| 1801 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1802 | "LL_STATS_CLEAR stopReq = %d", |
| 1803 | pLinkLayerStatsClearReq->stopReq); |
| 1804 | |
| 1805 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
| 1806 | pLinkLayerStatsClearReq)) |
| 1807 | { |
| 1808 | struct sk_buff *temp_skbuff; |
| 1809 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 1810 | 2 * sizeof(u32) + |
| 1811 | NLMSG_HDRLEN); |
| 1812 | |
| 1813 | if (temp_skbuff != NULL) |
| 1814 | { |
| 1815 | |
| 1816 | if (nla_put_u32(temp_skbuff, |
| 1817 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 1818 | statsClearReqMask) || |
| 1819 | nla_put_u32(temp_skbuff, |
| 1820 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 1821 | stopReq)) |
| 1822 | { |
| 1823 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 1824 | kfree_skb(temp_skbuff); |
| 1825 | return -EINVAL; |
| 1826 | } |
| 1827 | /* If the ask is to stop the stats collection as part of clear |
| 1828 | * (stopReq = 1) , ensure that no further requests of get |
| 1829 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 1830 | * However it the stopReq as part of the clear request is 0 , |
| 1831 | * the request to get the statistics are ehonoured as in this |
| 1832 | * case the firmware is just asked to clear the statistics. |
| 1833 | */ |
| 1834 | if (pLinkLayerStatsClearReq->stopReq == 1) |
| 1835 | pAdapter->isLinkLayerStatsSet = 0; |
| 1836 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 1837 | } |
| 1838 | return -ENOMEM; |
| 1839 | } |
| 1840 | vos_mem_free(pLinkLayerStatsClearReq); |
| 1841 | return -EINVAL; |
| 1842 | } |
| 1843 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1844 | |
| 1845 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 1846 | { |
| 1847 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1848 | { |
| 1849 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 1850 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 1851 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 1852 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 1853 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 1854 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
| 1855 | }, |
| 1856 | |
| 1857 | { |
| 1858 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 1859 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 1860 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 1861 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 1862 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 1863 | .doit = wlan_hdd_cfg80211_ll_stats_set |
| 1864 | }, |
| 1865 | |
| 1866 | { |
| 1867 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 1868 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 1869 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 1870 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 1871 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 1872 | .doit = wlan_hdd_cfg80211_ll_stats_get |
| 1873 | } |
| 1874 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1875 | }; |
| 1876 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 1877 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1878 | static const |
| 1879 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 1880 | { |
| 1881 | #ifdef FEATURE_WLAN_CH_AVOID |
| 1882 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1883 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1884 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 1885 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1886 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 1887 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1888 | { |
| 1889 | /* Index = 1*/ |
| 1890 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1891 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 1892 | }, |
| 1893 | { |
| 1894 | /* Index = 2*/ |
| 1895 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1896 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 1897 | }, |
| 1898 | { |
| 1899 | /* Index = 3*/ |
| 1900 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1901 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 1902 | }, |
| 1903 | { |
| 1904 | /* Index = 4*/ |
| 1905 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1906 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 1907 | }, |
| 1908 | { |
| 1909 | /* Index = 5*/ |
| 1910 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1911 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 1912 | }, |
| 1913 | { |
| 1914 | /* Index = 6*/ |
| 1915 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 1916 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 1917 | }, |
| 1918 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1919 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 1920 | }; |
| 1921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 1923 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1924 | * This function is called by hdd_wlan_startup() |
| 1925 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 1926 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 1928 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1929 | { |
| 1930 | struct wiphy *wiphy; |
| 1931 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1932 | /* |
| 1933 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1934 | */ |
| 1935 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 1936 | |
| 1937 | if (!wiphy) |
| 1938 | { |
| 1939 | /* Print error and jump into err label and free the memory */ |
| 1940 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 1941 | return NULL; |
| 1942 | } |
| 1943 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1944 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1945 | return wiphy; |
| 1946 | } |
| 1947 | |
| 1948 | /* |
| 1949 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 1950 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | * private ioctl to change the band value |
| 1952 | */ |
| 1953 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 1954 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 1955 | int i, j; |
| 1956 | eNVChannelEnabledType channelEnabledState; |
| 1957 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1958 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 1959 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 1960 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 1962 | |
| 1963 | if (NULL == wiphy->bands[i]) |
| 1964 | { |
| 1965 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 1966 | __func__, i); |
| 1967 | continue; |
| 1968 | } |
| 1969 | |
| 1970 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 1971 | { |
| 1972 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 1973 | |
| 1974 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 1975 | band->channels[j].hw_value); |
| 1976 | |
| 1977 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 1978 | { |
| 1979 | // Enable Social channels for P2P |
| 1980 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 1981 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 1982 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 1983 | else |
| 1984 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 1985 | continue; |
| 1986 | } |
| 1987 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 1988 | { |
| 1989 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 1990 | continue; |
| 1991 | } |
| 1992 | |
| 1993 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 1994 | NV_CHANNEL_INVALID == channelEnabledState) |
| 1995 | { |
| 1996 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 1997 | } |
| 1998 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 1999 | { |
| 2000 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 2001 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 2002 | } |
| 2003 | else |
| 2004 | { |
| 2005 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 2006 | |IEEE80211_CHAN_RADAR); |
| 2007 | } |
| 2008 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2009 | } |
| 2010 | return 0; |
| 2011 | } |
| 2012 | /* |
| 2013 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2014 | * This function is called by hdd_wlan_startup() |
| 2015 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | * This function is used to initialize and register wiphy structure. |
| 2017 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2018 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2019 | struct wiphy *wiphy, |
| 2020 | hdd_config_t *pCfg |
| 2021 | ) |
| 2022 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 2023 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 2024 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2025 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2026 | ENTER(); |
| 2027 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2028 | /* Now bind the underlying wlan device with wiphy */ |
| 2029 | set_wiphy_dev(wiphy, dev); |
| 2030 | |
| 2031 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2032 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 2033 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 2034 | /* the flag for the other case would be initialzed in |
| 2035 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 2036 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 2037 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 2038 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2039 | /* This will disable updating of NL channels from passive to |
| 2040 | * active if a beacon is received on passive channel. */ |
| 2041 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 2042 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2043 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 2044 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2045 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 2046 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 2047 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 2048 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2049 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 2050 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2051 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 2052 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2053 | #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] | 2054 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 2055 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 2056 | || pCfg->isFastRoamIniFeatureEnabled |
| 2057 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2058 | #ifdef FEATURE_WLAN_ESE |
| 2059 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 2060 | #endif |
| 2061 | ) |
| 2062 | { |
| 2063 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 2064 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 2065 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2066 | #ifdef FEATURE_WLAN_TDLS |
| 2067 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 2068 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 2069 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 2070 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 2071 | if (pCfg->configPNOScanSupport) |
| 2072 | { |
| 2073 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 2074 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 2075 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 2076 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 2077 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 2078 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2079 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2080 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 2081 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 2082 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2083 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 2084 | driver need to determine what to do with both |
| 2085 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2086 | |
| 2087 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 2088 | #else |
| 2089 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 2090 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2091 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2092 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 2093 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 2094 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2095 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 2096 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 2097 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2098 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2099 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2100 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2101 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 2102 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2103 | | BIT(NL80211_IFTYPE_AP); |
| 2104 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 2105 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 2106 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 2107 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 2108 | if( pCfg->enableMCC ) |
| 2109 | { |
| 2110 | /* Currently, supports up to two channels */ |
| 2111 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 2112 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 2113 | if( !pCfg->allowMCCGODiffBI ) |
| 2114 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 2115 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 2116 | } |
| 2117 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 2118 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 2119 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 2120 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 2121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | /* Before registering we need to update the ht capabilitied based |
| 2123 | * on ini values*/ |
| 2124 | if( !pCfg->ShortGI20MhzEnable ) |
| 2125 | { |
| 2126 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 2127 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 2128 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 2129 | } |
| 2130 | |
| 2131 | if( !pCfg->ShortGI40MhzEnable ) |
| 2132 | { |
| 2133 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 2134 | } |
| 2135 | |
| 2136 | if( !pCfg->nChannelBondingMode5GHz ) |
| 2137 | { |
| 2138 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 2139 | } |
| 2140 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 2141 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 2142 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 2143 | { |
| 2144 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 2145 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 2146 | |
| 2147 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 2148 | { |
| 2149 | |
| 2150 | if (NULL == wiphy->bands[i]) |
| 2151 | { |
| 2152 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 2153 | __func__, i); |
| 2154 | continue; |
| 2155 | } |
| 2156 | |
| 2157 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 2158 | { |
| 2159 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 2160 | |
| 2161 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 2162 | { |
| 2163 | // Enable social channels for P2P |
| 2164 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 2165 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 2166 | else |
| 2167 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 2168 | continue; |
| 2169 | } |
| 2170 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 2171 | { |
| 2172 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 2173 | continue; |
| 2174 | } |
| 2175 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2176 | } |
| 2177 | /*Initialise the supported cipher suite details*/ |
| 2178 | wiphy->cipher_suites = hdd_cipher_suites; |
| 2179 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 2180 | |
| 2181 | /*signal strength in mBm (100*dBm) */ |
| 2182 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 2183 | |
| 2184 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2185 | wiphy->max_remain_on_channel_duration = 1000; |
| 2186 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2187 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2188 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 2189 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 2190 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 2191 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 2192 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2193 | EXIT(); |
| 2194 | return 0; |
| 2195 | } |
| 2196 | |
| 2197 | /* In this function we are registering wiphy. */ |
| 2198 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 2199 | { |
| 2200 | ENTER(); |
| 2201 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | if (0 > wiphy_register(wiphy)) |
| 2203 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2204 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 2206 | return -EIO; |
| 2207 | } |
| 2208 | |
| 2209 | EXIT(); |
| 2210 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2213 | /* In this function we are updating channel list when, |
| 2214 | regulatory domain is FCC and country code is US. |
| 2215 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 2216 | As per FCC smart phone is not a indoor device. |
| 2217 | GO should not opeate on indoor channels */ |
| 2218 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 2219 | { |
| 2220 | int j; |
| 2221 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2222 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 2223 | //Default counrtycode from NV at the time of wiphy initialization. |
| 2224 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 2225 | &defaultCountryCode[0])) |
| 2226 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2227 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2228 | } |
| 2229 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 2230 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 2231 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 2232 | { |
| 2233 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 2234 | return; |
| 2235 | } |
| 2236 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 2237 | { |
| 2238 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 2239 | // Mark UNII -1 band channel as passive |
| 2240 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 2241 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 2242 | } |
| 2243 | } |
| 2244 | } |
| 2245 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 2246 | /* This function registers for all frame which supplicant is interested in */ |
| 2247 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2249 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2250 | /* Register for all P2P action, public action etc frames */ |
| 2251 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 2252 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2253 | ENTER(); |
| 2254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | /* Right now we are registering these frame when driver is getting |
| 2256 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 2257 | frame register ops, we will move this code as a part of that */ |
| 2258 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2259 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2260 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 2261 | |
| 2262 | /* GAS Initial Response */ |
| 2263 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2264 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2266 | /* GAS Comeback Request */ |
| 2267 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2268 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 2269 | |
| 2270 | /* GAS Comeback Response */ |
| 2271 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2272 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 2273 | |
| 2274 | /* P2P Public Action */ |
| 2275 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2276 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2277 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 2278 | |
| 2279 | /* P2P Action */ |
| 2280 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2281 | (v_U8_t*)P2P_ACTION_FRAME, |
| 2282 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2283 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 2284 | /* WNM BSS Transition Request frame */ |
| 2285 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2286 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 2287 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 2288 | |
| 2289 | /* WNM-Notification */ |
| 2290 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2291 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 2292 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2293 | } |
| 2294 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 2295 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2296 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2297 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2298 | /* Register for all P2P action, public action etc frames */ |
| 2299 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 2300 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2301 | ENTER(); |
| 2302 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2303 | /* Right now we are registering these frame when driver is getting |
| 2304 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 2305 | frame register ops, we will move this code as a part of that */ |
| 2306 | /* GAS Initial Request */ |
| 2307 | |
| 2308 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2309 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 2310 | |
| 2311 | /* GAS Initial Response */ |
| 2312 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2313 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | /* GAS Comeback Request */ |
| 2316 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2317 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 2318 | |
| 2319 | /* GAS Comeback Response */ |
| 2320 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2321 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 2322 | |
| 2323 | /* P2P Public Action */ |
| 2324 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2325 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 2327 | |
| 2328 | /* P2P Action */ |
| 2329 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2330 | (v_U8_t*)P2P_ACTION_FRAME, |
| 2331 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 2332 | /* WNM-Notification */ |
| 2333 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 2334 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 2335 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | } |
| 2337 | |
| 2338 | #ifdef FEATURE_WLAN_WAPI |
| 2339 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 2340 | const u8 *mac_addr, u8 *key , int key_Len) |
| 2341 | { |
| 2342 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2343 | tCsrRoamSetKey setKey; |
| 2344 | v_BOOL_t isConnected = TRUE; |
| 2345 | int status = 0; |
| 2346 | v_U32_t roamId= 0xFF; |
| 2347 | tANI_U8 *pKeyPtr = NULL; |
| 2348 | int n = 0; |
| 2349 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 2350 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 2351 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 2352 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 2354 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2355 | setKey.keyId = key_index; // Store Key ID |
| 2356 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 2357 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 2358 | setKey.paeRole = 0 ; // the PAE role |
| 2359 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 2360 | { |
| 2361 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 2362 | } |
| 2363 | else |
| 2364 | { |
| 2365 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 2366 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 2367 | } |
| 2368 | setKey.keyLength = key_Len; |
| 2369 | pKeyPtr = setKey.Key; |
| 2370 | memcpy( pKeyPtr, key, key_Len); |
| 2371 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2372 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2373 | __func__, key_Len); |
| 2374 | for (n = 0 ; n < key_Len; n++) |
| 2375 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 2376 | __func__,n,setKey.Key[n]); |
| 2377 | |
| 2378 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 2379 | if ( isConnected ) |
| 2380 | { |
| 2381 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2382 | pAdapter->sessionId, &setKey, &roamId ); |
| 2383 | } |
| 2384 | if ( status != 0 ) |
| 2385 | { |
| 2386 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2387 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 2388 | __LINE__, status ); |
| 2389 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2390 | } |
| 2391 | } |
| 2392 | #endif /* FEATURE_WLAN_WAPI*/ |
| 2393 | |
| 2394 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2395 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2396 | beacon_data_t **ppBeacon, |
| 2397 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2398 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2399 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2400 | beacon_data_t **ppBeacon, |
| 2401 | struct cfg80211_beacon_data *params, |
| 2402 | int dtim_period) |
| 2403 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2404 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2405 | int size; |
| 2406 | beacon_data_t *beacon = NULL; |
| 2407 | beacon_data_t *old = NULL; |
| 2408 | int head_len,tail_len; |
| 2409 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2410 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2411 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2412 | { |
| 2413 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2414 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2417 | |
| 2418 | old = pAdapter->sessionCtx.ap.beacon; |
| 2419 | |
| 2420 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2421 | { |
| 2422 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2423 | FL("session(%d) old and new heads points to NULL"), |
| 2424 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2425 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2426 | } |
| 2427 | |
| 2428 | if (params->tail && !params->tail_len) |
| 2429 | { |
| 2430 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2431 | FL("tail_len is zero but tail is not NULL")); |
| 2432 | return -EINVAL; |
| 2433 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2435 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 2436 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 2437 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2438 | { |
| 2439 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2440 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2441 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2442 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | #endif |
| 2444 | |
| 2445 | if(params->head) |
| 2446 | head_len = params->head_len; |
| 2447 | else |
| 2448 | head_len = old->head_len; |
| 2449 | |
| 2450 | if(params->tail || !old) |
| 2451 | tail_len = params->tail_len; |
| 2452 | else |
| 2453 | tail_len = old->tail_len; |
| 2454 | |
| 2455 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 2456 | |
| 2457 | beacon = kzalloc(size, GFP_KERNEL); |
| 2458 | |
| 2459 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2460 | { |
| 2461 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2462 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2463 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2464 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2466 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | if(params->dtim_period || !old ) |
| 2468 | beacon->dtim_period = params->dtim_period; |
| 2469 | else |
| 2470 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2471 | #else |
| 2472 | if(dtim_period || !old ) |
| 2473 | beacon->dtim_period = dtim_period; |
| 2474 | else |
| 2475 | beacon->dtim_period = old->dtim_period; |
| 2476 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2478 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 2479 | beacon->tail = beacon->head + head_len; |
| 2480 | beacon->head_len = head_len; |
| 2481 | beacon->tail_len = tail_len; |
| 2482 | |
| 2483 | if(params->head) { |
| 2484 | memcpy (beacon->head,params->head,beacon->head_len); |
| 2485 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2486 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2487 | if(old) |
| 2488 | memcpy (beacon->head,old->head,beacon->head_len); |
| 2489 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2491 | if(params->tail) { |
| 2492 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 2493 | } |
| 2494 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2495 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2496 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 2497 | } |
| 2498 | |
| 2499 | *ppBeacon = beacon; |
| 2500 | |
| 2501 | kfree(old); |
| 2502 | |
| 2503 | return 0; |
| 2504 | |
| 2505 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2506 | |
| 2507 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 2508 | { |
| 2509 | int left = length; |
| 2510 | v_U8_t *ptr = pIes; |
| 2511 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2512 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2513 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2514 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | elem_id = ptr[0]; |
| 2516 | elem_len = ptr[1]; |
| 2517 | left -= 2; |
| 2518 | if(elem_len > left) |
| 2519 | { |
| 2520 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2521 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2522 | eid,elem_len,left); |
| 2523 | return NULL; |
| 2524 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2525 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2526 | { |
| 2527 | return ptr; |
| 2528 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2530 | left -= elem_len; |
| 2531 | ptr += (elem_len + 2); |
| 2532 | } |
| 2533 | return NULL; |
| 2534 | } |
| 2535 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2536 | /* Check if rate is 11g rate or not */ |
| 2537 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 2538 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 2539 | 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] | 2540 | u8 i; |
| 2541 | for (i = 0; i < 8; i++) |
| 2542 | { |
| 2543 | if(rate == gRateArray[i]) |
| 2544 | return TRUE; |
| 2545 | } |
| 2546 | return FALSE; |
| 2547 | } |
| 2548 | |
| 2549 | /* Check for 11g rate and set proper 11g only mode */ |
| 2550 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 2551 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 2552 | { |
| 2553 | u8 i, num_rates = pIe[0]; |
| 2554 | |
| 2555 | pIe += 1; |
| 2556 | for ( i = 0; i < num_rates; i++) |
| 2557 | { |
| 2558 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 2559 | { |
| 2560 | /* If rate set have 11g rate than change the mode to 11G */ |
| 2561 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 2562 | if (pIe[i] & BASIC_RATE_MASK) |
| 2563 | { |
| 2564 | /* If we have 11g rate as basic rate, it means mode |
| 2565 | is 11g only mode. |
| 2566 | */ |
| 2567 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 2568 | *pCheckRatesfor11g = FALSE; |
| 2569 | } |
| 2570 | } |
| 2571 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 2572 | { |
| 2573 | *require_ht = TRUE; |
| 2574 | } |
| 2575 | } |
| 2576 | return; |
| 2577 | } |
| 2578 | |
| 2579 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 2580 | { |
| 2581 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 2582 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 2583 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 2584 | u8 checkRatesfor11g = TRUE; |
| 2585 | u8 require_ht = FALSE; |
| 2586 | u8 *pIe=NULL; |
| 2587 | |
| 2588 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 2589 | |
| 2590 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 2591 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 2592 | if (pIe != NULL) |
| 2593 | { |
| 2594 | pIe += 1; |
| 2595 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 2596 | &pConfig->SapHw_mode); |
| 2597 | } |
| 2598 | |
| 2599 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 2600 | WLAN_EID_EXT_SUPP_RATES); |
| 2601 | if (pIe != NULL) |
| 2602 | { |
| 2603 | |
| 2604 | pIe += 1; |
| 2605 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 2606 | &pConfig->SapHw_mode); |
| 2607 | } |
| 2608 | |
| 2609 | if( pConfig->channel > 14 ) |
| 2610 | { |
| 2611 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 2612 | } |
| 2613 | |
| 2614 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 2615 | WLAN_EID_HT_CAPABILITY); |
| 2616 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2617 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2618 | { |
| 2619 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 2620 | if(require_ht) |
| 2621 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 2622 | } |
| 2623 | } |
| 2624 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2625 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 2626 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 2627 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 2628 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2629 | v_U8_t *pIe = NULL; |
| 2630 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 2631 | |
| 2632 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 2633 | pBeacon->tail, pBeacon->tail_len); |
| 2634 | |
| 2635 | if (pIe) |
| 2636 | { |
| 2637 | ielen = pIe[1] + 2; |
| 2638 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 2639 | { |
| 2640 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 2641 | } |
| 2642 | else |
| 2643 | { |
| 2644 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 2645 | return -EINVAL; |
| 2646 | } |
| 2647 | *total_ielen += ielen; |
| 2648 | } |
| 2649 | return 0; |
| 2650 | } |
| 2651 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 2652 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 2653 | v_U8_t *genie, v_U8_t *total_ielen) |
| 2654 | { |
| 2655 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 2656 | int left = pBeacon->tail_len; |
| 2657 | v_U8_t *ptr = pBeacon->tail; |
| 2658 | v_U8_t elem_id, elem_len; |
| 2659 | v_U16_t ielen = 0; |
| 2660 | |
| 2661 | if ( NULL == ptr || 0 == left ) |
| 2662 | return; |
| 2663 | |
| 2664 | while (left >= 2) |
| 2665 | { |
| 2666 | elem_id = ptr[0]; |
| 2667 | elem_len = ptr[1]; |
| 2668 | left -= 2; |
| 2669 | if (elem_len > left) |
| 2670 | { |
| 2671 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 2672 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 2673 | elem_id, elem_len, left); |
| 2674 | return; |
| 2675 | } |
| 2676 | if (IE_EID_VENDOR == elem_id) |
| 2677 | { |
| 2678 | /* skipping the VSIE's which we don't want to include or |
| 2679 | * it will be included by existing code |
| 2680 | */ |
| 2681 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 2682 | #ifdef WLAN_FEATURE_WFD |
| 2683 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 2684 | #endif |
| 2685 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 2686 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 2687 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 2688 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 2689 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 2690 | { |
| 2691 | ielen = ptr[1] + 2; |
| 2692 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 2693 | { |
| 2694 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 2695 | *total_ielen += ielen; |
| 2696 | } |
| 2697 | else |
| 2698 | { |
| 2699 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 2700 | "IE Length is too big " |
| 2701 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 2702 | elem_id, elem_len, *total_ielen); |
| 2703 | } |
| 2704 | } |
| 2705 | } |
| 2706 | |
| 2707 | left -= elem_len; |
| 2708 | ptr += (elem_len + 2); |
| 2709 | } |
| 2710 | return; |
| 2711 | } |
| 2712 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2713 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2714 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 2715 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2716 | #else |
| 2717 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 2718 | struct cfg80211_beacon_data *params) |
| 2719 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | { |
| 2721 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2722 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2723 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2724 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2725 | |
| 2726 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 2727 | |
| 2728 | if(genie == NULL) { |
| 2729 | |
| 2730 | return -ENOMEM; |
| 2731 | } |
| 2732 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2733 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 2734 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2735 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2736 | hddLog(LOGE, |
| 2737 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2738 | ret = -EINVAL; |
| 2739 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | } |
| 2741 | |
| 2742 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2743 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 2744 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 2745 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2746 | hddLog(LOGE, |
| 2747 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2748 | ret = -EINVAL; |
| 2749 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2750 | } |
| 2751 | #endif |
| 2752 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2753 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 2754 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2755 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 2756 | hddLog(LOGE, |
| 2757 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2758 | ret = -EINVAL; |
| 2759 | goto done; |
| 2760 | } |
| 2761 | |
Abhishek Singh | 5128c4f | 2014-06-04 14:48:31 +0530 | [diff] [blame] | 2762 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 2763 | &total_ielen, WMM_OUI_TYPE, WMM_OUI_TYPE_SIZE)) |
| 2764 | { |
| 2765 | hddLog(LOGE, FL("Adding WMM IE failed")); |
| 2766 | ret = -EINVAL; |
| 2767 | goto done; |
| 2768 | } |
| 2769 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2770 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 2771 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 2772 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2774 | |
| 2775 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2776 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 2777 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 2778 | { |
| 2779 | hddLog(LOGE, |
| 2780 | "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] | 2781 | ret = -EINVAL; |
| 2782 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2783 | } |
| 2784 | |
| 2785 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2786 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 2787 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 2788 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 2789 | ==eHAL_STATUS_FAILURE) |
| 2790 | { |
| 2791 | hddLog(LOGE, |
| 2792 | "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] | 2793 | ret = -EINVAL; |
| 2794 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2795 | } |
| 2796 | |
| 2797 | // Added for ProResp IE |
| 2798 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 2799 | { |
| 2800 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 2801 | u8 probe_rsp_ie_len[3] = {0}; |
| 2802 | u8 counter = 0; |
| 2803 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 2804 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 2805 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 2806 | Store More then 255 bytes into One Variable. |
| 2807 | */ |
| 2808 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 2809 | { |
| 2810 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 2811 | { |
| 2812 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 2813 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 2814 | } |
| 2815 | else |
| 2816 | { |
| 2817 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 2818 | rem_probe_resp_ie_len = 0; |
| 2819 | } |
| 2820 | } |
| 2821 | |
| 2822 | rem_probe_resp_ie_len = 0; |
| 2823 | |
| 2824 | if (probe_rsp_ie_len[0] > 0) |
| 2825 | { |
| 2826 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2827 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 2828 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 2829 | probe_rsp_ie_len[0], NULL, |
| 2830 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 2831 | { |
| 2832 | hddLog(LOGE, |
| 2833 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2834 | ret = -EINVAL; |
| 2835 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | } |
| 2837 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 2838 | } |
| 2839 | |
| 2840 | if (probe_rsp_ie_len[1] > 0) |
| 2841 | { |
| 2842 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2843 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 2844 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 2845 | probe_rsp_ie_len[1], NULL, |
| 2846 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 2847 | { |
| 2848 | hddLog(LOGE, |
| 2849 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2850 | ret = -EINVAL; |
| 2851 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2852 | } |
| 2853 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 2854 | } |
| 2855 | |
| 2856 | if (probe_rsp_ie_len[2] > 0) |
| 2857 | { |
| 2858 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2859 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 2860 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 2861 | probe_rsp_ie_len[2], NULL, |
| 2862 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 2863 | { |
| 2864 | hddLog(LOGE, |
| 2865 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2866 | ret = -EINVAL; |
| 2867 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | } |
| 2869 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 2870 | } |
| 2871 | |
| 2872 | if (probe_rsp_ie_len[1] == 0 ) |
| 2873 | { |
| 2874 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2875 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 2876 | eANI_BOOLEAN_FALSE) ) |
| 2877 | { |
| 2878 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2879 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | } |
| 2881 | } |
| 2882 | |
| 2883 | if (probe_rsp_ie_len[2] == 0 ) |
| 2884 | { |
| 2885 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2886 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 2887 | eANI_BOOLEAN_FALSE) ) |
| 2888 | { |
| 2889 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2890 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2891 | } |
| 2892 | } |
| 2893 | |
| 2894 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2895 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 2896 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 2897 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 2898 | == eHAL_STATUS_FAILURE) |
| 2899 | { |
| 2900 | hddLog(LOGE, |
| 2901 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2902 | ret = -EINVAL; |
| 2903 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2904 | } |
| 2905 | } |
| 2906 | else |
| 2907 | { |
| 2908 | // Reset WNI_CFG_PROBE_RSP Flags |
| 2909 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 2910 | |
| 2911 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2912 | "%s: No Probe Response IE received in set beacon", |
| 2913 | __func__); |
| 2914 | } |
| 2915 | |
| 2916 | // Added for AssocResp IE |
| 2917 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 2918 | { |
| 2919 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2920 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 2921 | params->assocresp_ies_len, NULL, |
| 2922 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 2923 | { |
| 2924 | hddLog(LOGE, |
| 2925 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2926 | ret = -EINVAL; |
| 2927 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2928 | } |
| 2929 | |
| 2930 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2931 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 2932 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 2933 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 2934 | == eHAL_STATUS_FAILURE) |
| 2935 | { |
| 2936 | hddLog(LOGE, |
| 2937 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2938 | ret = -EINVAL; |
| 2939 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2940 | } |
| 2941 | } |
| 2942 | else |
| 2943 | { |
| 2944 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2945 | "%s: No Assoc Response IE received in set beacon", |
| 2946 | __func__); |
| 2947 | |
| 2948 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 2949 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 2950 | eANI_BOOLEAN_FALSE) ) |
| 2951 | { |
| 2952 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2953 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2954 | } |
| 2955 | } |
| 2956 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2957 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2958 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 2959 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2961 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2962 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2963 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 2964 | * called by wlan_hdd_cfg80211_start_bss() and |
| 2965 | * wlan_hdd_cfg80211_set_channel() |
| 2966 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2967 | * channel list. |
| 2968 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 2969 | 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] | 2970 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 2971 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2972 | v_U32_t num_ch = 0; |
| 2973 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2974 | u32 indx = 0; |
| 2975 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 2976 | v_U8_t fValidChannel = FALSE, count = 0; |
| 2977 | 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] | 2978 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2979 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2980 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 2981 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2982 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 2983 | /* Validate the channel */ |
| 2984 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 2986 | if ( channel == rfChannels[count].channelNum ) |
| 2987 | { |
| 2988 | fValidChannel = TRUE; |
| 2989 | break; |
| 2990 | } |
| 2991 | } |
| 2992 | if (fValidChannel != TRUE) |
| 2993 | { |
| 2994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2995 | "%s: Invalid Channel [%d]", __func__, channel); |
| 2996 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2997 | } |
| 2998 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 2999 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3000 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 3001 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 3002 | valid_ch, &num_ch)) |
| 3003 | { |
| 3004 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3005 | "%s: failed to get valid channel list", __func__); |
| 3006 | return VOS_STATUS_E_FAILURE; |
| 3007 | } |
| 3008 | for (indx = 0; indx < num_ch; indx++) |
| 3009 | { |
| 3010 | if (channel == valid_ch[indx]) |
| 3011 | { |
| 3012 | break; |
| 3013 | } |
| 3014 | } |
| 3015 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 3016 | if (indx >= num_ch) |
| 3017 | { |
| 3018 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 3019 | { |
| 3020 | eCsrBand band; |
| 3021 | unsigned int freq; |
| 3022 | |
| 3023 | sme_GetFreqBand(hHal, &band); |
| 3024 | |
| 3025 | if (eCSR_BAND_5G == band) |
| 3026 | { |
| 3027 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 3028 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 3029 | { |
| 3030 | freq = ieee80211_channel_to_frequency(channel, |
| 3031 | IEEE80211_BAND_2GHZ); |
| 3032 | } |
| 3033 | else |
| 3034 | { |
| 3035 | freq = ieee80211_channel_to_frequency(channel, |
| 3036 | IEEE80211_BAND_5GHZ); |
| 3037 | } |
| 3038 | #else |
| 3039 | freq = ieee80211_channel_to_frequency(channel); |
| 3040 | #endif |
| 3041 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 3042 | return VOS_STATUS_SUCCESS; |
| 3043 | } |
| 3044 | } |
| 3045 | |
| 3046 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3047 | "%s: Invalid Channel [%d]", __func__, channel); |
| 3048 | return VOS_STATUS_E_FAILURE; |
| 3049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3050 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 3051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3054 | } |
| 3055 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3056 | /** |
| 3057 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 3058 | * This function is used to set the channel number |
| 3059 | */ |
| 3060 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 3061 | struct ieee80211_channel *chan, |
| 3062 | enum nl80211_channel_type channel_type |
| 3063 | ) |
| 3064 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3065 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3066 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3067 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3068 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3069 | hdd_context_t *pHddCtx; |
| 3070 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3071 | |
| 3072 | ENTER(); |
| 3073 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3074 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3075 | if( NULL == dev ) |
| 3076 | { |
| 3077 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3078 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3079 | return -ENODEV; |
| 3080 | } |
| 3081 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 3082 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3083 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3084 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 3085 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3086 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3087 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 3088 | hdd_device_modetoString(pAdapter->device_mode), |
| 3089 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3090 | |
| 3091 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3092 | status = wlan_hdd_validate_context(pHddCtx); |
| 3093 | |
| 3094 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3095 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3096 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3097 | "%s: HDD context is not valid", __func__); |
| 3098 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3099 | } |
| 3100 | |
| 3101 | /* |
| 3102 | * Do freq to chan conversion |
| 3103 | * TODO: for 11a |
| 3104 | */ |
| 3105 | |
| 3106 | channel = ieee80211_frequency_to_channel(freq); |
| 3107 | |
| 3108 | /* Check freq range */ |
| 3109 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 3110 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 3111 | { |
| 3112 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3113 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3114 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 3115 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 3116 | return -EINVAL; |
| 3117 | } |
| 3118 | |
| 3119 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 3120 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 3121 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 3122 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3123 | { |
| 3124 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 3125 | { |
| 3126 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3127 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3128 | return -EINVAL; |
| 3129 | } |
| 3130 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 3131 | "%s: set channel to [%d] for device mode =%d", |
| 3132 | __func__, channel,pAdapter->device_mode); |
| 3133 | } |
| 3134 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3135 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3136 | ) |
| 3137 | { |
| 3138 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3139 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 3140 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3141 | |
| 3142 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 3143 | { |
| 3144 | /* Link is up then return cant set channel*/ |
| 3145 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3146 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3147 | return -EINVAL; |
| 3148 | } |
| 3149 | |
| 3150 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 3151 | pHddStaCtx->conn_info.operationChannel = channel; |
| 3152 | pRoamProfile->ChannelInfo.ChannelList = |
| 3153 | &pHddStaCtx->conn_info.operationChannel; |
| 3154 | } |
| 3155 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3156 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3157 | ) |
| 3158 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 3159 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 3160 | { |
| 3161 | if(VOS_STATUS_SUCCESS != |
| 3162 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 3163 | { |
| 3164 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3165 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 3166 | return -EINVAL; |
| 3167 | } |
| 3168 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 3169 | } |
| 3170 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3171 | { |
| 3172 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 3173 | |
| 3174 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 3175 | channel set by supplicant |
| 3176 | */ |
| 3177 | if ( cfg_param->apAutoChannelSelection ) |
| 3178 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 3179 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 3180 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3181 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3182 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 3183 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 3184 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3185 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 3186 | else |
| 3187 | { |
| 3188 | if(VOS_STATUS_SUCCESS != |
| 3189 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 3190 | { |
| 3191 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3192 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 3193 | return -EINVAL; |
| 3194 | } |
| 3195 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 3196 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3197 | } |
| 3198 | } |
| 3199 | else |
| 3200 | { |
| 3201 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3202 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 3203 | return -EINVAL; |
| 3204 | } |
| 3205 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3206 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 3207 | } |
| 3208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3209 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 3210 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 3211 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3212 | #else |
| 3213 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 3214 | struct cfg80211_beacon_data *params, |
| 3215 | const u8 *ssid, size_t ssid_len, |
| 3216 | enum nl80211_hidden_ssid hidden_ssid) |
| 3217 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3218 | { |
| 3219 | tsap_Config_t *pConfig; |
| 3220 | beacon_data_t *pBeacon = NULL; |
| 3221 | struct ieee80211_mgmt *pMgmt_frame; |
| 3222 | v_U8_t *pIe=NULL; |
| 3223 | v_U16_t capab_info; |
| 3224 | eCsrAuthType RSNAuthType; |
| 3225 | eCsrEncryptionType RSNEncryptType; |
| 3226 | eCsrEncryptionType mcRSNEncryptType; |
| 3227 | int status = VOS_STATUS_SUCCESS; |
| 3228 | tpWLAN_SAPEventCB pSapEventCallback; |
| 3229 | hdd_hostapd_state_t *pHostapdState; |
| 3230 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 3231 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 3232 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3233 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 3234 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3235 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 3236 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 3237 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 3238 | v_BOOL_t MFPRequired = VOS_FALSE; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 3239 | eHddDot11Mode sapDot11Mode = |
| 3240 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3241 | |
| 3242 | ENTER(); |
| 3243 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 3244 | iniConfig = pHddCtx->cfg_ini; |
| 3245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3246 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 3247 | |
| 3248 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 3249 | |
| 3250 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 3251 | |
| 3252 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 3253 | |
| 3254 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 3255 | |
| 3256 | //channel is already set in the set_channel Call back |
| 3257 | //pConfig->channel = pCommitConfig->channel; |
| 3258 | |
| 3259 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3260 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3261 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 3262 | |
| 3263 | pConfig->dtim_period = pBeacon->dtim_period; |
| 3264 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3265 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | pConfig->dtim_period); |
| 3267 | |
| 3268 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 3269 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3270 | { |
| 3271 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3272 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 3273 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 3274 | { |
| 3275 | tANI_BOOLEAN restartNeeded; |
| 3276 | pConfig->ieee80211d = 1; |
| 3277 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 3278 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 3279 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 3280 | } |
| 3281 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3282 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3283 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3284 | pConfig->ieee80211d = 1; |
| 3285 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 3286 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 3287 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3289 | else |
| 3290 | { |
| 3291 | pConfig->ieee80211d = 0; |
| 3292 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 3293 | /* |
| 3294 | * If auto channel is configured i.e. channel is 0, |
| 3295 | * so skip channel validation. |
| 3296 | */ |
| 3297 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 3298 | { |
| 3299 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 3300 | { |
| 3301 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3302 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 3303 | return -EINVAL; |
| 3304 | } |
| 3305 | } |
| 3306 | else |
| 3307 | { |
| 3308 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 3309 | { |
| 3310 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 3311 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 3312 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 3313 | } |
| 3314 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 3315 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3316 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3317 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | { |
| 3319 | pConfig->ieee80211d = 0; |
| 3320 | } |
| 3321 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 3322 | |
| 3323 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3324 | |
| 3325 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3326 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 3327 | |
| 3328 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 3329 | |
| 3330 | /*Set wps station to configured*/ |
| 3331 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 3332 | |
| 3333 | if(pIe) |
| 3334 | { |
| 3335 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 3336 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3337 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3338 | return -EINVAL; |
| 3339 | } |
| 3340 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 3341 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 3342 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3343 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 3344 | * WPS state |
| 3345 | */ |
| 3346 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 3347 | { |
| 3348 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 3349 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 3350 | { |
| 3351 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 3352 | } |
| 3353 | } |
| 3354 | } |
| 3355 | else |
| 3356 | { |
| 3357 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 3358 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3359 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3360 | |
| 3361 | pConfig->RSNWPAReqIELength = 0; |
| 3362 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3363 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3364 | WLAN_EID_RSN); |
| 3365 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3366 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 3368 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 3369 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3370 | /* The actual processing may eventually be more extensive than |
| 3371 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3372 | * by the app. |
| 3373 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3374 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3375 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 3376 | &RSNEncryptType, |
| 3377 | &mcRSNEncryptType, |
| 3378 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 3379 | &MFPCapable, |
| 3380 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3381 | pConfig->pRSNWPAReqIE[1]+2, |
| 3382 | pConfig->pRSNWPAReqIE ); |
| 3383 | |
| 3384 | if( VOS_STATUS_SUCCESS == status ) |
| 3385 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3386 | /* Now copy over all the security attributes you have |
| 3387 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | * */ |
| 3389 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 3390 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 3391 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 3392 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 3393 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3394 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 3396 | } |
| 3397 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 3400 | pBeacon->tail, pBeacon->tail_len); |
| 3401 | |
| 3402 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 3403 | { |
| 3404 | if (pConfig->pRSNWPAReqIE) |
| 3405 | { |
| 3406 | /*Mixed mode WPA/WPA2*/ |
| 3407 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 3408 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 3409 | } |
| 3410 | else |
| 3411 | { |
| 3412 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 3413 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 3414 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3415 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 3417 | &RSNEncryptType, |
| 3418 | &mcRSNEncryptType, |
| 3419 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 3420 | &MFPCapable, |
| 3421 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3422 | pConfig->pRSNWPAReqIE[1]+2, |
| 3423 | pConfig->pRSNWPAReqIE ); |
| 3424 | |
| 3425 | if( VOS_STATUS_SUCCESS == status ) |
| 3426 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3427 | /* Now copy over all the security attributes you have |
| 3428 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3429 | * */ |
| 3430 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 3431 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 3432 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 3433 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 3434 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3435 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3436 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 3437 | } |
| 3438 | } |
| 3439 | } |
| 3440 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3441 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 3442 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 3443 | return -EINVAL; |
| 3444 | } |
| 3445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3446 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 3447 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3448 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3449 | if (params->ssid != NULL) |
| 3450 | { |
| 3451 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 3452 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 3453 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 3454 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 3455 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3456 | #else |
| 3457 | if (ssid != NULL) |
| 3458 | { |
| 3459 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 3460 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 3461 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 3462 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 3463 | } |
| 3464 | #endif |
| 3465 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3466 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3468 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3469 | /* default value */ |
| 3470 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 3471 | pConfig->num_accept_mac = 0; |
| 3472 | pConfig->num_deny_mac = 0; |
| 3473 | |
| 3474 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 3475 | pBeacon->tail, pBeacon->tail_len); |
| 3476 | |
| 3477 | /* pIe for black list is following form: |
| 3478 | type : 1 byte |
| 3479 | length : 1 byte |
| 3480 | OUI : 4 bytes |
| 3481 | acl type : 1 byte |
| 3482 | no of mac addr in black list: 1 byte |
| 3483 | 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] | 3484 | */ |
| 3485 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3486 | { |
| 3487 | pConfig->SapMacaddr_acl = pIe[6]; |
| 3488 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3489 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 3491 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 3492 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3493 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 3494 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 3495 | { |
| 3496 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 3497 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3498 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3499 | } |
| 3500 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 3501 | pBeacon->tail, pBeacon->tail_len); |
| 3502 | |
| 3503 | /* pIe for white list is following form: |
| 3504 | type : 1 byte |
| 3505 | length : 1 byte |
| 3506 | OUI : 4 bytes |
| 3507 | acl type : 1 byte |
| 3508 | no of mac addr in white list: 1 byte |
| 3509 | 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] | 3510 | */ |
| 3511 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | { |
| 3513 | pConfig->SapMacaddr_acl = pIe[6]; |
| 3514 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3515 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 3517 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 3518 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3519 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 3520 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 3521 | { |
| 3522 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 3523 | acl_entry++; |
| 3524 | } |
| 3525 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 3526 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3527 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 3528 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3529 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 3530 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 3531 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 3532 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 3533 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 3534 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 3535 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 3536 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 3537 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 3538 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 3539 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 3540 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 3541 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3542 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 3543 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3544 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 3545 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 3546 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 3547 | /* If ACS disable and selected channel <= 14 |
| 3548 | * OR |
| 3549 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 3550 | * AND |
| 3551 | * VHT in 2.4G Disabled |
| 3552 | * THEN |
| 3553 | * Fallback to 11N mode |
| 3554 | */ |
| 3555 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 3556 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 3557 | operatingBand == RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 3558 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 3559 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 3560 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 3561 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 3562 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 3563 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3564 | } |
| 3565 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3566 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3567 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 3568 | { |
| 3569 | sme_SelectCBMode(hHal, |
| 3570 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 3571 | pConfig->channel); |
| 3572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3573 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 3574 | pConfig->ht_capab = |
| 3575 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 3576 | |
| 3577 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 3578 | { |
| 3579 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 3580 | return -EINVAL; |
| 3581 | } |
| 3582 | |
| 3583 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3584 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3585 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 3586 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3587 | pConfig->obssProtEnabled = |
| 3588 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3589 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 3590 | #ifdef WLAN_FEATURE_11W |
| 3591 | pConfig->mfpCapable = MFPCapable; |
| 3592 | pConfig->mfpRequired = MFPRequired; |
| 3593 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 3594 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 3595 | #endif |
| 3596 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3597 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3598 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3599 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 3600 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 3601 | (int)pConfig->channel); |
| 3602 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 3603 | pConfig->SapHw_mode, pConfig->privacy, |
| 3604 | pConfig->authType); |
| 3605 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 3606 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 3607 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 3608 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3610 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3611 | { |
| 3612 | //Bss already started. just return. |
| 3613 | //TODO Probably it should update some beacon params. |
| 3614 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 3615 | EXIT(); |
| 3616 | return 0; |
| 3617 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3619 | pConfig->persona = pHostapdAdapter->device_mode; |
| 3620 | |
| 3621 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 3622 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 3623 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 3624 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3625 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3626 | return -EINVAL; |
| 3627 | } |
| 3628 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3629 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3630 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 3631 | |
| 3632 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3633 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3634 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3635 | { |
| 3636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3637 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 3638 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3639 | VOS_ASSERT(0); |
| 3640 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3642 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 3643 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 3644 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 3645 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 3646 | { |
| 3647 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 3648 | { |
| 3649 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 3650 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3651 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 3652 | } |
| 3653 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 3654 | { |
| 3655 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 3656 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3657 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 3658 | } |
| 3659 | } |
| 3660 | #endif |
| 3661 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3662 | pHostapdState->bCommit = TRUE; |
| 3663 | EXIT(); |
| 3664 | |
| 3665 | return 0; |
| 3666 | } |
| 3667 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3668 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3669 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 3670 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3671 | struct beacon_parameters *params) |
| 3672 | { |
| 3673 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3674 | hdd_context_t *pHddCtx; |
| 3675 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | |
| 3677 | ENTER(); |
| 3678 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3679 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3680 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 3681 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3682 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 3683 | hdd_device_modetoString(pAdapter->device_mode), |
| 3684 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3685 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3686 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3687 | status = wlan_hdd_validate_context(pHddCtx); |
| 3688 | |
| 3689 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3690 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3691 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3692 | "%s: HDD context is not valid", __func__); |
| 3693 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3694 | } |
| 3695 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3696 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3697 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3698 | ) |
| 3699 | { |
| 3700 | beacon_data_t *old,*new; |
| 3701 | |
| 3702 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3705 | { |
| 3706 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 3707 | FL("already beacon info added to session(%d)"), |
| 3708 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3711 | |
| 3712 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 3713 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3714 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3715 | { |
| 3716 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3717 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3718 | return -EINVAL; |
| 3719 | } |
| 3720 | |
| 3721 | pAdapter->sessionCtx.ap.beacon = new; |
| 3722 | |
| 3723 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 3724 | } |
| 3725 | |
| 3726 | EXIT(); |
| 3727 | return status; |
| 3728 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3729 | |
| 3730 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3731 | struct net_device *dev, |
| 3732 | struct beacon_parameters *params) |
| 3733 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3734 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3735 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3736 | hdd_context_t *pHddCtx; |
| 3737 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | |
| 3739 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3740 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3741 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 3742 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3743 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 3744 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 3745 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3746 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3747 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3748 | status = wlan_hdd_validate_context(pHddCtx); |
| 3749 | |
| 3750 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3751 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3752 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3753 | "%s: HDD context is not valid", __func__); |
| 3754 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3755 | } |
| 3756 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3757 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3758 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3759 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3760 | { |
| 3761 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3763 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3765 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3766 | { |
| 3767 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3768 | FL("session(%d) old and new heads points to NULL"), |
| 3769 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3770 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3772 | |
| 3773 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 3774 | |
| 3775 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 3776 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3777 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3778 | return -EINVAL; |
| 3779 | } |
| 3780 | |
| 3781 | pAdapter->sessionCtx.ap.beacon = new; |
| 3782 | |
| 3783 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 3784 | } |
| 3785 | |
| 3786 | EXIT(); |
| 3787 | return status; |
| 3788 | } |
| 3789 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3790 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 3791 | |
| 3792 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3793 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 3794 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3795 | #else |
| 3796 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 3797 | struct net_device *dev) |
| 3798 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3799 | { |
| 3800 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3801 | hdd_context_t *pHddCtx = NULL; |
| 3802 | hdd_scaninfo_t *pScanInfo = NULL; |
| 3803 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3804 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3805 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3806 | |
| 3807 | ENTER(); |
| 3808 | |
| 3809 | if (NULL == pAdapter) |
| 3810 | { |
| 3811 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3812 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3813 | return -ENODEV; |
| 3814 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3815 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3816 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3817 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 3818 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3819 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3820 | status = wlan_hdd_validate_context(pHddCtx); |
| 3821 | |
| 3822 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3823 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3824 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3825 | "%s: HDD context is not valid", __func__); |
| 3826 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3827 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3828 | |
| 3829 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 3830 | if (NULL == staAdapter) |
| 3831 | { |
| 3832 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 3833 | if (NULL == staAdapter) |
| 3834 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 3835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3836 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 3837 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3838 | } |
| 3839 | } |
| 3840 | |
| 3841 | pScanInfo = &pHddCtx->scan_info; |
| 3842 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3843 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 3844 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 3845 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3846 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3847 | ret = wlan_hdd_scan_abort(pAdapter); |
| 3848 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 3849 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3850 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3851 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3852 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3853 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3854 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3855 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3856 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3857 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 3858 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3859 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3860 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3861 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 3862 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3863 | } |
| 3864 | |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 3865 | hdd_hostapd_stop(dev); |
| 3866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3867 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3868 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3869 | ) |
| 3870 | { |
| 3871 | beacon_data_t *old; |
| 3872 | |
| 3873 | old = pAdapter->sessionCtx.ap.beacon; |
| 3874 | |
| 3875 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3876 | { |
| 3877 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3878 | FL("session(%d) beacon data points to NULL"), |
| 3879 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3880 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 3881 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3883 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3884 | |
| 3885 | mutex_lock(&pHddCtx->sap_lock); |
| 3886 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 3887 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3888 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3889 | { |
| 3890 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 3891 | |
| 3892 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 3893 | |
| 3894 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 3895 | { |
| 3896 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3897 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3898 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3899 | } |
| 3900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
| 3902 | } |
| 3903 | mutex_unlock(&pHddCtx->sap_lock); |
| 3904 | |
| 3905 | if(status != VOS_STATUS_SUCCESS) |
| 3906 | { |
| 3907 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3908 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3909 | return -EINVAL; |
| 3910 | } |
| 3911 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3912 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3913 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 3914 | ==eHAL_STATUS_FAILURE) |
| 3915 | { |
| 3916 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3917 | "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] | 3918 | } |
| 3919 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3920 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3921 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 3922 | eANI_BOOLEAN_FALSE) ) |
| 3923 | { |
| 3924 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3925 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3926 | } |
| 3927 | |
| 3928 | // Reset WNI_CFG_PROBE_RSP Flags |
| 3929 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 3930 | |
| 3931 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 3932 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 3933 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 3934 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 3935 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 3936 | { |
| 3937 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 3938 | "GO got removed"); |
| 3939 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 3940 | } |
| 3941 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3942 | } |
| 3943 | EXIT(); |
| 3944 | return status; |
| 3945 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3946 | |
| 3947 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 3948 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3949 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 3950 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3951 | struct cfg80211_ap_settings *params) |
| 3952 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3953 | hdd_adapter_t *pAdapter; |
| 3954 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3955 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3956 | |
| 3957 | ENTER(); |
| 3958 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3959 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 3960 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3961 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3962 | "%s: Device is Null", __func__); |
| 3963 | return -ENODEV; |
| 3964 | } |
| 3965 | |
| 3966 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3967 | if (NULL == pAdapter) |
| 3968 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3969 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3970 | "%s: HDD adapter is Null", __func__); |
| 3971 | return -ENODEV; |
| 3972 | } |
| 3973 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 3974 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 3975 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 3976 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3977 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 3978 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3979 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3980 | "%s: HDD adapter magic is invalid", __func__); |
| 3981 | return -ENODEV; |
| 3982 | } |
| 3983 | |
| 3984 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3985 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3986 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3987 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3988 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 3989 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3990 | "%s: HDD context is not valid", __func__); |
| 3991 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3992 | } |
| 3993 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 3994 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 3995 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 3996 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 3997 | |
| 3998 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3999 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4000 | ) |
| 4001 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 4002 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4003 | |
| 4004 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 4005 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4006 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4007 | { |
| 4008 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4009 | FL("already beacon info added to session(%d)"), |
| 4010 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4011 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4012 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4013 | |
| 4014 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 4015 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 4016 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4017 | { |
| 4018 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 4019 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4020 | return -EINVAL; |
| 4021 | } |
| 4022 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 4023 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 4024 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 4025 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 4026 | params->channel, params->channel_type); |
| 4027 | #else |
| 4028 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 4029 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 4030 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4031 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 4032 | params->ssid_len, params->hidden_ssid); |
| 4033 | } |
| 4034 | |
| 4035 | EXIT(); |
| 4036 | return status; |
| 4037 | } |
| 4038 | |
| 4039 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4040 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4041 | struct net_device *dev, |
| 4042 | struct cfg80211_beacon_data *params) |
| 4043 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4044 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4045 | hdd_context_t *pHddCtx; |
| 4046 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4047 | |
| 4048 | ENTER(); |
| 4049 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4050 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4051 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 4052 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4053 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4054 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4055 | |
| 4056 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4057 | status = wlan_hdd_validate_context(pHddCtx); |
| 4058 | |
| 4059 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 4060 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4061 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4062 | "%s: HDD context is not valid", __func__); |
| 4063 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 4064 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4065 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4066 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4067 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4068 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4069 | { |
| 4070 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4071 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4072 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4073 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4074 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4075 | { |
| 4076 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4077 | FL("session(%d) beacon data points to NULL"), |
| 4078 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4079 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4080 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4081 | |
| 4082 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 4083 | |
| 4084 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4085 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4086 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4087 | return -EINVAL; |
| 4088 | } |
| 4089 | |
| 4090 | pAdapter->sessionCtx.ap.beacon = new; |
| 4091 | |
| 4092 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 4093 | } |
| 4094 | |
| 4095 | EXIT(); |
| 4096 | return status; |
| 4097 | } |
| 4098 | |
| 4099 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 4100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 4102 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4103 | struct net_device *dev, |
| 4104 | struct bss_parameters *params) |
| 4105 | { |
| 4106 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4107 | |
| 4108 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4109 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4110 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4111 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 4112 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 4113 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 4114 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 4115 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | |
| 4117 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4118 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4119 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4120 | { |
| 4121 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 4122 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4123 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4124 | { |
| 4125 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | } |
| 4128 | |
| 4129 | EXIT(); |
| 4130 | return 0; |
| 4131 | } |
| 4132 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 4133 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 4134 | struct net_device *dev, |
| 4135 | struct bss_parameters *params) |
| 4136 | { |
| 4137 | int ret; |
| 4138 | |
| 4139 | vos_ssr_protect(__func__); |
| 4140 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 4141 | vos_ssr_unprotect(__func__); |
| 4142 | |
| 4143 | return ret; |
| 4144 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4145 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 4146 | * to wait for contry code completion |
| 4147 | */ |
| 4148 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 4149 | { |
| 4150 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 4151 | complete(&call_back_pAdapter->change_country_code); |
| 4152 | return NULL; |
| 4153 | } |
| 4154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4155 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 4156 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4157 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 4158 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 4159 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4160 | struct net_device *ndev, |
| 4161 | enum nl80211_iftype type, |
| 4162 | u32 *flags, |
| 4163 | struct vif_params *params |
| 4164 | ) |
| 4165 | { |
| 4166 | struct wireless_dev *wdev; |
| 4167 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 4168 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 4169 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4170 | tCsrRoamProfile *pRoamProfile = NULL; |
| 4171 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4172 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4173 | eMib_dot11DesiredBssType connectedBssType; |
| 4174 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4175 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4176 | |
| 4177 | ENTER(); |
| 4178 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4179 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 4180 | { |
| 4181 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4182 | "%s: Adapter context is null", __func__); |
| 4183 | return VOS_STATUS_E_FAILURE; |
| 4184 | } |
| 4185 | |
| 4186 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4187 | if (!pHddCtx) |
| 4188 | { |
| 4189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4190 | "%s: HDD context is null", __func__); |
| 4191 | return VOS_STATUS_E_FAILURE; |
| 4192 | } |
| 4193 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4194 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4195 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 4196 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4197 | status = wlan_hdd_validate_context(pHddCtx); |
| 4198 | |
| 4199 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4200 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4201 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4202 | "%s: HDD context is not valid", __func__); |
| 4203 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | } |
| 4205 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 4206 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 4207 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 4208 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4209 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4210 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4211 | wdev = ndev->ieee80211_ptr; |
| 4212 | |
| 4213 | #ifdef WLAN_BTAMP_FEATURE |
| 4214 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 4215 | (NL80211_IFTYPE_ADHOC == type)|| |
| 4216 | (NL80211_IFTYPE_AP == type)|| |
| 4217 | (NL80211_IFTYPE_P2P_GO == type)) |
| 4218 | { |
| 4219 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 4220 | // stop AMP traffic |
| 4221 | status = WLANBAP_StopAmp(); |
| 4222 | if(VOS_STATUS_SUCCESS != status ) |
| 4223 | { |
| 4224 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 4225 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 4226 | "%s: Failed to stop AMP", __func__); |
| 4227 | return -EINVAL; |
| 4228 | } |
| 4229 | } |
| 4230 | #endif //WLAN_BTAMP_FEATURE |
| 4231 | /* Reset the current device mode bit mask*/ |
| 4232 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 4233 | |
| 4234 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4235 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4236 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4237 | ) |
| 4238 | { |
| 4239 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 4240 | if (!pWextState) |
| 4241 | { |
| 4242 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4243 | "%s: pWextState is null", __func__); |
| 4244 | return VOS_STATUS_E_FAILURE; |
| 4245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4246 | pRoamProfile = &pWextState->roamProfile; |
| 4247 | LastBSSType = pRoamProfile->BSSType; |
| 4248 | |
| 4249 | switch (type) |
| 4250 | { |
| 4251 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4252 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4253 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4254 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 4255 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4256 | #ifdef WLAN_FEATURE_11AC |
| 4257 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 4258 | { |
| 4259 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 4260 | } |
| 4261 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4262 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4263 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4264 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 4265 | //Check for sub-string p2p to confirm its a p2p interface |
| 4266 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4267 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 4268 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 4269 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 4270 | } |
| 4271 | else |
| 4272 | { |
| 4273 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4274 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 4275 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 4276 | #ifdef FEATURE_WLAN_TDLS |
| 4277 | /* The open adapter for the p2p shall skip initializations in |
| 4278 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 4279 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 4280 | * tdls_init when the change_iface sets the device mode to |
| 4281 | * WLAN_HDD_P2P_CLIENT. |
| 4282 | */ |
| 4283 | |
| 4284 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 4285 | { |
| 4286 | if (0 != wlan_hdd_tdls_init (pAdapter)) |
| 4287 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4289 | "%s: tdls initialization failed", __func__); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 4290 | return -EINVAL; |
| 4291 | } |
| 4292 | } |
| 4293 | #endif |
| 4294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4295 | break; |
| 4296 | case NL80211_IFTYPE_ADHOC: |
| 4297 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4298 | "%s: setting interface Type to ADHOC", __func__); |
| 4299 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 4300 | pRoamProfile->phyMode = |
| 4301 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4302 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4303 | wdev->iftype = type; |
| 4304 | break; |
| 4305 | |
| 4306 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4307 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4308 | { |
| 4309 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 4310 | "%s: setting interface Type to %s", __func__, |
| 4311 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 4312 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 4313 | //Cancel any remain on channel for GO mode |
| 4314 | if (NL80211_IFTYPE_P2P_GO == type) |
| 4315 | { |
| 4316 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 4317 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 4318 | if (NL80211_IFTYPE_AP == type) |
| 4319 | { |
| 4320 | /* As Loading WLAN Driver one interface being created for p2p device |
| 4321 | * address. This will take one HW STA and the max number of clients |
| 4322 | * that can connect to softAP will be reduced by one. so while changing |
| 4323 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 4324 | * interface as it is not required in SoftAP mode. |
| 4325 | */ |
| 4326 | |
| 4327 | // Get P2P Adapter |
| 4328 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 4329 | |
| 4330 | if (pP2pAdapter) |
| 4331 | { |
| 4332 | hdd_stop_adapter(pHddCtx, pP2pAdapter); |
| 4333 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 4334 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 4335 | } |
| 4336 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 4337 | //Disable IMPS & BMPS for SAP/GO |
| 4338 | if(VOS_STATUS_E_FAILURE == |
| 4339 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 4340 | { |
| 4341 | //Fail to Exit BMPS |
| 4342 | VOS_ASSERT(0); |
| 4343 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4344 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 4345 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4346 | /* A Mutex Lock is introduced while changing the mode to |
| 4347 | * protect the concurrent access for the Adapters by TDLS |
| 4348 | * module. |
| 4349 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 4350 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4351 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4352 | //De-init the adapter. |
| 4353 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 4354 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 4355 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4356 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 4357 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4358 | #ifdef FEATURE_WLAN_TDLS |
| 4359 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4360 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 4361 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 4362 | (pConfig->apRandomBssidEnabled)) |
| 4363 | { |
| 4364 | /* To meet Android requirements create a randomized |
| 4365 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 4366 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 4367 | ndev->dev_addr[0] = 0x02; |
| 4368 | ndev->dev_addr[1] = 0x1A; |
| 4369 | ndev->dev_addr[2] = 0x11; |
| 4370 | ndev->dev_addr[3] |= 0xF0; |
| 4371 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 4372 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 4373 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 4374 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 4375 | } |
| 4376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4377 | hdd_set_ap_ops( pAdapter->dev ); |
| 4378 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4379 | /* This is for only SAP mode where users can |
| 4380 | * control country through ini. |
| 4381 | * P2P GO follows station country code |
| 4382 | * acquired during the STA scanning. */ |
| 4383 | if((NL80211_IFTYPE_AP == type) && |
| 4384 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 4385 | { |
| 4386 | int status = 0; |
| 4387 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 4388 | "%s: setting country code from INI ", __func__); |
| 4389 | init_completion(&pAdapter->change_country_code); |
| 4390 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 4391 | (void *)(tSmeChangeCountryCallback) |
| 4392 | wlan_hdd_change_country_code_cb, |
| 4393 | pConfig->apCntryCode, pAdapter, |
| 4394 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 4395 | eSIR_FALSE, |
| 4396 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4397 | if (eHAL_STATUS_SUCCESS == status) |
| 4398 | { |
| 4399 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4400 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4401 | &pAdapter->change_country_code, |
| 4402 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4403 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4404 | { |
| 4405 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4406 | FL("SME Timed out while setting country code %ld"), |
| 4407 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 4408 | |
| 4409 | if (pHddCtx->isLogpInProgress) |
| 4410 | { |
| 4411 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4412 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 4413 | return -EAGAIN; |
| 4414 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4415 | } |
| 4416 | } |
| 4417 | else |
| 4418 | { |
| 4419 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4420 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 4421 | return -EINVAL; |
| 4422 | } |
| 4423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4424 | status = hdd_init_ap_mode(pAdapter); |
| 4425 | if(status != VOS_STATUS_SUCCESS) |
| 4426 | { |
| 4427 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 4428 | "%s: Error initializing the ap mode", __func__); |
| 4429 | return -EINVAL; |
| 4430 | } |
| 4431 | hdd_set_conparam(1); |
| 4432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | /*interface type changed update in wiphy structure*/ |
| 4434 | if(wdev) |
| 4435 | { |
| 4436 | wdev->iftype = type; |
| 4437 | pHddCtx->change_iface = type; |
| 4438 | } |
| 4439 | else |
| 4440 | { |
| 4441 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4442 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 4443 | return -EINVAL; |
| 4444 | } |
| 4445 | goto done; |
| 4446 | } |
| 4447 | |
| 4448 | default: |
| 4449 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 4450 | __func__); |
| 4451 | return -EOPNOTSUPP; |
| 4452 | } |
| 4453 | } |
| 4454 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4455 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4456 | ) |
| 4457 | { |
| 4458 | switch(type) |
| 4459 | { |
| 4460 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4461 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4462 | case NL80211_IFTYPE_ADHOC: |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4463 | #ifdef FEATURE_WLAN_TDLS |
| 4464 | |
| 4465 | /* A Mutex Lock is introduced while changing the mode to |
| 4466 | * protect the concurrent access for the Adapters by TDLS |
| 4467 | * module. |
| 4468 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 4469 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4470 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4471 | hdd_stop_adapter( pHddCtx, pAdapter ); |
| 4472 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4473 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 4474 | //Check for sub-string p2p to confirm its a p2p interface |
| 4475 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 4476 | { |
| 4477 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 4478 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 4479 | } |
| 4480 | else |
| 4481 | { |
| 4482 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 4484 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | hdd_set_conparam(0); |
| 4486 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4487 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 4488 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4489 | #ifdef FEATURE_WLAN_TDLS |
| 4490 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4491 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 4492 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | if( VOS_STATUS_SUCCESS != status ) |
| 4494 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4495 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 4496 | * This is the right place to enable back bmps_imps() |
| 4497 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 4498 | if (pHddCtx->hdd_wlan_suspended) |
| 4499 | { |
| 4500 | hdd_set_pwrparams(pHddCtx); |
| 4501 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4502 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | goto done; |
| 4504 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4505 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4507 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 4508 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4509 | goto done; |
| 4510 | default: |
| 4511 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 4512 | __func__); |
| 4513 | return -EOPNOTSUPP; |
| 4514 | |
| 4515 | } |
| 4516 | |
| 4517 | } |
| 4518 | else |
| 4519 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 4520 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 4521 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 4522 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4523 | return -EOPNOTSUPP; |
| 4524 | } |
| 4525 | |
| 4526 | |
| 4527 | if(pRoamProfile) |
| 4528 | { |
| 4529 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 4530 | { |
| 4531 | /*interface type changed update in wiphy structure*/ |
| 4532 | wdev->iftype = type; |
| 4533 | |
| 4534 | /*the BSS mode changed, We need to issue disconnect |
| 4535 | if connected or in IBSS disconnect state*/ |
| 4536 | if ( hdd_connGetConnectedBssType( |
| 4537 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 4538 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 4539 | { |
| 4540 | /*need to issue a disconnect to CSR.*/ |
| 4541 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4542 | if( eHAL_STATUS_SUCCESS == |
| 4543 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4544 | pAdapter->sessionId, |
| 4545 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 4546 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4547 | ret = wait_for_completion_interruptible_timeout( |
| 4548 | &pAdapter->disconnect_comp_var, |
| 4549 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 4550 | if (ret <= 0) |
| 4551 | { |
| 4552 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4553 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 4554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4555 | } |
| 4556 | } |
| 4557 | } |
| 4558 | } |
| 4559 | |
| 4560 | done: |
| 4561 | /*set bitmask based on updated value*/ |
| 4562 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 4563 | |
| 4564 | /* Only STA mode support TM now |
| 4565 | * all other mode, TM feature should be disabled */ |
| 4566 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 4567 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 4568 | { |
| 4569 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 4570 | } |
| 4571 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4572 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4573 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4574 | (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 4575 | { |
| 4576 | //we are ok to do AMP |
| 4577 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 4578 | } |
| 4579 | #endif //WLAN_BTAMP_FEATURE |
| 4580 | EXIT(); |
| 4581 | return 0; |
| 4582 | } |
| 4583 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 4584 | /* |
| 4585 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 4586 | * wrapper function to protect the actual implementation from SSR. |
| 4587 | */ |
| 4588 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 4589 | struct net_device *ndev, |
| 4590 | enum nl80211_iftype type, |
| 4591 | u32 *flags, |
| 4592 | struct vif_params *params |
| 4593 | ) |
| 4594 | { |
| 4595 | int ret; |
| 4596 | |
| 4597 | vos_ssr_protect(__func__); |
| 4598 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 4599 | vos_ssr_unprotect(__func__); |
| 4600 | |
| 4601 | return ret; |
| 4602 | } |
| 4603 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4604 | #ifdef FEATURE_WLAN_TDLS |
| 4605 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 4606 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 4607 | { |
| 4608 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4609 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4610 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4611 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4612 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 4613 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4614 | |
| 4615 | ENTER(); |
| 4616 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 4617 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4618 | { |
| 4619 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4620 | "Invalid arguments"); |
| 4621 | return -EINVAL; |
| 4622 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 4623 | |
| 4624 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 4625 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 4626 | { |
| 4627 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4628 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 4629 | MAC_ADDRESS_STR " Request declined.", |
| 4630 | __func__, MAC_ADDR_ARRAY(mac)); |
| 4631 | return -ENOTSUPP; |
| 4632 | } |
| 4633 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4634 | if (pHddCtx->isLogpInProgress) |
| 4635 | { |
| 4636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4637 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 4638 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4639 | return -EBUSY; |
| 4640 | } |
| 4641 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 4642 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4643 | |
| 4644 | if ( NULL == pTdlsPeer ) { |
| 4645 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4646 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 4647 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 4648 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 4649 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4650 | |
| 4651 | /* in add station, we accept existing valid staId if there is */ |
| 4652 | if ((0 == update) && |
| 4653 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 4654 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4655 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4656 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4657 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4658 | " link_status %d. staId %d. add station ignored.", |
| 4659 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 4660 | return 0; |
| 4661 | } |
| 4662 | /* in change station, we accept only when staId is valid */ |
| 4663 | if ((1 == update) && |
| 4664 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 4665 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 4666 | { |
| 4667 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4668 | "%s: " MAC_ADDRESS_STR |
| 4669 | " link status %d. staId %d. change station %s.", |
| 4670 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 4671 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 4672 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4673 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 4674 | |
| 4675 | /* 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] | 4676 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4677 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 4678 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4679 | "%s: " MAC_ADDRESS_STR |
| 4680 | " TDLS setup is ongoing. Request declined.", |
| 4681 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 4682 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4683 | } |
| 4684 | |
| 4685 | /* first to check if we reached to maximum supported TDLS peer. |
| 4686 | TODO: for now, return -EPERM looks working fine, |
| 4687 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 4688 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 4689 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4690 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 4691 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4692 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 4693 | " TDLS Max peer already connected. Request declined." |
| 4694 | " Num of peers (%d), Max allowed (%d).", |
| 4695 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 4696 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 4697 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4698 | } |
| 4699 | else |
| 4700 | { |
| 4701 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 4702 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4703 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4704 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 4705 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4706 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 4707 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4708 | return -EPERM; |
| 4709 | } |
| 4710 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4711 | if (0 == update) |
| 4712 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_CONNECTING); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4713 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 4714 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 4715 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4716 | { |
| 4717 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4718 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4719 | if(StaParams->htcap_present) |
| 4720 | { |
| 4721 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4722 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 4723 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4724 | "ht_capa->extended_capabilities: %0x", |
| 4725 | StaParams->HTCap.extendedHtCapInfo); |
| 4726 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4727 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4728 | "params->capability: %0x",StaParams->capability); |
| 4729 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4730 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4731 | if(StaParams->vhtcap_present) |
| 4732 | { |
| 4733 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4734 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 4735 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 4736 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 4737 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4738 | { |
| 4739 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4740 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4741 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 4742 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 4743 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 4744 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 4745 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 4746 | else if ((1 == update) && (NULL == StaParams)) |
| 4747 | { |
| 4748 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4749 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 4750 | return -EPERM; |
| 4751 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4752 | |
| 4753 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 4754 | |
| 4755 | if (!update) |
| 4756 | { |
| 4757 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4758 | pAdapter->sessionId, mac); |
| 4759 | } |
| 4760 | else |
| 4761 | { |
| 4762 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4763 | pAdapter->sessionId, mac, StaParams); |
| 4764 | } |
| 4765 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4766 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4767 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 4768 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4769 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4770 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 4771 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4772 | "%s: timeout waiting for tdls add station indication %ld", |
| 4773 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 4774 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4775 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4776 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4777 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 4778 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 4779 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4780 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 4781 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4782 | } |
| 4783 | |
| 4784 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 4785 | |
| 4786 | error: |
| 4787 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
| 4788 | return -EPERM; |
| 4789 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4790 | } |
| 4791 | #endif |
| 4792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4793 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 4794 | struct net_device *dev, |
| 4795 | u8 *mac, |
| 4796 | struct station_parameters *params) |
| 4797 | { |
| 4798 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4799 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4800 | hdd_context_t *pHddCtx; |
| 4801 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4802 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 4803 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4804 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4805 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 4806 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 4807 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4808 | ENTER(); |
| 4809 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4810 | if ((NULL == pAdapter)) |
| 4811 | { |
| 4812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4813 | "invalid adapter "); |
| 4814 | return -EINVAL; |
| 4815 | } |
| 4816 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4817 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4818 | TRACE_CODE_HDD_CHANGE_STATION, |
| 4819 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4820 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4821 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4822 | |
| 4823 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 4824 | { |
| 4825 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4826 | "invalid HDD state or HDD station context"); |
| 4827 | return -EINVAL; |
| 4828 | } |
| 4829 | |
| 4830 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4831 | { |
| 4832 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4833 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4834 | return -EAGAIN; |
| 4835 | } |
| 4836 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4837 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 4838 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4839 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 4840 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4841 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4842 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4843 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4844 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4845 | WLANTL_STA_AUTHENTICATED); |
| 4846 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4847 | if (status != VOS_STATUS_SUCCESS) |
| 4848 | { |
| 4849 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4850 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 4851 | return -EINVAL; |
| 4852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4853 | } |
| 4854 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 4855 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 4856 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 4857 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4858 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 4859 | StaParams.capability = params->capability; |
| 4860 | StaParams.uapsd_queues = params->uapsd_queues; |
| 4861 | StaParams.max_sp = params->max_sp; |
| 4862 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 4863 | /* Convert (first channel , number of channels) tuple to |
| 4864 | * the total list of channels. This goes with the assumption |
| 4865 | * that if the first channel is < 14, then the next channels |
| 4866 | * are an incremental of 1 else an incremental of 4 till the number |
| 4867 | * of channels. |
| 4868 | */ |
| 4869 | if (0 != params->supported_channels_len) { |
| 4870 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 4871 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 4872 | { |
| 4873 | int wifi_chan_index; |
| 4874 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 4875 | wifi_chan_index = |
| 4876 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 4877 | no_of_channels = params->supported_channels[i+1]; |
| 4878 | for(k=1; k <= no_of_channels; k++) |
| 4879 | { |
| 4880 | StaParams.supported_channels[j+1] = |
| 4881 | StaParams.supported_channels[j] + wifi_chan_index; |
| 4882 | j+=1; |
| 4883 | } |
| 4884 | } |
| 4885 | StaParams.supported_channels_len = j; |
| 4886 | } |
| 4887 | vos_mem_copy(StaParams.supported_oper_classes, |
| 4888 | params->supported_oper_classes, |
| 4889 | params->supported_oper_classes_len); |
| 4890 | StaParams.supported_oper_classes_len = |
| 4891 | params->supported_oper_classes_len; |
| 4892 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4893 | if (0 != params->ext_capab_len) |
| 4894 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 4895 | sizeof(StaParams.extn_capability)); |
| 4896 | |
| 4897 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4898 | { |
| 4899 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4900 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4901 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4902 | |
| 4903 | StaParams.supported_rates_len = params->supported_rates_len; |
| 4904 | |
| 4905 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 4906 | * The supported_rates array , for all the structures propogating till Add Sta |
| 4907 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 4908 | * modified to send more rates. |
| 4909 | */ |
| 4910 | |
| 4911 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 4912 | */ |
| 4913 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 4914 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 4915 | |
| 4916 | if (0 != StaParams.supported_rates_len) { |
| 4917 | int i = 0; |
| 4918 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 4919 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4920 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4921 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 4922 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 4923 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4924 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 4925 | } |
| 4926 | |
| 4927 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4928 | { |
| 4929 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4930 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 4931 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 4932 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4933 | if (0 != params->ext_capab_len ) { |
| 4934 | /*Define A Macro : TODO Sunil*/ |
| 4935 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 4936 | isBufSta = 1; |
| 4937 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 4938 | /* TDLS Channel Switching Support */ |
| 4939 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 4940 | isOffChannelSupported = 1; |
| 4941 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4942 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 4943 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 4944 | &StaParams, isBufSta, |
| 4945 | isOffChannelSupported); |
| 4946 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 4947 | if (VOS_STATUS_SUCCESS != status) { |
| 4948 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4949 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 4950 | return -EINVAL; |
| 4951 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4952 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 4953 | |
| 4954 | if (VOS_STATUS_SUCCESS != status) { |
| 4955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4956 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 4957 | return -EINVAL; |
| 4958 | } |
| 4959 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 4960 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 4961 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4962 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4963 | return status; |
| 4964 | } |
| 4965 | |
| 4966 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 4967 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4968 | * This function is used to initialize the key information |
| 4969 | */ |
| 4970 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 4971 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4972 | struct net_device *ndev, |
| 4973 | u8 key_index, bool pairwise, |
| 4974 | const u8 *mac_addr, |
| 4975 | struct key_params *params |
| 4976 | ) |
| 4977 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 4978 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4979 | struct net_device *ndev, |
| 4980 | u8 key_index, const u8 *mac_addr, |
| 4981 | struct key_params *params |
| 4982 | ) |
| 4983 | #endif |
| 4984 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 4985 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | tCsrRoamSetKey setKey; |
| 4987 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4988 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 4989 | v_U32_t roamId= 0xFF; |
| 4990 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | hdd_hostapd_state_t *pHostapdState; |
| 4992 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 4993 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 4994 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | |
| 4996 | ENTER(); |
| 4997 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4998 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 4999 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 5000 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5001 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5002 | status = wlan_hdd_validate_context(pHddCtx); |
| 5003 | |
| 5004 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5005 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5006 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5007 | "%s: HDD context is not valid", __func__); |
| 5008 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5009 | } |
| 5010 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5011 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 5012 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5013 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | |
| 5015 | if (CSR_MAX_NUM_KEY <= key_index) |
| 5016 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5017 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5018 | key_index); |
| 5019 | |
| 5020 | return -EINVAL; |
| 5021 | } |
| 5022 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5023 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 5024 | { |
| 5025 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 5026 | params->key_len); |
| 5027 | |
| 5028 | return -EINVAL; |
| 5029 | } |
| 5030 | |
| 5031 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5032 | "%s: called with key index = %d & key length %d", |
| 5033 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5034 | |
| 5035 | /*extract key idx, key len and key*/ |
| 5036 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 5037 | setKey.keyId = key_index; |
| 5038 | setKey.keyLength = params->key_len; |
| 5039 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 5040 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5041 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5042 | { |
| 5043 | case WLAN_CIPHER_SUITE_WEP40: |
| 5044 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5045 | break; |
| 5046 | |
| 5047 | case WLAN_CIPHER_SUITE_WEP104: |
| 5048 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5049 | break; |
| 5050 | |
| 5051 | case WLAN_CIPHER_SUITE_TKIP: |
| 5052 | { |
| 5053 | u8 *pKey = &setKey.Key[0]; |
| 5054 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5055 | |
| 5056 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 5057 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5058 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5059 | |
| 5060 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5061 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5062 | |--------------|----------|----------| |
| 5063 | <---16bytes---><--8bytes--><--8bytes--> |
| 5064 | |
| 5065 | */ |
| 5066 | /*Sme expects the 32 bytes key to be in the below order |
| 5067 | |
| 5068 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5069 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5070 | |--------------|----------|----------| |
| 5071 | <---16bytes---><--8bytes--><--8bytes--> |
| 5072 | */ |
| 5073 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5074 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5075 | |
| 5076 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5077 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5078 | |
| 5079 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5080 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5081 | |
| 5082 | |
| 5083 | break; |
| 5084 | } |
| 5085 | |
| 5086 | case WLAN_CIPHER_SUITE_CCMP: |
| 5087 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 5088 | break; |
| 5089 | |
| 5090 | #ifdef FEATURE_WLAN_WAPI |
| 5091 | case WLAN_CIPHER_SUITE_SMS4: |
| 5092 | { |
| 5093 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 5094 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 5095 | params->key, params->key_len); |
| 5096 | return 0; |
| 5097 | } |
| 5098 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5099 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5100 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5101 | case WLAN_CIPHER_SUITE_KRK: |
| 5102 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 5103 | break; |
| 5104 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5105 | |
| 5106 | #ifdef WLAN_FEATURE_11W |
| 5107 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 5108 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 5109 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5110 | #endif |
| 5111 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5112 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5113 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5114 | __func__, params->cipher); |
| 5115 | return -EOPNOTSUPP; |
| 5116 | } |
| 5117 | |
| 5118 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 5119 | __func__, setKey.encType); |
| 5120 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 5121 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5122 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5123 | (!pairwise) |
| 5124 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5125 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5126 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 5127 | ) |
| 5128 | { |
| 5129 | /* set group key*/ |
| 5130 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5131 | "%s- %d: setting Broadcast key", |
| 5132 | __func__, __LINE__); |
| 5133 | setKey.keyDirection = eSIR_RX_ONLY; |
| 5134 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 5135 | } |
| 5136 | else |
| 5137 | { |
| 5138 | /* set pairwise key*/ |
| 5139 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5140 | "%s- %d: setting pairwise key", |
| 5141 | __func__, __LINE__); |
| 5142 | setKey.keyDirection = eSIR_TX_RX; |
| 5143 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 5144 | } |
| 5145 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 5146 | { |
| 5147 | setKey.keyDirection = eSIR_TX_RX; |
| 5148 | /*Set the group key*/ |
| 5149 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5150 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5151 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 5152 | if ( 0 != status ) |
| 5153 | { |
| 5154 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5155 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 5156 | return -EINVAL; |
| 5157 | } |
| 5158 | /*Save the keys here and call sme_RoamSetKey for setting |
| 5159 | the PTK after peer joins the IBSS network*/ |
| 5160 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 5161 | &setKey, sizeof(tCsrRoamSetKey)); |
| 5162 | return status; |
| 5163 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5164 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 5165 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 5166 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5167 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5168 | if( pHostapdState->bssState == BSS_START ) |
| 5169 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 5170 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5171 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 5172 | |
| 5173 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 5174 | { |
| 5175 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5176 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 5177 | __LINE__, vos_status ); |
| 5178 | |
| 5179 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5180 | |
| 5181 | return -EINVAL; |
| 5182 | } |
| 5183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 5185 | |
| 5186 | if ( status != eHAL_STATUS_SUCCESS ) |
| 5187 | { |
| 5188 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5189 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 5190 | __LINE__, status ); |
| 5191 | } |
| 5192 | } |
| 5193 | |
| 5194 | /* Saving WEP keys */ |
| 5195 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 5196 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 5197 | { |
| 5198 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 5199 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 5200 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 5201 | } |
| 5202 | else |
| 5203 | { |
| 5204 | //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] | 5205 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 5207 | } |
| 5208 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5209 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 5210 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5211 | { |
| 5212 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5213 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5214 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 5215 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5216 | if (!pairwise) |
| 5217 | #else |
| 5218 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 5219 | #endif |
| 5220 | { |
| 5221 | /* set group key*/ |
| 5222 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 5223 | { |
| 5224 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5225 | "%s- %d: Perform Set key Complete", |
| 5226 | __func__, __LINE__); |
| 5227 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 5228 | } |
| 5229 | } |
| 5230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5231 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 5232 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 5233 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 5234 | |
| 5235 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 5236 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5237 | params->key, params->key_len); |
| 5238 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 5239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5240 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5241 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5242 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | "%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] | 5244 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 5245 | setKey.peerMac[2], setKey.peerMac[3], |
| 5246 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5247 | setKey.keyDirection); |
| 5248 | |
| 5249 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 5250 | |
| 5251 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 5252 | { |
| 5253 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5254 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 5255 | __LINE__, vos_status ); |
| 5256 | |
| 5257 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5258 | |
| 5259 | return -EINVAL; |
| 5260 | |
| 5261 | } |
| 5262 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5263 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 5264 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 5265 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 5266 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5267 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 5268 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5269 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 5270 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 5271 | "%s: Update PreAuth Key success", __func__); |
| 5272 | return 0; |
| 5273 | } |
| 5274 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 5275 | { |
| 5276 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5277 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 5278 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 5279 | } |
| 5280 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | |
| 5282 | /* issue set key request to SME*/ |
| 5283 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5284 | pAdapter->sessionId, &setKey, &roamId ); |
| 5285 | |
| 5286 | if ( 0 != status ) |
| 5287 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5289 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 5290 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5291 | return -EINVAL; |
| 5292 | } |
| 5293 | |
| 5294 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5295 | /* in case of IBSS as there was no information available about WEP keys during |
| 5296 | * 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] | 5297 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5298 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 5299 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 5300 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5301 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 5302 | ) |
| 5303 | && |
| 5304 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 5305 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 5306 | ) |
| 5307 | ) |
| 5308 | { |
| 5309 | setKey.keyDirection = eSIR_RX_ONLY; |
| 5310 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 5311 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5312 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5313 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5314 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 5315 | setKey.peerMac[2], setKey.peerMac[3], |
| 5316 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5317 | setKey.keyDirection); |
| 5318 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5319 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5320 | pAdapter->sessionId, &setKey, &roamId ); |
| 5321 | |
| 5322 | if ( 0 != status ) |
| 5323 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5324 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5325 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5326 | __func__, status); |
| 5327 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5328 | return -EINVAL; |
| 5329 | } |
| 5330 | } |
| 5331 | } |
| 5332 | |
| 5333 | return 0; |
| 5334 | } |
| 5335 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5336 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5337 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 5338 | struct net_device *ndev, |
| 5339 | u8 key_index, bool pairwise, |
| 5340 | const u8 *mac_addr, |
| 5341 | struct key_params *params |
| 5342 | ) |
| 5343 | #else |
| 5344 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 5345 | struct net_device *ndev, |
| 5346 | u8 key_index, const u8 *mac_addr, |
| 5347 | struct key_params *params |
| 5348 | ) |
| 5349 | #endif |
| 5350 | { |
| 5351 | int ret; |
| 5352 | vos_ssr_protect(__func__); |
| 5353 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5354 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 5355 | mac_addr, params); |
| 5356 | #else |
| 5357 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 5358 | params); |
| 5359 | #endif |
| 5360 | vos_ssr_unprotect(__func__); |
| 5361 | |
| 5362 | return ret; |
| 5363 | } |
| 5364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5365 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5366 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | * This function is used to get the key information |
| 5368 | */ |
| 5369 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5370 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5371 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5372 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5373 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5374 | const u8 *mac_addr, void *cookie, |
| 5375 | void (*callback)(void *cookie, struct key_params*) |
| 5376 | ) |
| 5377 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5378 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5379 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5380 | struct net_device *ndev, |
| 5381 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 5382 | void (*callback)(void *cookie, struct key_params*) |
| 5383 | ) |
| 5384 | #endif |
| 5385 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5386 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5387 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5388 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5389 | struct key_params params; |
| 5390 | |
| 5391 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5392 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5393 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 5394 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5395 | pAdapter->device_mode); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5397 | memset(¶ms, 0, sizeof(params)); |
| 5398 | |
| 5399 | if (CSR_MAX_NUM_KEY <= key_index) |
| 5400 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5401 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5402 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5404 | |
| 5405 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 5406 | { |
| 5407 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5408 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 5409 | break; |
| 5410 | |
| 5411 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5412 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5413 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 5414 | break; |
| 5415 | |
| 5416 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5417 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5418 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 5419 | break; |
| 5420 | |
| 5421 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5422 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 5423 | break; |
| 5424 | |
| 5425 | case eCSR_ENCRYPT_TYPE_AES: |
| 5426 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 5427 | break; |
| 5428 | |
| 5429 | default: |
| 5430 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 5431 | break; |
| 5432 | } |
| 5433 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 5434 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5435 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 5436 | pAdapter->sessionId, params.cipher)); |
| 5437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5438 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 5439 | params.seq_len = 0; |
| 5440 | params.seq = NULL; |
| 5441 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 5442 | callback(cookie, ¶ms); |
| 5443 | return 0; |
| 5444 | } |
| 5445 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5446 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5447 | static int wlan_hdd_cfg80211_get_key( |
| 5448 | struct wiphy *wiphy, |
| 5449 | struct net_device *ndev, |
| 5450 | u8 key_index, bool pairwise, |
| 5451 | const u8 *mac_addr, void *cookie, |
| 5452 | void (*callback)(void *cookie, struct key_params*) |
| 5453 | ) |
| 5454 | #else |
| 5455 | static int wlan_hdd_cfg80211_get_key( |
| 5456 | struct wiphy *wiphy, |
| 5457 | struct net_device *ndev, |
| 5458 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 5459 | void (*callback)(void *cookie, struct key_params*) |
| 5460 | ) |
| 5461 | #endif |
| 5462 | { |
| 5463 | int ret; |
| 5464 | |
| 5465 | vos_ssr_protect(__func__); |
| 5466 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5467 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 5468 | mac_addr, cookie, callback); |
| 5469 | #else |
| 5470 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 5471 | callback); |
| 5472 | #endif |
| 5473 | vos_ssr_unprotect(__func__); |
| 5474 | |
| 5475 | return ret; |
| 5476 | } |
| 5477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | /* |
| 5479 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 5480 | * This function is used to delete the key information |
| 5481 | */ |
| 5482 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5483 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5484 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5485 | u8 key_index, |
| 5486 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | const u8 *mac_addr |
| 5488 | ) |
| 5489 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5490 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | struct net_device *ndev, |
| 5492 | u8 key_index, |
| 5493 | const u8 *mac_addr |
| 5494 | ) |
| 5495 | #endif |
| 5496 | { |
| 5497 | int status = 0; |
| 5498 | |
| 5499 | //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] | 5500 | //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] | 5501 | //it is observed that this is invalidating peer |
| 5502 | //key index whenever re-key is done. This is affecting data link. |
| 5503 | //It should be ok to ignore del_key. |
| 5504 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5505 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 5506 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 5508 | tCsrRoamSetKey setKey; |
| 5509 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5511 | ENTER(); |
| 5512 | |
| 5513 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 5514 | __func__,pAdapter->device_mode); |
| 5515 | |
| 5516 | if (CSR_MAX_NUM_KEY <= key_index) |
| 5517 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5518 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5519 | key_index); |
| 5520 | |
| 5521 | return -EINVAL; |
| 5522 | } |
| 5523 | |
| 5524 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 5525 | setKey.keyId = key_index; |
| 5526 | |
| 5527 | if (mac_addr) |
| 5528 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 5529 | else |
| 5530 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 5531 | |
| 5532 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 5533 | |
| 5534 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5535 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5536 | ) |
| 5537 | { |
| 5538 | |
| 5539 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 5541 | if( pHostapdState->bssState == BSS_START) |
| 5542 | { |
| 5543 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5544 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5545 | if ( status != eHAL_STATUS_SUCCESS ) |
| 5546 | { |
| 5547 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5548 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 5549 | __LINE__, status ); |
| 5550 | } |
| 5551 | } |
| 5552 | } |
| 5553 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5554 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5555 | ) |
| 5556 | { |
| 5557 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5558 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5559 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5560 | |
| 5561 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5562 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5563 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 5564 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5565 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5566 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 5567 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5568 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5569 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5570 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5571 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5572 | if ( 0 != status ) |
| 5573 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5574 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5575 | "%s: sme_RoamSetKey failure, returned %d", |
| 5576 | __func__, status); |
| 5577 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5578 | return -EINVAL; |
| 5579 | } |
| 5580 | } |
| 5581 | } |
| 5582 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5583 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | return status; |
| 5585 | } |
| 5586 | |
| 5587 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5588 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5589 | * This function is used to set the default tx key index |
| 5590 | */ |
| 5591 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5592 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | struct net_device *ndev, |
| 5594 | u8 key_index, |
| 5595 | bool unicast, bool multicast) |
| 5596 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5597 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5598 | struct net_device *ndev, |
| 5599 | u8 key_index) |
| 5600 | #endif |
| 5601 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5602 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5603 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5604 | hdd_wext_state_t *pWextState; |
| 5605 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5606 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5607 | |
| 5608 | ENTER(); |
| 5609 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5610 | if ((NULL == pAdapter)) |
| 5611 | { |
| 5612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5613 | "invalid adapter"); |
| 5614 | return -EINVAL; |
| 5615 | } |
| 5616 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5617 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5618 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 5619 | pAdapter->sessionId, key_index)); |
| 5620 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5621 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5622 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5623 | |
| 5624 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 5625 | { |
| 5626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5627 | "invalid Wext state or HDD context"); |
| 5628 | return -EINVAL; |
| 5629 | } |
| 5630 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5631 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5633 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5634 | if (CSR_MAX_NUM_KEY <= key_index) |
| 5635 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5636 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5637 | key_index); |
| 5638 | |
| 5639 | return -EINVAL; |
| 5640 | } |
| 5641 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5642 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5643 | status = wlan_hdd_validate_context(pHddCtx); |
| 5644 | |
| 5645 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5646 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5647 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5648 | "%s: HDD context is not valid", __func__); |
| 5649 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5650 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5651 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5654 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5656 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 5657 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5658 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 5659 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5660 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5661 | { |
| 5662 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5663 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5665 | tCsrRoamSetKey setKey; |
| 5666 | v_U32_t roamId= 0xFF; |
| 5667 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5668 | |
| 5669 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5670 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5671 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5672 | Keys->defaultIndex = (u8)key_index; |
| 5673 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 5674 | setKey.keyId = key_index; |
| 5675 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5676 | |
| 5677 | vos_mem_copy(&setKey.Key[0], |
| 5678 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5679 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5680 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5681 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5682 | |
| 5683 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5684 | &pHddStaCtx->conn_info.bssId[0], |
| 5685 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5686 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 5687 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 5688 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 5689 | eCSR_ENCRYPT_TYPE_WEP104) |
| 5690 | { |
| 5691 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 5692 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 5693 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 5694 | type(104) and switching encryption type to 40*/ |
| 5695 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 5696 | eCSR_ENCRYPT_TYPE_WEP40; |
| 5697 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5698 | eCSR_ENCRYPT_TYPE_WEP40; |
| 5699 | } |
| 5700 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5701 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5702 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5704 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5705 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5706 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5708 | if ( 0 != status ) |
| 5709 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5710 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5711 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5712 | status); |
| 5713 | return -EINVAL; |
| 5714 | } |
| 5715 | } |
| 5716 | } |
| 5717 | |
| 5718 | /* In SoftAp mode setting key direction for default mode */ |
| 5719 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 5720 | { |
| 5721 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 5722 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 5723 | (eCSR_ENCRYPT_TYPE_AES != |
| 5724 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 5725 | ) |
| 5726 | { |
| 5727 | /* Saving key direction for default key index to TX default */ |
| 5728 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 5729 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 5730 | } |
| 5731 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | return status; |
| 5734 | } |
| 5735 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 5736 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5737 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 5738 | struct net_device *ndev, |
| 5739 | u8 key_index, |
| 5740 | bool unicast, bool multicast) |
| 5741 | #else |
| 5742 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 5743 | struct net_device *ndev, |
| 5744 | u8 key_index) |
| 5745 | #endif |
| 5746 | { |
| 5747 | int ret; |
| 5748 | vos_ssr_protect(__func__); |
| 5749 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 5750 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 5751 | multicast); |
| 5752 | #else |
| 5753 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 5754 | #endif |
| 5755 | vos_ssr_unprotect(__func__); |
| 5756 | |
| 5757 | return ret; |
| 5758 | } |
| 5759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5760 | /* |
| 5761 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 5762 | * This function is used to inform the BSS details to nl80211 interface. |
| 5763 | */ |
| 5764 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 5765 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 5766 | { |
| 5767 | struct net_device *dev = pAdapter->dev; |
| 5768 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 5769 | struct wiphy *wiphy = wdev->wiphy; |
| 5770 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 5771 | int chan_no; |
| 5772 | int ie_length; |
| 5773 | const char *ie; |
| 5774 | unsigned int freq; |
| 5775 | struct ieee80211_channel *chan; |
| 5776 | int rssi = 0; |
| 5777 | struct cfg80211_bss *bss = NULL; |
| 5778 | |
| 5779 | ENTER(); |
| 5780 | |
| 5781 | if( NULL == pBssDesc ) |
| 5782 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5783 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | return bss; |
| 5785 | } |
| 5786 | |
| 5787 | chan_no = pBssDesc->channelId; |
| 5788 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 5789 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 5790 | |
| 5791 | if( NULL == ie ) |
| 5792 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5793 | 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] | 5794 | return bss; |
| 5795 | } |
| 5796 | |
| 5797 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 5798 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 5799 | { |
| 5800 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 5801 | } |
| 5802 | else |
| 5803 | { |
| 5804 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 5805 | } |
| 5806 | #else |
| 5807 | freq = ieee80211_channel_to_frequency(chan_no); |
| 5808 | #endif |
| 5809 | |
| 5810 | chan = __ieee80211_get_channel(wiphy, freq); |
| 5811 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 5812 | if (!chan) { |
| 5813 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 5814 | return NULL; |
| 5815 | } |
| 5816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | bss = cfg80211_get_bss(wiphy, chan, pBssDesc->bssId, |
| 5818 | &roamProfile->SSID.ssId[0], roamProfile->SSID.length, |
| 5819 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
| 5820 | if (bss == NULL) |
| 5821 | { |
| 5822 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
| 5823 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5824 | return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
| 5825 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5826 | pBssDesc->capabilityInfo, |
| 5827 | pBssDesc->beaconInterval, ie, ie_length, |
| 5828 | rssi, GFP_KERNEL )); |
| 5829 | } |
| 5830 | else |
| 5831 | { |
| 5832 | return bss; |
| 5833 | } |
| 5834 | } |
| 5835 | |
| 5836 | |
| 5837 | |
| 5838 | /* |
| 5839 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 5840 | * This function is used to inform the BSS details to nl80211 interface. |
| 5841 | */ |
| 5842 | struct cfg80211_bss* |
| 5843 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 5844 | tSirBssDescription *bss_desc |
| 5845 | ) |
| 5846 | { |
| 5847 | /* |
| 5848 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 5849 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 5850 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 5851 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 5852 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 5853 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 5854 | cfg80211_inform_bss_frame. |
| 5855 | */ |
| 5856 | struct net_device *dev = pAdapter->dev; |
| 5857 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 5858 | struct wiphy *wiphy = wdev->wiphy; |
| 5859 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 5860 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 5861 | qcom_ie_age *qie_age = NULL; |
| 5862 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 5863 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5864 | 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] | 5865 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5866 | const char *ie = |
| 5867 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 5868 | unsigned int freq; |
| 5869 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 5870 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5871 | struct cfg80211_bss *bss_status = NULL; |
| 5872 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 5873 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 5874 | hdd_context_t *pHddCtx; |
| 5875 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5876 | #ifdef WLAN_OPEN_SOURCE |
| 5877 | struct timespec ts; |
| 5878 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 5880 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5881 | status = wlan_hdd_validate_context(pHddCtx); |
| 5882 | |
| 5883 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 5884 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 5885 | { |
| 5886 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5887 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 5888 | return NULL; |
| 5889 | } |
| 5890 | |
| 5891 | |
| 5892 | if (0 != status) |
| 5893 | { |
| 5894 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5895 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 5896 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 5897 | } |
| 5898 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 5899 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 5900 | if (!mgmt) |
| 5901 | { |
| 5902 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5903 | "%s: memory allocation failed ", __func__); |
| 5904 | return NULL; |
| 5905 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 5906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5907 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5908 | |
| 5909 | #ifdef WLAN_OPEN_SOURCE |
| 5910 | /* Android does not want the timestamp from the frame. |
| 5911 | Instead it wants a monotonic increasing value */ |
| 5912 | get_monotonic_boottime(&ts); |
| 5913 | mgmt->u.probe_resp.timestamp = |
| 5914 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 5915 | #else |
| 5916 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5917 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 5918 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5919 | |
| 5920 | #endif |
| 5921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5922 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 5923 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 5924 | |
| 5925 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 5926 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 5927 | /* Assuming this is the last IE, copy at the end */ |
| 5928 | ie_length -=sizeof(qcom_ie_age); |
| 5929 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 5930 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 5931 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 5932 | qie_age->oui_1 = QCOM_OUI1; |
| 5933 | qie_age->oui_2 = QCOM_OUI2; |
| 5934 | qie_age->oui_3 = QCOM_OUI3; |
| 5935 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 5936 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 5937 | #endif |
| 5938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5939 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 5940 | if (bss_desc->fProbeRsp) |
| 5941 | { |
| 5942 | mgmt->frame_control |= |
| 5943 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 5944 | } |
| 5945 | else |
| 5946 | { |
| 5947 | mgmt->frame_control |= |
| 5948 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 5949 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | |
| 5951 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5952 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5953 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 5954 | { |
| 5955 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 5956 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5957 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5958 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 5959 | |
| 5960 | { |
| 5961 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 5962 | } |
| 5963 | else |
| 5964 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5965 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 5966 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | kfree(mgmt); |
| 5968 | return NULL; |
| 5969 | } |
| 5970 | #else |
| 5971 | freq = ieee80211_channel_to_frequency(chan_no); |
| 5972 | #endif |
| 5973 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 5974 | /*when the band is changed on the fly using the GUI, three things are done |
| 5975 | * 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) |
| 5976 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 5977 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 5978 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 5979 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 5980 | * 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 |
| 5981 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 5982 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 5983 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 5984 | * So drop the bss and continue to next bss. |
| 5985 | */ |
| 5986 | if(chan == NULL) |
| 5987 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 5988 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 5989 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 5990 | return NULL; |
| 5991 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5992 | /*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] | 5993 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5994 | * */ |
| 5995 | if (( eConnectionState_Associated == |
| 5996 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 5997 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 5998 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 5999 | WNI_CFG_BSSID_LEN))) |
| 6000 | { |
| 6001 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 6002 | rssi = (pAdapter->rssi * 100); |
| 6003 | } |
| 6004 | else |
| 6005 | { |
| 6006 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 6007 | } |
| 6008 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6009 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 6010 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 6011 | chan->center_freq, (int)(rssi/100)); |
| 6012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 6014 | frame_len, rssi, GFP_KERNEL); |
| 6015 | kfree(mgmt); |
| 6016 | return bss_status; |
| 6017 | } |
| 6018 | |
| 6019 | /* |
| 6020 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 6021 | * This function is used to update the BSS data base of CFG8011 |
| 6022 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6023 | 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] | 6024 | tCsrRoamInfo *pRoamInfo |
| 6025 | ) |
| 6026 | { |
| 6027 | tCsrRoamConnectedProfile roamProfile; |
| 6028 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6029 | struct cfg80211_bss *bss = NULL; |
| 6030 | |
| 6031 | ENTER(); |
| 6032 | |
| 6033 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 6034 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 6035 | |
| 6036 | if (NULL != roamProfile.pBssDesc) |
| 6037 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6038 | bss = wlan_hdd_cfg80211_inform_bss(pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6039 | &roamProfile); |
| 6040 | |
| 6041 | if (NULL == bss) |
| 6042 | { |
| 6043 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 6044 | __func__); |
| 6045 | } |
| 6046 | |
| 6047 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 6048 | } |
| 6049 | else |
| 6050 | { |
| 6051 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 6052 | __func__); |
| 6053 | } |
| 6054 | return bss; |
| 6055 | } |
| 6056 | |
| 6057 | /* |
| 6058 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 6059 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6060 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 6061 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6062 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6063 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6064 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6065 | tCsrScanResultInfo *pScanResult; |
| 6066 | eHalStatus status = 0; |
| 6067 | tScanResultHandle pResult; |
| 6068 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 6069 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6070 | |
| 6071 | ENTER(); |
| 6072 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6073 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6074 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 6075 | NO_SESSION, pAdapter->sessionId)); |
| 6076 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 6077 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6078 | |
| 6079 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6080 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 6081 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6082 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 6083 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6084 | } |
| 6085 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 6086 | |
| 6087 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 6088 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 6089 | { |
| 6090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6091 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 6092 | return VOS_STATUS_E_PERM; |
| 6093 | } |
| 6094 | |
| 6095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6096 | /* |
| 6097 | * start getting scan results and populate cgf80211 BSS database |
| 6098 | */ |
| 6099 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 6100 | |
| 6101 | /* no scan results */ |
| 6102 | if (NULL == pResult) |
| 6103 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6104 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 6105 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | return status; |
| 6107 | } |
| 6108 | |
| 6109 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 6110 | |
| 6111 | while (pScanResult) |
| 6112 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6113 | /* |
| 6114 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 6115 | * entry already exists in bss data base of cfg80211 for that |
| 6116 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 6117 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 6118 | * mgmt packet as input. As of now there is no possibility to get |
| 6119 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6120 | * ieee80211_mgmt(probe response) and passing to c |
| 6121 | * fg80211_inform_bss_frame. |
| 6122 | * */ |
| 6123 | |
| 6124 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 6125 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6126 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6127 | |
| 6128 | if (NULL == bss_status) |
| 6129 | { |
| 6130 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6131 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6132 | } |
| 6133 | else |
| 6134 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6135 | cfg80211_put_bss( |
| 6136 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 6137 | wiphy, |
| 6138 | #endif |
| 6139 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | } |
| 6141 | |
| 6142 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 6143 | } |
| 6144 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6145 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6146 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6147 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6148 | } |
| 6149 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6150 | void |
| 6151 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 6152 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6153 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 6154 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6155 | } /****** end hddPrintMacAddr() ******/ |
| 6156 | |
| 6157 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 6158 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6159 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6160 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6161 | "%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] | 6162 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 6163 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 6164 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6165 | } /****** end hddPrintPmkId() ******/ |
| 6166 | |
| 6167 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 6168 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 6169 | |
| 6170 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 6171 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 6172 | |
| 6173 | #define dump_bssid(bssid) \ |
| 6174 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6175 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 6176 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6177 | } |
| 6178 | |
| 6179 | #define dump_pmkid(pMac, pmkid) \ |
| 6180 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6181 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 6182 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6183 | } |
| 6184 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 6185 | #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] | 6186 | /* |
| 6187 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 6188 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 6189 | */ |
| 6190 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6191 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6192 | int index, bool preauth ) |
| 6193 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6194 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6195 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 6196 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6197 | |
| 6198 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6199 | 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] | 6200 | |
| 6201 | if( NULL == pRoamInfo ) |
| 6202 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6203 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6204 | return -EINVAL; |
| 6205 | } |
| 6206 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 6207 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 6208 | { |
| 6209 | dump_bssid(pRoamInfo->bssid); |
| 6210 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6211 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 6212 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6213 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6214 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6215 | } |
| 6216 | #endif //FEATURE_WLAN_LFR |
| 6217 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 6218 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 6219 | /* |
| 6220 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 6221 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 6222 | * |
| 6223 | */ |
| 6224 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 6225 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 6226 | tCsrRoamInfo *pRoamInfo) |
| 6227 | { |
| 6228 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 6229 | union iwreq_data wrqu; |
| 6230 | |
| 6231 | ENTER(); |
| 6232 | |
| 6233 | if (NULL == pAdapter) |
| 6234 | { |
| 6235 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 6236 | return VOS_STATUS_E_FAILURE; |
| 6237 | } |
| 6238 | |
| 6239 | /* create the event */ |
| 6240 | memset(&wrqu, 0, sizeof(wrqu)); |
| 6241 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 6242 | |
| 6243 | wrqu.data.pointer = metrics_notification; |
| 6244 | wrqu.data.length = scnprintf(metrics_notification, |
| 6245 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 6246 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 6247 | |
| 6248 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 6249 | |
| 6250 | EXIT(); |
| 6251 | |
| 6252 | return VOS_STATUS_SUCCESS; |
| 6253 | } |
| 6254 | |
| 6255 | /* |
| 6256 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 6257 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 6258 | * or failure |
| 6259 | */ |
| 6260 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 6261 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 6262 | { |
| 6263 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 6264 | union iwreq_data wrqu; |
| 6265 | |
| 6266 | ENTER(); |
| 6267 | |
| 6268 | if (NULL == pAdapter) |
| 6269 | { |
| 6270 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 6271 | return VOS_STATUS_E_FAILURE; |
| 6272 | } |
| 6273 | |
| 6274 | /* create the event */ |
| 6275 | memset(&wrqu, 0, sizeof(wrqu)); |
| 6276 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 6277 | |
| 6278 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 6279 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 6280 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 6281 | |
| 6282 | if (1 == preauth_status) |
| 6283 | strncat(metrics_notification, " TRUE", 5); |
| 6284 | else |
| 6285 | strncat(metrics_notification, " FALSE", 6); |
| 6286 | |
| 6287 | wrqu.data.pointer = metrics_notification; |
| 6288 | wrqu.data.length = strlen(metrics_notification); |
| 6289 | |
| 6290 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 6291 | |
| 6292 | EXIT(); |
| 6293 | |
| 6294 | return VOS_STATUS_SUCCESS; |
| 6295 | } |
| 6296 | |
| 6297 | /* |
| 6298 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 6299 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 6300 | * |
| 6301 | */ |
| 6302 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 6303 | tCsrRoamInfo *pRoamInfo) |
| 6304 | { |
| 6305 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 6306 | union iwreq_data wrqu; |
| 6307 | |
| 6308 | ENTER(); |
| 6309 | |
| 6310 | if (NULL == pAdapter) |
| 6311 | { |
| 6312 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 6313 | return VOS_STATUS_E_FAILURE; |
| 6314 | } |
| 6315 | |
| 6316 | /* create the event */ |
| 6317 | memset(&wrqu, 0, sizeof(wrqu)); |
| 6318 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 6319 | |
| 6320 | wrqu.data.pointer = metrics_notification; |
| 6321 | wrqu.data.length = scnprintf(metrics_notification, |
| 6322 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 6323 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 6324 | |
| 6325 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 6326 | |
| 6327 | EXIT(); |
| 6328 | |
| 6329 | return VOS_STATUS_SUCCESS; |
| 6330 | } |
| 6331 | #endif |
| 6332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | /* |
| 6334 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 6335 | * scanning callback function, called after finishing scan |
| 6336 | * |
| 6337 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6338 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6339 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 6340 | { |
| 6341 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6342 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6344 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6345 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6346 | struct cfg80211_scan_request *req = NULL; |
| 6347 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6348 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6349 | long waitRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6350 | |
| 6351 | ENTER(); |
| 6352 | |
| 6353 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6354 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6355 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 6357 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 6358 | pScanInfo->mScanPendingCounter = 0; |
| 6359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6361 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6362 | &pScanInfo->scan_req_completion_event, |
| 6363 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6364 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6365 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6366 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6367 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6368 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6369 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6370 | } |
| 6371 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 6372 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6373 | { |
| 6374 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6375 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6379 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | { |
| 6381 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6382 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6383 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | (int) scanId); |
| 6385 | } |
| 6386 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6387 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6388 | pAdapter); |
| 6389 | |
| 6390 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6391 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6392 | |
| 6393 | |
| 6394 | /* If any client wait scan result through WEXT |
| 6395 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6396 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6397 | { |
| 6398 | /* The other scan request waiting for current scan finish |
| 6399 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6400 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6401 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6402 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6403 | } |
| 6404 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6405 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6406 | { |
| 6407 | struct net_device *dev = pAdapter->dev; |
| 6408 | union iwreq_data wrqu; |
| 6409 | int we_event; |
| 6410 | char *msg; |
| 6411 | |
| 6412 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6413 | we_event = SIOCGIWSCAN; |
| 6414 | msg = NULL; |
| 6415 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 6416 | } |
| 6417 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6418 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | |
| 6420 | /* Get the Scan Req */ |
| 6421 | req = pAdapter->request; |
| 6422 | |
| 6423 | if (!req) |
| 6424 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6425 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 6426 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6427 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6428 | } |
| 6429 | |
| 6430 | /* |
| 6431 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6432 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6433 | req->n_ssids = 0; |
| 6434 | req->n_channels = 0; |
| 6435 | req->ie = 0; |
| 6436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6437 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6438 | /* Scan is no longer pending */ |
| 6439 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6440 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 6441 | /* |
| 6442 | * cfg80211_scan_done informing NL80211 about completion |
| 6443 | * of scanning |
| 6444 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 6445 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 6446 | { |
| 6447 | aborted = true; |
| 6448 | } |
| 6449 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 6450 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6451 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6452 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 6453 | /* release the wake lock at the end of the scan*/ |
| 6454 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6455 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 6456 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 6457 | * immediatly after the driver gets connect request(i.e after scan) |
| 6458 | * from supplicant, this result in app's is suspending and not able |
| 6459 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 6460 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 6461 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 6462 | #ifdef FEATURE_WLAN_TDLS |
c_hpothu | 3c8f8e8 | 2014-06-02 18:01:50 +0530 | [diff] [blame] | 6463 | if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) |
| 6464 | { |
| 6465 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 6466 | } |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 6467 | #endif |
| 6468 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6469 | EXIT(); |
| 6470 | return 0; |
| 6471 | } |
| 6472 | |
| 6473 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6474 | * FUNCTION: hdd_isConnectionInProgress |
| 6475 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6476 | * |
| 6477 | */ |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6478 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx ) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6479 | { |
| 6480 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 6481 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 6482 | hdd_adapter_t *pAdapter = NULL; |
| 6483 | VOS_STATUS status = 0; |
| 6484 | v_U8_t staId = 0; |
| 6485 | v_U8_t *staMac = NULL; |
| 6486 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 6487 | if (TRUE == pHddCtx->btCoexModeSet) |
| 6488 | { |
| 6489 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6490 | FL("BTCoex Mode operation in progress")); |
| 6491 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 6492 | } |
| 6493 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6494 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 6495 | |
| 6496 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 6497 | { |
| 6498 | pAdapter = pAdapterNode->pAdapter; |
| 6499 | |
| 6500 | if( pAdapter ) |
| 6501 | { |
| 6502 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6503 | "%s: Adapter with device mode %s (%d) exists", |
| 6504 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6505 | pAdapter->device_mode); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6506 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 6507 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 6508 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 6509 | (eConnectionState_Connecting == |
| 6510 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 6511 | { |
| 6512 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6513 | "%s: %p(%d) Connection is in progress", __func__, |
| 6514 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 6515 | return VOS_TRUE; |
| 6516 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6517 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6518 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 6519 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6520 | { |
| 6521 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6522 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6523 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6524 | { |
| 6525 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 6526 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 6527 | "%s: client " MAC_ADDRESS_STR |
| 6528 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 6529 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6530 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6531 | } |
| 6532 | } |
| 6533 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 6534 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 6535 | { |
| 6536 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 6537 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6538 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6539 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 6540 | { |
| 6541 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 6542 | |
| 6543 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 6544 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 6545 | "middle of WPS/EAPOL exchange.", __func__, |
| 6546 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6547 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6548 | } |
| 6549 | } |
| 6550 | } |
| 6551 | } |
| 6552 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 6553 | pAdapterNode = pNext; |
| 6554 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6555 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6556 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6557 | |
| 6558 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 6559 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | * this scan respond to scan trigger and update cfg80211 scan database |
| 6561 | * later, scan dump command can be used to recieve scan results |
| 6562 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 6563 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 6564 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 6565 | struct net_device *dev, |
| 6566 | #endif |
| 6567 | struct cfg80211_scan_request *request) |
| 6568 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 6569 | hdd_adapter_t *pAdapter = NULL; |
| 6570 | hdd_context_t *pHddCtx = NULL; |
| 6571 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6572 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | tCsrScanRequest scanRequest; |
| 6574 | tANI_U8 *channelList = NULL, i; |
| 6575 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6576 | int status; |
| 6577 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6578 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6579 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 6580 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 6581 | struct net_device *dev = NULL; |
| 6582 | if (NULL == request) |
| 6583 | { |
| 6584 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6585 | "%s: scan req param null", __func__); |
| 6586 | return -EINVAL; |
| 6587 | } |
| 6588 | dev = request->wdev->netdev; |
| 6589 | #endif |
| 6590 | |
| 6591 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 6592 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 6593 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6594 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6595 | ENTER(); |
| 6596 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6597 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6598 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6599 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6600 | pAdapter->device_mode); |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 6601 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6602 | status = wlan_hdd_validate_context(pHddCtx); |
| 6603 | |
| 6604 | if (0 != status) |
| 6605 | { |
| 6606 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6607 | "%s: HDD context is not valid", __func__); |
| 6608 | return status; |
| 6609 | } |
| 6610 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 6611 | if (NULL == pwextBuf) |
| 6612 | { |
| 6613 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 6614 | __func__); |
| 6615 | return -EIO; |
| 6616 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6617 | cfg_param = pHddCtx->cfg_ini; |
| 6618 | pScanInfo = &pHddCtx->scan_info; |
| 6619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | #ifdef WLAN_BTAMP_FEATURE |
| 6621 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6622 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6623 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 6624 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6625 | "%s: No scanning when AMP is on", __func__); |
| 6626 | return -EOPNOTSUPP; |
| 6627 | } |
| 6628 | #endif |
| 6629 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6630 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6632 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6633 | "%s: Not scanning on device_mode = %s (%d)", |
| 6634 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6635 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | return -EOPNOTSUPP; |
| 6637 | } |
| 6638 | |
| 6639 | if (TRUE == pScanInfo->mScanPending) |
| 6640 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 6641 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 6642 | { |
| 6643 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 6644 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6645 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | } |
| 6647 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6648 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6649 | //Channel and action frame is pending |
| 6650 | //Otherwise Cancel Remain On Channel and allow Scan |
| 6651 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6652 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6653 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 6654 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6655 | return -EBUSY; |
| 6656 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6657 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 6658 | /* if tdls disagree scan right now, return immediately. |
| 6659 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 6660 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 6661 | */ |
| 6662 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 6663 | wiphy, |
| 6664 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 6665 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 6666 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 6667 | request); |
| 6668 | if(status <= 0) |
| 6669 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6670 | if(!status) |
| 6671 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 6672 | "scan rejected %d", __func__, status); |
| 6673 | else |
| 6674 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 6675 | __func__, status); |
| 6676 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 6677 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6678 | } |
| 6679 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6681 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 6682 | { |
| 6683 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6684 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6685 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6686 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6687 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 6688 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | "%s: MAX TM Level Scan not allowed", __func__); |
| 6691 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6692 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6693 | } |
| 6694 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 6695 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6696 | /* Check if scan is allowed at this point of time. |
| 6697 | */ |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 6698 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 6699 | { |
| 6700 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 6701 | return -EBUSY; |
| 6702 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 6705 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6706 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 6707 | (int)request->n_ssids); |
| 6708 | |
| 6709 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 6710 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 6711 | * is not aging out the scan results. |
| 6712 | */ |
| 6713 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6714 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6715 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6716 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6717 | |
| 6718 | if ((request->ssids) && (0 < request->n_ssids)) |
| 6719 | { |
| 6720 | tCsrSSIDInfo *SsidInfo; |
| 6721 | int j; |
| 6722 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 6723 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 6724 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 6725 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 6726 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 6727 | |
| 6728 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 6729 | { |
| 6730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6731 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 6732 | return -ENOMEM; |
| 6733 | } |
| 6734 | |
| 6735 | /* copy all the ssid's and their length */ |
| 6736 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 6737 | { |
| 6738 | /* get the ssid length */ |
| 6739 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 6740 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 6741 | SsidInfo->SSID.length); |
| 6742 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 6743 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 6744 | j, SsidInfo->SSID.ssId); |
| 6745 | } |
| 6746 | /* set the scan type to active */ |
| 6747 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 6748 | } |
| 6749 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6750 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 6751 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6752 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 6753 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6754 | /* set the scan type to active */ |
| 6755 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6756 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6757 | else |
| 6758 | { |
| 6759 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 6760 | scanRequest.scanType = pScanInfo->scan_mode; |
| 6761 | } |
| 6762 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 6763 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6764 | |
| 6765 | /* set BSSType to default type */ |
| 6766 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 6767 | |
| 6768 | /*TODO: scan the requested channels only*/ |
| 6769 | |
| 6770 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6771 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6772 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6773 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 6774 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 6775 | request->n_channels = MAX_CHANNEL; |
| 6776 | } |
| 6777 | |
| 6778 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6779 | "No of Scan Channels: %d", request->n_channels); |
| 6780 | |
| 6781 | |
| 6782 | if( request->n_channels ) |
| 6783 | { |
| 6784 | char chList [(request->n_channels*5)+1]; |
| 6785 | int len; |
| 6786 | channelList = vos_mem_malloc( request->n_channels ); |
| 6787 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 6788 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6789 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6790 | "%s: memory alloc failed channelList", __func__); |
| 6791 | status = -ENOMEM; |
| 6792 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 6793 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6794 | |
| 6795 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 6796 | { |
| 6797 | channelList[i] = request->channels[i]->hw_value; |
| 6798 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 6799 | } |
| 6800 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6801 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6802 | "Channel-List: %s ", chList); |
| 6803 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 6804 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6805 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 6806 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 6807 | |
| 6808 | /* set requestType to full scan */ |
| 6809 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 6810 | |
| 6811 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 6812 | * search (Flush on both full scan and social scan but not on single |
| 6813 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 6814 | */ |
| 6815 | |
| 6816 | /* Supplicant does single channel scan after 8-way handshake |
| 6817 | * and in that case driver shoudnt flush scan results. If |
| 6818 | * driver flushes the scan results here and unfortunately if |
| 6819 | * the AP doesnt respond to our probe req then association |
| 6820 | * fails which is not desired |
| 6821 | */ |
| 6822 | |
| 6823 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 6824 | { |
| 6825 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 6826 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6827 | pAdapter->sessionId ); |
| 6828 | } |
| 6829 | |
| 6830 | if( request->ie_len ) |
| 6831 | { |
| 6832 | /* save this for future association (join requires this) */ |
| 6833 | /*TODO: Array needs to be converted to dynamic allocation, |
| 6834 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 6835 | * CR 597966 |
| 6836 | */ |
| 6837 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 6838 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 6839 | pScanInfo->scanAddIE.length = request->ie_len; |
| 6840 | |
| 6841 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 6842 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 6843 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6844 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6845 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6846 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6847 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 6848 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 6849 | request->ie, request->ie_len); |
| 6850 | } |
| 6851 | else |
| 6852 | { |
| 6853 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 6854 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6855 | } |
| 6856 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6857 | } |
| 6858 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 6859 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 6860 | |
| 6861 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 6862 | request->ie_len); |
| 6863 | if (pP2pIe != NULL) |
| 6864 | { |
| 6865 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6866 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 6867 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 6868 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6869 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6870 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 6871 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 6872 | "Go nego completed to Connection is started"); |
| 6873 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 6874 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6875 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6876 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 6877 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6879 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 6880 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 6881 | "Disconnected state to Connection is started"); |
| 6882 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 6883 | "for 4way Handshake"); |
| 6884 | } |
| 6885 | #endif |
| 6886 | |
| 6887 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 6888 | if(TRUE == request->no_cck) |
| 6889 | { |
| 6890 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6891 | "%s: This is a P2P Search", __func__); |
| 6892 | scanRequest.p2pSearch = 1; |
| 6893 | |
| 6894 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6895 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6896 | /* set requestType to P2P Discovery */ |
| 6897 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 6898 | } |
| 6899 | |
| 6900 | /* |
| 6901 | Skip Dfs Channel in case of P2P Search |
| 6902 | if it is set in ini file |
| 6903 | */ |
| 6904 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 6905 | { |
| 6906 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6907 | } |
| 6908 | else |
| 6909 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 6910 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6911 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6912 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6913 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | } |
| 6915 | } |
| 6916 | |
| 6917 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 6918 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 6919 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 6920 | * address the following issues. |
| 6921 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 6922 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 6923 | * for long time, this result in apps running at full power for long time. |
| 6924 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 6925 | * be stuck in full power because of resume BMPS |
| 6926 | */ |
| 6927 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6928 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6929 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6930 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6931 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 6932 | scanRequest.requestType, scanRequest.scanType, |
| 6933 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6934 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 6935 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6936 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6937 | pAdapter->sessionId, &scanRequest, &scanId, |
| 6938 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6940 | if (eHAL_STATUS_SUCCESS != status) |
| 6941 | { |
| 6942 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6943 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 6944 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 6945 | if(eHAL_STATUS_RESOURCES == status) |
| 6946 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 6947 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 6948 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 6949 | status = -EBUSY; |
| 6950 | } else { |
| 6951 | status = -EIO; |
| 6952 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 6953 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6954 | goto free_mem; |
| 6955 | } |
| 6956 | |
| 6957 | pScanInfo->mScanPending = TRUE; |
| 6958 | pAdapter->request = request; |
| 6959 | pScanInfo->scanId = scanId; |
| 6960 | |
| 6961 | complete(&pScanInfo->scan_req_completion_event); |
| 6962 | |
| 6963 | free_mem: |
| 6964 | if( scanRequest.SSIDs.SSIDList ) |
| 6965 | { |
| 6966 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 6967 | } |
| 6968 | |
| 6969 | if( channelList ) |
| 6970 | vos_mem_free( channelList ); |
| 6971 | |
| 6972 | EXIT(); |
| 6973 | |
| 6974 | return status; |
| 6975 | } |
| 6976 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 6977 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 6978 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 6979 | struct net_device *dev, |
| 6980 | #endif |
| 6981 | struct cfg80211_scan_request *request) |
| 6982 | { |
| 6983 | int ret; |
| 6984 | |
| 6985 | vos_ssr_protect(__func__); |
| 6986 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 6987 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 6988 | dev, |
| 6989 | #endif |
| 6990 | request); |
| 6991 | vos_ssr_unprotect(__func__); |
| 6992 | |
| 6993 | return ret; |
| 6994 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 6995 | |
| 6996 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 6997 | { |
| 6998 | v_U8_t iniDot11Mode = |
| 6999 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 7000 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 7001 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 7002 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 7003 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 7004 | switch ( iniDot11Mode ) |
| 7005 | { |
| 7006 | case eHDD_DOT11_MODE_AUTO: |
| 7007 | case eHDD_DOT11_MODE_11ac: |
| 7008 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 7009 | #ifdef WLAN_FEATURE_11AC |
| 7010 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 7011 | #else |
| 7012 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 7013 | #endif |
| 7014 | break; |
| 7015 | case eHDD_DOT11_MODE_11n: |
| 7016 | case eHDD_DOT11_MODE_11n_ONLY: |
| 7017 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 7018 | break; |
| 7019 | default: |
| 7020 | hddDot11Mode = iniDot11Mode; |
| 7021 | break; |
| 7022 | } |
| 7023 | /* This call decides required channel bonding mode */ |
| 7024 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 7025 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 7026 | operationChannel); |
| 7027 | } |
| 7028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | /* |
| 7030 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7031 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7032 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7033 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7034 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7035 | { |
| 7036 | int status = 0; |
| 7037 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 7038 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7039 | v_U32_t roamId; |
| 7040 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7041 | eCsrAuthType RSNAuthType; |
| 7042 | |
| 7043 | ENTER(); |
| 7044 | |
| 7045 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 7046 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7047 | |
| 7048 | status = wlan_hdd_validate_context(pHddCtx); |
| 7049 | if (status) |
| 7050 | { |
| 7051 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7052 | "%s: HDD context is not valid!", __func__); |
| 7053 | return status; |
| 7054 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7056 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 7057 | { |
| 7058 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 7059 | return -EINVAL; |
| 7060 | } |
| 7061 | |
| 7062 | pRoamProfile = &pWextState->roamProfile; |
| 7063 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7064 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7065 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7066 | hdd_station_ctx_t *pHddStaCtx; |
| 7067 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7068 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7069 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7070 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 7071 | { |
| 7072 | /*QoS not enabled in cfg file*/ |
| 7073 | pRoamProfile->uapsd_mask = 0; |
| 7074 | } |
| 7075 | else |
| 7076 | { |
| 7077 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7078 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 7080 | } |
| 7081 | |
| 7082 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 7083 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 7084 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7085 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7086 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 7087 | ssid, ssid_len); |
| 7088 | |
| 7089 | if (bssid) |
| 7090 | { |
| 7091 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 7092 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 7093 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7094 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 7095 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | case of join failure we should send valid BSSID to supplicant |
| 7097 | */ |
| 7098 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 7099 | WNI_CFG_BSSID_LEN); |
| 7100 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 7101 | else |
| 7102 | { |
| 7103 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 7104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 7106 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 7107 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7108 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 7109 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7110 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7111 | /*set gen ie*/ |
| 7112 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 7113 | /*set auth*/ |
| 7114 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 7115 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7116 | #ifdef FEATURE_WLAN_WAPI |
| 7117 | if (pAdapter->wapi_info.nWapiMode) |
| 7118 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7119 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7120 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 7121 | { |
| 7122 | case WAPI_AUTH_MODE_PSK: |
| 7123 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7124 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7125 | pAdapter->wapi_info.wapiAuthMode); |
| 7126 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 7127 | break; |
| 7128 | } |
| 7129 | case WAPI_AUTH_MODE_CERT: |
| 7130 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7131 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7132 | pAdapter->wapi_info.wapiAuthMode); |
| 7133 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 7134 | break; |
| 7135 | } |
| 7136 | } // End of switch |
| 7137 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 7138 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 7139 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7140 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | pRoamProfile->AuthType.numEntries = 1; |
| 7142 | pRoamProfile->EncryptionType.numEntries = 1; |
| 7143 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 7144 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 7145 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 7146 | } |
| 7147 | } |
| 7148 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7149 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 7150 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7151 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 7152 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 7153 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 7154 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 7155 | sizeof (tSirGtkOffloadParams)); |
| 7156 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 7157 | } |
| 7158 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7159 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 7160 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7161 | if( operatingChannel ) |
| 7162 | { |
| 7163 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 7164 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 7165 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7166 | else |
| 7167 | { |
| 7168 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 7169 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 7170 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 7171 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 7172 | { |
| 7173 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 7174 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 7175 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 7176 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 7177 | * 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] | 7178 | * 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] | 7179 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 7180 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 7181 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 7182 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 7183 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 7184 | { |
| 7185 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7186 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 7187 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 7188 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 7189 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 7190 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7191 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7192 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 7193 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 7194 | if ((eHAL_STATUS_SUCCESS != status) && |
| 7195 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 7196 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 7197 | |
| 7198 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 7199 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 7200 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 7201 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 7202 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 7203 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 7204 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 7205 | |
| 7206 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 7207 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 7208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7209 | } |
| 7210 | else |
| 7211 | { |
| 7212 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 7213 | return -EINVAL; |
| 7214 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 7215 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | return status; |
| 7217 | } |
| 7218 | |
| 7219 | /* |
| 7220 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 7221 | * This function is used to set the authentication type (OPEN/SHARED). |
| 7222 | * |
| 7223 | */ |
| 7224 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 7225 | enum nl80211_auth_type auth_type) |
| 7226 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7227 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7228 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7229 | |
| 7230 | ENTER(); |
| 7231 | |
| 7232 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7233 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7234 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7235 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7236 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7237 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 7238 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 7239 | break; |
| 7240 | |
| 7241 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7242 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7243 | case NL80211_AUTHTYPE_FT: |
| 7244 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7245 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7246 | "%s: set authentication type to OPEN", __func__); |
| 7247 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 7248 | break; |
| 7249 | |
| 7250 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7251 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7252 | "%s: set authentication type to SHARED", __func__); |
| 7253 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 7254 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7255 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7256 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7257 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7258 | "%s: set authentication type to CCKM WPA", __func__); |
| 7259 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 7260 | break; |
| 7261 | #endif |
| 7262 | |
| 7263 | |
| 7264 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7265 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7266 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7267 | auth_type); |
| 7268 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 7269 | return -EINVAL; |
| 7270 | } |
| 7271 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7272 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7273 | pHddStaCtx->conn_info.authType; |
| 7274 | return 0; |
| 7275 | } |
| 7276 | |
| 7277 | /* |
| 7278 | * FUNCTION: wlan_hdd_set_akm_suite |
| 7279 | * This function is used to set the key mgmt type(PSK/8021x). |
| 7280 | * |
| 7281 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7282 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7283 | u32 key_mgmt |
| 7284 | ) |
| 7285 | { |
| 7286 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7287 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7289 | /*set key mgmt type*/ |
| 7290 | switch(key_mgmt) |
| 7291 | { |
| 7292 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 7293 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7294 | case WLAN_AKM_SUITE_FT_PSK: |
| 7295 | #endif |
| 7296 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7297 | __func__); |
| 7298 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 7299 | break; |
| 7300 | |
| 7301 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 7302 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7303 | case WLAN_AKM_SUITE_FT_8021X: |
| 7304 | #endif |
| 7305 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7306 | __func__); |
| 7307 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 7308 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7309 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7310 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 7311 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 7312 | case WLAN_AKM_SUITE_CCKM: |
| 7313 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 7314 | __func__); |
| 7315 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 7316 | break; |
| 7317 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 7318 | #ifndef WLAN_AKM_SUITE_OSEN |
| 7319 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 7320 | case WLAN_AKM_SUITE_OSEN: |
| 7321 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 7322 | __func__); |
| 7323 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 7324 | break; |
| 7325 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | |
| 7327 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7328 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7329 | __func__, key_mgmt); |
| 7330 | return -EINVAL; |
| 7331 | |
| 7332 | } |
| 7333 | return 0; |
| 7334 | } |
| 7335 | |
| 7336 | /* |
| 7337 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7338 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7339 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 7340 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7341 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 7342 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7343 | bool ucast |
| 7344 | ) |
| 7345 | { |
| 7346 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7347 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7348 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7349 | |
| 7350 | ENTER(); |
| 7351 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7352 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7353 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7354 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7355 | __func__, cipher); |
| 7356 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 7357 | } |
| 7358 | else |
| 7359 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7362 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7363 | { |
| 7364 | case IW_AUTH_CIPHER_NONE: |
| 7365 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 7366 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7368 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7369 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7370 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7372 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7373 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7374 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7376 | case WLAN_CIPHER_SUITE_TKIP: |
| 7377 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 7378 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7380 | case WLAN_CIPHER_SUITE_CCMP: |
| 7381 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 7382 | break; |
| 7383 | #ifdef FEATURE_WLAN_WAPI |
| 7384 | case WLAN_CIPHER_SUITE_SMS4: |
| 7385 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 7386 | break; |
| 7387 | #endif |
| 7388 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7389 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7390 | case WLAN_CIPHER_SUITE_KRK: |
| 7391 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 7392 | break; |
| 7393 | #endif |
| 7394 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7395 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7396 | __func__, cipher); |
| 7397 | return -EOPNOTSUPP; |
| 7398 | } |
| 7399 | } |
| 7400 | |
| 7401 | if (ucast) |
| 7402 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7403 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7404 | __func__, encryptionType); |
| 7405 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 7406 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7407 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7408 | encryptionType; |
| 7409 | } |
| 7410 | else |
| 7411 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7412 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7413 | __func__, encryptionType); |
| 7414 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 7415 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 7416 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 7417 | } |
| 7418 | |
| 7419 | return 0; |
| 7420 | } |
| 7421 | |
| 7422 | |
| 7423 | /* |
| 7424 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 7425 | * This function is used to parse WPA/RSN IE's. |
| 7426 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7427 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 7428 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7429 | size_t ie_len |
| 7430 | ) |
| 7431 | { |
| 7432 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7433 | u8 *genie = ie; |
| 7434 | v_U16_t remLen = ie_len; |
| 7435 | #ifdef FEATURE_WLAN_WAPI |
| 7436 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 7437 | u16 *tmp; |
| 7438 | v_U16_t akmsuiteCount; |
| 7439 | int *akmlist; |
| 7440 | #endif |
| 7441 | ENTER(); |
| 7442 | |
| 7443 | /* clear previous assocAddIE */ |
| 7444 | pWextState->assocAddIE.length = 0; |
| 7445 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 7446 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7447 | |
| 7448 | while (remLen >= 2) |
| 7449 | { |
| 7450 | v_U16_t eLen = 0; |
| 7451 | v_U8_t elementId; |
| 7452 | elementId = *genie++; |
| 7453 | eLen = *genie++; |
| 7454 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7455 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7456 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7457 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7458 | |
| 7459 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7460 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7461 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7462 | 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] | 7463 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7464 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7465 | "%s: Invalid WPA IE", __func__); |
| 7466 | return -EINVAL; |
| 7467 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7468 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7469 | { |
| 7470 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7471 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7472 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7473 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7474 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7475 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 7476 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 7477 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7478 | VOS_ASSERT(0); |
| 7479 | return -ENOMEM; |
| 7480 | } |
| 7481 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 7482 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7483 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7485 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 7486 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7487 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7488 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7489 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 7490 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7491 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 7492 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 7493 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 7494 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 7495 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 7496 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7497 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 7498 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7499 | { |
| 7500 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7501 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7502 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7504 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7505 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 7506 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 7507 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7508 | VOS_ASSERT(0); |
| 7509 | return -ENOMEM; |
| 7510 | } |
| 7511 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 7512 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7513 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7515 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7516 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7518 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7519 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 7520 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7521 | /*Consider WFD IE, only for P2P Client */ |
| 7522 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 7523 | { |
| 7524 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7525 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7526 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7528 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7529 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 7530 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 7531 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7532 | VOS_ASSERT(0); |
| 7533 | return -ENOMEM; |
| 7534 | } |
| 7535 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 7536 | // WPS IE + P2P IE + WFD IE |
| 7537 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7538 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7540 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7541 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7542 | } |
| 7543 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7544 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7545 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 7546 | HS20_OUI_TYPE_SIZE)) ) |
| 7547 | { |
| 7548 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7549 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 7550 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7551 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 7552 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7553 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 7554 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 7555 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 7556 | VOS_ASSERT(0); |
| 7557 | return -ENOMEM; |
| 7558 | } |
| 7559 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7560 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7561 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 7562 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7563 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7564 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 7565 | /* Appending OSEN Information Element in Assiciation Request */ |
| 7566 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 7567 | OSEN_OUI_TYPE_SIZE)) ) |
| 7568 | { |
| 7569 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 7570 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 7571 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7572 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 7573 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7574 | { |
| 7575 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 7576 | "Need bigger buffer space"); |
| 7577 | VOS_ASSERT(0); |
| 7578 | return -ENOMEM; |
| 7579 | } |
| 7580 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7581 | pWextState->assocAddIE.length += eLen + 2; |
| 7582 | |
| 7583 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 7584 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7585 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7586 | } |
| 7587 | |
| 7588 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 7589 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 7590 | |
| 7591 | /* populating as ADDIE in beacon frames */ |
| 7592 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7593 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 7594 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 7595 | { |
| 7596 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7597 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 7598 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 7599 | { |
| 7600 | hddLog(LOGE, |
| 7601 | "Coldn't pass " |
| 7602 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 7603 | } |
| 7604 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 7605 | else |
| 7606 | hddLog(LOGE, |
| 7607 | "Could not pass on " |
| 7608 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 7609 | |
| 7610 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 7611 | beaconIE's need to be populated in probe response frames */ |
| 7612 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 7613 | { |
| 7614 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 7615 | u8 probe_rsp_ie_len[3] = {0}; |
| 7616 | u8 counter = 0; |
| 7617 | |
| 7618 | /* Check Probe Resp Length if it is greater then 255 then |
| 7619 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 7620 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 7621 | not able Store More then 255 bytes into One Variable */ |
| 7622 | |
| 7623 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 7624 | { |
| 7625 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 7626 | { |
| 7627 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 7628 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 7629 | } |
| 7630 | else |
| 7631 | { |
| 7632 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 7633 | rem_probe_resp_ie_len = 0; |
| 7634 | } |
| 7635 | } |
| 7636 | |
| 7637 | rem_probe_resp_ie_len = 0; |
| 7638 | |
| 7639 | if (probe_rsp_ie_len[0] > 0) |
| 7640 | { |
| 7641 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7642 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 7643 | (tANI_U8*)(genie - 2), |
| 7644 | probe_rsp_ie_len[0], NULL, |
| 7645 | eANI_BOOLEAN_FALSE) |
| 7646 | == eHAL_STATUS_FAILURE) |
| 7647 | { |
| 7648 | hddLog(LOGE, |
| 7649 | "Could not pass" |
| 7650 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 7651 | } |
| 7652 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 7653 | } |
| 7654 | |
| 7655 | if (probe_rsp_ie_len[1] > 0) |
| 7656 | { |
| 7657 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7658 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 7659 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 7660 | probe_rsp_ie_len[1], NULL, |
| 7661 | eANI_BOOLEAN_FALSE) |
| 7662 | == eHAL_STATUS_FAILURE) |
| 7663 | { |
| 7664 | hddLog(LOGE, |
| 7665 | "Could not pass" |
| 7666 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 7667 | } |
| 7668 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 7669 | } |
| 7670 | |
| 7671 | if (probe_rsp_ie_len[2] > 0) |
| 7672 | { |
| 7673 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7674 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 7675 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 7676 | probe_rsp_ie_len[2], NULL, |
| 7677 | eANI_BOOLEAN_FALSE) |
| 7678 | == eHAL_STATUS_FAILURE) |
| 7679 | { |
| 7680 | hddLog(LOGE, |
| 7681 | "Could not pass" |
| 7682 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 7683 | } |
| 7684 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 7685 | } |
| 7686 | |
| 7687 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7688 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 7689 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 7690 | { |
| 7691 | hddLog(LOGE, |
| 7692 | "Could not pass" |
| 7693 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 7694 | } |
| 7695 | } |
| 7696 | else |
| 7697 | { |
| 7698 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7699 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7700 | |
| 7701 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7702 | "%s: No Probe Response IE received in set beacon", |
| 7703 | __func__); |
| 7704 | } |
| 7705 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7706 | break; |
| 7707 | case DOT11F_EID_RSN: |
| 7708 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 7709 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 7710 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 7711 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 7712 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 7713 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7714 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 7715 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7716 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7717 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7718 | 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] | 7719 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7720 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7721 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 7722 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 7723 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 7724 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7725 | VOS_ASSERT(0); |
| 7726 | return -ENOMEM; |
| 7727 | } |
| 7728 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 7729 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7730 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7731 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 7732 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 7733 | break; |
| 7734 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | #ifdef FEATURE_WLAN_WAPI |
| 7736 | case WLAN_EID_WAPI: |
| 7737 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7738 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7739 | pAdapter->wapi_info.nWapiMode); |
| 7740 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7741 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7742 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 7743 | tmp = tmp + 1; |
| 7744 | akmlist = (int *)(tmp); |
| 7745 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 7746 | { |
| 7747 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 7748 | } |
| 7749 | else |
| 7750 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7751 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7752 | VOS_ASSERT(0); |
| 7753 | return -EINVAL; |
| 7754 | } |
| 7755 | |
| 7756 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 7757 | { |
| 7758 | 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] | 7759 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7760 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7762 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7763 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7764 | 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] | 7765 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7766 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 7767 | } |
| 7768 | break; |
| 7769 | #endif |
| 7770 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7771 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7772 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 7773 | /* when Unknown IE is received we should break and continue |
| 7774 | * to the next IE in the buffer instead we were returning |
| 7775 | * so changing this to break */ |
| 7776 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7777 | } |
| 7778 | genie += eLen; |
| 7779 | remLen -= eLen; |
| 7780 | } |
| 7781 | EXIT(); |
| 7782 | return 0; |
| 7783 | } |
| 7784 | |
| 7785 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 7786 | * FUNCTION: hdd_isWPAIEPresent |
| 7787 | * Parse the received IE to find the WPA IE |
| 7788 | * |
| 7789 | */ |
| 7790 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 7791 | { |
| 7792 | v_U8_t eLen = 0; |
| 7793 | v_U16_t remLen = ie_len; |
| 7794 | v_U8_t elementId = 0; |
| 7795 | |
| 7796 | while (remLen >= 2) |
| 7797 | { |
| 7798 | elementId = *ie++; |
| 7799 | eLen = *ie++; |
| 7800 | remLen -= 2; |
| 7801 | if (eLen > remLen) |
| 7802 | { |
| 7803 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7804 | "%s: IE length is wrong %d", __func__, eLen); |
| 7805 | return FALSE; |
| 7806 | } |
| 7807 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 7808 | { |
| 7809 | /* OUI - 0x00 0X50 0XF2 |
| 7810 | WPA Information Element - 0x01 |
| 7811 | WPA version - 0x01*/ |
| 7812 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 7813 | return TRUE; |
| 7814 | } |
| 7815 | ie += eLen; |
| 7816 | remLen -= eLen; |
| 7817 | } |
| 7818 | return FALSE; |
| 7819 | } |
| 7820 | |
| 7821 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7822 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7823 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7824 | * parameters during connect operation. |
| 7825 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7826 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7827 | struct cfg80211_connect_params *req |
| 7828 | ) |
| 7829 | { |
| 7830 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7831 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7832 | ENTER(); |
| 7833 | |
| 7834 | /*set wpa version*/ |
| 7835 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 7836 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7837 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7838 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 7839 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7840 | { |
| 7841 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 7842 | } |
| 7843 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 7844 | { |
| 7845 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 7846 | } |
| 7847 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7848 | |
| 7849 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7850 | pWextState->wpaVersion); |
| 7851 | |
| 7852 | /*set authentication type*/ |
| 7853 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 7854 | |
| 7855 | if (0 > status) |
| 7856 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7857 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7858 | "%s: failed to set authentication type ", __func__); |
| 7859 | return status; |
| 7860 | } |
| 7861 | |
| 7862 | /*set key mgmt type*/ |
| 7863 | if (req->crypto.n_akm_suites) |
| 7864 | { |
| 7865 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 7866 | if (0 > status) |
| 7867 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7868 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7869 | __func__); |
| 7870 | return status; |
| 7871 | } |
| 7872 | } |
| 7873 | |
| 7874 | /*set pairwise cipher type*/ |
| 7875 | if (req->crypto.n_ciphers_pairwise) |
| 7876 | { |
| 7877 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 7878 | req->crypto.ciphers_pairwise[0], true); |
| 7879 | if (0 > status) |
| 7880 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7881 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7882 | "%s: failed to set unicast cipher type", __func__); |
| 7883 | return status; |
| 7884 | } |
| 7885 | } |
| 7886 | else |
| 7887 | { |
| 7888 | /*Reset previous cipher suite to none*/ |
| 7889 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 7890 | if (0 > status) |
| 7891 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7892 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7893 | "%s: failed to set unicast cipher type", __func__); |
| 7894 | return status; |
| 7895 | } |
| 7896 | } |
| 7897 | |
| 7898 | /*set group cipher type*/ |
| 7899 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 7900 | false); |
| 7901 | |
| 7902 | if (0 > status) |
| 7903 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7904 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7905 | __func__); |
| 7906 | return status; |
| 7907 | } |
| 7908 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7909 | #ifdef WLAN_FEATURE_11W |
| 7910 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 7911 | #endif |
| 7912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7913 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 7914 | if (req->ie_len) |
| 7915 | { |
| 7916 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 7917 | if ( 0 > status) |
| 7918 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7919 | 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] | 7920 | __func__); |
| 7921 | return status; |
| 7922 | } |
| 7923 | } |
| 7924 | |
| 7925 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7926 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7927 | { |
| 7928 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 7929 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 7930 | ) |
| 7931 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7932 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7933 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 7934 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7935 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7936 | __func__); |
| 7937 | return -EOPNOTSUPP; |
| 7938 | } |
| 7939 | else |
| 7940 | { |
| 7941 | u8 key_len = req->key_len; |
| 7942 | u8 key_idx = req->key_idx; |
| 7943 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7944 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7945 | && (CSR_MAX_NUM_KEY > key_idx) |
| 7946 | ) |
| 7947 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7948 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7949 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7950 | __func__, key_idx, key_len); |
| 7951 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7952 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7953 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7954 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7955 | (u8)key_len; |
| 7956 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 7957 | } |
| 7958 | } |
| 7959 | } |
| 7960 | } |
| 7961 | |
| 7962 | return status; |
| 7963 | } |
| 7964 | |
| 7965 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 7966 | * FUNCTION: wlan_hdd_try_disconnect |
| 7967 | * This function is used to disconnect from previous |
| 7968 | * connection |
| 7969 | */ |
| 7970 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 7971 | { |
| 7972 | long ret = 0; |
| 7973 | hdd_station_ctx_t *pHddStaCtx; |
| 7974 | eMib_dot11DesiredBssType connectedBssType; |
| 7975 | |
| 7976 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7977 | |
| 7978 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 7979 | |
| 7980 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 7981 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 7982 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 7983 | { |
| 7984 | /* Issue disconnect to CSR */ |
| 7985 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7986 | if( eHAL_STATUS_SUCCESS == |
| 7987 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7988 | pAdapter->sessionId, |
| 7989 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 7990 | { |
| 7991 | ret = wait_for_completion_interruptible_timeout( |
| 7992 | &pAdapter->disconnect_comp_var, |
| 7993 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 7994 | if (0 >= ret) |
| 7995 | { |
| 7996 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 7997 | return -EALREADY; |
| 7998 | } |
| 7999 | } |
| 8000 | } |
| 8001 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 8002 | { |
| 8003 | ret = wait_for_completion_interruptible_timeout( |
| 8004 | &pAdapter->disconnect_comp_var, |
| 8005 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8006 | if (0 >= ret) |
| 8007 | { |
| 8008 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 8009 | return -EALREADY; |
| 8010 | } |
| 8011 | } |
| 8012 | |
| 8013 | return 0; |
| 8014 | } |
| 8015 | |
| 8016 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8017 | * FUNCTION: __wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8018 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8019 | * parameters during connect operation. |
| 8020 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8021 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8022 | struct net_device *ndev, |
| 8023 | struct cfg80211_connect_params *req |
| 8024 | ) |
| 8025 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8026 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8027 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8028 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8029 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8030 | |
| 8031 | ENTER(); |
| 8032 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8033 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8034 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 8035 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8036 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8037 | "%s: device_mode = %s (%d)", __func__, |
| 8038 | hdd_device_modetoString(pAdapter->device_mode), |
| 8039 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8040 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8041 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8042 | if (!pHddCtx) |
| 8043 | { |
| 8044 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8045 | "%s: HDD context is null", __func__); |
| 8046 | return VOS_STATUS_E_FAILURE; |
| 8047 | } |
| 8048 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8049 | status = wlan_hdd_validate_context(pHddCtx); |
| 8050 | |
| 8051 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8052 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8053 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8054 | "%s: HDD context is not valid", __func__); |
| 8055 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8056 | } |
| 8057 | |
| 8058 | #ifdef WLAN_BTAMP_FEATURE |
| 8059 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8060 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8062 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8063 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 8064 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8065 | } |
| 8066 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 8067 | |
| 8068 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 8069 | //P2P Mode will be taken care in Open/close adapter |
| 8070 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 8071 | (vos_concurrent_sessions_running())) |
| 8072 | { |
| 8073 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 8074 | } |
| 8075 | |
| 8076 | /*Try disconnecting if already in connected state*/ |
| 8077 | status = wlan_hdd_try_disconnect(pAdapter); |
| 8078 | if ( 0 > status) |
| 8079 | { |
| 8080 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 8081 | " connection")); |
| 8082 | return -EALREADY; |
| 8083 | } |
| 8084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8086 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8087 | |
| 8088 | if ( 0 > status) |
| 8089 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8090 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8091 | __func__); |
| 8092 | return status; |
| 8093 | } |
| 8094 | |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 8095 | if ( req->channel ) |
| 8096 | { |
| 8097 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 8098 | req->ssid_len, req->bssid, |
| 8099 | req->channel->hw_value); |
| 8100 | } |
| 8101 | else |
| 8102 | { |
| 8103 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8104 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 8105 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8106 | |
| 8107 | if (0 > status) |
| 8108 | { |
| 8109 | //ReEnable BMPS if disabled |
| 8110 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 8111 | (NULL != pHddCtx)) |
| 8112 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8113 | if (pHddCtx->hdd_wlan_suspended) |
| 8114 | { |
| 8115 | hdd_set_pwrparams(pHddCtx); |
| 8116 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8117 | //ReEnable Bmps and Imps back |
| 8118 | hdd_enable_bmps_imps(pHddCtx); |
| 8119 | } |
| 8120 | |
| 8121 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 8122 | return status; |
| 8123 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8124 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8125 | EXIT(); |
| 8126 | return status; |
| 8127 | } |
| 8128 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8129 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 8130 | struct net_device *ndev, |
| 8131 | struct cfg80211_connect_params *req) |
| 8132 | { |
| 8133 | int ret; |
| 8134 | vos_ssr_protect(__func__); |
| 8135 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 8136 | vos_ssr_unprotect(__func__); |
| 8137 | |
| 8138 | return ret; |
| 8139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8140 | |
| 8141 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8142 | * FUNCTION: wlan_hdd_disconnect |
| 8143 | * This function is used to issue a disconnect request to SME |
| 8144 | */ |
| 8145 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 8146 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8147 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8148 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8149 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8150 | |
| 8151 | status = wlan_hdd_validate_context(pHddCtx); |
| 8152 | |
| 8153 | if (0 != status) |
| 8154 | { |
| 8155 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8156 | "%s: HDD context is not valid", __func__); |
| 8157 | return status; |
| 8158 | } |
| 8159 | |
| 8160 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 8161 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8162 | "%s: Set HDD connState to eConnectionState_Disconnecting", |
| 8163 | __func__); |
Vinay Krishna Eranna | b09d3e7 | 2014-03-26 21:23:55 +0530 | [diff] [blame] | 8164 | pHddStaCtx->conn_info.connState = eConnectionState_Disconnecting; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8165 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8166 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8167 | /*issue disconnect*/ |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 8168 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8169 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8170 | pAdapter->sessionId, reason); |
| 8171 | |
| 8172 | if ( 0 != status ) |
| 8173 | { |
| 8174 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8175 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8176 | __func__, (int)status ); |
| 8177 | return -EINVAL; |
| 8178 | } |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8179 | status = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8180 | &pAdapter->disconnect_comp_var, |
| 8181 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8182 | if (!status) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8183 | { |
| 8184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8185 | "%s: Failed to disconnect, timed out", __func__); |
| 8186 | return -ETIMEDOUT; |
| 8187 | } |
| 8188 | else if (status == -ERESTARTSYS) |
| 8189 | { |
| 8190 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8191 | "%s: Failed to disconnect, wait interrupted", __func__); |
| 8192 | return status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8193 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8194 | /*stop tx queues*/ |
| 8195 | netif_tx_disable(pAdapter->dev); |
| 8196 | netif_carrier_off(pAdapter->dev); |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8197 | return 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8198 | } |
| 8199 | |
| 8200 | |
| 8201 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8202 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8203 | * This function is used to issue a disconnect request to SME |
| 8204 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8205 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8206 | struct net_device *dev, |
| 8207 | u16 reason |
| 8208 | ) |
| 8209 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8210 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 8211 | tCsrRoamProfile *pRoamProfile = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8213 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8214 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8215 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 8216 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8217 | tANI_U8 staIdx; |
| 8218 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8220 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8221 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8222 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8223 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 8224 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8225 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 8226 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8227 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8228 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8229 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 8230 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8231 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8232 | status = wlan_hdd_validate_context(pHddCtx); |
| 8233 | |
| 8234 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8235 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8236 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8237 | "%s: HDD context is not valid", __func__); |
| 8238 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8239 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8241 | if (NULL != pRoamProfile) |
| 8242 | { |
| 8243 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 8244 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 8245 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8246 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8247 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8248 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 8249 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8250 | switch(reason) |
| 8251 | { |
| 8252 | case WLAN_REASON_MIC_FAILURE: |
| 8253 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 8254 | break; |
| 8255 | |
| 8256 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 8257 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 8258 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 8259 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 8260 | break; |
| 8261 | |
| 8262 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 8263 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 8264 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8265 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 8266 | break; |
| 8267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8268 | default: |
| 8269 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 8270 | break; |
| 8271 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 8272 | pScanInfo = &pHddCtx->scan_info; |
| 8273 | if (pScanInfo->mScanPending) |
| 8274 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 8275 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 8276 | "Aborting Scan"); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 8277 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 8278 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 8279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8280 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8281 | #ifdef FEATURE_WLAN_TDLS |
| 8282 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8283 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8284 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8285 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 8286 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8287 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8288 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8289 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 8290 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8291 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8292 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8293 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8294 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 8295 | pAdapter->sessionId, |
| 8296 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 8297 | } |
| 8298 | } |
| 8299 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 8300 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8301 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 8302 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8303 | { |
| 8304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8305 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8306 | __func__, (int)status ); |
| 8307 | return -EINVAL; |
| 8308 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 8310 | else |
| 8311 | { |
| 8312 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 8313 | "called while in %d state", __func__, |
| 8314 | pHddStaCtx->conn_info.connState); |
| 8315 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8316 | } |
| 8317 | else |
| 8318 | { |
| 8319 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 8320 | } |
| 8321 | |
| 8322 | return status; |
| 8323 | } |
| 8324 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8325 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 8326 | struct net_device *dev, |
| 8327 | u16 reason |
| 8328 | ) |
| 8329 | { |
| 8330 | int ret; |
| 8331 | vos_ssr_protect(__func__); |
| 8332 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 8333 | vos_ssr_unprotect(__func__); |
| 8334 | |
| 8335 | return ret; |
| 8336 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 8337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8338 | /* |
| 8339 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8340 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8341 | * settings in IBSS mode. |
| 8342 | */ |
| 8343 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8344 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8345 | struct cfg80211_ibss_params *params |
| 8346 | ) |
| 8347 | { |
| 8348 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8349 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8350 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 8351 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8353 | ENTER(); |
| 8354 | |
| 8355 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 8356 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8357 | |
| 8358 | if (params->ie_len && ( NULL != params->ie) ) |
| 8359 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 8360 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 8361 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8362 | { |
| 8363 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 8364 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 8365 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 8366 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8367 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8368 | tDot11fIEWPA dot11WPAIE; |
| 8369 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 8370 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8371 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 8372 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 8373 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 8374 | params->ie_len, DOT11F_EID_WPA); |
| 8375 | if ( NULL != ie ) |
| 8376 | { |
| 8377 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 8378 | // Unpack the WPA IE |
| 8379 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 8380 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 8381 | &ie[2+4], |
| 8382 | ie[1] - 4, |
| 8383 | &dot11WPAIE); |
| 8384 | /*Extract the multicast cipher, the encType for unicast |
| 8385 | cipher for wpa-none is none*/ |
| 8386 | encryptionType = |
| 8387 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 8388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8389 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 8390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8391 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 8392 | |
| 8393 | if (0 > status) |
| 8394 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8395 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8396 | __func__); |
| 8397 | return status; |
| 8398 | } |
| 8399 | } |
| 8400 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8401 | pWextState->roamProfile.AuthType.authType[0] = |
| 8402 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8403 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 8404 | |
| 8405 | if (params->privacy) |
| 8406 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8407 | /* Security enabled IBSS, At this time there is no information available |
| 8408 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8409 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8410 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8411 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8412 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8413 | *enable privacy bit in beacons */ |
| 8414 | |
| 8415 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8416 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8417 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8418 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8419 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 8420 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 8421 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8422 | return status; |
| 8423 | } |
| 8424 | |
| 8425 | /* |
| 8426 | * FUNCTION: wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8427 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8428 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8429 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8430 | struct net_device *dev, |
| 8431 | struct cfg80211_ibss_params *params |
| 8432 | ) |
| 8433 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8434 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8435 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8436 | tCsrRoamProfile *pRoamProfile; |
| 8437 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 8438 | bool alloc_bssid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8439 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8440 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8441 | |
| 8442 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8443 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8444 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8445 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 8446 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8447 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8448 | "%s: device_mode = %s (%d)", __func__, |
| 8449 | hdd_device_modetoString(pAdapter->device_mode), |
| 8450 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8451 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8452 | status = wlan_hdd_validate_context(pHddCtx); |
| 8453 | |
| 8454 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8455 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8456 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8457 | "%s: HDD context is not valid", __func__); |
| 8458 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8459 | } |
| 8460 | |
| 8461 | if (NULL == pWextState) |
| 8462 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8463 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8464 | __func__); |
| 8465 | return -EIO; |
| 8466 | } |
| 8467 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 8468 | /*Try disconnecting if already in connected state*/ |
| 8469 | status = wlan_hdd_try_disconnect(pAdapter); |
| 8470 | if ( 0 > status) |
| 8471 | { |
| 8472 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 8473 | " IBSS connection")); |
| 8474 | return -EALREADY; |
| 8475 | } |
| 8476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8477 | pRoamProfile = &pWextState->roamProfile; |
| 8478 | |
| 8479 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 8480 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8481 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8482 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8483 | return -EINVAL; |
| 8484 | } |
| 8485 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 8486 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 8487 | if (NULL != params->bssid) { |
| 8488 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 8489 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 8490 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 8491 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 8492 | return -EIO; |
| 8493 | } |
| 8494 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 8495 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 8496 | { |
| 8497 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 8498 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 8499 | { |
| 8500 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 8501 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 8502 | return -EIO; |
| 8503 | } |
| 8504 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 8505 | if (!params->bssid) |
| 8506 | { |
| 8507 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 8508 | "%s:Failed memory allocation", __func__); |
| 8509 | return -EIO; |
| 8510 | } |
| 8511 | vos_mem_copy((v_U8_t *)params->bssid, |
| 8512 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 8513 | VOS_MAC_ADDR_SIZE); |
| 8514 | alloc_bssid = VOS_TRUE; |
| 8515 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 8516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8517 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8518 | if (NULL != |
| 8519 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 8520 | params->chandef.chan) |
| 8521 | #else |
| 8522 | params->channel) |
| 8523 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8524 | { |
| 8525 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8526 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 8527 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 8528 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8529 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8530 | |
| 8531 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8532 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8533 | ieee80211_frequency_to_channel( |
| 8534 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 8535 | params->chandef.chan->center_freq); |
| 8536 | #else |
| 8537 | params->channel->center_freq); |
| 8538 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8539 | |
| 8540 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 8541 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8542 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8543 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 8544 | __func__); |
| 8545 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8546 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8547 | |
| 8548 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8549 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8550 | if (channelNum == validChan[indx]) |
| 8551 | { |
| 8552 | break; |
| 8553 | } |
| 8554 | } |
| 8555 | if (indx >= numChans) |
| 8556 | { |
| 8557 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8558 | __func__, channelNum); |
| 8559 | return -EINVAL; |
| 8560 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8561 | /* Set the Operational Channel */ |
| 8562 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 8563 | channelNum); |
| 8564 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 8565 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 8566 | pRoamProfile->ChannelInfo.ChannelList = |
| 8567 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8568 | } |
| 8569 | |
| 8570 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8571 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8572 | if (status < 0) |
| 8573 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8574 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8575 | __func__); |
| 8576 | return status; |
| 8577 | } |
| 8578 | |
| 8579 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8580 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 8581 | params->ssid_len, params->bssid, |
| 8582 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8583 | |
| 8584 | if (0 > status) |
| 8585 | { |
| 8586 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 8587 | return status; |
| 8588 | } |
| 8589 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 8590 | if (NULL != params->bssid && |
| 8591 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 8592 | alloc_bssid == VOS_TRUE) |
| 8593 | { |
| 8594 | vos_mem_free(params->bssid); |
| 8595 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8596 | return 0; |
| 8597 | } |
| 8598 | |
| 8599 | /* |
| 8600 | * FUNCTION: wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8601 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8602 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8603 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8604 | struct net_device *dev |
| 8605 | ) |
| 8606 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8607 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8608 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8609 | tCsrRoamProfile *pRoamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8610 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8611 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8612 | |
| 8613 | ENTER(); |
| 8614 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8615 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8616 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 8617 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8618 | status = wlan_hdd_validate_context(pHddCtx); |
| 8619 | |
| 8620 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8621 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8622 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8623 | "%s: HDD context is not valid", __func__); |
| 8624 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8625 | } |
| 8626 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8627 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 8628 | hdd_device_modetoString(pAdapter->device_mode), |
| 8629 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8630 | if (NULL == pWextState) |
| 8631 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8632 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8633 | __func__); |
| 8634 | return -EIO; |
| 8635 | } |
| 8636 | |
| 8637 | pRoamProfile = &pWextState->roamProfile; |
| 8638 | |
| 8639 | /* Issue disconnect only if interface type is set to IBSS */ |
| 8640 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 8641 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8642 | 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] | 8643 | __func__); |
| 8644 | return -EINVAL; |
| 8645 | } |
| 8646 | |
| 8647 | /* Issue Disconnect request */ |
| 8648 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8649 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 8650 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 8651 | |
| 8652 | return 0; |
| 8653 | } |
| 8654 | |
| 8655 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8656 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8657 | * This function is used to set the phy parameters |
| 8658 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 8659 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8660 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8661 | u32 changed) |
| 8662 | { |
| 8663 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8664 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8665 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8666 | |
| 8667 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8668 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8669 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 8670 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8671 | status = wlan_hdd_validate_context(pHddCtx); |
| 8672 | |
| 8673 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8674 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8675 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8676 | "%s: HDD context is not valid", __func__); |
| 8677 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8678 | } |
| 8679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8680 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 8681 | { |
| 8682 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 8683 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 8684 | wiphy->rts_threshold; |
| 8685 | |
| 8686 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8687 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8688 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8690 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8691 | __func__, rts_threshold); |
| 8692 | return -EINVAL; |
| 8693 | } |
| 8694 | |
| 8695 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 8696 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8697 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8698 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8700 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8701 | __func__, rts_threshold); |
| 8702 | return -EIO; |
| 8703 | } |
| 8704 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8705 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8706 | rts_threshold); |
| 8707 | } |
| 8708 | |
| 8709 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 8710 | { |
| 8711 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 8712 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 8713 | wiphy->frag_threshold; |
| 8714 | |
| 8715 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8716 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8717 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8718 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8719 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8720 | frag_threshold); |
| 8721 | return -EINVAL; |
| 8722 | } |
| 8723 | |
| 8724 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 8725 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8726 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8727 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8728 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8729 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8730 | __func__, frag_threshold); |
| 8731 | return -EIO; |
| 8732 | } |
| 8733 | |
| 8734 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 8735 | frag_threshold); |
| 8736 | } |
| 8737 | |
| 8738 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 8739 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 8740 | { |
| 8741 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 8742 | wiphy->retry_short : |
| 8743 | wiphy->retry_long; |
| 8744 | |
| 8745 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 8746 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 8747 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8748 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8749 | __func__, retry_value); |
| 8750 | return -EINVAL; |
| 8751 | } |
| 8752 | |
| 8753 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 8754 | { |
| 8755 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 8756 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8757 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8758 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8759 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8760 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8761 | __func__, retry_value); |
| 8762 | return -EIO; |
| 8763 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8764 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8765 | __func__, retry_value); |
| 8766 | } |
| 8767 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 8768 | { |
| 8769 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 8770 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8771 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8772 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8773 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8774 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8775 | __func__, retry_value); |
| 8776 | return -EIO; |
| 8777 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8778 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8779 | __func__, retry_value); |
| 8780 | } |
| 8781 | } |
| 8782 | |
| 8783 | return 0; |
| 8784 | } |
| 8785 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8786 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 8787 | u32 changed) |
| 8788 | { |
| 8789 | int ret; |
| 8790 | |
| 8791 | vos_ssr_protect(__func__); |
| 8792 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 8793 | vos_ssr_unprotect(__func__); |
| 8794 | |
| 8795 | return ret; |
| 8796 | } |
| 8797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8798 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8799 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8800 | * This function is used to set the txpower |
| 8801 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8802 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8803 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 8804 | struct wireless_dev *wdev, |
| 8805 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8806 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8807 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8808 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8809 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8810 | #endif |
| 8811 | int dbm) |
| 8812 | { |
| 8813 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8814 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8815 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 8816 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8817 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8818 | |
| 8819 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8820 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8821 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 8822 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8823 | status = wlan_hdd_validate_context(pHddCtx); |
| 8824 | |
| 8825 | if (0 != status) |
| 8826 | { |
| 8827 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8828 | "%s: HDD context is not valid", __func__); |
| 8829 | return status; |
| 8830 | } |
| 8831 | |
| 8832 | hHal = pHddCtx->hHal; |
| 8833 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8834 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 8835 | dbm, ccmCfgSetCallback, |
| 8836 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8838 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8839 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 8840 | return -EIO; |
| 8841 | } |
| 8842 | |
| 8843 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 8844 | dbm); |
| 8845 | |
| 8846 | switch(type) |
| 8847 | { |
| 8848 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 8849 | /* Fall through */ |
| 8850 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 8851 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 8852 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8853 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 8854 | __func__); |
| 8855 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8856 | } |
| 8857 | break; |
| 8858 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8859 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8860 | __func__); |
| 8861 | return -EOPNOTSUPP; |
| 8862 | break; |
| 8863 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8864 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 8865 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8866 | return -EIO; |
| 8867 | } |
| 8868 | |
| 8869 | return 0; |
| 8870 | } |
| 8871 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8872 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 8873 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 8874 | struct wireless_dev *wdev, |
| 8875 | #endif |
| 8876 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 8877 | enum tx_power_setting type, |
| 8878 | #else |
| 8879 | enum nl80211_tx_power_setting type, |
| 8880 | #endif |
| 8881 | int dbm) |
| 8882 | { |
| 8883 | int ret; |
| 8884 | vos_ssr_protect(__func__); |
| 8885 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 8886 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 8887 | wdev, |
| 8888 | #endif |
| 8889 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 8890 | type, |
| 8891 | #else |
| 8892 | type, |
| 8893 | #endif |
| 8894 | dbm); |
| 8895 | vos_ssr_unprotect(__func__); |
| 8896 | |
| 8897 | return ret; |
| 8898 | } |
| 8899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8900 | /* |
| 8901 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 8902 | * This function is used to read the txpower |
| 8903 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8904 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 8905 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 8906 | struct wireless_dev *wdev, |
| 8907 | #endif |
| 8908 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | { |
| 8910 | |
| 8911 | hdd_adapter_t *pAdapter; |
| 8912 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8913 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8914 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8915 | ENTER(); |
| 8916 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8917 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8918 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8919 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8920 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8921 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8922 | "%s: HDD context is not valid", __func__); |
| 8923 | *dbm = 0; |
| 8924 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8925 | } |
| 8926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8927 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 8928 | if (NULL == pAdapter) |
| 8929 | { |
| 8930 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 8931 | return -ENOENT; |
| 8932 | } |
| 8933 | |
| 8934 | wlan_hdd_get_classAstats(pAdapter); |
| 8935 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 8936 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8937 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8938 | return 0; |
| 8939 | } |
| 8940 | |
| 8941 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 8942 | u8* mac, struct station_info *sinfo) |
| 8943 | { |
| 8944 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 8945 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8946 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 8947 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8948 | |
| 8949 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 8950 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8951 | |
| 8952 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 8953 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 8954 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 8955 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 8956 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 8957 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 8958 | tANI_U16 maxRate = 0; |
| 8959 | tANI_U16 myRate; |
| 8960 | tANI_U16 currentRate = 0; |
| 8961 | tANI_U8 maxSpeedMCS = 0; |
| 8962 | tANI_U8 maxMCSIdx = 0; |
| 8963 | tANI_U8 rateFlag = 1; |
| 8964 | tANI_U8 i, j, rssidx; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 8965 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8966 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8967 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 8968 | #ifdef WLAN_FEATURE_11AC |
| 8969 | tANI_U32 vht_mcs_map; |
| 8970 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 8971 | #endif /* WLAN_FEATURE_11AC */ |
| 8972 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8973 | ENTER(); |
| 8974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8975 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 8976 | (0 == ssidlen)) |
| 8977 | { |
| 8978 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 8979 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 8980 | /*To keep GUI happy*/ |
| 8981 | return 0; |
| 8982 | } |
| 8983 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8984 | status = wlan_hdd_validate_context(pHddCtx); |
| 8985 | |
| 8986 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8987 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8988 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8989 | "%s: HDD context is not valid", __func__); |
| 8990 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8991 | } |
| 8992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8993 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 8994 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 8995 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 8996 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 8997 | wlan_hdd_get_station_stats(pAdapter); |
| 8998 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 8999 | |
| 9000 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 9001 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 9002 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
| 9003 | sinfo->signal >= pCfg->linkSpeedRssiHigh)) |
| 9004 | { |
| 9005 | rate_flags = pAdapter->maxRateFlags; |
| 9006 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 9007 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9008 | //convert to the UI units of 100kbps |
| 9009 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 9010 | |
| 9011 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9012 | 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] | 9013 | sinfo->signal, |
| 9014 | pCfg->reportMaxLinkSpeed, |
| 9015 | myRate, |
| 9016 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 9017 | (int) pCfg->linkSpeedRssiMid, |
| 9018 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9019 | (int) rate_flags, |
| 9020 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9021 | #endif //LINKSPEED_DEBUG_ENABLED |
| 9022 | |
| 9023 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 9024 | { |
| 9025 | // we do not want to necessarily report the current speed |
| 9026 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 9027 | { |
| 9028 | // report the max possible speed |
| 9029 | rssidx = 0; |
| 9030 | } |
| 9031 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 9032 | { |
| 9033 | // report the max possible speed with RSSI scaling |
| 9034 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 9035 | { |
| 9036 | // report the max possible speed |
| 9037 | rssidx = 0; |
| 9038 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 9039 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9040 | { |
| 9041 | // report middle speed |
| 9042 | rssidx = 1; |
| 9043 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 9044 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 9045 | { |
| 9046 | // report middle speed |
| 9047 | rssidx = 2; |
| 9048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9049 | else |
| 9050 | { |
| 9051 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 9052 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9053 | } |
| 9054 | } |
| 9055 | else |
| 9056 | { |
| 9057 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 9058 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9059 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 9060 | __func__, pCfg->reportMaxLinkSpeed); |
| 9061 | rssidx = 0; |
| 9062 | } |
| 9063 | |
| 9064 | maxRate = 0; |
| 9065 | |
| 9066 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 9067 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 9068 | OperationalRates, &ORLeng)) |
| 9069 | { |
| 9070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 9071 | /*To keep GUI happy*/ |
| 9072 | return 0; |
| 9073 | } |
| 9074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9075 | for (i = 0; i < ORLeng; i++) |
| 9076 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9077 | 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] | 9078 | { |
| 9079 | /* Validate Rate Set */ |
| 9080 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 9081 | { |
| 9082 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 9083 | break; |
| 9084 | } |
| 9085 | } |
| 9086 | /* Update MAX rate */ |
| 9087 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 9088 | } |
| 9089 | |
| 9090 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 9091 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 9092 | ExtendedRates, &ERLeng)) |
| 9093 | { |
| 9094 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 9095 | /*To keep GUI happy*/ |
| 9096 | return 0; |
| 9097 | } |
| 9098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9099 | for (i = 0; i < ERLeng; i++) |
| 9100 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9101 | 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] | 9102 | { |
| 9103 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 9104 | { |
| 9105 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 9106 | break; |
| 9107 | } |
| 9108 | } |
| 9109 | /* Update MAX rate */ |
| 9110 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 9111 | } |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 9112 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 9113 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 9114 | if we have good rssi */ |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 9115 | if ((0 == rssidx) || |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 9116 | (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9117 | { |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 9118 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 9119 | MCSRates, &MCSLeng)) |
| 9120 | { |
| 9121 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 9122 | /*To keep GUI happy*/ |
| 9123 | return 0; |
| 9124 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9125 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9126 | #ifdef WLAN_FEATURE_11AC |
| 9127 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9128 | 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] | 9129 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9130 | 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] | 9131 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9132 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9133 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9134 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9135 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9136 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9137 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9138 | maxMCSIdx = 7; |
| 9139 | } |
| 9140 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 9141 | { |
| 9142 | maxMCSIdx = 8; |
| 9143 | } |
| 9144 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 9145 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9146 | //VHT20 is supporting 0~8 |
| 9147 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 9148 | maxMCSIdx = 8; |
| 9149 | else |
| 9150 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9151 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9152 | |
| 9153 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 9154 | { |
| 9155 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 9156 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 9157 | } |
| 9158 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 9159 | { |
| 9160 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 9161 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 9162 | } |
| 9163 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 9164 | { |
| 9165 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 9166 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 9167 | } |
| 9168 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9169 | maxSpeedMCS = 1; |
| 9170 | if (currentRate > maxRate) |
| 9171 | { |
| 9172 | maxRate = currentRate; |
| 9173 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9174 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9175 | } |
| 9176 | else |
| 9177 | #endif /* WLAN_FEATURE_11AC */ |
| 9178 | { |
| 9179 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 9180 | { |
| 9181 | rateFlag |= 1; |
| 9182 | } |
| 9183 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 9184 | { |
| 9185 | rateFlag |= 2; |
| 9186 | } |
| 9187 | |
| 9188 | for (i = 0; i < MCSLeng; i++) |
| 9189 | { |
| 9190 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
| 9191 | for (j = 0; j < temp; j++) |
| 9192 | { |
| 9193 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 9194 | { |
| 9195 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 9196 | break; |
| 9197 | } |
| 9198 | } |
| 9199 | if ((j < temp) && (currentRate > maxRate)) |
| 9200 | { |
| 9201 | maxRate = currentRate; |
| 9202 | maxSpeedMCS = 1; |
| 9203 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 9204 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9205 | } |
| 9206 | } |
| 9207 | } |
| 9208 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9209 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 9210 | { |
| 9211 | maxRate = myRate; |
| 9212 | maxSpeedMCS = 1; |
| 9213 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 9214 | } |
| 9215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9216 | // 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] | 9217 | if (((maxRate < myRate) && (0 == rssidx)) || |
| 9218 | (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9219 | { |
| 9220 | maxRate = myRate; |
| 9221 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 9222 | { |
| 9223 | maxSpeedMCS = 0; |
| 9224 | } |
| 9225 | else |
| 9226 | { |
| 9227 | maxSpeedMCS = 1; |
| 9228 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 9229 | } |
| 9230 | } |
| 9231 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9232 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9233 | { |
| 9234 | sinfo->txrate.legacy = maxRate; |
| 9235 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 9236 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 9237 | #endif //LINKSPEED_DEBUG_ENABLED |
| 9238 | } |
| 9239 | else |
| 9240 | { |
| 9241 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9242 | #ifdef WLAN_FEATURE_11AC |
| 9243 | sinfo->txrate.nss = 1; |
| 9244 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 9245 | { |
| 9246 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9247 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9248 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9249 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9250 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9251 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 9252 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 9253 | } |
| 9254 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 9255 | { |
| 9256 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 9257 | } |
| 9258 | #endif /* WLAN_FEATURE_11AC */ |
| 9259 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 9260 | { |
| 9261 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 9262 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 9263 | { |
| 9264 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 9265 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9266 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9267 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 9268 | { |
| 9269 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 9270 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 9271 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9272 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 9273 | pr_info("Reporting MCS rate %d flags %x\n", |
| 9274 | sinfo->txrate.mcs, |
| 9275 | sinfo->txrate.flags ); |
| 9276 | #endif //LINKSPEED_DEBUG_ENABLED |
| 9277 | } |
| 9278 | } |
| 9279 | else |
| 9280 | { |
| 9281 | // report current rate instead of max rate |
| 9282 | |
| 9283 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 9284 | { |
| 9285 | //provide to the UI in units of 100kbps |
| 9286 | sinfo->txrate.legacy = myRate; |
| 9287 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 9288 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 9289 | #endif //LINKSPEED_DEBUG_ENABLED |
| 9290 | } |
| 9291 | else |
| 9292 | { |
| 9293 | //must be MCS |
| 9294 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9295 | #ifdef WLAN_FEATURE_11AC |
| 9296 | sinfo->txrate.nss = 1; |
| 9297 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 9298 | { |
| 9299 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 9300 | } |
| 9301 | else |
| 9302 | #endif /* WLAN_FEATURE_11AC */ |
| 9303 | { |
| 9304 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 9305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9306 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 9307 | { |
| 9308 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 9309 | } |
| 9310 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 9311 | { |
| 9312 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 9313 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 9314 | #ifdef WLAN_FEATURE_11AC |
| 9315 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 9316 | { |
| 9317 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 9318 | } |
| 9319 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9320 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 9321 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 9322 | sinfo->txrate.mcs, |
| 9323 | sinfo->txrate.flags ); |
| 9324 | #endif //LINKSPEED_DEBUG_ENABLED |
| 9325 | } |
| 9326 | } |
| 9327 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 9328 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 9329 | sinfo->tx_packets = |
| 9330 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 9331 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 9332 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 9333 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 9334 | |
| 9335 | sinfo->tx_retries = |
| 9336 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 9337 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 9338 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 9339 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 9340 | |
| 9341 | sinfo->tx_failed = |
| 9342 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 9343 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 9344 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 9345 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 9346 | |
| 9347 | sinfo->filled |= |
| 9348 | STATION_INFO_TX_PACKETS | |
| 9349 | STATION_INFO_TX_RETRIES | |
| 9350 | STATION_INFO_TX_FAILED; |
| 9351 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9352 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9353 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 9354 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 9355 | EXIT(); |
| 9356 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9357 | } |
| 9358 | |
| 9359 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 9360 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9361 | { |
| 9362 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9363 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9364 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9365 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9366 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9367 | ENTER(); |
| 9368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9369 | if (NULL == pAdapter) |
| 9370 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9371 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9372 | return -ENODEV; |
| 9373 | } |
| 9374 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9375 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9376 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 9377 | pAdapter->sessionId, timeout)); |
| 9378 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9379 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9380 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9381 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9382 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9383 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9384 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9385 | "%s: HDD context is not valid", __func__); |
| 9386 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9387 | } |
| 9388 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9389 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 9390 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 9391 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 9392 | (eConnectionState_Associated == |
| 9393 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 9394 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 9395 | |
| 9396 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9397 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 9398 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9399 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 9400 | { |
| 9401 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9402 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 9403 | __func__, vos_status); |
| 9404 | } |
| 9405 | } |
| 9406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9407 | /**The get power cmd from the supplicant gets updated by the nl only |
| 9408 | *on successful execution of the function call |
| 9409 | *we are oppositely mapped w.r.t mode in the driver |
| 9410 | **/ |
| 9411 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 9412 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9413 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9414 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 9415 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9417 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9418 | return -EINVAL; |
| 9419 | } |
| 9420 | return 0; |
| 9421 | } |
| 9422 | |
| 9423 | |
| 9424 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9425 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 9426 | struct net_device *netdev, |
| 9427 | u8 key_index) |
| 9428 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9429 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9430 | return 0; |
| 9431 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9432 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | |
| 9434 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 9435 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 9436 | struct net_device *dev, |
| 9437 | struct ieee80211_txq_params *params) |
| 9438 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9439 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9440 | return 0; |
| 9441 | } |
| 9442 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9443 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 9444 | struct ieee80211_txq_params *params) |
| 9445 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9446 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9447 | return 0; |
| 9448 | } |
| 9449 | #endif //LINUX_VERSION_CODE |
| 9450 | |
| 9451 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 9452 | struct net_device *dev, u8 *mac) |
| 9453 | { |
| 9454 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9455 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9456 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9457 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9458 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9459 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9460 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9461 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9462 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9463 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9464 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9465 | return -EINVAL; |
| 9466 | } |
| 9467 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9468 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9469 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 9470 | pAdapter->sessionId, pAdapter->device_mode)); |
| 9471 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9472 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9473 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9474 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9475 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9476 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9477 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9478 | "%s: HDD context is not valid", __func__); |
| 9479 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9480 | } |
| 9481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9482 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9483 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9484 | ) |
| 9485 | { |
| 9486 | if( NULL == mac ) |
| 9487 | { |
| 9488 | v_U16_t i; |
| 9489 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 9490 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 9491 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 9492 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9493 | { |
| 9494 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 9495 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9496 | "%s: Delete STA with MAC::" |
| 9497 | MAC_ADDRESS_STR, |
| 9498 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 9499 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 9500 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 9501 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9502 | } |
| 9503 | } |
| 9504 | } |
| 9505 | else |
| 9506 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9507 | |
| 9508 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 9509 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 9510 | { |
| 9511 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9512 | "%s: Skip this DEL STA as this is not used::" |
| 9513 | MAC_ADDRESS_STR, |
| 9514 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9515 | return -ENOENT; |
| 9516 | } |
| 9517 | |
| 9518 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 9519 | { |
| 9520 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9521 | "%s: Skip this DEL STA as deauth is in progress::" |
| 9522 | MAC_ADDRESS_STR, |
| 9523 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9524 | return -ENOENT; |
| 9525 | } |
| 9526 | |
| 9527 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 9528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9530 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9531 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9533 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9534 | |
| 9535 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 9536 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 9537 | { |
| 9538 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 9539 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9540 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9541 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9542 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9543 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9544 | return -ENOENT; |
| 9545 | } |
| 9546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9547 | } |
| 9548 | } |
| 9549 | |
| 9550 | EXIT(); |
| 9551 | |
| 9552 | return 0; |
| 9553 | } |
| 9554 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 9555 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 9556 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 9557 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9558 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 9559 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 9560 | #ifdef FEATURE_WLAN_TDLS |
| 9561 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 9562 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9563 | |
| 9564 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9565 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 9566 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9567 | mask = params->sta_flags_mask; |
| 9568 | |
| 9569 | set = params->sta_flags_set; |
| 9570 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 9571 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 9572 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9573 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 9574 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 9575 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9576 | |
| 9577 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 9578 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9579 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9580 | } |
| 9581 | } |
| 9582 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 9583 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9584 | } |
| 9585 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9586 | |
| 9587 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9588 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9589 | 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] | 9590 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9591 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9592 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9593 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9594 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9595 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9596 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9597 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9598 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9599 | hdd_context_t *pHddCtx; |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9600 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 9601 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9602 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9603 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9604 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9605 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9606 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9607 | return -EINVAL; |
| 9608 | } |
| 9609 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9610 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9611 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9612 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9613 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9614 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9615 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9616 | "%s: HDD context is not valid", __func__); |
| 9617 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9618 | } |
| 9619 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9620 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9621 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9622 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9623 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9624 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9625 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9626 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9627 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 9628 | { |
| 9629 | /* BSSID matched previous entry. Overwrite it. */ |
| 9630 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9631 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9632 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9633 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9634 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9635 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9636 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9637 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9638 | dump_bssid(pmksa->bssid); |
| 9639 | dump_pmkid(halHandle, pmksa->pmkid); |
| 9640 | break; |
| 9641 | } |
| 9642 | } |
| 9643 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 9644 | /* Check we compared all entries,if then take the first slot now */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9645 | if (j == MAX_PMKSAIDS_IN_CACHE) pHddStaCtx->PMKIDCacheIndex=0; |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 9646 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9647 | if (!BSSIDMatched) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9648 | { |
| 9649 | // Now, we DON'T have a BSSID match, so take a new entry in the cache. |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9650 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].BSSID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9651 | pmksa->bssid, ETHER_ADDR_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9652 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9653 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9654 | CSR_RSN_PMKID_SIZE); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9655 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Adding a new cache entry %d.", |
| 9656 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9657 | dump_bssid(pmksa->bssid); |
| 9658 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9659 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9660 | // The "i=0" doesn't work for the call to sme_RoamSetPMKIDCache() - LFR FIXME |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9661 | if (pHddStaCtx->PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) |
| 9662 | pHddStaCtx->PMKIDCacheIndex++; |
| 9663 | else |
| 9664 | pHddStaCtx->PMKIDCacheIndex = 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9665 | } |
| 9666 | |
| 9667 | |
| 9668 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9669 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
| 9670 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
| 9671 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9672 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9673 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9674 | pHddStaCtx->PMKIDCache, |
| 9675 | pHddStaCtx->PMKIDCacheIndex); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9676 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9677 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 9678 | pAdapter->sessionId, result)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9679 | return 0; |
| 9680 | } |
| 9681 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9682 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 9683 | struct cfg80211_pmksa *pmksa) |
| 9684 | { |
| 9685 | int ret; |
| 9686 | |
| 9687 | vos_ssr_protect(__func__); |
| 9688 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 9689 | vos_ssr_unprotect(__func__); |
| 9690 | |
| 9691 | return ret; |
| 9692 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9693 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9694 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9695 | 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] | 9696 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9697 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9698 | tANI_U32 j=0; |
| 9699 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9700 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9701 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9702 | tANI_U8 BSSIDMatched = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9703 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9704 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9705 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9706 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 9707 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9708 | |
| 9709 | /* Validate pAdapter */ |
| 9710 | if (NULL == pAdapter) |
| 9711 | { |
| 9712 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 9713 | return -EINVAL; |
| 9714 | } |
| 9715 | |
| 9716 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9717 | status = wlan_hdd_validate_context(pHddCtx); |
| 9718 | |
| 9719 | if (0 != status) |
| 9720 | { |
| 9721 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9722 | "%s: HDD context is not valid", __func__); |
| 9723 | return status; |
| 9724 | } |
| 9725 | |
| 9726 | /*Retrieve halHandle*/ |
| 9727 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9728 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9729 | |
| 9730 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9731 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9732 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9733 | hddLog(VOS_TRACE_LEVEL_INFO, FL("No entries to flush")); |
| 9734 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9735 | } |
| 9736 | |
| 9737 | /*find the matching PMKSA entry from j=0 to (index-1), |
| 9738 | * and delete the matched one |
| 9739 | */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9740 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9741 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9742 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9743 | pmksa->bssid, |
| 9744 | WNI_CFG_BSSID_LEN)) |
| 9745 | { |
| 9746 | /* BSSID matched entry */ |
| 9747 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9748 | if (j < pHddStaCtx->PMKIDCacheIndex-1) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9749 | { |
| 9750 | /*replace the matching entry with the last entry in HDD local cache*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9751 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
| 9752 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 9753 | VOS_MAC_ADDR_SIZE); |
| 9754 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
| 9755 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 9756 | CSR_RSN_PMKID_SIZE); |
| 9757 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9758 | |
| 9759 | /*clear the last entry in HDD cache ---[index-1]*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9760 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 9761 | VOS_MAC_ADDR_SIZE); |
| 9762 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 9763 | CSR_RSN_PMKID_SIZE); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9764 | /*reduce the PMKID array index*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9765 | pHddStaCtx->PMKIDCacheIndex--; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9766 | /*delete the last PMKID cache in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9767 | if (eHAL_STATUS_SUCCESS != |
| 9768 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9769 | { |
| 9770 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9771 | __func__, pHddStaCtx->PMKIDCacheIndex); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9772 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9773 | } |
| 9774 | |
| 9775 | dump_bssid(pmksa->bssid); |
| 9776 | dump_pmkid(halHandle,pmksa->pmkid); |
| 9777 | |
| 9778 | break; |
| 9779 | } |
| 9780 | } |
| 9781 | |
| 9782 | /* we compare all entries,but cannot find matching entry */ |
| 9783 | if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched) |
| 9784 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9785 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 9786 | "%s: No such PMKSA entry existed " MAC_ADDRESS_STR, |
| 9787 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9788 | dump_bssid(pmksa->bssid); |
| 9789 | dump_pmkid(halHandle, pmksa->pmkid); |
| 9790 | return -EINVAL; |
| 9791 | } |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9792 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9793 | } |
| 9794 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9795 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9796 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 9797 | struct cfg80211_pmksa *pmksa) |
| 9798 | { |
| 9799 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9800 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9801 | vos_ssr_protect(__func__); |
| 9802 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 9803 | vos_ssr_unprotect(__func__); |
| 9804 | |
| 9805 | return ret; |
| 9806 | |
| 9807 | } |
| 9808 | |
| 9809 | static int __wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9810 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9811 | tANI_U32 j=0; |
| 9812 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9813 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9814 | tHalHandle halHandle; |
| 9815 | hdd_context_t *pHddCtx; |
| 9816 | tANI_U8 *pBSSId; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9817 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9818 | |
| 9819 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 9820 | |
| 9821 | /* Validate pAdapter */ |
| 9822 | if (NULL == pAdapter) |
| 9823 | { |
| 9824 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9825 | "%s: Invalid Adapter" ,__func__); |
| 9826 | return -EINVAL; |
| 9827 | } |
| 9828 | |
| 9829 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9830 | status = wlan_hdd_validate_context(pHddCtx); |
| 9831 | |
| 9832 | if (0 != status) |
| 9833 | { |
| 9834 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9835 | "%s: HDD context is not valid", __func__); |
| 9836 | return status; |
| 9837 | } |
| 9838 | |
| 9839 | /*Retrieve halHandle*/ |
| 9840 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9841 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9842 | |
| 9843 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9844 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9845 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 9846 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("No entries to flush")); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9847 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9848 | } |
| 9849 | |
| 9850 | /*delete all the PMKSA one by one */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9851 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9852 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9853 | pBSSId =(tANI_U8 *)(pHddStaCtx->PMKIDCache[j].BSSID); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9854 | /*delete the PMKID in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9855 | if (eHAL_STATUS_SUCCESS != |
| 9856 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9857 | { |
| 9858 | hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.", |
| 9859 | __func__,j); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9860 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9861 | } |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 9862 | /*clear the entry in HDD cache 0--index-1 */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9863 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].BSSID, VOS_MAC_ADDR_SIZE); |
| 9864 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); |
| 9865 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 9866 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 9867 | pHddStaCtx->PMKIDCacheIndex = 0; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 9868 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9869 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 9870 | |
| 9871 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 9872 | { |
| 9873 | int ret; |
| 9874 | |
| 9875 | vos_ssr_protect(__func__); |
| 9876 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 9877 | vos_ssr_unprotect(__func__); |
| 9878 | |
| 9879 | return ret; |
| 9880 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9881 | #endif |
| 9882 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9883 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9884 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9885 | struct net_device *dev, struct cfg80211_update_ft_ies_params *ftie) |
| 9886 | { |
| 9887 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9888 | hdd_station_ctx_t *pHddStaCtx; |
| 9889 | |
| 9890 | if (NULL == pAdapter) |
| 9891 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9892 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9893 | return -ENODEV; |
| 9894 | } |
| 9895 | |
| 9896 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9897 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9898 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9899 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 9900 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9901 | // Added for debug on reception of Re-assoc Req. |
| 9902 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 9903 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9904 | 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] | 9905 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9906 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9907 | } |
| 9908 | |
| 9909 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9910 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9911 | ftie->ie_len); |
| 9912 | #endif |
| 9913 | |
| 9914 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 9915 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 9916 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9917 | ftie->ie_len); |
| 9918 | return 0; |
| 9919 | } |
| 9920 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9921 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9922 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 9923 | |
| 9924 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 9925 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 9926 | { |
| 9927 | int ret; |
| 9928 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 9929 | hdd_context_t *pHddCtx; |
| 9930 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 9931 | ENTER(); |
| 9932 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9933 | if (NULL == pAdapter) |
| 9934 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 9935 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9936 | "%s: HDD adapter is Null", __func__); |
| 9937 | return ; |
| 9938 | } |
| 9939 | |
| 9940 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9941 | if (NULL == pHddCtx) |
| 9942 | { |
| 9943 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9944 | "%s: HDD context is Null!!!", __func__); |
| 9945 | return ; |
| 9946 | } |
| 9947 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9948 | spin_lock(&pHddCtx->schedScan_lock); |
| 9949 | if (TRUE == pHddCtx->isWiphySuspended) |
| 9950 | { |
| 9951 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 9952 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9953 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9954 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 9955 | return ; |
| 9956 | } |
| 9957 | spin_unlock(&pHddCtx->schedScan_lock); |
| 9958 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9959 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 9960 | |
| 9961 | if (0 > ret) |
| 9962 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 9963 | |
| 9964 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 9965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9966 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9967 | } |
| 9968 | |
| 9969 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9970 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 9971 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9972 | */ |
| 9973 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 9974 | { |
| 9975 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 9976 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 9977 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9978 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9979 | int status = 0; |
| 9980 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 9981 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 9982 | /* The current firmware design does not allow PNO during any |
| 9983 | * active sessions. Hence, determine the active sessions |
| 9984 | * and return a failure. |
| 9985 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9986 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 9987 | { |
| 9988 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 9989 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9990 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 9991 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 9992 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 9993 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 9994 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 9995 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
| 9996 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9997 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 9998 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 9999 | } |
| 10000 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10001 | pAdapterNode = pNext; |
| 10002 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 10003 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 10004 | } |
| 10005 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10006 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 10007 | { |
| 10008 | hdd_adapter_t *pAdapter = callbackContext; |
| 10009 | hdd_context_t *pHddCtx; |
| 10010 | |
| 10011 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 10012 | { |
| 10013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10014 | FL("Invalid adapter or adapter has invalid magic")); |
| 10015 | return; |
| 10016 | } |
| 10017 | |
| 10018 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10019 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 10020 | { |
| 10021 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10022 | FL("HDD context is not valid")); |
| 10023 | return; |
| 10024 | } |
| 10025 | |
| 10026 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10027 | FL("PNO enable response status = %d"), status); |
| 10028 | |
| 10029 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 10030 | complete(&pAdapter->pno_comp_var); |
| 10031 | } |
| 10032 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 10033 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 10034 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 10035 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10036 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 10037 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10038 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 10039 | { |
| 10040 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10041 | tpSirPNOScanReq pPnoRequest = NULL; |
| 10042 | hdd_context_t *pHddCtx; |
| 10043 | tHalHandle hHal; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 10044 | v_U32_t i, indx, num_ch, tempInterval; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 10045 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 10046 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10047 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 10048 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10049 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10050 | |
| 10051 | if (NULL == pAdapter) |
| 10052 | { |
| 10053 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10054 | "%s: HDD adapter is Null", __func__); |
| 10055 | return -ENODEV; |
| 10056 | } |
| 10057 | |
| 10058 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10059 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10060 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10061 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10062 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 10063 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10064 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10065 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10066 | } |
| 10067 | |
| 10068 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10069 | if (NULL == hHal) |
| 10070 | { |
| 10071 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10072 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10073 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10074 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 10075 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10076 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 10077 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10078 | { |
| 10079 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10080 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 10081 | return -EBUSY; |
| 10082 | } |
| 10083 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 10084 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 10085 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 10086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 10087 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 10088 | return -EBUSY; |
| 10089 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10090 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 10091 | if (TRUE == pHddCtx->isPnoEnable) |
| 10092 | { |
| 10093 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 10094 | FL("already PNO is enabled")); |
| 10095 | return -EBUSY; |
| 10096 | } |
| 10097 | pHddCtx->isPnoEnable = TRUE; |
| 10098 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10099 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 10100 | if (NULL == pPnoRequest) |
| 10101 | { |
| 10102 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10103 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 10104 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10105 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10106 | } |
| 10107 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 10108 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10109 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 10110 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 10111 | |
| 10112 | if (( !pPnoRequest->ucNetworksCount ) || |
| 10113 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 10114 | { |
| 10115 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 10116 | "%s: Network input is not correct %d Max Network supported is %d", |
| 10117 | __func__, pPnoRequest->ucNetworksCount, |
| 10118 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10119 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10120 | goto error; |
| 10121 | } |
| 10122 | |
| 10123 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 10124 | { |
| 10125 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10126 | "%s: Incorrect number of channels %d", |
| 10127 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10128 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10129 | goto error; |
| 10130 | } |
| 10131 | |
| 10132 | /* Framework provides one set of channels(all) |
| 10133 | * common for all saved profile */ |
| 10134 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 10135 | channels_allowed, &num_channels_allowed)) |
| 10136 | { |
| 10137 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10138 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10139 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10140 | goto error; |
| 10141 | } |
| 10142 | /* Checking each channel against allowed channel list */ |
| 10143 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10144 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10145 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10146 | char chList [(request->n_channels*5)+1]; |
| 10147 | int len; |
| 10148 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10149 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10150 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10151 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10152 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 10153 | { |
| 10154 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 10155 | len += snprintf(chList+len, 5, "%d ", |
| 10156 | request->channels[i]->hw_value); |
| 10157 | break ; |
| 10158 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10159 | } |
| 10160 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10161 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
| 10162 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10163 | |
| 10164 | /* Filling per profile params */ |
| 10165 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 10166 | { |
| 10167 | pPnoRequest->aNetworks[i].ssId.length = |
| 10168 | request->match_sets[i].ssid.ssid_len; |
| 10169 | |
| 10170 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 10171 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 10172 | { |
| 10173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10174 | "%s: SSID Len %d is not correct for network %d", |
| 10175 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10176 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10177 | goto error; |
| 10178 | } |
| 10179 | |
| 10180 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 10181 | request->match_sets[i].ssid.ssid, |
| 10182 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 10183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10184 | "%s: SSID of network %d is %s ", __func__, |
| 10185 | i, pPnoRequest->aNetworks[i].ssId.ssId); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10186 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 10187 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 10188 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 10189 | |
| 10190 | /*Copying list of valid channel into request */ |
| 10191 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 10192 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 10193 | |
| 10194 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 10195 | } |
| 10196 | |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 10197 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 10198 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 10199 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 10200 | { |
| 10201 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 10202 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 10203 | pPnoRequest->us24GProbeTemplateLen); |
| 10204 | |
| 10205 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 10206 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 10207 | pPnoRequest->us5GProbeTemplateLen); |
| 10208 | } |
| 10209 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 10210 | /* Driver gets only one time interval which is hardcoded in |
| 10211 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 10212 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 10213 | * 80,160,320 secs. And number of scan cycle for each timer |
| 10214 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 10215 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 10216 | * will be repeated after each interval specified by supplicant |
| 10217 | * till PNO is disabled. |
| 10218 | */ |
| 10219 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 10220 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 10221 | else |
| 10222 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 10223 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 10224 | |
| 10225 | tempInterval = (request->interval)/1000; |
| 10226 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10227 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 10228 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 10229 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 10230 | { |
| 10231 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 10232 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 10233 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 10234 | tempInterval *= 2; |
| 10235 | } |
| 10236 | //Repeat last timer until pno disabled. |
| 10237 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 10238 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 10239 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10240 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10241 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 10242 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 10243 | pPnoRequest->callbackContext = pAdapter; |
| 10244 | pAdapter->pno_req_status = 0; |
| 10245 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10246 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10247 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 10248 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 10249 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 10250 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10251 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10252 | pPnoRequest, pAdapter->sessionId, |
| 10253 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 10254 | if (eHAL_STATUS_SUCCESS != status) |
| 10255 | { |
| 10256 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 10257 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10258 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10259 | goto error; |
| 10260 | } |
| 10261 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10262 | ret = wait_for_completion_timeout( |
| 10263 | &pAdapter->pno_comp_var, |
| 10264 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 10265 | if (0 >= ret) |
| 10266 | { |
| 10267 | // Did not receive the response for PNO enable in time. |
| 10268 | // Assuming the PNO enable was success. |
| 10269 | // Returning error from here, because we timeout, results |
| 10270 | // in side effect of Wifi (Wifi Setting) not to work. |
| 10271 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10272 | FL("Timed out waiting for PNO to be Enabled")); |
| 10273 | ret = 0; |
| 10274 | goto error; |
| 10275 | } |
| 10276 | |
| 10277 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 10278 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10279 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10280 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10281 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10282 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10283 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 10284 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10285 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10286 | } |
| 10287 | |
| 10288 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 10289 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 10290 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10291 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 10292 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 10293 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 10294 | { |
| 10295 | int ret; |
| 10296 | |
| 10297 | vos_ssr_protect(__func__); |
| 10298 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 10299 | vos_ssr_unprotect(__func__); |
| 10300 | |
| 10301 | return ret; |
| 10302 | } |
| 10303 | |
| 10304 | /* |
| 10305 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 10306 | * Function to disable PNO |
| 10307 | */ |
| 10308 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10309 | struct net_device *dev) |
| 10310 | { |
| 10311 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10312 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10313 | hdd_context_t *pHddCtx; |
| 10314 | tHalHandle hHal; |
| 10315 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10316 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10317 | |
| 10318 | ENTER(); |
| 10319 | |
| 10320 | if (NULL == pAdapter) |
| 10321 | { |
| 10322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10323 | "%s: HDD adapter is Null", __func__); |
| 10324 | return -ENODEV; |
| 10325 | } |
| 10326 | |
| 10327 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10328 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10329 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10330 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 10331 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10332 | "%s: HDD context is Null", __func__); |
| 10333 | return -ENODEV; |
| 10334 | } |
| 10335 | |
| 10336 | /* The return 0 is intentional when isLogpInProgress and |
| 10337 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 10338 | * failure in sched_scan_stop , especially for a case where the unload |
| 10339 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 10340 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 10341 | * success. If it returns a failure , then its next invocation due to the |
| 10342 | * clean up of the second interface will have the dev pointer corresponding |
| 10343 | * to the first one leading to a crash. |
| 10344 | */ |
| 10345 | if (pHddCtx->isLogpInProgress) |
| 10346 | { |
| 10347 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10348 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 10349 | return ret; |
| 10350 | } |
| 10351 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 10352 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10353 | { |
| 10354 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10355 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 10356 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10357 | } |
| 10358 | |
| 10359 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10360 | if (NULL == hHal) |
| 10361 | { |
| 10362 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10363 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10364 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10365 | } |
| 10366 | |
| 10367 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 10368 | if (NULL == pPnoRequest) |
| 10369 | { |
| 10370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10371 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10372 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10373 | } |
| 10374 | |
| 10375 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 10376 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 10377 | pPnoRequest->ucNetworksCount = 0; |
| 10378 | |
| 10379 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 10380 | pAdapter->sessionId, |
| 10381 | NULL, pAdapter); |
| 10382 | if (eHAL_STATUS_SUCCESS != status) |
| 10383 | { |
| 10384 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10385 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10386 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10387 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10388 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 10389 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10390 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10391 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 10392 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 10393 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10394 | vos_mem_free(pPnoRequest); |
| 10395 | |
| 10396 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 10397 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10398 | } |
| 10399 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 10400 | /* |
| 10401 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 10402 | * NL interface to disable PNO |
| 10403 | */ |
| 10404 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 10405 | struct net_device *dev) |
| 10406 | { |
| 10407 | int ret; |
| 10408 | |
| 10409 | vos_ssr_protect(__func__); |
| 10410 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 10411 | vos_ssr_unprotect(__func__); |
| 10412 | |
| 10413 | return ret; |
| 10414 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 10415 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 10416 | |
| 10417 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10418 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 10419 | #if TDLS_MGMT_VERSION2 |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10420 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 10421 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 10422 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 10423 | #else |
| 10424 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 10425 | u8 *peer, u8 action_code, u8 dialog_token, |
| 10426 | u16 status_code, const u8 *buf, size_t len) |
| 10427 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10428 | { |
| 10429 | |
| 10430 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10431 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10432 | u8 peerMac[6]; |
| 10433 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10434 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10435 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 10436 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 10437 | #if !(TDLS_MGMT_VERSION2) |
| 10438 | u32 peer_capability = 0; |
| 10439 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10440 | tANI_U16 numCurrTdlsPeers; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10441 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10442 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10443 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 10444 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10445 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10446 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10447 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10448 | "Invalid arguments"); |
| 10449 | return -EINVAL; |
| 10450 | } |
| 10451 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 10452 | if (pHddCtx->isLogpInProgress) |
| 10453 | { |
| 10454 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10455 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10456 | wlan_hdd_tdls_set_link_status(pAdapter, peer, eTDLS_LINK_IDLE); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 10457 | return -EBUSY; |
| 10458 | } |
| 10459 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10460 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10461 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10462 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 10463 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 10464 | MAC_ADDRESS_STR " action %d declined.", |
| 10465 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10466 | return -ENOTSUPP; |
| 10467 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10468 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10469 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 10470 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 10471 | { |
| 10472 | /* if tdls_mode is disabled to respond to peer's request */ |
| 10473 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 10474 | { |
| 10475 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 10476 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10477 | " TDLS mode is disabled. action %d declined.", |
| 10478 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10479 | |
| 10480 | return -ENOTSUPP; |
| 10481 | } |
| 10482 | } |
| 10483 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10484 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 10485 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10486 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10487 | { |
| 10488 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10489 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10490 | " TDLS setup is ongoing. action %d declined.", |
| 10491 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 10492 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10493 | } |
| 10494 | } |
| 10495 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10496 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 10497 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10498 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10499 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 10500 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10501 | { |
| 10502 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 10503 | we return error code at 'add_station()'. Hence we have this |
| 10504 | check again in addtion to add_station(). |
| 10505 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10506 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10507 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10508 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10509 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10510 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 10511 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 10512 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 10513 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10514 | } |
| 10515 | else |
| 10516 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10517 | /* maximum reached. tweak to send error code to peer and return |
| 10518 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10519 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10520 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10521 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10522 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 10523 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 10524 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10525 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10526 | /* fall through to send setup resp with failure status |
| 10527 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10528 | } |
| 10529 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10530 | else |
| 10531 | { |
| 10532 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10533 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10534 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10535 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10536 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10537 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 10538 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10539 | return -EPERM; |
| 10540 | } |
| 10541 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10542 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10543 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10544 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 10545 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 10546 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 10547 | "%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] | 10548 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 10549 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 10550 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10551 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10552 | /*Except teardown responder will not be used so just make 0*/ |
| 10553 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10554 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10555 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 10556 | |
| 10557 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10558 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 10559 | |
| 10560 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 10561 | responder = pTdlsPeer->is_responder; |
| 10562 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10563 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 10564 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 10565 | "%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] | 10566 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 10567 | dialog_token, status_code, len); |
| 10568 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10569 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10570 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10571 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 10572 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 10573 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10574 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 10575 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 10576 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10577 | { |
| 10578 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 10579 | { |
| 10580 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 10581 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10582 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 10583 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 10584 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 10585 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10586 | } |
| 10587 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10588 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 10589 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 10590 | { |
| 10591 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10592 | "%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] | 10593 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 10594 | return -EBUSY; |
| 10595 | } |
| 10596 | |
| 10597 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10598 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 10599 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10600 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 10601 | 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] | 10602 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10603 | if (VOS_STATUS_SUCCESS != status) |
| 10604 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10606 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10607 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10608 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 10609 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10610 | } |
| 10611 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 10612 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 10613 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 10614 | |
| 10615 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10616 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 10617 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 10618 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 10619 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10620 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 10621 | |
| 10622 | if (pHddCtx->isLogpInProgress) |
| 10623 | { |
| 10624 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10625 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 10626 | return -EAGAIN; |
| 10627 | } |
| 10628 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 10629 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 10630 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10631 | } |
| 10632 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10633 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10634 | { |
| 10635 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10636 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10637 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10638 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10639 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 10640 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10641 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10642 | } |
| 10643 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 10644 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10645 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 10646 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10647 | |
| 10648 | return 0; |
| 10649 | } |
| 10650 | |
| 10651 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 10652 | u8 *peer, enum nl80211_tdls_operation oper) |
| 10653 | { |
| 10654 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10655 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10656 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10657 | hddTdlsPeer_t *pTdlsPeer; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10658 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10659 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10660 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 10661 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10662 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10663 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 10664 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 10665 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10666 | return -EINVAL; |
| 10667 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 10668 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10669 | status = wlan_hdd_validate_context(pHddCtx); |
| 10670 | |
| 10671 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 10672 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10673 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10674 | "%s: HDD context is not valid", __func__); |
| 10675 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 10676 | } |
| 10677 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10678 | |
| 10679 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 10680 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10681 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 10682 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 10683 | "TDLS Disabled in INI OR not enabled in FW. " |
| 10684 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10685 | return -ENOTSUPP; |
| 10686 | } |
| 10687 | |
| 10688 | switch (oper) { |
| 10689 | case NL80211_TDLS_ENABLE_LINK: |
| 10690 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10691 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10692 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10693 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10694 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10695 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 10696 | |
| 10697 | if ( NULL == pTdlsPeer ) { |
| 10698 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 10699 | " (oper %d) not exsting. ignored", |
| 10700 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 10701 | return -EINVAL; |
| 10702 | } |
| 10703 | |
| 10704 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10705 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 10706 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 10707 | "NL80211_TDLS_ENABLE_LINK"); |
| 10708 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 10709 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 10710 | { |
| 10711 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 10712 | MAC_ADDRESS_STR " failed", |
| 10713 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 10714 | return -EINVAL; |
| 10715 | } |
| 10716 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10717 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10718 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 10719 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 10720 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 10721 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 10722 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 10723 | return -EINVAL; |
| 10724 | } |
| 10725 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10726 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 10727 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10728 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 10729 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 10730 | * register with the TL on after the response for this operation |
| 10731 | * is received . |
| 10732 | */ |
| 10733 | ret = wait_for_completion_interruptible_timeout( |
| 10734 | &pAdapter->tdls_link_establish_req_comp, |
| 10735 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 10736 | if (ret <= 0) |
| 10737 | { |
| 10738 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10739 | "%s: Link Establish Request Faled Status %ld", |
| 10740 | __func__, ret); |
| 10741 | return -EINVAL; |
| 10742 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10743 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 10744 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 10745 | /* Mark TDLS client Authenticated .*/ |
| 10746 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 10747 | pTdlsPeer->staId, |
| 10748 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 10749 | if (VOS_STATUS_SUCCESS == status) |
| 10750 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 10751 | if (pTdlsPeer->is_responder == 0) |
| 10752 | { |
| 10753 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 10754 | |
| 10755 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 10756 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 10757 | WAIT_TIME_TDLS_INITIATOR); |
| 10758 | /* suspend initiator TX until it receives direct packet from the |
| 10759 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 10760 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 10761 | &staId, NULL); |
| 10762 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 10763 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 10764 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10765 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10766 | |
| 10767 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 10768 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 10769 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10770 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 10771 | int ac; |
| 10772 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 10773 | WLANTL_AC_VI, |
| 10774 | WLANTL_AC_BK, |
| 10775 | WLANTL_AC_BE }; |
| 10776 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 10777 | for(ac=0; ac < 4; ac++) |
| 10778 | { |
| 10779 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 10780 | pTdlsPeer->staId, ucAc[ac], |
| 10781 | tlTid[ac], tlTid[ac], 0, 0, |
| 10782 | WLANTL_BI_DIR ); |
| 10783 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 10784 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10785 | } |
| 10786 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10787 | } |
| 10788 | break; |
| 10789 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10790 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10791 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 10792 | |
| 10793 | if ( NULL == pTdlsPeer ) { |
| 10794 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 10795 | " (oper %d) not exsting. ignored", |
| 10796 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 10797 | return -EINVAL; |
| 10798 | } |
| 10799 | |
| 10800 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10801 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 10802 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 10803 | "NL80211_TDLS_DISABLE_LINK"); |
| 10804 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10805 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10806 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10807 | long status; |
| 10808 | |
| 10809 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 10810 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10811 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10812 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10813 | |
| 10814 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 10815 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
| 10816 | if (status <= 0) |
| 10817 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10818 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10819 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10820 | "%s: Del station failed status %ld", |
| 10821 | __func__, status); |
| 10822 | return -EPERM; |
| 10823 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10824 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10825 | } |
| 10826 | else |
| 10827 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10828 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10829 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10830 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 10831 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10832 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10833 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10834 | { |
| 10835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10836 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 10837 | __func__, MAC_ADDR_ARRAY(peer)); |
| 10838 | |
| 10839 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 10840 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 10841 | |
| 10842 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10843 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 10844 | __func__); |
| 10845 | return -ENOTSUPP; |
| 10846 | } |
| 10847 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10848 | |
| 10849 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 10850 | |
| 10851 | if ( NULL == pTdlsPeer ) { |
| 10852 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 10853 | " peer not exsting", |
| 10854 | __func__, MAC_ADDR_ARRAY(peer)); |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 10855 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10856 | } |
| 10857 | else { |
| 10858 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 10859 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 10860 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 10861 | |
| 10862 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 10863 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10864 | break; |
| 10865 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10866 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10867 | { |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 10868 | hddTdlsPeer_t *pTdlsPeer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10869 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10870 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 10871 | __func__, MAC_ADDR_ARRAY(peer)); |
| 10872 | |
| 10873 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 10874 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 10875 | |
| 10876 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10877 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 10878 | __func__); |
| 10879 | return -ENOTSUPP; |
| 10880 | } |
| 10881 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 10882 | /* To cater the requirement of establishing the TDLS link |
| 10883 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 10884 | */ |
| 10885 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 10886 | if (pTdlsPeer == NULL) { |
| 10887 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10888 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 10889 | __func__, MAC_ADDR_ARRAY(peer)); |
| 10890 | return -EINVAL; |
| 10891 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 10892 | |
| 10893 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 10894 | |
| 10895 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10896 | " %s TDLS Add Force Peer Failed", |
| 10897 | __func__); |
| 10898 | return -EINVAL; |
| 10899 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 10900 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 10901 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10902 | case NL80211_TDLS_DISCOVERY_REQ: |
| 10903 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10904 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 10905 | "%s: We don't support in-driver setup/teardown/discovery " |
| 10906 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10907 | return -ENOTSUPP; |
| 10908 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10909 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10910 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10911 | return -ENOTSUPP; |
| 10912 | } |
| 10913 | return 0; |
| 10914 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 10915 | |
| 10916 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 10917 | struct net_device *dev, u8 *peer) |
| 10918 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10919 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10920 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 10921 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 10922 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 10923 | #if TDLS_MGMT_VERSION2 |
| 10924 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 10925 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 10926 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 10927 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 10928 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 10929 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 10930 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 10931 | #endif |
| 10932 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10933 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 10934 | /* |
| 10935 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 10936 | * Callback rountine called upon receiving response for |
| 10937 | * get offload info |
| 10938 | */ |
| 10939 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 10940 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 10941 | { |
| 10942 | |
| 10943 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10944 | tANI_U8 tempReplayCounter[8]; |
| 10945 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10946 | |
| 10947 | ENTER(); |
| 10948 | |
| 10949 | if (NULL == pAdapter) |
| 10950 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 10951 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10952 | "%s: HDD adapter is Null", __func__); |
| 10953 | return ; |
| 10954 | } |
| 10955 | |
| 10956 | if (NULL == pGtkOffloadGetInfoRsp) |
| 10957 | { |
| 10958 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10959 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 10960 | return ; |
| 10961 | } |
| 10962 | |
| 10963 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 10964 | { |
| 10965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10966 | "%s: wlan Failed to get replay counter value", |
| 10967 | __func__); |
| 10968 | return ; |
| 10969 | } |
| 10970 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10971 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10972 | /* Update replay counter */ |
| 10973 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 10974 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 10975 | |
| 10976 | { |
| 10977 | /* changing from little to big endian since supplicant |
| 10978 | * works on big endian format |
| 10979 | */ |
| 10980 | int i; |
| 10981 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 10982 | |
| 10983 | for (i = 0; i < 8; i++) |
| 10984 | { |
| 10985 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 10986 | } |
| 10987 | } |
| 10988 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10989 | /* Update replay counter to NL */ |
| 10990 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10991 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10992 | } |
| 10993 | |
| 10994 | /* |
| 10995 | * FUNCTION: wlan_hdd_cfg80211_set_rekey_data |
| 10996 | * This function is used to offload GTK rekeying job to the firmware. |
| 10997 | */ |
| 10998 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 10999 | struct cfg80211_gtk_rekey_data *data) |
| 11000 | { |
| 11001 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11002 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 11003 | hdd_station_ctx_t *pHddStaCtx; |
| 11004 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11005 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11006 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11007 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11008 | |
| 11009 | ENTER(); |
| 11010 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11011 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11012 | if (NULL == pAdapter) |
| 11013 | { |
| 11014 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11015 | "%s: HDD adapter is Null", __func__); |
| 11016 | return -ENODEV; |
| 11017 | } |
| 11018 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11019 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11020 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 11021 | pAdapter->sessionId, pAdapter->device_mode)); |
| 11022 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11023 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11024 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11025 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11026 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11027 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11028 | "%s: HDD context is not valid", __func__); |
| 11029 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11030 | } |
| 11031 | |
| 11032 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11033 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11034 | if (NULL == hHal) |
| 11035 | { |
| 11036 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11037 | "%s: HAL context is Null!!!", __func__); |
| 11038 | return -EAGAIN; |
| 11039 | } |
| 11040 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11041 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 11042 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 11043 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 11044 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11045 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11046 | { |
| 11047 | /* changing from big to little endian since driver |
| 11048 | * works on little endian format |
| 11049 | */ |
| 11050 | tANI_U8 *p = |
| 11051 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 11052 | int i; |
| 11053 | |
| 11054 | for (i = 0; i < 8; i++) |
| 11055 | { |
| 11056 | p[7-i] = data->replay_ctr[i]; |
| 11057 | } |
| 11058 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11059 | |
| 11060 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 11061 | { |
| 11062 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11063 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 11064 | sizeof (tSirGtkOffloadParams)); |
| 11065 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11066 | pAdapter->sessionId); |
| 11067 | |
| 11068 | if (eHAL_STATUS_SUCCESS != status) |
| 11069 | { |
| 11070 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11071 | "%s: sme_SetGTKOffload failed, returned %d", |
| 11072 | __func__, status); |
| 11073 | return status; |
| 11074 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11075 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11076 | "%s: sme_SetGTKOffload successfull", __func__); |
| 11077 | } |
| 11078 | else |
| 11079 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11080 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11081 | "%s: wlan not suspended GTKOffload request is stored", |
| 11082 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11083 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11084 | |
| 11085 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11086 | } |
| 11087 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
| 11088 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11089 | /* |
| 11090 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 11091 | * This function is used to set access control policy |
| 11092 | */ |
| 11093 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 11094 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 11095 | { |
| 11096 | int i; |
| 11097 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11098 | hdd_hostapd_state_t *pHostapdState; |
| 11099 | tsap_Config_t *pConfig; |
| 11100 | v_CONTEXT_t pVosContext = NULL; |
| 11101 | hdd_context_t *pHddCtx; |
| 11102 | int status; |
| 11103 | |
| 11104 | ENTER(); |
| 11105 | |
| 11106 | if (NULL == pAdapter) |
| 11107 | { |
| 11108 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11109 | "%s: HDD adapter is Null", __func__); |
| 11110 | return -ENODEV; |
| 11111 | } |
| 11112 | |
| 11113 | if (NULL == params) |
| 11114 | { |
| 11115 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11116 | "%s: params is Null", __func__); |
| 11117 | return -EINVAL; |
| 11118 | } |
| 11119 | |
| 11120 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11121 | status = wlan_hdd_validate_context(pHddCtx); |
| 11122 | |
| 11123 | if (0 != status) |
| 11124 | { |
| 11125 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11126 | "%s: HDD context is not valid", __func__); |
| 11127 | return status; |
| 11128 | } |
| 11129 | |
| 11130 | pVosContext = pHddCtx->pvosContext; |
| 11131 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 11132 | |
| 11133 | if (NULL == pHostapdState) |
| 11134 | { |
| 11135 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11136 | "%s: pHostapdState is Null", __func__); |
| 11137 | return -EINVAL; |
| 11138 | } |
| 11139 | |
| 11140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 11141 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 11142 | |
| 11143 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 11144 | { |
| 11145 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 11146 | |
| 11147 | /* default value */ |
| 11148 | pConfig->num_accept_mac = 0; |
| 11149 | pConfig->num_deny_mac = 0; |
| 11150 | |
| 11151 | /** |
| 11152 | * access control policy |
| 11153 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 11154 | * listed in hostapd.deny file. |
| 11155 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 11156 | * listed in hostapd.accept file. |
| 11157 | */ |
| 11158 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 11159 | { |
| 11160 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 11161 | } |
| 11162 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 11163 | { |
| 11164 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 11165 | } |
| 11166 | else |
| 11167 | { |
| 11168 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11169 | "%s:Acl Policy : %d is not supported", |
| 11170 | __func__, params->acl_policy); |
| 11171 | return -ENOTSUPP; |
| 11172 | } |
| 11173 | |
| 11174 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 11175 | { |
| 11176 | pConfig->num_accept_mac = params->n_acl_entries; |
| 11177 | for (i = 0; i < params->n_acl_entries; i++) |
| 11178 | { |
| 11179 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11180 | "** Add ACL MAC entry %i in WhiletList :" |
| 11181 | MAC_ADDRESS_STR, i, |
| 11182 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 11183 | |
| 11184 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 11185 | sizeof(qcmacaddr)); |
| 11186 | } |
| 11187 | } |
| 11188 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 11189 | { |
| 11190 | pConfig->num_deny_mac = params->n_acl_entries; |
| 11191 | for (i = 0; i < params->n_acl_entries; i++) |
| 11192 | { |
| 11193 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11194 | "** Add ACL MAC entry %i in BlackList :" |
| 11195 | MAC_ADDRESS_STR, i, |
| 11196 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 11197 | |
| 11198 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 11199 | sizeof(qcmacaddr)); |
| 11200 | } |
| 11201 | } |
| 11202 | |
| 11203 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 11204 | { |
| 11205 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11206 | "%s: SAP Set Mac Acl fail", __func__); |
| 11207 | return -EINVAL; |
| 11208 | } |
| 11209 | } |
| 11210 | else |
| 11211 | { |
| 11212 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11213 | "%s: Invalid device_mode = %s (%d)", |
| 11214 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11215 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11216 | return -EINVAL; |
| 11217 | } |
| 11218 | |
| 11219 | return 0; |
| 11220 | } |
| 11221 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11222 | #ifdef WLAN_NL80211_TESTMODE |
| 11223 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11224 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11225 | ( |
| 11226 | void *pAdapter, |
| 11227 | void *indCont |
| 11228 | ) |
| 11229 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11230 | tSirLPHBInd *lphbInd; |
| 11231 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 11232 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11233 | |
| 11234 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11235 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11236 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 11237 | if (pAdapter == NULL) |
| 11238 | { |
| 11239 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11240 | "%s: pAdapter is NULL\n",__func__); |
| 11241 | return; |
| 11242 | } |
| 11243 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11244 | if (NULL == indCont) |
| 11245 | { |
| 11246 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11247 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11248 | return; |
| 11249 | } |
| 11250 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 11251 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11252 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11253 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 11254 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11255 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11256 | GFP_ATOMIC); |
| 11257 | if (!skb) |
| 11258 | { |
| 11259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11260 | "LPHB timeout, NL buffer alloc fail"); |
| 11261 | return; |
| 11262 | } |
| 11263 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 11264 | 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] | 11265 | { |
| 11266 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11267 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 11268 | goto nla_put_failure; |
| 11269 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 11270 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11271 | { |
| 11272 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11273 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 11274 | goto nla_put_failure; |
| 11275 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 11276 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11277 | sizeof(tSirLPHBInd), lphbInd)) |
| 11278 | { |
| 11279 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11280 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 11281 | goto nla_put_failure; |
| 11282 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11283 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 11284 | return; |
| 11285 | |
| 11286 | nla_put_failure: |
| 11287 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11288 | "NLA Put fail"); |
| 11289 | kfree_skb(skb); |
| 11290 | |
| 11291 | return; |
| 11292 | } |
| 11293 | #endif /* FEATURE_WLAN_LPHB */ |
| 11294 | |
| 11295 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 11296 | { |
| 11297 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 11298 | int err = 0; |
| 11299 | #ifdef FEATURE_WLAN_LPHB |
| 11300 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11301 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11302 | #endif /* FEATURE_WLAN_LPHB */ |
| 11303 | |
| 11304 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 11305 | if (err) |
| 11306 | { |
| 11307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11308 | "%s Testmode INV ATTR", __func__); |
| 11309 | return err; |
| 11310 | } |
| 11311 | |
| 11312 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 11313 | { |
| 11314 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11315 | "%s Testmode INV CMD", __func__); |
| 11316 | return -EINVAL; |
| 11317 | } |
| 11318 | |
| 11319 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 11320 | { |
| 11321 | #ifdef FEATURE_WLAN_LPHB |
| 11322 | /* Low Power Heartbeat configuration request */ |
| 11323 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 11324 | { |
| 11325 | int buf_len; |
| 11326 | void *buf; |
| 11327 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 11328 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11329 | |
| 11330 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 11331 | { |
| 11332 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11333 | "%s Testmode INV DATA", __func__); |
| 11334 | return -EINVAL; |
| 11335 | } |
| 11336 | |
| 11337 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 11338 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 11339 | |
| 11340 | hb_params_temp =(tSirLPHBReq *)buf; |
| 11341 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 11342 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 11343 | return -EINVAL; |
| 11344 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11345 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 11346 | if (NULL == hb_params) |
| 11347 | { |
| 11348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11349 | "%s Request Buffer Alloc Fail", __func__); |
| 11350 | return -EINVAL; |
| 11351 | } |
| 11352 | |
| 11353 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11354 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 11355 | hb_params, |
| 11356 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 11357 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11358 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 11359 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11360 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11361 | vos_mem_free(hb_params); |
| 11362 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11363 | return 0; |
| 11364 | } |
| 11365 | #endif /* FEATURE_WLAN_LPHB */ |
| 11366 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11368 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11369 | return -EOPNOTSUPP; |
| 11370 | } |
| 11371 | |
| 11372 | return err; |
| 11373 | } |
| 11374 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 11375 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11376 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 11377 | struct net_device *dev, |
| 11378 | int idx, struct survey_info *survey) |
| 11379 | { |
| 11380 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11381 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 11382 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11383 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 11384 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11385 | v_S7_t snr,rssi; |
| 11386 | int status, i, j, filled = 0; |
| 11387 | |
| 11388 | ENTER(); |
| 11389 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11390 | if (NULL == pAdapter) |
| 11391 | { |
| 11392 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11393 | "%s: HDD adapter is Null", __func__); |
| 11394 | return -ENODEV; |
| 11395 | } |
| 11396 | |
| 11397 | if (NULL == wiphy) |
| 11398 | { |
| 11399 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11400 | "%s: wiphy is Null", __func__); |
| 11401 | return -ENODEV; |
| 11402 | } |
| 11403 | |
| 11404 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11405 | status = wlan_hdd_validate_context(pHddCtx); |
| 11406 | |
| 11407 | if (0 != status) |
| 11408 | { |
| 11409 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11410 | "%s: HDD context is not valid", __func__); |
| 11411 | return status; |
| 11412 | } |
| 11413 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 11414 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11415 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11416 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 11417 | 0 != pAdapter->survey_idx || |
| 11418 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11419 | { |
| 11420 | /* The survey dump ops when implemented completely is expected to |
| 11421 | * return a survey of all channels and the ops is called by the |
| 11422 | * kernel with incremental values of the argument 'idx' till it |
| 11423 | * returns -ENONET. But we can only support the survey for the |
| 11424 | * operating channel for now. survey_idx is used to track |
| 11425 | * that the ops is called only once and then return -ENONET for |
| 11426 | * the next iteration |
| 11427 | */ |
| 11428 | pAdapter->survey_idx = 0; |
| 11429 | return -ENONET; |
| 11430 | } |
| 11431 | |
| 11432 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11433 | |
| 11434 | wlan_hdd_get_snr(pAdapter, &snr); |
| 11435 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 11436 | |
| 11437 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 11438 | hdd_wlan_get_freq(channel, &freq); |
| 11439 | |
| 11440 | |
| 11441 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 11442 | { |
| 11443 | if (NULL == wiphy->bands[i]) |
| 11444 | { |
| 11445 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 11446 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 11447 | continue; |
| 11448 | } |
| 11449 | |
| 11450 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 11451 | { |
| 11452 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 11453 | |
| 11454 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 11455 | { |
| 11456 | survey->channel = &band->channels[j]; |
| 11457 | /* The Rx BDs contain SNR values in dB for the received frames |
| 11458 | * while the supplicant expects noise. So we calculate and |
| 11459 | * return the value of noise (dBm) |
| 11460 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 11461 | */ |
| 11462 | survey->noise = rssi - snr; |
| 11463 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 11464 | filled = 1; |
| 11465 | } |
| 11466 | } |
| 11467 | } |
| 11468 | |
| 11469 | if (filled) |
| 11470 | pAdapter->survey_idx = 1; |
| 11471 | else |
| 11472 | { |
| 11473 | pAdapter->survey_idx = 0; |
| 11474 | return -ENONET; |
| 11475 | } |
| 11476 | |
| 11477 | return 0; |
| 11478 | } |
| 11479 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11480 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11481 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11482 | * this is called when cfg80211 driver resume |
| 11483 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 11484 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11485 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11486 | { |
| 11487 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 11488 | hdd_adapter_t *pAdapter; |
| 11489 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 11490 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 11491 | |
| 11492 | ENTER(); |
| 11493 | |
| 11494 | if ( NULL == pHddCtx ) |
| 11495 | { |
| 11496 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11497 | "%s: HddCtx validation failed", __func__); |
| 11498 | return 0; |
| 11499 | } |
| 11500 | |
| 11501 | if (pHddCtx->isLogpInProgress) |
| 11502 | { |
| 11503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11504 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 11505 | return 0; |
| 11506 | } |
| 11507 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 11508 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11509 | { |
| 11510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11511 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 11512 | return 0; |
| 11513 | } |
| 11514 | |
| 11515 | spin_lock(&pHddCtx->schedScan_lock); |
| 11516 | pHddCtx->isWiphySuspended = FALSE; |
| 11517 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 11518 | { |
| 11519 | spin_unlock(&pHddCtx->schedScan_lock); |
| 11520 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11521 | "%s: Return resume is not due to PNO indication", __func__); |
| 11522 | return 0; |
| 11523 | } |
| 11524 | // Reset flag to avoid updatating cfg80211 data old results again |
| 11525 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 11526 | spin_unlock(&pHddCtx->schedScan_lock); |
| 11527 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 11528 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11529 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 11530 | |
| 11531 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 11532 | { |
| 11533 | pAdapter = pAdapterNode->pAdapter; |
| 11534 | if ( (NULL != pAdapter) && |
| 11535 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 11536 | { |
| 11537 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 11538 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11539 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 11540 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 11541 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11542 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 11543 | { |
| 11544 | /* Acquire wakelock to handle the case where APP's tries to |
| 11545 | * suspend immediately after updating the scan results. Whis |
| 11546 | * results in app's is in suspended state and not able to |
| 11547 | * process the connect request to AP |
| 11548 | */ |
| 11549 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11550 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 11551 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11552 | |
| 11553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11554 | "%s : cfg80211 scan result database updated", __func__); |
| 11555 | |
| 11556 | return 0; |
| 11557 | |
| 11558 | } |
| 11559 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 11560 | pAdapterNode = pNext; |
| 11561 | } |
| 11562 | |
| 11563 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11564 | "%s: Failed to find Adapter", __func__); |
| 11565 | return 0; |
| 11566 | } |
| 11567 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11568 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 11569 | { |
| 11570 | int ret; |
| 11571 | |
| 11572 | vos_ssr_protect(__func__); |
| 11573 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 11574 | vos_ssr_unprotect(__func__); |
| 11575 | |
| 11576 | return ret; |
| 11577 | } |
| 11578 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11579 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11580 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11581 | * this is called when cfg80211 driver suspends |
| 11582 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11583 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11584 | struct cfg80211_wowlan *wow) |
| 11585 | { |
| 11586 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 11587 | |
| 11588 | ENTER(); |
| 11589 | if (NULL == pHddCtx) |
| 11590 | { |
| 11591 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11592 | "%s: HddCtx validation failed", __func__); |
| 11593 | return 0; |
| 11594 | } |
| 11595 | |
| 11596 | pHddCtx->isWiphySuspended = TRUE; |
| 11597 | |
| 11598 | EXIT(); |
| 11599 | |
| 11600 | return 0; |
| 11601 | } |
| 11602 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 11603 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 11604 | struct cfg80211_wowlan *wow) |
| 11605 | { |
| 11606 | int ret; |
| 11607 | |
| 11608 | vos_ssr_protect(__func__); |
| 11609 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 11610 | vos_ssr_unprotect(__func__); |
| 11611 | |
| 11612 | return ret; |
| 11613 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11614 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11615 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11616 | { |
| 11617 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 11618 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 11619 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 11620 | .change_station = wlan_hdd_change_station, |
| 11621 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 11622 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 11623 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 11624 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11625 | #else |
| 11626 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 11627 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 11628 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11629 | #endif |
| 11630 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 11631 | .add_key = wlan_hdd_cfg80211_add_key, |
| 11632 | .get_key = wlan_hdd_cfg80211_get_key, |
| 11633 | .del_key = wlan_hdd_cfg80211_del_key, |
| 11634 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 11635 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11636 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 11637 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11638 | .scan = wlan_hdd_cfg80211_scan, |
| 11639 | .connect = wlan_hdd_cfg80211_connect, |
| 11640 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 11641 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 11642 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 11643 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 11644 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 11645 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11646 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 11647 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 11648 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11649 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11650 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 11651 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 11652 | .set_txq_params = wlan_hdd_set_txq_params, |
| 11653 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | .get_station = wlan_hdd_cfg80211_get_station, |
| 11655 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 11656 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11657 | .add_station = wlan_hdd_cfg80211_add_station, |
| 11658 | #ifdef FEATURE_WLAN_LFR |
| 11659 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 11660 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 11661 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 11662 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11663 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 11664 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 11665 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 11666 | #ifdef FEATURE_WLAN_TDLS |
| 11667 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 11668 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 11669 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11670 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 11671 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 11672 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 11673 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 11674 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 11675 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 11676 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 11677 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 11678 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11679 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 11680 | #ifdef WLAN_NL80211_TESTMODE |
| 11681 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 11682 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 11683 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11684 | }; |
| 11685 | |