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 |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 156 | #ifdef WLAN_FEATURE_EXTSCAN |
| 157 | /* |
| 158 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 159 | * The size of 4096 is considered assuming that all data per |
| 160 | * respective event fit with in the limit.Please take a call |
| 161 | * on the limit based on the data requirements. |
| 162 | */ |
| 163 | |
| 164 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 165 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 166 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 167 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 168 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | { |
| 170 | WLAN_CIPHER_SUITE_WEP40, |
| 171 | WLAN_CIPHER_SUITE_WEP104, |
| 172 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 173 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 175 | WLAN_CIPHER_SUITE_KRK, |
| 176 | WLAN_CIPHER_SUITE_CCMP, |
| 177 | #else |
| 178 | WLAN_CIPHER_SUITE_CCMP, |
| 179 | #endif |
| 180 | #ifdef FEATURE_WLAN_WAPI |
| 181 | WLAN_CIPHER_SUITE_SMS4, |
| 182 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 183 | #ifdef WLAN_FEATURE_11W |
| 184 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 185 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 189 | { |
| 190 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 191 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 192 | } |
| 193 | |
| 194 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 195 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 196 | HDD2GHZCHAN(2412, 1, 0) , |
| 197 | HDD2GHZCHAN(2417, 2, 0) , |
| 198 | HDD2GHZCHAN(2422, 3, 0) , |
| 199 | HDD2GHZCHAN(2427, 4, 0) , |
| 200 | HDD2GHZCHAN(2432, 5, 0) , |
| 201 | HDD2GHZCHAN(2437, 6, 0) , |
| 202 | HDD2GHZCHAN(2442, 7, 0) , |
| 203 | HDD2GHZCHAN(2447, 8, 0) , |
| 204 | HDD2GHZCHAN(2452, 9, 0) , |
| 205 | HDD2GHZCHAN(2457, 10, 0) , |
| 206 | HDD2GHZCHAN(2462, 11, 0) , |
| 207 | HDD2GHZCHAN(2467, 12, 0) , |
| 208 | HDD2GHZCHAN(2472, 13, 0) , |
| 209 | HDD2GHZCHAN(2484, 14, 0) , |
| 210 | }; |
| 211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 213 | { |
| 214 | HDD2GHZCHAN(2412, 1, 0) , |
| 215 | HDD2GHZCHAN(2437, 6, 0) , |
| 216 | HDD2GHZCHAN(2462, 11, 0) , |
| 217 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 218 | |
| 219 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 220 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 221 | HDD5GHZCHAN(4920, 240, 0) , |
| 222 | HDD5GHZCHAN(4940, 244, 0) , |
| 223 | HDD5GHZCHAN(4960, 248, 0) , |
| 224 | HDD5GHZCHAN(4980, 252, 0) , |
| 225 | HDD5GHZCHAN(5040, 208, 0) , |
| 226 | HDD5GHZCHAN(5060, 212, 0) , |
| 227 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | HDD5GHZCHAN(5180, 36, 0) , |
| 229 | HDD5GHZCHAN(5200, 40, 0) , |
| 230 | HDD5GHZCHAN(5220, 44, 0) , |
| 231 | HDD5GHZCHAN(5240, 48, 0) , |
| 232 | HDD5GHZCHAN(5260, 52, 0) , |
| 233 | HDD5GHZCHAN(5280, 56, 0) , |
| 234 | HDD5GHZCHAN(5300, 60, 0) , |
| 235 | HDD5GHZCHAN(5320, 64, 0) , |
| 236 | HDD5GHZCHAN(5500,100, 0) , |
| 237 | HDD5GHZCHAN(5520,104, 0) , |
| 238 | HDD5GHZCHAN(5540,108, 0) , |
| 239 | HDD5GHZCHAN(5560,112, 0) , |
| 240 | HDD5GHZCHAN(5580,116, 0) , |
| 241 | HDD5GHZCHAN(5600,120, 0) , |
| 242 | HDD5GHZCHAN(5620,124, 0) , |
| 243 | HDD5GHZCHAN(5640,128, 0) , |
| 244 | HDD5GHZCHAN(5660,132, 0) , |
| 245 | HDD5GHZCHAN(5680,136, 0) , |
| 246 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 247 | #ifdef FEATURE_WLAN_CH144 |
| 248 | HDD5GHZCHAN(5720,144, 0) , |
| 249 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 250 | HDD5GHZCHAN(5745,149, 0) , |
| 251 | HDD5GHZCHAN(5765,153, 0) , |
| 252 | HDD5GHZCHAN(5785,157, 0) , |
| 253 | HDD5GHZCHAN(5805,161, 0) , |
| 254 | HDD5GHZCHAN(5825,165, 0) , |
| 255 | }; |
| 256 | |
| 257 | static struct ieee80211_rate g_mode_rates[] = |
| 258 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 259 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 260 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 261 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 262 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 263 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 264 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 265 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 266 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 267 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 268 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 269 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 271 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | |
| 273 | static struct ieee80211_rate a_mode_rates[] = |
| 274 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 275 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 276 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 277 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 278 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 279 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 280 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 281 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 283 | }; |
| 284 | |
| 285 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 286 | { |
| 287 | .channels = hdd_channels_2_4_GHZ, |
| 288 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 289 | .band = IEEE80211_BAND_2GHZ, |
| 290 | .bitrates = g_mode_rates, |
| 291 | .n_bitrates = g_mode_rates_size, |
| 292 | .ht_cap.ht_supported = 1, |
| 293 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 294 | | IEEE80211_HT_CAP_GRN_FLD |
| 295 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 296 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 297 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 298 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 299 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 300 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 301 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 302 | }; |
| 303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 305 | { |
| 306 | .channels = hdd_social_channels_2_4_GHZ, |
| 307 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 308 | .band = IEEE80211_BAND_2GHZ, |
| 309 | .bitrates = g_mode_rates, |
| 310 | .n_bitrates = g_mode_rates_size, |
| 311 | .ht_cap.ht_supported = 1, |
| 312 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 313 | | IEEE80211_HT_CAP_GRN_FLD |
| 314 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 315 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 316 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 317 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 318 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 319 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 320 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 321 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 322 | |
| 323 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 324 | { |
| 325 | .channels = hdd_channels_5_GHZ, |
| 326 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 327 | .band = IEEE80211_BAND_5GHZ, |
| 328 | .bitrates = a_mode_rates, |
| 329 | .n_bitrates = a_mode_rates_size, |
| 330 | .ht_cap.ht_supported = 1, |
| 331 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 332 | | IEEE80211_HT_CAP_GRN_FLD |
| 333 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 334 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 335 | | IEEE80211_HT_CAP_SGI_40 |
| 336 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 337 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 338 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 339 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 340 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 341 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 342 | }; |
| 343 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 344 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | TX/RX direction for each kind of interface */ |
| 346 | static const struct ieee80211_txrx_stypes |
| 347 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 348 | [NL80211_IFTYPE_STATION] = { |
| 349 | .tx = 0xffff, |
| 350 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 351 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 352 | }, |
| 353 | [NL80211_IFTYPE_AP] = { |
| 354 | .tx = 0xffff, |
| 355 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 356 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 357 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 358 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 359 | BIT(SIR_MAC_MGMT_AUTH) | |
| 360 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 361 | BIT(SIR_MAC_MGMT_ACTION), |
| 362 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 363 | [NL80211_IFTYPE_ADHOC] = { |
| 364 | .tx = 0xffff, |
| 365 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 366 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 367 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 368 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 369 | BIT(SIR_MAC_MGMT_AUTH) | |
| 370 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 371 | BIT(SIR_MAC_MGMT_ACTION), |
| 372 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 373 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 374 | .tx = 0xffff, |
| 375 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 376 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 377 | }, |
| 378 | [NL80211_IFTYPE_P2P_GO] = { |
| 379 | /* This is also same as for SoftAP */ |
| 380 | .tx = 0xffff, |
| 381 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 382 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 383 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 384 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 385 | BIT(SIR_MAC_MGMT_AUTH) | |
| 386 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 387 | BIT(SIR_MAC_MGMT_ACTION), |
| 388 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 391 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 392 | static const struct ieee80211_iface_limit |
| 393 | wlan_hdd_iface_limit[] = { |
| 394 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 395 | /* max = 3 ; Our driver create two interfaces during driver init |
| 396 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 397 | * interface until a group is formed. In JB architecture, once the |
| 398 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 399 | * Client. |
| 400 | * When supplicant remove the group, it first issue a set interface |
| 401 | * cmd to change the mode back to Station. In JB this works fine as |
| 402 | * we advertize two station type interface during driver init. |
| 403 | * Some vendors create separate interface for P2P GO/Client, |
| 404 | * after group formation(Third one). But while group remove |
| 405 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 406 | * But as we advertized only two sta type interfaces nl80211 was |
| 407 | * returning error for the third one which was leading to failure in |
| 408 | * delete interface. Ideally while removing the group, supplicant |
| 409 | * should not try to change the 3rd interface mode to Station type. |
| 410 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 411 | * interface type to 3 |
| 412 | */ |
| 413 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 414 | .types = BIT(NL80211_IFTYPE_STATION), |
| 415 | }, |
| 416 | { |
| 417 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 418 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 419 | }, |
| 420 | { |
| 421 | .max = 1, |
| 422 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 423 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 424 | }, |
| 425 | }; |
| 426 | |
| 427 | /* By default, only single channel concurrency is allowed */ |
| 428 | static struct ieee80211_iface_combination |
| 429 | wlan_hdd_iface_combination = { |
| 430 | .limits = wlan_hdd_iface_limit, |
| 431 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 432 | /* |
| 433 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 434 | * and p2p0 interfaces during driver init |
| 435 | * Some vendors create separate interface for P2P operations. |
| 436 | * wlan0: STA interface |
| 437 | * p2p0: P2P Device interface, action frames goes |
| 438 | * through this interface. |
| 439 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 440 | * created for p2p operations(GO/CLIENT interface). |
| 441 | */ |
| 442 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 443 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 444 | .beacon_int_infra_match = false, |
| 445 | }; |
| 446 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 447 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 449 | |
| 450 | /* Data rate 100KBPS based on IE Index */ |
| 451 | struct index_data_rate_type |
| 452 | { |
| 453 | v_U8_t beacon_rate_index; |
| 454 | v_U16_t supported_rate[4]; |
| 455 | }; |
| 456 | |
| 457 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 458 | The IDX field is the rate index |
| 459 | The HI field is the rate when RSSI is strong or being ignored |
| 460 | (in this case we report actual rate) |
| 461 | The MID field is the rate when RSSI is moderate |
| 462 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 463 | The LO field is the rate when RSSI is low |
| 464 | (in this case we don't report rates, actual current rate used) |
| 465 | */ |
| 466 | static const struct |
| 467 | { |
| 468 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 469 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 470 | } supported_data_rate[] = |
| 471 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 472 | /* IDX HI HM LM LO (RSSI-based index */ |
| 473 | {2, { 10, 10, 10, 0}}, |
| 474 | {4, { 20, 20, 10, 0}}, |
| 475 | {11, { 55, 20, 10, 0}}, |
| 476 | {12, { 60, 55, 20, 0}}, |
| 477 | {18, { 90, 55, 20, 0}}, |
| 478 | {22, {110, 55, 20, 0}}, |
| 479 | {24, {120, 90, 60, 0}}, |
| 480 | {36, {180, 120, 60, 0}}, |
| 481 | {44, {220, 180, 60, 0}}, |
| 482 | {48, {240, 180, 90, 0}}, |
| 483 | {66, {330, 180, 90, 0}}, |
| 484 | {72, {360, 240, 90, 0}}, |
| 485 | {96, {480, 240, 120, 0}}, |
| 486 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | }; |
| 488 | |
| 489 | /* MCS Based rate table */ |
| 490 | static struct index_data_rate_type supported_mcs_rate[] = |
| 491 | { |
| 492 | /* MCS L20 L40 S20 S40 */ |
| 493 | {0, {65, 135, 72, 150}}, |
| 494 | {1, {130, 270, 144, 300}}, |
| 495 | {2, {195, 405, 217, 450}}, |
| 496 | {3, {260, 540, 289, 600}}, |
| 497 | {4, {390, 810, 433, 900}}, |
| 498 | {5, {520, 1080, 578, 1200}}, |
| 499 | {6, {585, 1215, 650, 1350}}, |
| 500 | {7, {650, 1350, 722, 1500}} |
| 501 | }; |
| 502 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 503 | #ifdef WLAN_FEATURE_11AC |
| 504 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 505 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 506 | |
| 507 | struct index_vht_data_rate_type |
| 508 | { |
| 509 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 510 | v_U16_t supported_VHT80_rate[2]; |
| 511 | v_U16_t supported_VHT40_rate[2]; |
| 512 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 513 | }; |
| 514 | |
| 515 | typedef enum |
| 516 | { |
| 517 | DATA_RATE_11AC_MAX_MCS_7, |
| 518 | DATA_RATE_11AC_MAX_MCS_8, |
| 519 | DATA_RATE_11AC_MAX_MCS_9, |
| 520 | DATA_RATE_11AC_MAX_MCS_NA |
| 521 | } eDataRate11ACMaxMcs; |
| 522 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame^] | 523 | /* SSID broadcast type */ |
| 524 | typedef enum eSSIDBcastType |
| 525 | { |
| 526 | eBCAST_UNKNOWN = 0, |
| 527 | eBCAST_NORMAL = 1, |
| 528 | eBCAST_HIDDEN = 2, |
| 529 | } tSSIDBcastType; |
| 530 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 531 | /* MCS Based VHT rate table */ |
| 532 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 533 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 534 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 535 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 536 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 537 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 538 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 539 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 540 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 541 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 542 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 543 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 544 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 545 | }; |
| 546 | #endif /* WLAN_FEATURE_11AC */ |
| 547 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 548 | /*array index points to MCS and array value points respective rssi*/ |
| 549 | static int rssiMcsTbl[][10] = |
| 550 | { |
| 551 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 552 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 553 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 554 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 555 | }; |
| 556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 557 | extern struct net_device_ops net_ops_struct; |
| 558 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 559 | #ifdef WLAN_NL80211_TESTMODE |
| 560 | enum wlan_hdd_tm_attr |
| 561 | { |
| 562 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 563 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 564 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 565 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 566 | /* keep last */ |
| 567 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 568 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 569 | }; |
| 570 | |
| 571 | enum wlan_hdd_tm_cmd |
| 572 | { |
| 573 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 574 | }; |
| 575 | |
| 576 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 577 | |
| 578 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 579 | { |
| 580 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 581 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 582 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 583 | }; |
| 584 | #endif /* WLAN_NL80211_TESTMODE */ |
| 585 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 586 | #ifdef FEATURE_WLAN_CH_AVOID |
| 587 | /* |
| 588 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 589 | * This is called when wlan driver needs to send vendor specific |
| 590 | * avoid frequency range event to userspace |
| 591 | */ |
| 592 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 593 | tHddAvoidFreqList *pAvoidFreqList) |
| 594 | { |
| 595 | struct sk_buff *vendor_event; |
| 596 | |
| 597 | ENTER(); |
| 598 | |
| 599 | if (!pHddCtx) |
| 600 | { |
| 601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 602 | "%s: HDD context is null", __func__); |
| 603 | return -1; |
| 604 | } |
| 605 | |
| 606 | if (!pAvoidFreqList) |
| 607 | { |
| 608 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 609 | "%s: pAvoidFreqList is null", __func__); |
| 610 | return -1; |
| 611 | } |
| 612 | |
| 613 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 614 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 615 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 616 | GFP_KERNEL); |
| 617 | if (!vendor_event) |
| 618 | { |
| 619 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 620 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 621 | return -1; |
| 622 | } |
| 623 | |
| 624 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 625 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 626 | |
| 627 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 628 | |
| 629 | EXIT(); |
| 630 | return 0; |
| 631 | } |
| 632 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 633 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 634 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 635 | |
| 636 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 637 | struct sk_buff *vendor_event) |
| 638 | { |
| 639 | if (nla_put_u8(vendor_event, |
| 640 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 641 | stats->rate.preamble) || |
| 642 | nla_put_u8(vendor_event, |
| 643 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 644 | stats->rate.nss) || |
| 645 | nla_put_u8(vendor_event, |
| 646 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 647 | stats->rate.bw) || |
| 648 | nla_put_u8(vendor_event, |
| 649 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 650 | stats->rate.rateMcsIdx) || |
| 651 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 652 | stats->rate.bitrate ) || |
| 653 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 654 | stats->txMpdu ) || |
| 655 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 656 | stats->rxMpdu ) || |
| 657 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 658 | stats->mpduLost ) || |
| 659 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 660 | stats->retries) || |
| 661 | nla_put_u32(vendor_event, |
| 662 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 663 | stats->retriesShort ) || |
| 664 | nla_put_u32(vendor_event, |
| 665 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 666 | stats->retriesLong)) |
| 667 | { |
| 668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 669 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 670 | return FALSE; |
| 671 | } |
| 672 | return TRUE; |
| 673 | } |
| 674 | |
| 675 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 676 | struct sk_buff *vendor_event) |
| 677 | { |
| 678 | u32 i = 0; |
| 679 | struct nlattr *rateInfo; |
| 680 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 681 | stats->type) || |
| 682 | nla_put(vendor_event, |
| 683 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 684 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 685 | nla_put_u32(vendor_event, |
| 686 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 687 | stats->capabilities) || |
| 688 | nla_put_u32(vendor_event, |
| 689 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 690 | stats->numRate)) |
| 691 | { |
| 692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 693 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 694 | goto error; |
| 695 | } |
| 696 | |
| 697 | rateInfo = nla_nest_start(vendor_event, |
| 698 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
| 699 | for (i = 0; i < stats->numRate; i++) |
| 700 | { |
| 701 | struct nlattr *rates; |
| 702 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 703 | stats->rateStats + |
| 704 | (i * sizeof(tSirWifiRateStat))); |
| 705 | rates = nla_nest_start(vendor_event, i); |
| 706 | |
| 707 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 708 | { |
| 709 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 710 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 711 | return FALSE; |
| 712 | } |
| 713 | nla_nest_end(vendor_event, rates); |
| 714 | } |
| 715 | nla_nest_end(vendor_event, rateInfo); |
| 716 | |
| 717 | return TRUE; |
| 718 | error: |
| 719 | return FALSE; |
| 720 | } |
| 721 | |
| 722 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 723 | struct sk_buff *vendor_event) |
| 724 | { |
| 725 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 726 | stats->ac ) || |
| 727 | nla_put_u32(vendor_event, |
| 728 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 729 | stats->txMpdu ) || |
| 730 | nla_put_u32(vendor_event, |
| 731 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 732 | stats->rxMpdu ) || |
| 733 | nla_put_u32(vendor_event, |
| 734 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 735 | stats->txMcast ) || |
| 736 | nla_put_u32(vendor_event, |
| 737 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 738 | stats->rxMcast ) || |
| 739 | nla_put_u32(vendor_event, |
| 740 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 741 | stats->rxAmpdu ) || |
| 742 | nla_put_u32(vendor_event, |
| 743 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 744 | stats->txAmpdu ) || |
| 745 | nla_put_u32(vendor_event, |
| 746 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 747 | stats->mpduLost )|| |
| 748 | nla_put_u32(vendor_event, |
| 749 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 750 | stats->retries ) || |
| 751 | nla_put_u32(vendor_event, |
| 752 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 753 | stats->retriesShort ) || |
| 754 | nla_put_u32(vendor_event, |
| 755 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 756 | stats->retriesLong ) || |
| 757 | nla_put_u32(vendor_event, |
| 758 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 759 | stats->contentionTimeMin ) || |
| 760 | nla_put_u32(vendor_event, |
| 761 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 762 | stats->contentionTimeMax ) || |
| 763 | nla_put_u32(vendor_event, |
| 764 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 765 | stats->contentionTimeAvg ) || |
| 766 | nla_put_u32(vendor_event, |
| 767 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 768 | stats->contentionNumSamples )) |
| 769 | { |
| 770 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 771 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 772 | return FALSE; |
| 773 | } |
| 774 | return TRUE; |
| 775 | } |
| 776 | |
| 777 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 778 | struct sk_buff *vendor_event) |
| 779 | { |
| 780 | if (nla_put_u32(vendor_event, |
| 781 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 782 | nla_put(vendor_event, |
| 783 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 784 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 785 | nla_put_u32(vendor_event, |
| 786 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 787 | stats->state ) || |
| 788 | nla_put_u32(vendor_event, |
| 789 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 790 | stats->roaming ) || |
| 791 | nla_put_u32(vendor_event, |
| 792 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 793 | stats->capabilities ) || |
| 794 | nla_put(vendor_event, |
| 795 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 796 | strlen(stats->ssid), stats->ssid) || |
| 797 | nla_put(vendor_event, |
| 798 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 799 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 800 | nla_put(vendor_event, |
| 801 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 802 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 803 | nla_put(vendor_event, |
| 804 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 805 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 806 | ) |
| 807 | { |
| 808 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 809 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 810 | return FALSE; |
| 811 | } |
| 812 | return TRUE; |
| 813 | } |
| 814 | |
| 815 | static v_BOOL_t put_wifi_iface_stats(tpSirWifiIfaceStat pWifiIfaceStat, |
| 816 | struct sk_buff *vendor_event) |
| 817 | { |
| 818 | int i = 0; |
| 819 | struct nlattr *wmmInfo; |
| 820 | if (FALSE == put_wifi_interface_info( |
| 821 | &pWifiIfaceStat->info, |
| 822 | vendor_event)) |
| 823 | { |
| 824 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 825 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 826 | return FALSE; |
| 827 | |
| 828 | } |
| 829 | |
| 830 | if (nla_put_u32(vendor_event, |
| 831 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 832 | pWifiIfaceStat->beaconRx) || |
| 833 | nla_put_u32(vendor_event, |
| 834 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 835 | pWifiIfaceStat->mgmtRx) || |
| 836 | nla_put_u32(vendor_event, |
| 837 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 838 | pWifiIfaceStat->mgmtActionRx) || |
| 839 | nla_put_u32(vendor_event, |
| 840 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 841 | pWifiIfaceStat->mgmtActionTx) || |
| 842 | nla_put_u32(vendor_event, |
| 843 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 844 | pWifiIfaceStat->rssiMgmt) || |
| 845 | nla_put_u32(vendor_event, |
| 846 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 847 | pWifiIfaceStat->rssiData) || |
| 848 | nla_put_u32(vendor_event, |
| 849 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 850 | pWifiIfaceStat->rssiAck)) |
| 851 | { |
| 852 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 853 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 854 | return FALSE; |
| 855 | } |
| 856 | |
| 857 | wmmInfo = nla_nest_start(vendor_event, |
| 858 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
| 859 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 860 | { |
| 861 | struct nlattr *wmmStats; |
| 862 | wmmStats = nla_nest_start(vendor_event, i); |
| 863 | if (FALSE == put_wifi_wmm_ac_stat( |
| 864 | &pWifiIfaceStat->AccessclassStats[i], |
| 865 | vendor_event)) |
| 866 | { |
| 867 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 868 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
| 869 | return FALSE; |
| 870 | } |
| 871 | |
| 872 | nla_nest_end(vendor_event, wmmStats); |
| 873 | } |
| 874 | nla_nest_end(vendor_event, wmmInfo); |
| 875 | return TRUE; |
| 876 | } |
| 877 | |
| 878 | static tSirWifiInterfaceMode |
| 879 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 880 | { |
| 881 | switch (deviceMode) |
| 882 | { |
| 883 | case WLAN_HDD_INFRA_STATION: |
| 884 | return WIFI_INTERFACE_STA; |
| 885 | case WLAN_HDD_SOFTAP: |
| 886 | return WIFI_INTERFACE_SOFTAP; |
| 887 | case WLAN_HDD_P2P_CLIENT: |
| 888 | return WIFI_INTERFACE_P2P_CLIENT; |
| 889 | case WLAN_HDD_P2P_GO: |
| 890 | return WIFI_INTERFACE_P2P_GO; |
| 891 | case WLAN_HDD_IBSS: |
| 892 | return WIFI_INTERFACE_IBSS; |
| 893 | default: |
| 894 | /* Return Interface Mode as STA for all the unsupported modes */ |
| 895 | return WIFI_INTERFACE_STA; |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 900 | tpSirWifiInterfaceInfo pInfo) |
| 901 | { |
| 902 | v_U8_t *staMac = NULL; |
| 903 | hdd_station_ctx_t *pHddStaCtx; |
| 904 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 905 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 906 | |
| 907 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 908 | |
| 909 | vos_mem_copy(pInfo->macAddr, |
| 910 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 911 | |
| 912 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 913 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 914 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 915 | { |
| 916 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 917 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 918 | { |
| 919 | pInfo->state = WIFI_DISCONNECTED; |
| 920 | } |
| 921 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 922 | { |
| 923 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 924 | "%s: Session ID %d, Connection is in progress", __func__, |
| 925 | pAdapter->sessionId); |
| 926 | pInfo->state = WIFI_ASSOCIATING; |
| 927 | } |
| 928 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 929 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 930 | { |
| 931 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 932 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 933 | "%s: client " MAC_ADDRESS_STR |
| 934 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 935 | MAC_ADDR_ARRAY(staMac)); |
| 936 | pInfo->state = WIFI_AUTHENTICATING; |
| 937 | } |
| 938 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 939 | { |
| 940 | pInfo->state = WIFI_ASSOCIATED; |
| 941 | vos_mem_copy(pInfo->bssid, |
| 942 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 943 | vos_mem_copy(pInfo->ssid, |
| 944 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 945 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 946 | //NULL Terminate the string. |
| 947 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 948 | } |
| 949 | } |
| 950 | vos_mem_copy(pInfo->countryStr, |
| 951 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 952 | |
| 953 | vos_mem_copy(pInfo->apCountryStr, |
| 954 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 955 | |
| 956 | return TRUE; |
| 957 | } |
| 958 | |
| 959 | /* |
| 960 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 961 | * receiving Link Layer Peer statistics from FW.This function converts |
| 962 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 963 | * layers. |
| 964 | */ |
| 965 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 966 | v_VOID_t *pData) |
| 967 | { |
| 968 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 969 | tpSirWifiRateStat pWifiRateStat; |
| 970 | tpSirWifiPeerStat pWifiPeerStat; |
| 971 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 972 | struct nlattr *peerInfo; |
| 973 | struct sk_buff *vendor_event; |
| 974 | int status, i; |
| 975 | |
| 976 | status = wlan_hdd_validate_context(pHddCtx); |
| 977 | if (0 != status) |
| 978 | { |
| 979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 980 | FL("HDD context is not valid") ); |
| 981 | return; |
| 982 | } |
| 983 | |
| 984 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 985 | |
| 986 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 987 | "LL_STATS_PEER_ALL : numPeers %u", |
| 988 | pWifiPeerStat->numPeers); |
| 989 | { |
| 990 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 991 | { |
| 992 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 993 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 994 | ( i * sizeof(tSirWifiPeerInfo))); |
| 995 | |
| 996 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 997 | " %d) LL_STATS Channel Stats " |
| 998 | " Peer Type %u " |
| 999 | " peerMacAddress %pM " |
| 1000 | " capabilities 0x%x " |
| 1001 | " numRate %u ", |
| 1002 | i, |
| 1003 | pWifiPeerInfo->type, |
| 1004 | pWifiPeerInfo->peerMacAddress, |
| 1005 | pWifiPeerInfo->capabilities, |
| 1006 | pWifiPeerInfo->numRate); |
| 1007 | { |
| 1008 | int j; |
| 1009 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1010 | { |
| 1011 | pWifiRateStat = (tpSirWifiRateStat) |
| 1012 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1013 | ( j * sizeof(tSirWifiRateStat))); |
| 1014 | |
| 1015 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1016 | " peer Rate Stats " |
| 1017 | " preamble %u " |
| 1018 | " nss %u " |
| 1019 | " bw %u " |
| 1020 | " rateMcsIdx %u " |
| 1021 | " reserved %u " |
| 1022 | " bitrate %u " |
| 1023 | " txMpdu %u " |
| 1024 | " rxMpdu %u " |
| 1025 | " mpduLost %u " |
| 1026 | " retries %u " |
| 1027 | " retriesShort %u " |
| 1028 | " retriesLong %u", |
| 1029 | pWifiRateStat->rate.preamble, |
| 1030 | pWifiRateStat->rate.nss, |
| 1031 | pWifiRateStat->rate.bw, |
| 1032 | pWifiRateStat->rate.rateMcsIdx, |
| 1033 | pWifiRateStat->rate.reserved, |
| 1034 | pWifiRateStat->rate.bitrate, |
| 1035 | pWifiRateStat->txMpdu, |
| 1036 | pWifiRateStat->rxMpdu, |
| 1037 | pWifiRateStat->mpduLost, |
| 1038 | pWifiRateStat->retries, |
| 1039 | pWifiRateStat->retriesShort, |
| 1040 | pWifiRateStat->retriesLong); |
| 1041 | } |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 | |
| 1046 | /* |
| 1047 | * Allocate a size of 4096 for the peer stats comprising |
| 1048 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1049 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1050 | * NL attribute.The size of 4096 is considered assuming |
| 1051 | * that number of rates shall not exceed beyond 50 with |
| 1052 | * the sizeof (tSirWifiRateStat) being 32. |
| 1053 | */ |
| 1054 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1055 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1056 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1057 | GFP_KERNEL); |
| 1058 | if (!vendor_event) |
| 1059 | { |
| 1060 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1061 | "%s: cfg80211_vendor_event_alloc failed", |
| 1062 | __func__); |
| 1063 | return; |
| 1064 | } |
| 1065 | if (nla_put_u32(vendor_event, |
| 1066 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1067 | pWifiPeerStat->numPeers)) |
| 1068 | { |
| 1069 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1070 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1071 | kfree_skb(vendor_event); |
| 1072 | return; |
| 1073 | } |
| 1074 | |
| 1075 | peerInfo = nla_nest_start(vendor_event, |
| 1076 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
| 1077 | |
| 1078 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1079 | pWifiPeerStat->peerInfo); |
| 1080 | |
| 1081 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1082 | { |
| 1083 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
| 1084 | int numRate = pWifiPeerInfo->numRate; |
| 1085 | |
| 1086 | if (FALSE == put_wifi_peer_info( |
| 1087 | pWifiPeerInfo, vendor_event)) |
| 1088 | { |
| 1089 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1090 | "%s: put_wifi_peer_info put fail", __func__); |
| 1091 | kfree_skb(vendor_event); |
| 1092 | return; |
| 1093 | } |
| 1094 | |
| 1095 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1096 | pWifiPeerStat->peerInfo + |
| 1097 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1098 | (numRate * sizeof (tSirWifiRateStat))); |
| 1099 | nla_nest_end(vendor_event, peers); |
| 1100 | } |
| 1101 | nla_nest_end(vendor_event, peerInfo); |
| 1102 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1103 | } |
| 1104 | |
| 1105 | /* |
| 1106 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1107 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1108 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1109 | * layers. |
| 1110 | */ |
| 1111 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1112 | v_VOID_t *pData) |
| 1113 | { |
| 1114 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1115 | struct sk_buff *vendor_event; |
| 1116 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1117 | int status; |
| 1118 | |
| 1119 | status = wlan_hdd_validate_context(pHddCtx); |
| 1120 | if (0 != status) |
| 1121 | { |
| 1122 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1123 | FL("HDD context is not valid") ); |
| 1124 | return; |
| 1125 | } |
| 1126 | /* |
| 1127 | * Allocate a size of 4096 for the interface stats comprising |
| 1128 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1129 | * assuming that all these fit with in the limit.Please take |
| 1130 | * a call on the limit based on the data requirements on |
| 1131 | * interface statistics. |
| 1132 | */ |
| 1133 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1134 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1135 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1136 | GFP_KERNEL); |
| 1137 | if (!vendor_event) |
| 1138 | { |
| 1139 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1140 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1141 | return; |
| 1142 | } |
| 1143 | |
| 1144 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1145 | |
| 1146 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1147 | "WMI_LINK_STATS_IFACE Data"); |
| 1148 | |
| 1149 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1150 | "LL_STATS_IFACE: " |
| 1151 | " Mode %u " |
| 1152 | " MAC %pM " |
| 1153 | " State %u " |
| 1154 | " Roaming %u " |
| 1155 | " capabilities 0x%x " |
| 1156 | " SSID %s " |
| 1157 | " BSSID %pM", |
| 1158 | pWifiIfaceStat->info.mode, |
| 1159 | pWifiIfaceStat->info.macAddr, |
| 1160 | pWifiIfaceStat->info.state, |
| 1161 | pWifiIfaceStat->info.roaming, |
| 1162 | pWifiIfaceStat->info.capabilities, |
| 1163 | pWifiIfaceStat->info.ssid, |
| 1164 | pWifiIfaceStat->info.bssid); |
| 1165 | |
| 1166 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1167 | " AP country str: %c%c%c", |
| 1168 | pWifiIfaceStat->info.apCountryStr[0], |
| 1169 | pWifiIfaceStat->info.apCountryStr[1], |
| 1170 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1171 | |
| 1172 | |
| 1173 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1174 | " Country Str Association: %c%c%c", |
| 1175 | pWifiIfaceStat->info.countryStr[0], |
| 1176 | pWifiIfaceStat->info.countryStr[1], |
| 1177 | pWifiIfaceStat->info.countryStr[2]); |
| 1178 | |
| 1179 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1180 | " beaconRx %u " |
| 1181 | " mgmtRx %u " |
| 1182 | " mgmtActionRx %u " |
| 1183 | " mgmtActionTx %u " |
| 1184 | " rssiMgmt %u " |
| 1185 | " rssiData %u " |
| 1186 | " rssiAck %u", |
| 1187 | pWifiIfaceStat->beaconRx, |
| 1188 | pWifiIfaceStat->mgmtRx, |
| 1189 | pWifiIfaceStat->mgmtActionRx, |
| 1190 | pWifiIfaceStat->mgmtActionTx, |
| 1191 | pWifiIfaceStat->rssiMgmt, |
| 1192 | pWifiIfaceStat->rssiData, |
| 1193 | pWifiIfaceStat->rssiAck ); |
| 1194 | |
| 1195 | |
| 1196 | { |
| 1197 | int i; |
| 1198 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1199 | { |
| 1200 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1201 | |
| 1202 | " %d) LL_STATS IFACE: " |
| 1203 | " ac: %u txMpdu: %u " |
| 1204 | " rxMpdu: %u txMcast: %u " |
| 1205 | " rxMcast: %u rxAmpdu: %u " |
| 1206 | " txAmpdu: %u mpduLost: %u " |
| 1207 | " retries: %u retriesShort: %u " |
| 1208 | " retriesLong: %u contentionTimeMin: %u " |
| 1209 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1210 | " contentionNumSamples: %u", |
| 1211 | i, |
| 1212 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1213 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1214 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1215 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1216 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1217 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1218 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1219 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1220 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1221 | pWifiIfaceStat-> |
| 1222 | AccessclassStats[i].retriesShort, |
| 1223 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1224 | pWifiIfaceStat-> |
| 1225 | AccessclassStats[i].contentionTimeMin, |
| 1226 | pWifiIfaceStat-> |
| 1227 | AccessclassStats[i].contentionTimeMax, |
| 1228 | pWifiIfaceStat-> |
| 1229 | AccessclassStats[i].contentionTimeAvg, |
| 1230 | pWifiIfaceStat-> |
| 1231 | AccessclassStats[i].contentionNumSamples); |
| 1232 | |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1237 | &pWifiIfaceStat->info)) |
| 1238 | { |
| 1239 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1240 | FL("hdd_get_interface_info get fail") ); |
| 1241 | kfree_skb(vendor_event); |
| 1242 | return; |
| 1243 | } |
| 1244 | |
| 1245 | if (FALSE == put_wifi_iface_stats( pWifiIfaceStat, |
| 1246 | vendor_event)) |
| 1247 | { |
| 1248 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1249 | FL("put_wifi_iface_stats fail") ); |
| 1250 | kfree_skb(vendor_event); |
| 1251 | return; |
| 1252 | } |
| 1253 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1254 | } |
| 1255 | |
| 1256 | /* |
| 1257 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1258 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1259 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1260 | * layers. |
| 1261 | */ |
| 1262 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1263 | v_VOID_t *pData) |
| 1264 | { |
| 1265 | int status, i; |
| 1266 | tpSirWifiRadioStat pWifiRadioStat; |
| 1267 | tpSirWifiChannelStats pWifiChannelStats; |
| 1268 | struct sk_buff *vendor_event; |
| 1269 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1270 | struct nlattr *chList; |
| 1271 | |
| 1272 | status = wlan_hdd_validate_context(pHddCtx); |
| 1273 | if (0 != status) |
| 1274 | { |
| 1275 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1276 | FL("HDD context is not valid") ); |
| 1277 | return; |
| 1278 | } |
| 1279 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1280 | |
| 1281 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1282 | "LL_STATS_RADIO" |
| 1283 | " radio is %d onTime is %u " |
| 1284 | " txTime is %u rxTime is %u " |
| 1285 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1286 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1287 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1288 | " numChannels is %u", |
| 1289 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1290 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1291 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1292 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1293 | pWifiRadioStat->onTimeRoamScan, |
| 1294 | pWifiRadioStat->onTimePnoScan, |
| 1295 | pWifiRadioStat->onTimeHs20, |
| 1296 | pWifiRadioStat->numChannels); |
| 1297 | /* |
| 1298 | * Allocate a size of 4096 for the Radio stats comprising |
| 1299 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1300 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1301 | * NL attribute.The size of 4096 is considered assuming that |
| 1302 | * number of channels shall not exceed beyond 60 with the |
| 1303 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1304 | */ |
| 1305 | |
| 1306 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1307 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1308 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1309 | GFP_KERNEL); |
| 1310 | |
| 1311 | if (!vendor_event) |
| 1312 | { |
| 1313 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1314 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1315 | return; |
| 1316 | } |
| 1317 | |
| 1318 | if (nla_put_u32(vendor_event, |
| 1319 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1320 | pWifiRadioStat->radio) || |
| 1321 | nla_put_u32(vendor_event, |
| 1322 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1323 | pWifiRadioStat->onTime) || |
| 1324 | nla_put_u32(vendor_event, |
| 1325 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1326 | pWifiRadioStat->txTime) || |
| 1327 | nla_put_u32(vendor_event, |
| 1328 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1329 | pWifiRadioStat->rxTime) || |
| 1330 | nla_put_u32(vendor_event, |
| 1331 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1332 | pWifiRadioStat->onTimeScan) || |
| 1333 | nla_put_u32(vendor_event, |
| 1334 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1335 | pWifiRadioStat->onTimeNbd) || |
| 1336 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1337 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1338 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1339 | nla_put_u32(vendor_event, |
| 1340 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1341 | pWifiRadioStat->onTimeRoamScan) || |
| 1342 | nla_put_u32(vendor_event, |
| 1343 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1344 | pWifiRadioStat->onTimePnoScan) || |
| 1345 | nla_put_u32(vendor_event, |
| 1346 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1347 | pWifiRadioStat->onTimeHs20) || |
| 1348 | nla_put_u32(vendor_event, |
| 1349 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1350 | pWifiRadioStat->numChannels)) |
| 1351 | { |
| 1352 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1353 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1354 | kfree_skb(vendor_event); |
| 1355 | return ; |
| 1356 | } |
| 1357 | |
| 1358 | chList = nla_nest_start(vendor_event, |
| 1359 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
| 1360 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1361 | { |
| 1362 | struct nlattr *chInfo; |
| 1363 | |
| 1364 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1365 | pWifiRadioStat->channels + |
| 1366 | (i * sizeof(tSirWifiChannelStats))); |
| 1367 | |
| 1368 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1369 | " %d) Channel Info" |
| 1370 | " width is %u " |
| 1371 | " CenterFreq %u " |
| 1372 | " CenterFreq0 %u " |
| 1373 | " CenterFreq1 %u " |
| 1374 | " onTime %u " |
| 1375 | " ccaBusyTime %u", |
| 1376 | i, |
| 1377 | pWifiChannelStats->channel.width, |
| 1378 | pWifiChannelStats->channel.centerFreq, |
| 1379 | pWifiChannelStats->channel.centerFreq0, |
| 1380 | pWifiChannelStats->channel.centerFreq1, |
| 1381 | pWifiChannelStats->onTime, |
| 1382 | pWifiChannelStats->ccaBusyTime); |
| 1383 | |
| 1384 | |
| 1385 | chInfo = nla_nest_start(vendor_event, i); |
| 1386 | |
| 1387 | if (nla_put_u32(vendor_event, |
| 1388 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1389 | pWifiChannelStats->channel.width) || |
| 1390 | nla_put_u32(vendor_event, |
| 1391 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1392 | pWifiChannelStats->channel.centerFreq) || |
| 1393 | nla_put_u32(vendor_event, |
| 1394 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1395 | pWifiChannelStats->channel.centerFreq0) || |
| 1396 | nla_put_u32(vendor_event, |
| 1397 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1398 | pWifiChannelStats->channel.centerFreq1) || |
| 1399 | nla_put_u32(vendor_event, |
| 1400 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1401 | pWifiChannelStats->onTime) || |
| 1402 | nla_put_u32(vendor_event, |
| 1403 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1404 | pWifiChannelStats->ccaBusyTime)) |
| 1405 | { |
| 1406 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1407 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1408 | kfree_skb(vendor_event); |
| 1409 | return ; |
| 1410 | } |
| 1411 | nla_nest_end(vendor_event, chInfo); |
| 1412 | } |
| 1413 | nla_nest_end(vendor_event, chList); |
| 1414 | |
| 1415 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1416 | return; |
| 1417 | } |
| 1418 | |
| 1419 | /* |
| 1420 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1421 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1422 | * data to the NL data and send the same to the kernel/upper layers. |
| 1423 | */ |
| 1424 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1425 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1426 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1427 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1428 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1429 | hdd_adapter_t *pAdapter = NULL; |
| 1430 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1431 | int status; |
| 1432 | |
| 1433 | status = wlan_hdd_validate_context(pHddCtx); |
| 1434 | |
| 1435 | if (0 != status) |
| 1436 | { |
| 1437 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1438 | FL("HDD context is not valid")); |
| 1439 | return; |
| 1440 | } |
| 1441 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1442 | |
| 1443 | |
| 1444 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1445 | if (NULL == pAdapter) |
| 1446 | { |
| 1447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1448 | FL(" MAC address %pM does not exist with host"), |
| 1449 | macAddr); |
| 1450 | return; |
| 1451 | } |
| 1452 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1453 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1454 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1455 | pAdapter->dev->name, indType); |
| 1456 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1457 | switch (indType) |
| 1458 | { |
| 1459 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1460 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1461 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1462 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1463 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1464 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1465 | linkLayerStatsResults->paramId); |
| 1466 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1467 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1468 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1469 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1470 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1471 | linkLayerStatsResults->respId); |
| 1472 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1473 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1474 | linkLayerStatsResults->moreResultToFollow); |
| 1475 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1476 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1477 | linkLayerStatsResults->result); |
| 1478 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1479 | { |
| 1480 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1481 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1482 | } |
| 1483 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1484 | { |
| 1485 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1486 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1487 | } |
| 1488 | else if ( linkLayerStatsResults->paramId & |
| 1489 | WMI_LINK_STATS_ALL_PEER ) |
| 1490 | { |
| 1491 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1492 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1493 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1494 | else |
| 1495 | { |
| 1496 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1497 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1498 | } |
| 1499 | |
| 1500 | break; |
| 1501 | } |
| 1502 | default: |
| 1503 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1504 | break; |
| 1505 | } |
| 1506 | return; |
| 1507 | } |
| 1508 | |
| 1509 | const struct |
| 1510 | nla_policy |
| 1511 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1512 | { |
| 1513 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1514 | { .type = NLA_U32 }, |
| 1515 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1516 | { .type = NLA_U32 }, |
| 1517 | }; |
| 1518 | |
| 1519 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1520 | struct wireless_dev *wdev, |
| 1521 | void *data, |
| 1522 | int data_len) |
| 1523 | { |
| 1524 | int status; |
| 1525 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1]; |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1526 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1527 | struct net_device *dev = wdev->netdev; |
| 1528 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1529 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1530 | |
| 1531 | status = wlan_hdd_validate_context(pHddCtx); |
| 1532 | if (0 != status) |
| 1533 | { |
| 1534 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1535 | FL("HDD context is not valid")); |
| 1536 | return -EINVAL; |
| 1537 | } |
| 1538 | |
| 1539 | if (NULL == pAdapter) |
| 1540 | { |
| 1541 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1542 | FL("HDD adapter is Null")); |
| 1543 | return -ENODEV; |
| 1544 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1545 | /* check the LLStats Capability */ |
| 1546 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1547 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1548 | { |
| 1549 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1550 | FL("Link Layer Statistics not supported by Firmware")); |
| 1551 | return -EINVAL; |
| 1552 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1553 | |
| 1554 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1555 | (struct nlattr *)data, |
| 1556 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1557 | { |
| 1558 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1559 | return -EINVAL; |
| 1560 | } |
| 1561 | if (!tb_vendor |
| 1562 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1563 | { |
| 1564 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1565 | return -EINVAL; |
| 1566 | } |
| 1567 | if (!tb_vendor[ |
| 1568 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1569 | { |
| 1570 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1571 | return -EINVAL; |
| 1572 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1573 | // Shall take the request Id if the Upper layers pass. 1 For now. |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1574 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1575 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1576 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1577 | nla_get_u32( |
| 1578 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1579 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1580 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1581 | nla_get_u32( |
| 1582 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1583 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1584 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1585 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1586 | |
| 1587 | |
| 1588 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1589 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1590 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1591 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1592 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1593 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1594 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1595 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1596 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1597 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1598 | |
| 1599 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1600 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1601 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1602 | { |
| 1603 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1604 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1605 | return -EINVAL; |
| 1606 | |
| 1607 | } |
| 1608 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1609 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1610 | { |
| 1611 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1612 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1613 | return -EINVAL; |
| 1614 | } |
| 1615 | |
| 1616 | pAdapter->isLinkLayerStatsSet = 1; |
| 1617 | |
| 1618 | return 0; |
| 1619 | } |
| 1620 | |
| 1621 | const struct |
| 1622 | nla_policy |
| 1623 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1624 | { |
| 1625 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1626 | * command. When reporting |
| 1627 | * the stats results, the driver uses the same value to indicate |
| 1628 | * which GET request the results |
| 1629 | * correspond to. |
| 1630 | */ |
| 1631 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1632 | |
| 1633 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1634 | requested for retrieval */ |
| 1635 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1636 | }; |
| 1637 | |
| 1638 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1639 | struct wireless_dev *wdev, |
| 1640 | void *data, |
| 1641 | int data_len) |
| 1642 | { |
| 1643 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1644 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1]; |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1645 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1646 | struct net_device *dev = wdev->netdev; |
| 1647 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1648 | int status; |
| 1649 | |
| 1650 | status = wlan_hdd_validate_context(pHddCtx); |
| 1651 | if (0 != status) |
| 1652 | { |
| 1653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1654 | FL("HDD context is not valid")); |
| 1655 | return -EINVAL ; |
| 1656 | } |
| 1657 | |
| 1658 | if (NULL == pAdapter) |
| 1659 | { |
| 1660 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1661 | "%s: HDD adapter is Null", __func__); |
| 1662 | return -ENODEV; |
| 1663 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1664 | /* check the LLStats Capability */ |
| 1665 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1666 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1667 | { |
| 1668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1669 | FL("Link Layer Statistics not supported by Firmware")); |
| 1670 | return -EINVAL; |
| 1671 | } |
| 1672 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1673 | |
| 1674 | if (!pAdapter->isLinkLayerStatsSet) |
| 1675 | { |
| 1676 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1677 | "%s: isLinkLayerStatsSet : %d", |
| 1678 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1679 | return -EINVAL; |
| 1680 | } |
| 1681 | |
| 1682 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1683 | (struct nlattr *)data, |
| 1684 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1685 | { |
| 1686 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1687 | return -EINVAL; |
| 1688 | } |
| 1689 | |
| 1690 | if (!tb_vendor |
| 1691 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1692 | { |
| 1693 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1694 | return -EINVAL; |
| 1695 | } |
| 1696 | |
| 1697 | if (!tb_vendor |
| 1698 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1699 | { |
| 1700 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1701 | return -EINVAL; |
| 1702 | } |
| 1703 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1704 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1705 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1706 | nla_get_u32( tb_vendor[ |
| 1707 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1708 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1709 | nla_get_u32( tb_vendor[ |
| 1710 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1711 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1712 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1713 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1714 | |
| 1715 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1716 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1717 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1718 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1719 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1720 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1721 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1722 | |
| 1723 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1724 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1725 | { |
| 1726 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1727 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1728 | return -EINVAL; |
| 1729 | } |
| 1730 | return 0; |
| 1731 | } |
| 1732 | |
| 1733 | const struct |
| 1734 | nla_policy |
| 1735 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1736 | { |
| 1737 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1738 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1739 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1740 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1741 | }; |
| 1742 | |
| 1743 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1744 | struct wireless_dev *wdev, |
| 1745 | void *data, |
| 1746 | int data_len) |
| 1747 | { |
| 1748 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1749 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX + 1]; |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1750 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1751 | struct net_device *dev = wdev->netdev; |
| 1752 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1753 | u32 statsClearReqMask; |
| 1754 | u8 stopReq; |
| 1755 | int status; |
| 1756 | |
| 1757 | status = wlan_hdd_validate_context(pHddCtx); |
| 1758 | if (0 != status) |
| 1759 | { |
| 1760 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1761 | FL("HDD context is not valid")); |
| 1762 | return -EINVAL; |
| 1763 | } |
| 1764 | |
| 1765 | if (NULL == pAdapter) |
| 1766 | { |
| 1767 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1768 | "%s: HDD adapter is Null", __func__); |
| 1769 | return -ENODEV; |
| 1770 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1771 | /* check the LLStats Capability */ |
| 1772 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1773 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1774 | { |
| 1775 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1776 | FL("Enable LLStats Capability")); |
| 1777 | return -EINVAL; |
| 1778 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1779 | |
| 1780 | if (!pAdapter->isLinkLayerStatsSet) |
| 1781 | { |
| 1782 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1783 | "%s: isLinkLayerStatsSet : %d", |
| 1784 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1785 | return -EINVAL; |
| 1786 | } |
| 1787 | |
| 1788 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1789 | (struct nlattr *)data, |
| 1790 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1791 | { |
| 1792 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1793 | return -EINVAL; |
| 1794 | } |
| 1795 | |
| 1796 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1797 | |
| 1798 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 1799 | { |
| 1800 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 1801 | return -EINVAL; |
| 1802 | |
| 1803 | } |
| 1804 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1805 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1806 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1807 | nla_get_u32( |
| 1808 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 1809 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1810 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1811 | nla_get_u8( |
| 1812 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 1813 | |
| 1814 | // Shall take the request Id if the Upper layers pass. 1 For now. |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1815 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1816 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1817 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 1818 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1819 | |
| 1820 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1821 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1822 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1823 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1824 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1825 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1826 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1827 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1828 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1829 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1830 | |
| 1831 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1832 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1833 | { |
| 1834 | struct sk_buff *temp_skbuff; |
| 1835 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 1836 | 2 * sizeof(u32) + |
| 1837 | NLMSG_HDRLEN); |
| 1838 | |
| 1839 | if (temp_skbuff != NULL) |
| 1840 | { |
| 1841 | |
| 1842 | if (nla_put_u32(temp_skbuff, |
| 1843 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 1844 | statsClearReqMask) || |
| 1845 | nla_put_u32(temp_skbuff, |
| 1846 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 1847 | stopReq)) |
| 1848 | { |
| 1849 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 1850 | kfree_skb(temp_skbuff); |
| 1851 | return -EINVAL; |
| 1852 | } |
| 1853 | /* If the ask is to stop the stats collection as part of clear |
| 1854 | * (stopReq = 1) , ensure that no further requests of get |
| 1855 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 1856 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1857 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1858 | * case the firmware is just asked to clear the statistics. |
| 1859 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1860 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1861 | pAdapter->isLinkLayerStatsSet = 0; |
| 1862 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 1863 | } |
| 1864 | return -ENOMEM; |
| 1865 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1866 | return -EINVAL; |
| 1867 | } |
| 1868 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1869 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1870 | #ifdef WLAN_FEATURE_EXTSCAN |
| 1871 | static const struct nla_policy |
| 1872 | wlan_hdd_extscan_config_policy |
| 1873 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 1874 | { |
| 1875 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 1876 | { .type = NLA_U32 }, |
| 1877 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 1878 | { .type = NLA_U32 }, |
| 1879 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 1880 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 1881 | { .type = NLA_U32 }, |
| 1882 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 1883 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 1884 | |
| 1885 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 1886 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 1887 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 1888 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 1889 | { .type = NLA_U8 }, |
| 1890 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 1891 | { .type = NLA_U32 }, |
| 1892 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 1893 | { .type = NLA_U32 }, |
| 1894 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 1895 | { .type = NLA_U32 }, |
| 1896 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 1897 | { .type = NLA_U8 }, |
| 1898 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 1899 | { .type = NLA_U8 }, |
| 1900 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 1901 | { .type = NLA_U8 }, |
| 1902 | |
| 1903 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 1904 | { .type = NLA_U32 }, |
| 1905 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 1906 | { .type = NLA_UNSPEC }, |
| 1907 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 1908 | { .type = NLA_S32 }, |
| 1909 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 1910 | { .type = NLA_S32 }, |
| 1911 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 1912 | { .type = NLA_U32 }, |
| 1913 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 1914 | { .type = NLA_U32 }, |
| 1915 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 1916 | { .type = NLA_U32 }, |
| 1917 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 1918 | = { .type = NLA_U32 }, |
| 1919 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 1920 | { .type = NLA_U32 }, |
| 1921 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 1922 | NLA_U32 }, |
| 1923 | }; |
| 1924 | |
| 1925 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 1926 | { |
| 1927 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 1928 | struct sk_buff *skb = NULL; |
| 1929 | tpSirEXTScanCapabilitiesEvent pData = |
| 1930 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 1931 | |
| 1932 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 1933 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 1934 | "or pData(%p) is null"), pData); |
| 1935 | return; |
| 1936 | } |
| 1937 | |
| 1938 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1939 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1940 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 1941 | GFP_KERNEL); |
| 1942 | |
| 1943 | if (!skb) { |
| 1944 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1945 | FL("cfg80211_vendor_event_alloc failed")); |
| 1946 | return; |
| 1947 | } |
| 1948 | |
| 1949 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 1950 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 1951 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 1952 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 1953 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 1954 | pData->maxRssiSampleSize); |
| 1955 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 1956 | pData->maxScanReportingThreshold); |
| 1957 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 1958 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 1959 | pData->maxSignificantWifiChangeAPs); |
| 1960 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 1961 | pData->maxBsidHistoryEntries); |
| 1962 | |
| 1963 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 1964 | pData->requestId) || |
| 1965 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 1966 | nla_put_u32(skb, |
| 1967 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 1968 | pData->scanCacheSize) || |
| 1969 | nla_put_u32(skb, |
| 1970 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 1971 | pData->scanBuckets) || |
| 1972 | nla_put_u32(skb, |
| 1973 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 1974 | pData->maxApPerScan) || |
| 1975 | nla_put_u32(skb, |
| 1976 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 1977 | pData->maxRssiSampleSize) || |
| 1978 | nla_put_u32(skb, |
| 1979 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 1980 | pData->maxScanReportingThreshold) || |
| 1981 | nla_put_u32(skb, |
| 1982 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 1983 | pData->maxHotlistAPs) || |
| 1984 | nla_put_u32(skb, |
| 1985 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 1986 | pData->maxSignificantWifiChangeAPs) || |
| 1987 | nla_put_u32(skb, |
| 1988 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 1989 | pData->maxBsidHistoryEntries)) { |
| 1990 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 1991 | goto nla_put_failure; |
| 1992 | } |
| 1993 | |
| 1994 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 1995 | return; |
| 1996 | |
| 1997 | nla_put_failure: |
| 1998 | kfree_skb(skb); |
| 1999 | return; |
| 2000 | } |
| 2001 | |
| 2002 | |
| 2003 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2004 | { |
| 2005 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2006 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2007 | struct sk_buff *skb = NULL; |
| 2008 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2009 | |
| 2010 | |
| 2011 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2012 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2013 | "or pData(%p) is null"), pData); |
| 2014 | return; |
| 2015 | } |
| 2016 | |
| 2017 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2018 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2019 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2020 | GFP_KERNEL); |
| 2021 | |
| 2022 | if (!skb) { |
| 2023 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2024 | FL("cfg80211_vendor_event_alloc failed")); |
| 2025 | return; |
| 2026 | } |
| 2027 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2028 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2029 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2030 | |
| 2031 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2032 | pData->requestId) || |
| 2033 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2034 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2035 | goto nla_put_failure; |
| 2036 | } |
| 2037 | |
| 2038 | /* |
| 2039 | * Store the Request ID for comparing with the requestID obtained |
| 2040 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2041 | * request is issued with a different requestId as that of the |
| 2042 | * extscan_start request. Also, This requestId shall be used while |
| 2043 | * indicating the full scan results to the upper layers. |
| 2044 | * The requestId is stored with the assumption that the firmware |
| 2045 | * shall return the ext scan start request's requestId in ext scan |
| 2046 | * start response. |
| 2047 | */ |
| 2048 | if (pData->status == 0) |
| 2049 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2050 | |
| 2051 | |
| 2052 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2053 | return; |
| 2054 | |
| 2055 | nla_put_failure: |
| 2056 | kfree_skb(skb); |
| 2057 | return; |
| 2058 | } |
| 2059 | |
| 2060 | |
| 2061 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2062 | { |
| 2063 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2064 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2065 | struct sk_buff *skb = NULL; |
| 2066 | |
| 2067 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2068 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2069 | "or pData(%p) is null"), pData); |
| 2070 | return; |
| 2071 | } |
| 2072 | |
| 2073 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2074 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2075 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2076 | GFP_KERNEL); |
| 2077 | |
| 2078 | if (!skb) { |
| 2079 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2080 | FL("cfg80211_vendor_event_alloc failed")); |
| 2081 | return; |
| 2082 | } |
| 2083 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2084 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2085 | |
| 2086 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2087 | pData->requestId) || |
| 2088 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2089 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2090 | goto nla_put_failure; |
| 2091 | } |
| 2092 | |
| 2093 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2094 | return; |
| 2095 | |
| 2096 | nla_put_failure: |
| 2097 | kfree_skb(skb); |
| 2098 | return; |
| 2099 | } |
| 2100 | |
| 2101 | |
| 2102 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2103 | void *pMsg) |
| 2104 | { |
| 2105 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2106 | struct sk_buff *skb = NULL; |
| 2107 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2108 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2109 | |
| 2110 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2111 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2112 | "or pData(%p) is null"), pData); |
| 2113 | return; |
| 2114 | } |
| 2115 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2116 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2117 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2118 | GFP_KERNEL); |
| 2119 | |
| 2120 | if (!skb) { |
| 2121 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2122 | FL("cfg80211_vendor_event_alloc failed")); |
| 2123 | return; |
| 2124 | } |
| 2125 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2126 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2127 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2128 | |
| 2129 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2130 | pData->requestId) || |
| 2131 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2133 | goto nla_put_failure; |
| 2134 | } |
| 2135 | |
| 2136 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2137 | return; |
| 2138 | |
| 2139 | nla_put_failure: |
| 2140 | kfree_skb(skb); |
| 2141 | return; |
| 2142 | } |
| 2143 | |
| 2144 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2145 | void *pMsg) |
| 2146 | { |
| 2147 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2148 | struct sk_buff *skb = NULL; |
| 2149 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2150 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2151 | |
| 2152 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2153 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2154 | "or pData(%p) is null"), pData); |
| 2155 | return; |
| 2156 | } |
| 2157 | |
| 2158 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2159 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2160 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2161 | GFP_KERNEL); |
| 2162 | |
| 2163 | if (!skb) { |
| 2164 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2165 | FL("cfg80211_vendor_event_alloc failed")); |
| 2166 | return; |
| 2167 | } |
| 2168 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2169 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2170 | |
| 2171 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2172 | pData->requestId) || |
| 2173 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2174 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2175 | goto nla_put_failure; |
| 2176 | } |
| 2177 | |
| 2178 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2179 | return; |
| 2180 | |
| 2181 | nla_put_failure: |
| 2182 | kfree_skb(skb); |
| 2183 | return; |
| 2184 | } |
| 2185 | |
| 2186 | |
| 2187 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2188 | void *pMsg) |
| 2189 | { |
| 2190 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2191 | struct sk_buff *skb = NULL; |
| 2192 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2193 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2194 | |
| 2195 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2196 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2197 | "or pData(%p) is null"), pData); |
| 2198 | return; |
| 2199 | } |
| 2200 | |
| 2201 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2202 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2203 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2204 | GFP_KERNEL); |
| 2205 | |
| 2206 | if (!skb) { |
| 2207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2208 | FL("cfg80211_vendor_event_alloc failed")); |
| 2209 | return; |
| 2210 | } |
| 2211 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2212 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2213 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2214 | |
| 2215 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2216 | pData->requestId) || |
| 2217 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2218 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2219 | goto nla_put_failure; |
| 2220 | } |
| 2221 | |
| 2222 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2223 | return; |
| 2224 | |
| 2225 | nla_put_failure: |
| 2226 | kfree_skb(skb); |
| 2227 | return; |
| 2228 | } |
| 2229 | |
| 2230 | |
| 2231 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2232 | void *pMsg) |
| 2233 | { |
| 2234 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2235 | struct sk_buff *skb = NULL; |
| 2236 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2237 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2238 | |
| 2239 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2240 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2241 | "or pData(%p) is null"), pData); |
| 2242 | return; |
| 2243 | } |
| 2244 | |
| 2245 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2246 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2247 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2248 | GFP_KERNEL); |
| 2249 | |
| 2250 | if (!skb) { |
| 2251 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2252 | FL("cfg80211_vendor_event_alloc failed")); |
| 2253 | return; |
| 2254 | } |
| 2255 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2256 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2257 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2258 | |
| 2259 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2260 | pData->requestId) || |
| 2261 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2262 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2263 | goto nla_put_failure; |
| 2264 | } |
| 2265 | |
| 2266 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2267 | return; |
| 2268 | |
| 2269 | nla_put_failure: |
| 2270 | kfree_skb(skb); |
| 2271 | return; |
| 2272 | } |
| 2273 | |
| 2274 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2275 | void *pMsg) |
| 2276 | { |
| 2277 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2278 | struct sk_buff *skb = NULL; |
| 2279 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2280 | tANI_S32 totalResults; |
| 2281 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2282 | tpSirWifiScanResult pSirWifiScanResult; |
| 2283 | |
| 2284 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2285 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2286 | "or pData(%p) is null"), pData); |
| 2287 | return; |
| 2288 | } |
| 2289 | totalResults = pData->numOfAps; |
| 2290 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2291 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2292 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2293 | |
| 2294 | do{ |
| 2295 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2296 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2297 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2298 | |
| 2299 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2300 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2301 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2302 | GFP_KERNEL); |
| 2303 | |
| 2304 | if (!skb) { |
| 2305 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2306 | FL("cfg80211_vendor_event_alloc failed")); |
| 2307 | return; |
| 2308 | } |
| 2309 | |
| 2310 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2311 | |
| 2312 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2313 | pData->requestId) || |
| 2314 | nla_put_u32(skb, |
| 2315 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2316 | resultsPerEvent)) { |
| 2317 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2318 | goto fail; |
| 2319 | } |
| 2320 | if (nla_put_u8(skb, |
| 2321 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2322 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2323 | { |
| 2324 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2325 | goto fail; |
| 2326 | } |
| 2327 | |
| 2328 | if (resultsPerEvent) { |
| 2329 | struct nlattr *aps; |
| 2330 | |
| 2331 | aps = nla_nest_start(skb, |
| 2332 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2333 | if (!aps) |
| 2334 | { |
| 2335 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2336 | goto fail; |
| 2337 | } |
| 2338 | |
| 2339 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2340 | struct nlattr *ap; |
| 2341 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2342 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2343 | |
| 2344 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2345 | "Ssid (%s)" |
| 2346 | "Bssid: %pM " |
| 2347 | "Channel (%u)" |
| 2348 | "Rssi (%d)" |
| 2349 | "RTT (%u)" |
| 2350 | "RTT_SD (%u)", |
| 2351 | i, |
| 2352 | pSirWifiScanResult->ts, |
| 2353 | pSirWifiScanResult->ssid, |
| 2354 | pSirWifiScanResult->bssid, |
| 2355 | pSirWifiScanResult->channel, |
| 2356 | pSirWifiScanResult->rssi, |
| 2357 | pSirWifiScanResult->rtt, |
| 2358 | pSirWifiScanResult->rtt_sd); |
| 2359 | |
| 2360 | ap = nla_nest_start(skb, j + 1); |
| 2361 | if (!ap) |
| 2362 | { |
| 2363 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2364 | goto fail; |
| 2365 | } |
| 2366 | |
| 2367 | if (nla_put_u64(skb, |
| 2368 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2369 | pSirWifiScanResult->ts) ) |
| 2370 | { |
| 2371 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2372 | goto fail; |
| 2373 | } |
| 2374 | if (nla_put(skb, |
| 2375 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2376 | sizeof(pSirWifiScanResult->ssid), |
| 2377 | pSirWifiScanResult->ssid) ) |
| 2378 | { |
| 2379 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2380 | goto fail; |
| 2381 | } |
| 2382 | if (nla_put(skb, |
| 2383 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2384 | sizeof(pSirWifiScanResult->bssid), |
| 2385 | pSirWifiScanResult->bssid) ) |
| 2386 | { |
| 2387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2388 | goto fail; |
| 2389 | } |
| 2390 | if (nla_put_u32(skb, |
| 2391 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2392 | pSirWifiScanResult->channel) ) |
| 2393 | { |
| 2394 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2395 | goto fail; |
| 2396 | } |
| 2397 | if (nla_put_u32(skb, |
| 2398 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2399 | pSirWifiScanResult->rssi) ) |
| 2400 | { |
| 2401 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2402 | goto fail; |
| 2403 | } |
| 2404 | if (nla_put_u32(skb, |
| 2405 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2406 | pSirWifiScanResult->rtt) ) |
| 2407 | { |
| 2408 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2409 | goto fail; |
| 2410 | } |
| 2411 | if (nla_put_u32(skb, |
| 2412 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2413 | pSirWifiScanResult->rtt_sd)) |
| 2414 | { |
| 2415 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2416 | goto fail; |
| 2417 | } |
| 2418 | |
| 2419 | nla_nest_end(skb, ap); |
| 2420 | } |
| 2421 | nla_nest_end(skb, aps); |
| 2422 | |
| 2423 | } |
| 2424 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2425 | } while (totalResults > 0); |
| 2426 | |
| 2427 | return; |
| 2428 | fail: |
| 2429 | kfree_skb(skb); |
| 2430 | return; |
| 2431 | } |
| 2432 | |
| 2433 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2434 | void *pMsg) |
| 2435 | { |
| 2436 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2437 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2438 | struct sk_buff *skb = NULL; |
| 2439 | tANI_U32 i; |
| 2440 | |
| 2441 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2442 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2443 | "or pData(%p) is null"), pData); |
| 2444 | return; |
| 2445 | } |
| 2446 | |
| 2447 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2448 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2449 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2450 | GFP_KERNEL); |
| 2451 | |
| 2452 | if (!skb) { |
| 2453 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2454 | FL("cfg80211_vendor_event_alloc failed")); |
| 2455 | return; |
| 2456 | } |
| 2457 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2458 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2459 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2460 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2461 | |
| 2462 | for (i = 0; i < pData->numOfAps; i++) { |
| 2463 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2464 | "Ssid (%s) " |
| 2465 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2466 | "Channel (%u) " |
| 2467 | "Rssi (%d) " |
| 2468 | "RTT (%u) " |
| 2469 | "RTT_SD (%u) ", |
| 2470 | i, |
| 2471 | pData->ap[i].ts, |
| 2472 | pData->ap[i].ssid, |
| 2473 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2474 | pData->ap[i].channel, |
| 2475 | pData->ap[i].rssi, |
| 2476 | pData->ap[i].rtt, |
| 2477 | pData->ap[i].rtt_sd); |
| 2478 | } |
| 2479 | |
| 2480 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2481 | pData->requestId) || |
| 2482 | nla_put_u32(skb, |
| 2483 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2484 | pData->numOfAps)) { |
| 2485 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2486 | goto fail; |
| 2487 | } |
| 2488 | if (pData->numOfAps) { |
| 2489 | struct nlattr *aps; |
| 2490 | |
| 2491 | aps = nla_nest_start(skb, |
| 2492 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2493 | if (!aps) |
| 2494 | goto fail; |
| 2495 | |
| 2496 | for (i = 0; i < pData->numOfAps; i++) { |
| 2497 | struct nlattr *ap; |
| 2498 | |
| 2499 | ap = nla_nest_start(skb, i + 1); |
| 2500 | if (!ap) |
| 2501 | goto fail; |
| 2502 | |
| 2503 | if (nla_put_u64(skb, |
| 2504 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2505 | pData->ap[i].ts) || |
| 2506 | nla_put(skb, |
| 2507 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2508 | sizeof(pData->ap[i].ssid), |
| 2509 | pData->ap[i].ssid) || |
| 2510 | nla_put(skb, |
| 2511 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2512 | sizeof(pData->ap[i].bssid), |
| 2513 | pData->ap[i].bssid) || |
| 2514 | nla_put_u32(skb, |
| 2515 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2516 | pData->ap[i].channel) || |
| 2517 | nla_put_s32(skb, |
| 2518 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2519 | pData->ap[i].rssi) || |
| 2520 | nla_put_u32(skb, |
| 2521 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2522 | pData->ap[i].rtt) || |
| 2523 | nla_put_u32(skb, |
| 2524 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2525 | pData->ap[i].rtt_sd)) |
| 2526 | goto fail; |
| 2527 | |
| 2528 | nla_nest_end(skb, ap); |
| 2529 | } |
| 2530 | nla_nest_end(skb, aps); |
| 2531 | |
| 2532 | if (nla_put_u8(skb, |
| 2533 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2534 | pData->moreData)) |
| 2535 | goto fail; |
| 2536 | } |
| 2537 | |
| 2538 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2539 | return; |
| 2540 | |
| 2541 | fail: |
| 2542 | kfree_skb(skb); |
| 2543 | return; |
| 2544 | |
| 2545 | } |
| 2546 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2547 | void *pMsg) |
| 2548 | { |
| 2549 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2550 | struct sk_buff *skb = NULL; |
| 2551 | tANI_U32 i, j; |
| 2552 | tpSirWifiSignificantChangeEvent pData = |
| 2553 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2554 | |
| 2555 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2556 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2557 | "or pData(%p) is null"), pData); |
| 2558 | return; |
| 2559 | } |
| 2560 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2561 | EXTSCAN_EVENT_BUF_SIZE, |
| 2562 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2563 | GFP_KERNEL); |
| 2564 | |
| 2565 | if (!skb) { |
| 2566 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2567 | FL("cfg80211_vendor_event_alloc failed")); |
| 2568 | return; |
| 2569 | } |
| 2570 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2571 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2572 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2573 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2574 | pData->numSigRssiBss); |
| 2575 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2576 | |
| 2577 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2578 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2579 | " num RSSI %u ", |
| 2580 | i, pData->sigRssiResult[i].bssid, |
| 2581 | pData->sigRssiResult[i].channel, |
| 2582 | pData->sigRssiResult[i].numRssi); |
| 2583 | |
| 2584 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2585 | |
| 2586 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2587 | " [%d]", |
| 2588 | pData->sigRssiResult[i].rssi[0]); |
| 2589 | |
| 2590 | } |
| 2591 | } |
| 2592 | |
| 2593 | |
| 2594 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2595 | pData->requestId) || |
| 2596 | nla_put_u32(skb, |
| 2597 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2598 | pData->numSigRssiBss)) { |
| 2599 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2600 | goto fail; |
| 2601 | } |
| 2602 | |
| 2603 | if (pData->numSigRssiBss) { |
| 2604 | struct nlattr *aps; |
| 2605 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2606 | if (!aps) |
| 2607 | goto fail; |
| 2608 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2609 | struct nlattr *ap; |
| 2610 | |
| 2611 | ap = nla_nest_start(skb, i); |
| 2612 | if (!ap) |
| 2613 | goto fail; |
| 2614 | if (nla_put(skb, |
| 2615 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2616 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2617 | nla_put_u32(skb, |
| 2618 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2619 | pData->sigRssiResult[i].channel) || |
| 2620 | nla_put_u32(skb, |
| 2621 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2622 | pData->sigRssiResult[i].numRssi) || |
| 2623 | nla_put(skb, |
| 2624 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2625 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2626 | pData->sigRssiResult[i].rssi)) |
| 2627 | goto fail; |
| 2628 | nla_nest_end(skb, ap); |
| 2629 | } |
| 2630 | nla_nest_end(skb, aps); |
| 2631 | if (nla_put_u8(skb, |
| 2632 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2633 | pData->moreData)) |
| 2634 | goto fail; |
| 2635 | } |
| 2636 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2637 | return; |
| 2638 | fail: |
| 2639 | kfree_skb(skb); |
| 2640 | return; |
| 2641 | } |
| 2642 | |
| 2643 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2644 | void *pMsg) |
| 2645 | { |
| 2646 | struct sk_buff *skb; |
| 2647 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2648 | tpSirWifiFullScanResultEvent pData = |
| 2649 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2650 | |
| 2651 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2653 | "or pData(%p) is null"), pData); |
| 2654 | return; |
| 2655 | } |
| 2656 | |
| 2657 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2658 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2659 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2660 | GFP_KERNEL); |
| 2661 | |
| 2662 | if (!skb) { |
| 2663 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2664 | FL("cfg80211_vendor_event_alloc failed")); |
| 2665 | return; |
| 2666 | } |
| 2667 | |
| 2668 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2669 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2670 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2671 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2672 | "Ssid (%s)" |
| 2673 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2674 | "Channel (%u)" |
| 2675 | "Rssi (%d)" |
| 2676 | "RTT (%u)" |
| 2677 | "RTT_SD (%u)"), |
| 2678 | pData->ap.ts, |
| 2679 | pData->ap.ssid, |
| 2680 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2681 | pData->ap.channel, |
| 2682 | pData->ap.rssi, |
| 2683 | pData->ap.rtt, |
| 2684 | pData->ap.rtt_sd); |
| 2685 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2686 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2687 | pData->requestId) || |
| 2688 | nla_put_u64(skb, |
| 2689 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2690 | pData->ap.ts) || |
| 2691 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2692 | sizeof(pData->ap.ssid), |
| 2693 | pData->ap.ssid) || |
| 2694 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2695 | WNI_CFG_BSSID_LEN, |
| 2696 | pData->ap.bssid) || |
| 2697 | nla_put_u32(skb, |
| 2698 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2699 | pData->ap.channel) || |
| 2700 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2701 | pData->ap.rssi) || |
| 2702 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2703 | pData->ap.rtt) || |
| 2704 | nla_put_u32(skb, |
| 2705 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2706 | pData->ap.rtt_sd) || |
| 2707 | nla_put_u16(skb, |
| 2708 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2709 | pData->ap.beaconPeriod) || |
| 2710 | nla_put_u16(skb, |
| 2711 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2712 | pData->ap.capability) || |
| 2713 | nla_put_u32(skb, |
| 2714 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2715 | pData->ieLength)) |
| 2716 | { |
| 2717 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2718 | goto nla_put_failure; |
| 2719 | } |
| 2720 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2721 | pData->ieLength, |
| 2722 | pData->ie)) |
| 2723 | { |
| 2724 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2725 | goto nla_put_failure; |
| 2726 | } |
| 2727 | |
| 2728 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2729 | return; |
| 2730 | |
| 2731 | nla_put_failure: |
| 2732 | kfree_skb(skb); |
| 2733 | return; |
| 2734 | } |
| 2735 | |
| 2736 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 2737 | void *pMsg) |
| 2738 | { |
| 2739 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2740 | struct sk_buff *skb = NULL; |
| 2741 | tpSirEXTScanResultsAvailableIndParams pData = |
| 2742 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 2743 | |
| 2744 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2745 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2746 | "or pData(%p) is null"), pData); |
| 2747 | return; |
| 2748 | } |
| 2749 | |
| 2750 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2751 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2752 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 2753 | GFP_KERNEL); |
| 2754 | |
| 2755 | if (!skb) { |
| 2756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2757 | FL("cfg80211_vendor_event_alloc failed")); |
| 2758 | return; |
| 2759 | } |
| 2760 | |
| 2761 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2762 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2763 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 2764 | pData->numResultsAvailable); |
| 2765 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2766 | pData->requestId) || |
| 2767 | nla_put_u32(skb, |
| 2768 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2769 | pData->numResultsAvailable)) { |
| 2770 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2771 | goto nla_put_failure; |
| 2772 | } |
| 2773 | |
| 2774 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2775 | return; |
| 2776 | |
| 2777 | nla_put_failure: |
| 2778 | kfree_skb(skb); |
| 2779 | return; |
| 2780 | } |
| 2781 | |
| 2782 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 2783 | { |
| 2784 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2785 | struct sk_buff *skb = NULL; |
| 2786 | tpSirEXTScanProgressIndParams pData = |
| 2787 | (tpSirEXTScanProgressIndParams) pMsg; |
| 2788 | |
| 2789 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2790 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2791 | "or pData(%p) is null"), pData); |
| 2792 | return; |
| 2793 | } |
| 2794 | |
| 2795 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2796 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2797 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 2798 | GFP_KERNEL); |
| 2799 | |
| 2800 | if (!skb) { |
| 2801 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2802 | FL("cfg80211_vendor_event_alloc failed")); |
| 2803 | return; |
| 2804 | } |
| 2805 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2806 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 2807 | pData->extScanEventType); |
| 2808 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 2809 | pData->status); |
| 2810 | |
| 2811 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 2812 | pData->extScanEventType) || |
| 2813 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 2814 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2815 | pData->requestId) || |
| 2816 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2817 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 2818 | pData->status)) { |
| 2819 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2820 | goto nla_put_failure; |
| 2821 | } |
| 2822 | |
| 2823 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2824 | return; |
| 2825 | |
| 2826 | nla_put_failure: |
| 2827 | kfree_skb(skb); |
| 2828 | return; |
| 2829 | } |
| 2830 | |
| 2831 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 2832 | void *pMsg) |
| 2833 | { |
| 2834 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2835 | |
| 2836 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2837 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 2838 | return; |
| 2839 | } |
| 2840 | |
| 2841 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 2842 | |
| 2843 | |
| 2844 | switch(evType) { |
| 2845 | case SIR_HAL_EXTSCAN_START_RSP: |
| 2846 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 2847 | break; |
| 2848 | |
| 2849 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 2850 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 2851 | break; |
| 2852 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 2853 | /* There is no need to send this response to upper layer |
| 2854 | Just log the message */ |
| 2855 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2856 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 2857 | break; |
| 2858 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 2859 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 2860 | break; |
| 2861 | |
| 2862 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 2863 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 2864 | break; |
| 2865 | |
| 2866 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 2867 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 2868 | break; |
| 2869 | |
| 2870 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 2871 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 2872 | break; |
| 2873 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 2874 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 2875 | break; |
| 2876 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 2877 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 2878 | break; |
| 2879 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 2880 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 2881 | break; |
| 2882 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 2883 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 2884 | break; |
| 2885 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 2886 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 2887 | break; |
| 2888 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 2889 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 2890 | break; |
| 2891 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 2892 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 2893 | break; |
| 2894 | default: |
| 2895 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 2896 | break; |
| 2897 | } |
| 2898 | } |
| 2899 | |
| 2900 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 2901 | struct wireless_dev *wdev, |
| 2902 | void *data, int dataLen) |
| 2903 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2904 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2905 | struct net_device *dev = wdev->netdev; |
| 2906 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2907 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2908 | struct nlattr |
| 2909 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 2910 | eHalStatus status; |
| 2911 | |
| 2912 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 2913 | status = wlan_hdd_validate_context(pHddCtx); |
| 2914 | if (0 != status) |
| 2915 | { |
| 2916 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2917 | FL("HDD context is not valid")); |
| 2918 | return -EINVAL; |
| 2919 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2920 | /* check the EXTScan Capability */ |
| 2921 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 2922 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 2923 | { |
| 2924 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2925 | FL("EXTScan not enabled/supported by Firmware")); |
| 2926 | return -EINVAL; |
| 2927 | } |
| 2928 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2929 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 2930 | data, dataLen, |
| 2931 | wlan_hdd_extscan_config_policy)) { |
| 2932 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 2933 | return -EINVAL; |
| 2934 | } |
| 2935 | |
| 2936 | /* Parse and fetch request Id */ |
| 2937 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 2938 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 2939 | return -EINVAL; |
| 2940 | } |
| 2941 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2942 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2943 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2944 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2945 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2946 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2947 | reqMsg.sessionId = pAdapter->sessionId; |
| 2948 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2949 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2950 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2951 | if (!HAL_STATUS_SUCCESS(status)) { |
| 2952 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2953 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2954 | return -EINVAL; |
| 2955 | } |
| 2956 | |
| 2957 | return 0; |
| 2958 | } |
| 2959 | |
| 2960 | |
| 2961 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 2962 | struct wireless_dev *wdev, |
| 2963 | void *data, int dataLen) |
| 2964 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2965 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2966 | struct net_device *dev = wdev->netdev; |
| 2967 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2968 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2969 | struct nlattr |
| 2970 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 2971 | eHalStatus status; |
| 2972 | |
| 2973 | status = wlan_hdd_validate_context(pHddCtx); |
| 2974 | if (0 != status) |
| 2975 | { |
| 2976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2977 | FL("HDD context is not valid")); |
| 2978 | return -EINVAL; |
| 2979 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2980 | /* check the EXTScan Capability */ |
| 2981 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 2982 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 2983 | { |
| 2984 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2985 | FL("EXTScan not enabled/supported by Firmware")); |
| 2986 | return -EINVAL; |
| 2987 | } |
| 2988 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2989 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 2990 | data, dataLen, |
| 2991 | wlan_hdd_extscan_config_policy)) { |
| 2992 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 2993 | return -EINVAL; |
| 2994 | } |
| 2995 | /* Parse and fetch request Id */ |
| 2996 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 2997 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 2998 | return -EINVAL; |
| 2999 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3000 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3001 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3002 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3003 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3004 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3005 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3006 | reqMsg.sessionId = pAdapter->sessionId; |
| 3007 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3008 | |
| 3009 | /* Parse and fetch flush parameter */ |
| 3010 | if (!tb |
| 3011 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3012 | { |
| 3013 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3014 | goto failed; |
| 3015 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3016 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3017 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3018 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3019 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3020 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3021 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3022 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3023 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3024 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3025 | return -EINVAL; |
| 3026 | } |
| 3027 | return 0; |
| 3028 | |
| 3029 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3030 | return -EINVAL; |
| 3031 | } |
| 3032 | |
| 3033 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3034 | struct wireless_dev *wdev, |
| 3035 | void *data, int dataLen) |
| 3036 | { |
| 3037 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3038 | struct net_device *dev = wdev->netdev; |
| 3039 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3040 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3041 | struct nlattr |
| 3042 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3043 | struct nlattr |
| 3044 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3045 | struct nlattr *apTh; |
| 3046 | eHalStatus status; |
| 3047 | tANI_U8 i = 0; |
| 3048 | int rem; |
| 3049 | |
| 3050 | status = wlan_hdd_validate_context(pHddCtx); |
| 3051 | if (0 != status) |
| 3052 | { |
| 3053 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3054 | FL("HDD context is not valid")); |
| 3055 | return -EINVAL; |
| 3056 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3057 | /* check the EXTScan Capability */ |
| 3058 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3059 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3060 | { |
| 3061 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3062 | FL("EXTScan not enabled/supported by Firmware")); |
| 3063 | return -EINVAL; |
| 3064 | } |
| 3065 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3066 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3067 | data, dataLen, |
| 3068 | wlan_hdd_extscan_config_policy)) { |
| 3069 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3070 | return -EINVAL; |
| 3071 | } |
| 3072 | |
| 3073 | /* Parse and fetch request Id */ |
| 3074 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3075 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3076 | return -EINVAL; |
| 3077 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3078 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3079 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3080 | if (!pReqMsg) { |
| 3081 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3082 | return -ENOMEM; |
| 3083 | } |
| 3084 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3085 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3086 | pReqMsg->requestId = nla_get_u32( |
| 3087 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3088 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3089 | |
| 3090 | /* Parse and fetch number of APs */ |
| 3091 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3092 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3093 | goto fail; |
| 3094 | } |
| 3095 | |
| 3096 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3097 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3098 | |
| 3099 | pReqMsg->numAp = nla_get_u32( |
| 3100 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3101 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3102 | |
| 3103 | nla_for_each_nested(apTh, |
| 3104 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3105 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3106 | nla_data(apTh), nla_len(apTh), |
| 3107 | NULL)) { |
| 3108 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3109 | goto fail; |
| 3110 | } |
| 3111 | |
| 3112 | /* Parse and fetch MAC address */ |
| 3113 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3114 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3115 | goto fail; |
| 3116 | } |
| 3117 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3118 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3119 | sizeof(tSirMacAddr)); |
| 3120 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3121 | |
| 3122 | /* Parse and fetch low RSSI */ |
| 3123 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3125 | goto fail; |
| 3126 | } |
| 3127 | pReqMsg->ap[i].low = nla_get_s32( |
| 3128 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3129 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3130 | |
| 3131 | /* Parse and fetch high RSSI */ |
| 3132 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3133 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3134 | goto fail; |
| 3135 | } |
| 3136 | pReqMsg->ap[i].high = nla_get_s32( |
| 3137 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3138 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3139 | pReqMsg->ap[i].high); |
| 3140 | |
| 3141 | /* Parse and fetch channel */ |
| 3142 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3143 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3144 | goto fail; |
| 3145 | } |
| 3146 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3147 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3148 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3149 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3150 | i++; |
| 3151 | } |
| 3152 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3153 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3154 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3155 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3156 | vos_mem_free(pReqMsg); |
| 3157 | return -EINVAL; |
| 3158 | } |
| 3159 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3160 | vos_mem_free(pReqMsg); |
| 3161 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3162 | return 0; |
| 3163 | |
| 3164 | fail: |
| 3165 | vos_mem_free(pReqMsg); |
| 3166 | return -EINVAL; |
| 3167 | } |
| 3168 | |
| 3169 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3170 | struct wireless_dev *wdev, |
| 3171 | void *data, int dataLen) |
| 3172 | { |
| 3173 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3174 | struct net_device *dev = wdev->netdev; |
| 3175 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3176 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3177 | struct nlattr |
| 3178 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3179 | struct nlattr |
| 3180 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3181 | struct nlattr *apTh; |
| 3182 | eHalStatus status; |
| 3183 | int i = 0; |
| 3184 | int rem; |
| 3185 | |
| 3186 | status = wlan_hdd_validate_context(pHddCtx); |
| 3187 | if (0 != status) |
| 3188 | { |
| 3189 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3190 | FL("HDD context is not valid")); |
| 3191 | return -EINVAL; |
| 3192 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3193 | /* check the EXTScan Capability */ |
| 3194 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3195 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3196 | { |
| 3197 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3198 | FL("EXTScan not enabled/supported by Firmware")); |
| 3199 | return -EINVAL; |
| 3200 | } |
| 3201 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3202 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3203 | data, dataLen, |
| 3204 | wlan_hdd_extscan_config_policy)) { |
| 3205 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3206 | return -EINVAL; |
| 3207 | } |
| 3208 | |
| 3209 | /* Parse and fetch request Id */ |
| 3210 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3211 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3212 | return -EINVAL; |
| 3213 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3214 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3215 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3216 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3217 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3218 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3219 | } |
| 3220 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3221 | |
| 3222 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3223 | pReqMsg->requestId = nla_get_u32( |
| 3224 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3225 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3226 | |
| 3227 | /* Parse and fetch RSSI sample size */ |
| 3228 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3229 | { |
| 3230 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3231 | goto fail; |
| 3232 | } |
| 3233 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3234 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3235 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3236 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3237 | |
| 3238 | /* Parse and fetch lost AP sample size */ |
| 3239 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3240 | { |
| 3241 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3242 | goto fail; |
| 3243 | } |
| 3244 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3245 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3246 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3247 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3248 | /* Parse and fetch minimum Breaching */ |
| 3249 | if (!tb |
| 3250 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3251 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3252 | goto fail; |
| 3253 | } |
| 3254 | pReqMsg->minBreaching = nla_get_u32( |
| 3255 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3256 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3257 | |
| 3258 | /* Parse and fetch number of APs */ |
| 3259 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3261 | goto fail; |
| 3262 | } |
| 3263 | pReqMsg->numAp = nla_get_u32( |
| 3264 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3265 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3266 | |
| 3267 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3268 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3269 | |
| 3270 | nla_for_each_nested(apTh, |
| 3271 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3272 | if(nla_parse(tb2, |
| 3273 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3274 | nla_data(apTh), nla_len(apTh), |
| 3275 | NULL)) { |
| 3276 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3277 | goto fail; |
| 3278 | } |
| 3279 | |
| 3280 | /* Parse and fetch MAC address */ |
| 3281 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3282 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3283 | goto fail; |
| 3284 | } |
| 3285 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3286 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3287 | sizeof(tSirMacAddr)); |
| 3288 | |
| 3289 | /* Parse and fetch low RSSI */ |
| 3290 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3291 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3292 | goto fail; |
| 3293 | } |
| 3294 | pReqMsg->ap[i].low = nla_get_s32( |
| 3295 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3296 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3297 | |
| 3298 | /* Parse and fetch high RSSI */ |
| 3299 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3300 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3301 | goto fail; |
| 3302 | } |
| 3303 | pReqMsg->ap[i].high = nla_get_s32( |
| 3304 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3305 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3306 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3307 | |
| 3308 | /* Parse and fetch channel */ |
| 3309 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3310 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3311 | goto fail; |
| 3312 | } |
| 3313 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3314 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3315 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3316 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3317 | i++; |
| 3318 | } |
| 3319 | |
| 3320 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3321 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3322 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3323 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3324 | vos_mem_free(pReqMsg); |
| 3325 | return -EINVAL; |
| 3326 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3327 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3328 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3329 | return 0; |
| 3330 | |
| 3331 | fail: |
| 3332 | vos_mem_free(pReqMsg); |
| 3333 | return -EINVAL; |
| 3334 | } |
| 3335 | |
| 3336 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3337 | struct wireless_dev *wdev, |
| 3338 | void *data, int dataLen) |
| 3339 | { |
| 3340 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3341 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3342 | tANI_U8 numChannels = 0; |
| 3343 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3344 | tANI_U32 requestId; |
| 3345 | tWifiBand wifiBand; |
| 3346 | eHalStatus status; |
| 3347 | struct sk_buff *replySkb; |
| 3348 | tANI_U8 i; |
| 3349 | |
| 3350 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3351 | status = wlan_hdd_validate_context(pHddCtx); |
| 3352 | if (0 != status) |
| 3353 | { |
| 3354 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3355 | FL("HDD context is not valid")); |
| 3356 | return -EINVAL; |
| 3357 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3358 | /* check the EXTScan Capability */ |
| 3359 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3360 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3361 | { |
| 3362 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3363 | FL("EXTScan not enabled/supported by Firmware")); |
| 3364 | return -EINVAL; |
| 3365 | } |
| 3366 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3367 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3368 | data, dataLen, |
| 3369 | wlan_hdd_extscan_config_policy)) { |
| 3370 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3371 | return -EINVAL; |
| 3372 | } |
| 3373 | |
| 3374 | /* Parse and fetch request Id */ |
| 3375 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3376 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3377 | return -EINVAL; |
| 3378 | } |
| 3379 | requestId = nla_get_u32( |
| 3380 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3381 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3382 | |
| 3383 | /* Parse and fetch wifi band */ |
| 3384 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3385 | { |
| 3386 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3387 | return -EINVAL; |
| 3388 | } |
| 3389 | wifiBand = nla_get_u32( |
| 3390 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3391 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3392 | |
| 3393 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3394 | wifiBand, ChannelList, |
| 3395 | &numChannels); |
| 3396 | if (eHAL_STATUS_SUCCESS != status) { |
| 3397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3398 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3399 | return -EINVAL; |
| 3400 | } |
| 3401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3402 | for (i = 0; i < numChannels; i++) |
| 3403 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3404 | |
| 3405 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3406 | sizeof(u32) * numChannels + |
| 3407 | NLMSG_HDRLEN); |
| 3408 | |
| 3409 | if (!replySkb) { |
| 3410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3411 | FL("valid channels: buffer alloc fail")); |
| 3412 | return -EINVAL; |
| 3413 | } |
| 3414 | if (nla_put_u32(replySkb, |
| 3415 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3416 | numChannels) || |
| 3417 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3418 | sizeof(u32) * numChannels, ChannelList)) { |
| 3419 | |
| 3420 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3421 | kfree_skb(replySkb); |
| 3422 | return -EINVAL; |
| 3423 | } |
| 3424 | |
| 3425 | return cfg80211_vendor_cmd_reply(replySkb); |
| 3426 | } |
| 3427 | |
| 3428 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 3429 | struct wireless_dev *wdev, |
| 3430 | void *data, int dataLen) |
| 3431 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3432 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3433 | struct net_device *dev = wdev->netdev; |
| 3434 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3435 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3436 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3437 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3438 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3439 | struct nlattr *buckets; |
| 3440 | struct nlattr *channels; |
| 3441 | int rem1; |
| 3442 | int rem2; |
| 3443 | eHalStatus status; |
| 3444 | tANI_U8 bktIndex; |
| 3445 | tANI_U32 i = 0, j = 0; |
| 3446 | |
| 3447 | status = wlan_hdd_validate_context(pHddCtx); |
| 3448 | if (0 != status) |
| 3449 | { |
| 3450 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3451 | FL("HDD context is not valid")); |
| 3452 | return -EINVAL; |
| 3453 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3454 | /* check the EXTScan Capability */ |
| 3455 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3456 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3457 | { |
| 3458 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3459 | FL("EXTScan not enabled/supported by Firmware")); |
| 3460 | return -EINVAL; |
| 3461 | } |
| 3462 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3463 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3464 | data, dataLen, |
| 3465 | wlan_hdd_extscan_config_policy)) { |
| 3466 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3467 | return -EINVAL; |
| 3468 | } |
| 3469 | |
| 3470 | /* Parse and fetch request Id */ |
| 3471 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3472 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3473 | return -EINVAL; |
| 3474 | } |
| 3475 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3476 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3477 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3478 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3479 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3480 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3481 | } |
| 3482 | |
| 3483 | pReqMsg->requestId = nla_get_u32( |
| 3484 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3485 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3486 | |
| 3487 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3488 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3489 | |
| 3490 | /* Parse and fetch base period */ |
| 3491 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3492 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3493 | goto fail; |
| 3494 | } |
| 3495 | pReqMsg->basePeriod = nla_get_u32( |
| 3496 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3497 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3498 | pReqMsg->basePeriod); |
| 3499 | |
| 3500 | /* Parse and fetch max AP per scan */ |
| 3501 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3502 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3503 | goto fail; |
| 3504 | } |
| 3505 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3506 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3507 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3508 | pReqMsg->maxAPperScan); |
| 3509 | |
| 3510 | /* Parse and fetch report threshold */ |
| 3511 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3512 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3513 | goto fail; |
| 3514 | } |
| 3515 | pReqMsg->reportThreshold = nla_get_u8( |
| 3516 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3517 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3518 | pReqMsg->reportThreshold); |
| 3519 | |
| 3520 | /* Parse and fetch number of buckets */ |
| 3521 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3522 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3523 | goto fail; |
| 3524 | } |
| 3525 | pReqMsg->numBuckets = nla_get_u8( |
| 3526 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3527 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3528 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3529 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3530 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3531 | } |
| 3532 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3533 | pReqMsg->numBuckets); |
| 3534 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3535 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3536 | goto fail; |
| 3537 | } |
| 3538 | |
| 3539 | nla_for_each_nested(buckets, |
| 3540 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3541 | if(nla_parse(bucket, |
| 3542 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3543 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3544 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3545 | goto fail; |
| 3546 | } |
| 3547 | |
| 3548 | /* Parse and fetch bucket spec */ |
| 3549 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3550 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3551 | goto fail; |
| 3552 | } |
| 3553 | bktIndex = nla_get_u8( |
| 3554 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3555 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), bktIndex); |
| 3556 | pReqMsg->buckets[bktIndex].bucket = bktIndex; |
| 3557 | |
| 3558 | /* Parse and fetch wifi band */ |
| 3559 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3560 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3561 | goto fail; |
| 3562 | } |
| 3563 | pReqMsg->buckets[bktIndex].band = nla_get_u8( |
| 3564 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3565 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
| 3566 | pReqMsg->buckets[bktIndex].band); |
| 3567 | |
| 3568 | /* Parse and fetch period */ |
| 3569 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3570 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3571 | goto fail; |
| 3572 | } |
| 3573 | pReqMsg->buckets[bktIndex].period = nla_get_u32( |
| 3574 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3575 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
| 3576 | pReqMsg->buckets[bktIndex].period); |
| 3577 | |
| 3578 | /* Parse and fetch report events */ |
| 3579 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3580 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3581 | goto fail; |
| 3582 | } |
| 3583 | pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8( |
| 3584 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3585 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
| 3586 | pReqMsg->buckets[bktIndex].reportEvents); |
| 3587 | |
| 3588 | /* Parse and fetch number of channels */ |
| 3589 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) { |
| 3590 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3591 | goto fail; |
| 3592 | } |
| 3593 | pReqMsg->buckets[bktIndex].numChannels = nla_get_u32( |
| 3594 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3595 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
| 3596 | pReqMsg->buckets[bktIndex].numChannels); |
| 3597 | |
| 3598 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3599 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3600 | goto fail; |
| 3601 | } |
| 3602 | |
| 3603 | j = 0; |
| 3604 | nla_for_each_nested(channels, |
| 3605 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3606 | if(nla_parse(channel, |
| 3607 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3608 | nla_data(channels), nla_len(channels), |
| 3609 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 3610 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3611 | goto fail; |
| 3612 | } |
| 3613 | |
| 3614 | /* Parse and fetch channel */ |
| 3615 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 3616 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3617 | goto fail; |
| 3618 | } |
| 3619 | pReqMsg->buckets[bktIndex].channels[j].channel = nla_get_u32( |
| 3620 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 3621 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
| 3622 | pReqMsg->buckets[bktIndex].channels[j].channel); |
| 3623 | |
| 3624 | /* Parse and fetch dwell time */ |
| 3625 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 3626 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 3627 | goto fail; |
| 3628 | } |
| 3629 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs = nla_get_u32( |
| 3630 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 3631 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
| 3632 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 3633 | |
| 3634 | /* Parse and fetch channel spec passive */ |
| 3635 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 3636 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3637 | FL("attr channel spec passive failed")); |
| 3638 | goto fail; |
| 3639 | } |
| 3640 | pReqMsg->buckets[bktIndex].channels[j].passive = nla_get_u8( |
| 3641 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 3642 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
| 3643 | pReqMsg->buckets[bktIndex].channels[j].passive); |
| 3644 | j++; |
| 3645 | } |
| 3646 | i++; |
| 3647 | } |
| 3648 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 3649 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3650 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3651 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 3652 | vos_mem_free(pReqMsg); |
| 3653 | return -EINVAL; |
| 3654 | } |
| 3655 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3656 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3657 | return 0; |
| 3658 | |
| 3659 | fail: |
| 3660 | vos_mem_free(pReqMsg); |
| 3661 | return -EINVAL; |
| 3662 | } |
| 3663 | |
| 3664 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 3665 | struct wireless_dev *wdev, |
| 3666 | void *data, int dataLen) |
| 3667 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3668 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3669 | struct net_device *dev = wdev->netdev; |
| 3670 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3671 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3672 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3673 | eHalStatus status; |
| 3674 | |
| 3675 | status = wlan_hdd_validate_context(pHddCtx); |
| 3676 | if (0 != status) |
| 3677 | { |
| 3678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3679 | FL("HDD context is not valid")); |
| 3680 | return -EINVAL; |
| 3681 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3682 | /* check the EXTScan Capability */ |
| 3683 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3684 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3685 | { |
| 3686 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3687 | FL("EXTScan not enabled/supported by Firmware")); |
| 3688 | return -EINVAL; |
| 3689 | } |
| 3690 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3691 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3692 | data, dataLen, |
| 3693 | wlan_hdd_extscan_config_policy)) { |
| 3694 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3695 | return -EINVAL; |
| 3696 | } |
| 3697 | |
| 3698 | /* Parse and fetch request Id */ |
| 3699 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3700 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3701 | return -EINVAL; |
| 3702 | } |
| 3703 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3704 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3705 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3706 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3707 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3708 | reqMsg.sessionId = pAdapter->sessionId; |
| 3709 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3710 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3711 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3712 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3713 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3714 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3715 | return -EINVAL; |
| 3716 | } |
| 3717 | |
| 3718 | return 0; |
| 3719 | } |
| 3720 | |
| 3721 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 3722 | struct wireless_dev *wdev, |
| 3723 | void *data, int dataLen) |
| 3724 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3725 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3726 | struct net_device *dev = wdev->netdev; |
| 3727 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3728 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3729 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3730 | eHalStatus status; |
| 3731 | |
| 3732 | status = wlan_hdd_validate_context(pHddCtx); |
| 3733 | if (0 != status) |
| 3734 | { |
| 3735 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3736 | FL("HDD context is not valid")); |
| 3737 | return -EINVAL; |
| 3738 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3739 | /* check the EXTScan Capability */ |
| 3740 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3741 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3742 | { |
| 3743 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3744 | FL("EXTScan not enabled/supported by Firmware")); |
| 3745 | return -EINVAL; |
| 3746 | } |
| 3747 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3748 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3749 | data, dataLen, |
| 3750 | wlan_hdd_extscan_config_policy)) { |
| 3751 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3752 | return -EINVAL; |
| 3753 | } |
| 3754 | |
| 3755 | /* Parse and fetch request Id */ |
| 3756 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3757 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3758 | return -EINVAL; |
| 3759 | } |
| 3760 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3761 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3762 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3763 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3764 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3765 | reqMsg.sessionId = pAdapter->sessionId; |
| 3766 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3767 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3768 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3769 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3770 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3771 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3772 | return -EINVAL; |
| 3773 | } |
| 3774 | |
| 3775 | return 0; |
| 3776 | } |
| 3777 | |
| 3778 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 3779 | struct wiphy *wiphy, |
| 3780 | struct wireless_dev *wdev, |
| 3781 | void *data, int dataLen) |
| 3782 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3783 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3784 | struct net_device *dev = wdev->netdev; |
| 3785 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3786 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3787 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3788 | eHalStatus status; |
| 3789 | |
| 3790 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering")); |
| 3791 | status = wlan_hdd_validate_context(pHddCtx); |
| 3792 | if (0 != status) |
| 3793 | { |
| 3794 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3795 | FL("HDD context is not valid")); |
| 3796 | return -EINVAL; |
| 3797 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3798 | /* check the EXTScan Capability */ |
| 3799 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3800 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3801 | { |
| 3802 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3803 | FL("EXTScan not enabled/supported by Firmware")); |
| 3804 | return -EINVAL; |
| 3805 | } |
| 3806 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3807 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3808 | data, dataLen, |
| 3809 | wlan_hdd_extscan_config_policy)) { |
| 3810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3811 | return -EINVAL; |
| 3812 | } |
| 3813 | |
| 3814 | /* Parse and fetch request Id */ |
| 3815 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3816 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3817 | return -EINVAL; |
| 3818 | } |
| 3819 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3820 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3821 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3822 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3823 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3824 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3825 | reqMsg.sessionId = pAdapter->sessionId; |
| 3826 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3827 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3828 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3829 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3830 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3831 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3832 | return -EINVAL; |
| 3833 | } |
| 3834 | |
| 3835 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3836 | return 0; |
| 3837 | } |
| 3838 | |
| 3839 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 3840 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3841 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 3842 | { |
| 3843 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 3844 | { |
| 3845 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3846 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 3847 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3848 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3849 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3850 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
| 3851 | }, |
| 3852 | |
| 3853 | { |
| 3854 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3855 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 3856 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3857 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3858 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3859 | .doit = wlan_hdd_cfg80211_ll_stats_set |
| 3860 | }, |
| 3861 | |
| 3862 | { |
| 3863 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3864 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 3865 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3866 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3867 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3868 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3869 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3870 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3871 | #ifdef WLAN_FEATURE_EXTSCAN |
| 3872 | { |
| 3873 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3874 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 3875 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3876 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3877 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3878 | .doit = wlan_hdd_cfg80211_extscan_start |
| 3879 | }, |
| 3880 | { |
| 3881 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3882 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 3883 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3884 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3885 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3886 | .doit = wlan_hdd_cfg80211_extscan_stop |
| 3887 | }, |
| 3888 | { |
| 3889 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3890 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 3891 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3892 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 3893 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
| 3894 | }, |
| 3895 | { |
| 3896 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3897 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 3898 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3899 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3900 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3901 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
| 3902 | }, |
| 3903 | { |
| 3904 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3905 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 3906 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3907 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3908 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3909 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
| 3910 | }, |
| 3911 | { |
| 3912 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3913 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 3914 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3915 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3916 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3917 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
| 3918 | }, |
| 3919 | { |
| 3920 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3921 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 3922 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3923 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3924 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3925 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
| 3926 | }, |
| 3927 | { |
| 3928 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3929 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 3930 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3931 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3932 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3933 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
| 3934 | }, |
| 3935 | { |
| 3936 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 3937 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 3938 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 3939 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 3940 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 3941 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
| 3942 | }, |
| 3943 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3944 | }; |
| 3945 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 3946 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3947 | static const |
| 3948 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 3949 | { |
| 3950 | #ifdef FEATURE_WLAN_CH_AVOID |
| 3951 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3952 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3953 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 3954 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3955 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 3956 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 3957 | { |
| 3958 | /* Index = 1*/ |
| 3959 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3960 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 3961 | }, |
| 3962 | { |
| 3963 | /* Index = 2*/ |
| 3964 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3965 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 3966 | }, |
| 3967 | { |
| 3968 | /* Index = 3*/ |
| 3969 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3970 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 3971 | }, |
| 3972 | { |
| 3973 | /* Index = 4*/ |
| 3974 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3975 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 3976 | }, |
| 3977 | { |
| 3978 | /* Index = 5*/ |
| 3979 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3980 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 3981 | }, |
| 3982 | { |
| 3983 | /* Index = 6*/ |
| 3984 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3985 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 3986 | }, |
| 3987 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3988 | #ifdef WLAN_FEATURE_EXTSCAN |
| 3989 | { |
| 3990 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3991 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 3992 | }, |
| 3993 | { |
| 3994 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3995 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 3996 | }, |
| 3997 | { |
| 3998 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 3999 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 4000 | }, |
| 4001 | { |
| 4002 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4003 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 4004 | }, |
| 4005 | { |
| 4006 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4007 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 4008 | }, |
| 4009 | { |
| 4010 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4011 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 4012 | }, |
| 4013 | { |
| 4014 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4015 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 4016 | }, |
| 4017 | { |
| 4018 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4019 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 4020 | }, |
| 4021 | { |
| 4022 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4023 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 4024 | }, |
| 4025 | { |
| 4026 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4027 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 4028 | }, |
| 4029 | { |
| 4030 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4031 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 4032 | }, |
| 4033 | { |
| 4034 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4035 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 4036 | }, |
| 4037 | { |
| 4038 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4039 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 4040 | }, |
| 4041 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4042 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4043 | }; |
| 4044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4046 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4047 | * This function is called by hdd_wlan_startup() |
| 4048 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4049 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4050 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4051 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | { |
| 4053 | struct wiphy *wiphy; |
| 4054 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4055 | /* |
| 4056 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4057 | */ |
| 4058 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 4059 | |
| 4060 | if (!wiphy) |
| 4061 | { |
| 4062 | /* Print error and jump into err label and free the memory */ |
| 4063 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 4064 | return NULL; |
| 4065 | } |
| 4066 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | return wiphy; |
| 4069 | } |
| 4070 | |
| 4071 | /* |
| 4072 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4073 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4074 | * private ioctl to change the band value |
| 4075 | */ |
| 4076 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 4077 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4078 | int i, j; |
| 4079 | eNVChannelEnabledType channelEnabledState; |
| 4080 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4081 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4082 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4083 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4084 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4085 | |
| 4086 | if (NULL == wiphy->bands[i]) |
| 4087 | { |
| 4088 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4089 | __func__, i); |
| 4090 | continue; |
| 4091 | } |
| 4092 | |
| 4093 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4094 | { |
| 4095 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4096 | |
| 4097 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 4098 | band->channels[j].hw_value); |
| 4099 | |
| 4100 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 4101 | { |
| 4102 | // Enable Social channels for P2P |
| 4103 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 4104 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 4105 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4106 | else |
| 4107 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4108 | continue; |
| 4109 | } |
| 4110 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 4111 | { |
| 4112 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4113 | continue; |
| 4114 | } |
| 4115 | |
| 4116 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 4117 | NV_CHANNEL_INVALID == channelEnabledState) |
| 4118 | { |
| 4119 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4120 | } |
| 4121 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 4122 | { |
| 4123 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4124 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 4125 | } |
| 4126 | else |
| 4127 | { |
| 4128 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 4129 | |IEEE80211_CHAN_RADAR); |
| 4130 | } |
| 4131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4132 | } |
| 4133 | return 0; |
| 4134 | } |
| 4135 | /* |
| 4136 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4137 | * This function is called by hdd_wlan_startup() |
| 4138 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | * This function is used to initialize and register wiphy structure. |
| 4140 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4141 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4142 | struct wiphy *wiphy, |
| 4143 | hdd_config_t *pCfg |
| 4144 | ) |
| 4145 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4146 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4147 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4148 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4149 | ENTER(); |
| 4150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4151 | /* Now bind the underlying wlan device with wiphy */ |
| 4152 | set_wiphy_dev(wiphy, dev); |
| 4153 | |
| 4154 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4155 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4156 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4157 | /* the flag for the other case would be initialzed in |
| 4158 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4159 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4160 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4161 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4162 | /* This will disable updating of NL channels from passive to |
| 4163 | * active if a beacon is received on passive channel. */ |
| 4164 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 4165 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4166 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4167 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4168 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4169 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 4170 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 4171 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4172 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4173 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4174 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4175 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4176 | #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] | 4177 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4178 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4179 | || pCfg->isFastRoamIniFeatureEnabled |
| 4180 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4181 | #ifdef FEATURE_WLAN_ESE |
| 4182 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4183 | #endif |
| 4184 | ) |
| 4185 | { |
| 4186 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 4187 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4188 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4189 | #ifdef FEATURE_WLAN_TDLS |
| 4190 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 4191 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 4192 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4193 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 4194 | if (pCfg->configPNOScanSupport) |
| 4195 | { |
| 4196 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 4197 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4198 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4199 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 4200 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4201 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4202 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4203 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4204 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 4205 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4206 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4207 | driver need to determine what to do with both |
| 4208 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4209 | |
| 4210 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4211 | #else |
| 4212 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4213 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4214 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4215 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 4216 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 4217 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 4219 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 4220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4221 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4222 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4223 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4224 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 4225 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4226 | | BIT(NL80211_IFTYPE_AP); |
| 4227 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4228 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4229 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4230 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 4231 | if( pCfg->enableMCC ) |
| 4232 | { |
| 4233 | /* Currently, supports up to two channels */ |
| 4234 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4235 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4236 | if( !pCfg->allowMCCGODiffBI ) |
| 4237 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4238 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4239 | } |
| 4240 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 4241 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4242 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4243 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4245 | /* Before registering we need to update the ht capabilitied based |
| 4246 | * on ini values*/ |
| 4247 | if( !pCfg->ShortGI20MhzEnable ) |
| 4248 | { |
| 4249 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4250 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4251 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4252 | } |
| 4253 | |
| 4254 | if( !pCfg->ShortGI40MhzEnable ) |
| 4255 | { |
| 4256 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 4257 | } |
| 4258 | |
| 4259 | if( !pCfg->nChannelBondingMode5GHz ) |
| 4260 | { |
| 4261 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 4262 | } |
| 4263 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4264 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4265 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 4266 | { |
| 4267 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 4268 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4269 | |
| 4270 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 4271 | { |
| 4272 | |
| 4273 | if (NULL == wiphy->bands[i]) |
| 4274 | { |
| 4275 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4276 | __func__, i); |
| 4277 | continue; |
| 4278 | } |
| 4279 | |
| 4280 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4281 | { |
| 4282 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4283 | |
| 4284 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 4285 | { |
| 4286 | // Enable social channels for P2P |
| 4287 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 4288 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4289 | else |
| 4290 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4291 | continue; |
| 4292 | } |
| 4293 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 4294 | { |
| 4295 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4296 | continue; |
| 4297 | } |
| 4298 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4299 | } |
| 4300 | /*Initialise the supported cipher suite details*/ |
| 4301 | wiphy->cipher_suites = hdd_cipher_suites; |
| 4302 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 4303 | |
| 4304 | /*signal strength in mBm (100*dBm) */ |
| 4305 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 4306 | |
| 4307 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 4308 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4309 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4310 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4311 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 4312 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4313 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 4314 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 4315 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4316 | EXIT(); |
| 4317 | return 0; |
| 4318 | } |
| 4319 | |
| 4320 | /* In this function we are registering wiphy. */ |
| 4321 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 4322 | { |
| 4323 | ENTER(); |
| 4324 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4325 | if (0 > wiphy_register(wiphy)) |
| 4326 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4327 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4328 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 4329 | return -EIO; |
| 4330 | } |
| 4331 | |
| 4332 | EXIT(); |
| 4333 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4335 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4336 | /* In this function we are updating channel list when, |
| 4337 | regulatory domain is FCC and country code is US. |
| 4338 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 4339 | As per FCC smart phone is not a indoor device. |
| 4340 | GO should not opeate on indoor channels */ |
| 4341 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 4342 | { |
| 4343 | int j; |
| 4344 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4345 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 4346 | //Default counrtycode from NV at the time of wiphy initialization. |
| 4347 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 4348 | &defaultCountryCode[0])) |
| 4349 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4350 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4351 | } |
| 4352 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 4353 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4354 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 4355 | { |
| 4356 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 4357 | return; |
| 4358 | } |
| 4359 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 4360 | { |
| 4361 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 4362 | // Mark UNII -1 band channel as passive |
| 4363 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 4364 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 4365 | } |
| 4366 | } |
| 4367 | } |
| 4368 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 4369 | /* This function registers for all frame which supplicant is interested in */ |
| 4370 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4371 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4372 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4373 | /* Register for all P2P action, public action etc frames */ |
| 4374 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 4375 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4376 | ENTER(); |
| 4377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4378 | /* Right now we are registering these frame when driver is getting |
| 4379 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 4380 | frame register ops, we will move this code as a part of that */ |
| 4381 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4382 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4383 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 4384 | |
| 4385 | /* GAS Initial Response */ |
| 4386 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4387 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4389 | /* GAS Comeback Request */ |
| 4390 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4391 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 4392 | |
| 4393 | /* GAS Comeback Response */ |
| 4394 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4395 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 4396 | |
| 4397 | /* P2P Public Action */ |
| 4398 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4399 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4400 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 4401 | |
| 4402 | /* P2P Action */ |
| 4403 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4404 | (v_U8_t*)P2P_ACTION_FRAME, |
| 4405 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4406 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 4407 | /* WNM BSS Transition Request frame */ |
| 4408 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4409 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 4410 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 4411 | |
| 4412 | /* WNM-Notification */ |
| 4413 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4414 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 4415 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4416 | } |
| 4417 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 4418 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4419 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4420 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4421 | /* Register for all P2P action, public action etc frames */ |
| 4422 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 4423 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4424 | ENTER(); |
| 4425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4426 | /* Right now we are registering these frame when driver is getting |
| 4427 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 4428 | frame register ops, we will move this code as a part of that */ |
| 4429 | /* GAS Initial Request */ |
| 4430 | |
| 4431 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4432 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 4433 | |
| 4434 | /* GAS Initial Response */ |
| 4435 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4436 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4438 | /* GAS Comeback Request */ |
| 4439 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4440 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 4441 | |
| 4442 | /* GAS Comeback Response */ |
| 4443 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4444 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 4445 | |
| 4446 | /* P2P Public Action */ |
| 4447 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4448 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4449 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 4450 | |
| 4451 | /* P2P Action */ |
| 4452 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4453 | (v_U8_t*)P2P_ACTION_FRAME, |
| 4454 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 4455 | /* WNM-Notification */ |
| 4456 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4457 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 4458 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4459 | } |
| 4460 | |
| 4461 | #ifdef FEATURE_WLAN_WAPI |
| 4462 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 4463 | const u8 *mac_addr, u8 *key , int key_Len) |
| 4464 | { |
| 4465 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4466 | tCsrRoamSetKey setKey; |
| 4467 | v_BOOL_t isConnected = TRUE; |
| 4468 | int status = 0; |
| 4469 | v_U32_t roamId= 0xFF; |
| 4470 | tANI_U8 *pKeyPtr = NULL; |
| 4471 | int n = 0; |
| 4472 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 4473 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 4474 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 4475 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 4477 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4478 | setKey.keyId = key_index; // Store Key ID |
| 4479 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 4480 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 4481 | setKey.paeRole = 0 ; // the PAE role |
| 4482 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 4483 | { |
| 4484 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 4485 | } |
| 4486 | else |
| 4487 | { |
| 4488 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 4489 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 4490 | } |
| 4491 | setKey.keyLength = key_Len; |
| 4492 | pKeyPtr = setKey.Key; |
| 4493 | memcpy( pKeyPtr, key, key_Len); |
| 4494 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4495 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4496 | __func__, key_Len); |
| 4497 | for (n = 0 ; n < key_Len; n++) |
| 4498 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 4499 | __func__,n,setKey.Key[n]); |
| 4500 | |
| 4501 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4502 | if ( isConnected ) |
| 4503 | { |
| 4504 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4505 | pAdapter->sessionId, &setKey, &roamId ); |
| 4506 | } |
| 4507 | if ( status != 0 ) |
| 4508 | { |
| 4509 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4510 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 4511 | __LINE__, status ); |
| 4512 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4513 | } |
| 4514 | } |
| 4515 | #endif /* FEATURE_WLAN_WAPI*/ |
| 4516 | |
| 4517 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4518 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4519 | beacon_data_t **ppBeacon, |
| 4520 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4521 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4522 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4523 | beacon_data_t **ppBeacon, |
| 4524 | struct cfg80211_beacon_data *params, |
| 4525 | int dtim_period) |
| 4526 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4527 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4528 | int size; |
| 4529 | beacon_data_t *beacon = NULL; |
| 4530 | beacon_data_t *old = NULL; |
| 4531 | int head_len,tail_len; |
| 4532 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4533 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4534 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4535 | { |
| 4536 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4537 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4540 | |
| 4541 | old = pAdapter->sessionCtx.ap.beacon; |
| 4542 | |
| 4543 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4544 | { |
| 4545 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4546 | FL("session(%d) old and new heads points to NULL"), |
| 4547 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4548 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4549 | } |
| 4550 | |
| 4551 | if (params->tail && !params->tail_len) |
| 4552 | { |
| 4553 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4554 | FL("tail_len is zero but tail is not NULL")); |
| 4555 | return -EINVAL; |
| 4556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4558 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 4559 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 4560 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4561 | { |
| 4562 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4563 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4566 | #endif |
| 4567 | |
| 4568 | if(params->head) |
| 4569 | head_len = params->head_len; |
| 4570 | else |
| 4571 | head_len = old->head_len; |
| 4572 | |
| 4573 | if(params->tail || !old) |
| 4574 | tail_len = params->tail_len; |
| 4575 | else |
| 4576 | tail_len = old->tail_len; |
| 4577 | |
| 4578 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 4579 | |
| 4580 | beacon = kzalloc(size, GFP_KERNEL); |
| 4581 | |
| 4582 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4583 | { |
| 4584 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4585 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4587 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4588 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4589 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4590 | if(params->dtim_period || !old ) |
| 4591 | beacon->dtim_period = params->dtim_period; |
| 4592 | else |
| 4593 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4594 | #else |
| 4595 | if(dtim_period || !old ) |
| 4596 | beacon->dtim_period = dtim_period; |
| 4597 | else |
| 4598 | beacon->dtim_period = old->dtim_period; |
| 4599 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 4602 | beacon->tail = beacon->head + head_len; |
| 4603 | beacon->head_len = head_len; |
| 4604 | beacon->tail_len = tail_len; |
| 4605 | |
| 4606 | if(params->head) { |
| 4607 | memcpy (beacon->head,params->head,beacon->head_len); |
| 4608 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4609 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4610 | if(old) |
| 4611 | memcpy (beacon->head,old->head,beacon->head_len); |
| 4612 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | if(params->tail) { |
| 4615 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 4616 | } |
| 4617 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4618 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4619 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 4620 | } |
| 4621 | |
| 4622 | *ppBeacon = beacon; |
| 4623 | |
| 4624 | kfree(old); |
| 4625 | |
| 4626 | return 0; |
| 4627 | |
| 4628 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4629 | |
| 4630 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 4631 | { |
| 4632 | int left = length; |
| 4633 | v_U8_t *ptr = pIes; |
| 4634 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4637 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | elem_id = ptr[0]; |
| 4639 | elem_len = ptr[1]; |
| 4640 | left -= 2; |
| 4641 | if(elem_len > left) |
| 4642 | { |
| 4643 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 4644 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4645 | eid,elem_len,left); |
| 4646 | return NULL; |
| 4647 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4648 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4649 | { |
| 4650 | return ptr; |
| 4651 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4653 | left -= elem_len; |
| 4654 | ptr += (elem_len + 2); |
| 4655 | } |
| 4656 | return NULL; |
| 4657 | } |
| 4658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4659 | /* Check if rate is 11g rate or not */ |
| 4660 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 4661 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 4662 | 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] | 4663 | u8 i; |
| 4664 | for (i = 0; i < 8; i++) |
| 4665 | { |
| 4666 | if(rate == gRateArray[i]) |
| 4667 | return TRUE; |
| 4668 | } |
| 4669 | return FALSE; |
| 4670 | } |
| 4671 | |
| 4672 | /* Check for 11g rate and set proper 11g only mode */ |
| 4673 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 4674 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 4675 | { |
| 4676 | u8 i, num_rates = pIe[0]; |
| 4677 | |
| 4678 | pIe += 1; |
| 4679 | for ( i = 0; i < num_rates; i++) |
| 4680 | { |
| 4681 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 4682 | { |
| 4683 | /* If rate set have 11g rate than change the mode to 11G */ |
| 4684 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 4685 | if (pIe[i] & BASIC_RATE_MASK) |
| 4686 | { |
| 4687 | /* If we have 11g rate as basic rate, it means mode |
| 4688 | is 11g only mode. |
| 4689 | */ |
| 4690 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 4691 | *pCheckRatesfor11g = FALSE; |
| 4692 | } |
| 4693 | } |
| 4694 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 4695 | { |
| 4696 | *require_ht = TRUE; |
| 4697 | } |
| 4698 | } |
| 4699 | return; |
| 4700 | } |
| 4701 | |
| 4702 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 4703 | { |
| 4704 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 4705 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 4706 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 4707 | u8 checkRatesfor11g = TRUE; |
| 4708 | u8 require_ht = FALSE; |
| 4709 | u8 *pIe=NULL; |
| 4710 | |
| 4711 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 4712 | |
| 4713 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 4714 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 4715 | if (pIe != NULL) |
| 4716 | { |
| 4717 | pIe += 1; |
| 4718 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 4719 | &pConfig->SapHw_mode); |
| 4720 | } |
| 4721 | |
| 4722 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 4723 | WLAN_EID_EXT_SUPP_RATES); |
| 4724 | if (pIe != NULL) |
| 4725 | { |
| 4726 | |
| 4727 | pIe += 1; |
| 4728 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 4729 | &pConfig->SapHw_mode); |
| 4730 | } |
| 4731 | |
| 4732 | if( pConfig->channel > 14 ) |
| 4733 | { |
| 4734 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 4735 | } |
| 4736 | |
| 4737 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 4738 | WLAN_EID_HT_CAPABILITY); |
| 4739 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4740 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4741 | { |
| 4742 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 4743 | if(require_ht) |
| 4744 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 4745 | } |
| 4746 | } |
| 4747 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4748 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 4749 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 4750 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 4751 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4752 | v_U8_t *pIe = NULL; |
| 4753 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 4754 | |
| 4755 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 4756 | pBeacon->tail, pBeacon->tail_len); |
| 4757 | |
| 4758 | if (pIe) |
| 4759 | { |
| 4760 | ielen = pIe[1] + 2; |
| 4761 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 4762 | { |
| 4763 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 4764 | } |
| 4765 | else |
| 4766 | { |
| 4767 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 4768 | return -EINVAL; |
| 4769 | } |
| 4770 | *total_ielen += ielen; |
| 4771 | } |
| 4772 | return 0; |
| 4773 | } |
| 4774 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 4775 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 4776 | v_U8_t *genie, v_U8_t *total_ielen) |
| 4777 | { |
| 4778 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 4779 | int left = pBeacon->tail_len; |
| 4780 | v_U8_t *ptr = pBeacon->tail; |
| 4781 | v_U8_t elem_id, elem_len; |
| 4782 | v_U16_t ielen = 0; |
| 4783 | |
| 4784 | if ( NULL == ptr || 0 == left ) |
| 4785 | return; |
| 4786 | |
| 4787 | while (left >= 2) |
| 4788 | { |
| 4789 | elem_id = ptr[0]; |
| 4790 | elem_len = ptr[1]; |
| 4791 | left -= 2; |
| 4792 | if (elem_len > left) |
| 4793 | { |
| 4794 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 4795 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 4796 | elem_id, elem_len, left); |
| 4797 | return; |
| 4798 | } |
| 4799 | if (IE_EID_VENDOR == elem_id) |
| 4800 | { |
| 4801 | /* skipping the VSIE's which we don't want to include or |
| 4802 | * it will be included by existing code |
| 4803 | */ |
| 4804 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 4805 | #ifdef WLAN_FEATURE_WFD |
| 4806 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 4807 | #endif |
| 4808 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 4809 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 4810 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 4811 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 4812 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 4813 | { |
| 4814 | ielen = ptr[1] + 2; |
| 4815 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 4816 | { |
| 4817 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 4818 | *total_ielen += ielen; |
| 4819 | } |
| 4820 | else |
| 4821 | { |
| 4822 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 4823 | "IE Length is too big " |
| 4824 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 4825 | elem_id, elem_len, *total_ielen); |
| 4826 | } |
| 4827 | } |
| 4828 | } |
| 4829 | |
| 4830 | left -= elem_len; |
| 4831 | ptr += (elem_len + 2); |
| 4832 | } |
| 4833 | return; |
| 4834 | } |
| 4835 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4836 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4837 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 4838 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4839 | #else |
| 4840 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 4841 | struct cfg80211_beacon_data *params) |
| 4842 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4843 | { |
| 4844 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4845 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4846 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4847 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4848 | |
| 4849 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 4850 | |
| 4851 | if(genie == NULL) { |
| 4852 | |
| 4853 | return -ENOMEM; |
| 4854 | } |
| 4855 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4856 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 4857 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4858 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4859 | hddLog(LOGE, |
| 4860 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4861 | ret = -EINVAL; |
| 4862 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | } |
| 4864 | |
| 4865 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4866 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 4867 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 4868 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4869 | hddLog(LOGE, |
| 4870 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4871 | ret = -EINVAL; |
| 4872 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | } |
| 4874 | #endif |
| 4875 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4876 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 4877 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4878 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4879 | hddLog(LOGE, |
| 4880 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 4881 | ret = -EINVAL; |
| 4882 | goto done; |
| 4883 | } |
| 4884 | |
| 4885 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 4886 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 4887 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4889 | |
| 4890 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4891 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 4892 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 4893 | { |
| 4894 | hddLog(LOGE, |
| 4895 | "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] | 4896 | ret = -EINVAL; |
| 4897 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4898 | } |
| 4899 | |
| 4900 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4901 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 4902 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 4903 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 4904 | ==eHAL_STATUS_FAILURE) |
| 4905 | { |
| 4906 | hddLog(LOGE, |
| 4907 | "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] | 4908 | ret = -EINVAL; |
| 4909 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4910 | } |
| 4911 | |
| 4912 | // Added for ProResp IE |
| 4913 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 4914 | { |
| 4915 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 4916 | u8 probe_rsp_ie_len[3] = {0}; |
| 4917 | u8 counter = 0; |
| 4918 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 4919 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 4920 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 4921 | Store More then 255 bytes into One Variable. |
| 4922 | */ |
| 4923 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 4924 | { |
| 4925 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 4926 | { |
| 4927 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 4928 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 4929 | } |
| 4930 | else |
| 4931 | { |
| 4932 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 4933 | rem_probe_resp_ie_len = 0; |
| 4934 | } |
| 4935 | } |
| 4936 | |
| 4937 | rem_probe_resp_ie_len = 0; |
| 4938 | |
| 4939 | if (probe_rsp_ie_len[0] > 0) |
| 4940 | { |
| 4941 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4942 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 4943 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 4944 | probe_rsp_ie_len[0], NULL, |
| 4945 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 4946 | { |
| 4947 | hddLog(LOGE, |
| 4948 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4949 | ret = -EINVAL; |
| 4950 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4951 | } |
| 4952 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 4953 | } |
| 4954 | |
| 4955 | if (probe_rsp_ie_len[1] > 0) |
| 4956 | { |
| 4957 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4958 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 4959 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 4960 | probe_rsp_ie_len[1], NULL, |
| 4961 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 4962 | { |
| 4963 | hddLog(LOGE, |
| 4964 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4965 | ret = -EINVAL; |
| 4966 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4967 | } |
| 4968 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 4969 | } |
| 4970 | |
| 4971 | if (probe_rsp_ie_len[2] > 0) |
| 4972 | { |
| 4973 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4974 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 4975 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 4976 | probe_rsp_ie_len[2], NULL, |
| 4977 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 4978 | { |
| 4979 | hddLog(LOGE, |
| 4980 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4981 | ret = -EINVAL; |
| 4982 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4983 | } |
| 4984 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 4985 | } |
| 4986 | |
| 4987 | if (probe_rsp_ie_len[1] == 0 ) |
| 4988 | { |
| 4989 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 4990 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 4991 | eANI_BOOLEAN_FALSE) ) |
| 4992 | { |
| 4993 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4994 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | } |
| 4996 | } |
| 4997 | |
| 4998 | if (probe_rsp_ie_len[2] == 0 ) |
| 4999 | { |
| 5000 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5001 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 5002 | eANI_BOOLEAN_FALSE) ) |
| 5003 | { |
| 5004 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5005 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5006 | } |
| 5007 | } |
| 5008 | |
| 5009 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5010 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 5011 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5012 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5013 | == eHAL_STATUS_FAILURE) |
| 5014 | { |
| 5015 | hddLog(LOGE, |
| 5016 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5017 | ret = -EINVAL; |
| 5018 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5019 | } |
| 5020 | } |
| 5021 | else |
| 5022 | { |
| 5023 | // Reset WNI_CFG_PROBE_RSP Flags |
| 5024 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 5025 | |
| 5026 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5027 | "%s: No Probe Response IE received in set beacon", |
| 5028 | __func__); |
| 5029 | } |
| 5030 | |
| 5031 | // Added for AssocResp IE |
| 5032 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 5033 | { |
| 5034 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5035 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 5036 | params->assocresp_ies_len, NULL, |
| 5037 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5038 | { |
| 5039 | hddLog(LOGE, |
| 5040 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5041 | ret = -EINVAL; |
| 5042 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5043 | } |
| 5044 | |
| 5045 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5046 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 5047 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5048 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5049 | == eHAL_STATUS_FAILURE) |
| 5050 | { |
| 5051 | hddLog(LOGE, |
| 5052 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5053 | ret = -EINVAL; |
| 5054 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5055 | } |
| 5056 | } |
| 5057 | else |
| 5058 | { |
| 5059 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5060 | "%s: No Assoc Response IE received in set beacon", |
| 5061 | __func__); |
| 5062 | |
| 5063 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5064 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 5065 | eANI_BOOLEAN_FALSE) ) |
| 5066 | { |
| 5067 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5068 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5069 | } |
| 5070 | } |
| 5071 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5072 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5073 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5074 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5075 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5076 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5077 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5078 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 5079 | * called by wlan_hdd_cfg80211_start_bss() and |
| 5080 | * wlan_hdd_cfg80211_set_channel() |
| 5081 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5082 | * channel list. |
| 5083 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 5084 | 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] | 5085 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5087 | v_U32_t num_ch = 0; |
| 5088 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5089 | u32 indx = 0; |
| 5090 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5091 | v_U8_t fValidChannel = FALSE, count = 0; |
| 5092 | 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] | 5093 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5094 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5095 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5096 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5098 | /* Validate the channel */ |
| 5099 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5100 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5101 | if ( channel == rfChannels[count].channelNum ) |
| 5102 | { |
| 5103 | fValidChannel = TRUE; |
| 5104 | break; |
| 5105 | } |
| 5106 | } |
| 5107 | if (fValidChannel != TRUE) |
| 5108 | { |
| 5109 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5110 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5111 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5112 | } |
| 5113 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5114 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5115 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5116 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 5117 | valid_ch, &num_ch)) |
| 5118 | { |
| 5119 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5120 | "%s: failed to get valid channel list", __func__); |
| 5121 | return VOS_STATUS_E_FAILURE; |
| 5122 | } |
| 5123 | for (indx = 0; indx < num_ch; indx++) |
| 5124 | { |
| 5125 | if (channel == valid_ch[indx]) |
| 5126 | { |
| 5127 | break; |
| 5128 | } |
| 5129 | } |
| 5130 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5131 | if (indx >= num_ch) |
| 5132 | { |
| 5133 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5134 | { |
| 5135 | eCsrBand band; |
| 5136 | unsigned int freq; |
| 5137 | |
| 5138 | sme_GetFreqBand(hHal, &band); |
| 5139 | |
| 5140 | if (eCSR_BAND_5G == band) |
| 5141 | { |
| 5142 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 5143 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 5144 | { |
| 5145 | freq = ieee80211_channel_to_frequency(channel, |
| 5146 | IEEE80211_BAND_2GHZ); |
| 5147 | } |
| 5148 | else |
| 5149 | { |
| 5150 | freq = ieee80211_channel_to_frequency(channel, |
| 5151 | IEEE80211_BAND_5GHZ); |
| 5152 | } |
| 5153 | #else |
| 5154 | freq = ieee80211_channel_to_frequency(channel); |
| 5155 | #endif |
| 5156 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 5157 | return VOS_STATUS_SUCCESS; |
| 5158 | } |
| 5159 | } |
| 5160 | |
| 5161 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5162 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5163 | return VOS_STATUS_E_FAILURE; |
| 5164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5165 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5167 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5168 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5169 | } |
| 5170 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5171 | /** |
| 5172 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 5173 | * This function is used to set the channel number |
| 5174 | */ |
| 5175 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 5176 | struct ieee80211_channel *chan, |
| 5177 | enum nl80211_channel_type channel_type |
| 5178 | ) |
| 5179 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5180 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5181 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5182 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5183 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5184 | hdd_context_t *pHddCtx; |
| 5185 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5186 | |
| 5187 | ENTER(); |
| 5188 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5189 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5190 | if( NULL == dev ) |
| 5191 | { |
| 5192 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5193 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5194 | return -ENODEV; |
| 5195 | } |
| 5196 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5197 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5198 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5199 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 5200 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5201 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5202 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 5203 | hdd_device_modetoString(pAdapter->device_mode), |
| 5204 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5205 | |
| 5206 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5207 | status = wlan_hdd_validate_context(pHddCtx); |
| 5208 | |
| 5209 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5210 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5211 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5212 | "%s: HDD context is not valid", __func__); |
| 5213 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5214 | } |
| 5215 | |
| 5216 | /* |
| 5217 | * Do freq to chan conversion |
| 5218 | * TODO: for 11a |
| 5219 | */ |
| 5220 | |
| 5221 | channel = ieee80211_frequency_to_channel(freq); |
| 5222 | |
| 5223 | /* Check freq range */ |
| 5224 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 5225 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 5226 | { |
| 5227 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5228 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5229 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 5230 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 5231 | return -EINVAL; |
| 5232 | } |
| 5233 | |
| 5234 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5235 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 5236 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 5237 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5238 | { |
| 5239 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5240 | { |
| 5241 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5242 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5243 | return -EINVAL; |
| 5244 | } |
| 5245 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5246 | "%s: set channel to [%d] for device mode =%d", |
| 5247 | __func__, channel,pAdapter->device_mode); |
| 5248 | } |
| 5249 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5250 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5251 | ) |
| 5252 | { |
| 5253 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5254 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 5255 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5256 | |
| 5257 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 5258 | { |
| 5259 | /* Link is up then return cant set channel*/ |
| 5260 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5261 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5262 | return -EINVAL; |
| 5263 | } |
| 5264 | |
| 5265 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5266 | pHddStaCtx->conn_info.operationChannel = channel; |
| 5267 | pRoamProfile->ChannelInfo.ChannelList = |
| 5268 | &pHddStaCtx->conn_info.operationChannel; |
| 5269 | } |
| 5270 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5271 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5272 | ) |
| 5273 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5274 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5275 | { |
| 5276 | if(VOS_STATUS_SUCCESS != |
| 5277 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5278 | { |
| 5279 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5280 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5281 | return -EINVAL; |
| 5282 | } |
| 5283 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5284 | } |
| 5285 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5286 | { |
| 5287 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 5288 | |
| 5289 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 5290 | channel set by supplicant |
| 5291 | */ |
| 5292 | if ( cfg_param->apAutoChannelSelection ) |
| 5293 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5294 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 5295 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5296 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5297 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 5298 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5299 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5300 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5301 | else |
| 5302 | { |
| 5303 | if(VOS_STATUS_SUCCESS != |
| 5304 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5305 | { |
| 5306 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5307 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5308 | return -EINVAL; |
| 5309 | } |
| 5310 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5311 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5312 | } |
| 5313 | } |
| 5314 | else |
| 5315 | { |
| 5316 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5317 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 5318 | return -EINVAL; |
| 5319 | } |
| 5320 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5321 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5322 | } |
| 5323 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5324 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 5325 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5326 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5327 | #else |
| 5328 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5329 | struct cfg80211_beacon_data *params, |
| 5330 | const u8 *ssid, size_t ssid_len, |
| 5331 | enum nl80211_hidden_ssid hidden_ssid) |
| 5332 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | { |
| 5334 | tsap_Config_t *pConfig; |
| 5335 | beacon_data_t *pBeacon = NULL; |
| 5336 | struct ieee80211_mgmt *pMgmt_frame; |
| 5337 | v_U8_t *pIe=NULL; |
| 5338 | v_U16_t capab_info; |
| 5339 | eCsrAuthType RSNAuthType; |
| 5340 | eCsrEncryptionType RSNEncryptType; |
| 5341 | eCsrEncryptionType mcRSNEncryptType; |
| 5342 | int status = VOS_STATUS_SUCCESS; |
| 5343 | tpWLAN_SAPEventCB pSapEventCallback; |
| 5344 | hdd_hostapd_state_t *pHostapdState; |
| 5345 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 5346 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5347 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5348 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5349 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5350 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 5351 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 5352 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 5353 | v_BOOL_t MFPRequired = VOS_FALSE; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 5354 | eHddDot11Mode sapDot11Mode = |
| 5355 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5356 | |
| 5357 | ENTER(); |
| 5358 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5359 | iniConfig = pHddCtx->cfg_ini; |
| 5360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5361 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 5362 | |
| 5363 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5364 | |
| 5365 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5366 | |
| 5367 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5368 | |
| 5369 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 5370 | |
| 5371 | //channel is already set in the set_channel Call back |
| 5372 | //pConfig->channel = pCommitConfig->channel; |
| 5373 | |
| 5374 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5375 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5376 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 5377 | |
| 5378 | pConfig->dtim_period = pBeacon->dtim_period; |
| 5379 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5380 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | pConfig->dtim_period); |
| 5382 | |
| 5383 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 5384 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5385 | { |
| 5386 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5387 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 5388 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 5389 | { |
| 5390 | tANI_BOOLEAN restartNeeded; |
| 5391 | pConfig->ieee80211d = 1; |
| 5392 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 5393 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 5394 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 5395 | } |
| 5396 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5397 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5398 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5399 | pConfig->ieee80211d = 1; |
| 5400 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 5401 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 5402 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5403 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5404 | else |
| 5405 | { |
| 5406 | pConfig->ieee80211d = 0; |
| 5407 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5408 | /* |
| 5409 | * If auto channel is configured i.e. channel is 0, |
| 5410 | * so skip channel validation. |
| 5411 | */ |
| 5412 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 5413 | { |
| 5414 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 5415 | { |
| 5416 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5417 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5418 | return -EINVAL; |
| 5419 | } |
| 5420 | } |
| 5421 | else |
| 5422 | { |
| 5423 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 5424 | { |
| 5425 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 5426 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 5427 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 5428 | } |
| 5429 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 5430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5431 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5432 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5433 | { |
| 5434 | pConfig->ieee80211d = 0; |
| 5435 | } |
| 5436 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 5437 | |
| 5438 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5439 | |
| 5440 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5441 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 5442 | |
| 5443 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 5444 | |
| 5445 | /*Set wps station to configured*/ |
| 5446 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 5447 | |
| 5448 | if(pIe) |
| 5449 | { |
| 5450 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 5451 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5452 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5453 | return -EINVAL; |
| 5454 | } |
| 5455 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 5456 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 5457 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5458 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 5459 | * WPS state |
| 5460 | */ |
| 5461 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 5462 | { |
| 5463 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 5464 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 5465 | { |
| 5466 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 5467 | } |
| 5468 | } |
| 5469 | } |
| 5470 | else |
| 5471 | { |
| 5472 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 5473 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5474 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 5476 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 5477 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 5478 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 5479 | eCSR_ENCRYPT_TYPE_NONE; |
| 5480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5481 | pConfig->RSNWPAReqIELength = 0; |
| 5482 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5483 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5484 | WLAN_EID_RSN); |
| 5485 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5486 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 5488 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 5489 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5490 | /* The actual processing may eventually be more extensive than |
| 5491 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5492 | * by the app. |
| 5493 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5494 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 5496 | &RSNEncryptType, |
| 5497 | &mcRSNEncryptType, |
| 5498 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 5499 | &MFPCapable, |
| 5500 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5501 | pConfig->pRSNWPAReqIE[1]+2, |
| 5502 | pConfig->pRSNWPAReqIE ); |
| 5503 | |
| 5504 | if( VOS_STATUS_SUCCESS == status ) |
| 5505 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5506 | /* Now copy over all the security attributes you have |
| 5507 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5508 | * */ |
| 5509 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 5510 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 5511 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 5512 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 5513 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5514 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 5516 | } |
| 5517 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5519 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5520 | pBeacon->tail, pBeacon->tail_len); |
| 5521 | |
| 5522 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 5523 | { |
| 5524 | if (pConfig->pRSNWPAReqIE) |
| 5525 | { |
| 5526 | /*Mixed mode WPA/WPA2*/ |
| 5527 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 5528 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 5529 | } |
| 5530 | else |
| 5531 | { |
| 5532 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 5533 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 5534 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5535 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 5537 | &RSNEncryptType, |
| 5538 | &mcRSNEncryptType, |
| 5539 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 5540 | &MFPCapable, |
| 5541 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5542 | pConfig->pRSNWPAReqIE[1]+2, |
| 5543 | pConfig->pRSNWPAReqIE ); |
| 5544 | |
| 5545 | if( VOS_STATUS_SUCCESS == status ) |
| 5546 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5547 | /* Now copy over all the security attributes you have |
| 5548 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5549 | * */ |
| 5550 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 5551 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 5552 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 5553 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 5554 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5555 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5556 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 5557 | } |
| 5558 | } |
| 5559 | } |
| 5560 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5561 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 5562 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 5563 | return -EINVAL; |
| 5564 | } |
| 5565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 5567 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5568 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5569 | if (params->ssid != NULL) |
| 5570 | { |
| 5571 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 5572 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 5573 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 5574 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 5575 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5576 | #else |
| 5577 | if (ssid != NULL) |
| 5578 | { |
| 5579 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 5580 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 5581 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 5582 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 5583 | } |
| 5584 | #endif |
| 5585 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5586 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5587 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5589 | /* default value */ |
| 5590 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 5591 | pConfig->num_accept_mac = 0; |
| 5592 | pConfig->num_deny_mac = 0; |
| 5593 | |
| 5594 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5595 | pBeacon->tail, pBeacon->tail_len); |
| 5596 | |
| 5597 | /* pIe for black list is following form: |
| 5598 | type : 1 byte |
| 5599 | length : 1 byte |
| 5600 | OUI : 4 bytes |
| 5601 | acl type : 1 byte |
| 5602 | no of mac addr in black list: 1 byte |
| 5603 | 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] | 5604 | */ |
| 5605 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5606 | { |
| 5607 | pConfig->SapMacaddr_acl = pIe[6]; |
| 5608 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5609 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5610 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5611 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 5612 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 5614 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 5615 | { |
| 5616 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 5617 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5618 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5619 | } |
| 5620 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5621 | pBeacon->tail, pBeacon->tail_len); |
| 5622 | |
| 5623 | /* pIe for white list is following form: |
| 5624 | type : 1 byte |
| 5625 | length : 1 byte |
| 5626 | OUI : 4 bytes |
| 5627 | acl type : 1 byte |
| 5628 | no of mac addr in white list: 1 byte |
| 5629 | 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] | 5630 | */ |
| 5631 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | { |
| 5633 | pConfig->SapMacaddr_acl = pIe[6]; |
| 5634 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5635 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5636 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5637 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 5638 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 5640 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 5641 | { |
| 5642 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 5643 | acl_entry++; |
| 5644 | } |
| 5645 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5647 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 5648 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5649 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 5650 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 5651 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 5652 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 5653 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 5654 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 5655 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 5656 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 5657 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 5658 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 5659 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 5660 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 5661 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5662 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 5663 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5664 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 5665 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 5666 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5667 | /* If ACS disable and selected channel <= 14 |
| 5668 | * OR |
| 5669 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 5670 | * AND |
| 5671 | * VHT in 2.4G Disabled |
| 5672 | * THEN |
| 5673 | * Fallback to 11N mode |
| 5674 | */ |
| 5675 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 5676 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 5677 | operatingBand == RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5678 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 5679 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 5680 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 5681 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 5682 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 5683 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5684 | } |
| 5685 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5686 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5687 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 5688 | { |
| 5689 | sme_SelectCBMode(hHal, |
| 5690 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 5691 | pConfig->channel); |
| 5692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5693 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 5694 | pConfig->ht_capab = |
| 5695 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 5696 | |
| 5697 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 5698 | { |
| 5699 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 5700 | return -EINVAL; |
| 5701 | } |
| 5702 | |
| 5703 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5704 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5705 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 5706 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5707 | pConfig->obssProtEnabled = |
| 5708 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5709 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 5710 | #ifdef WLAN_FEATURE_11W |
| 5711 | pConfig->mfpCapable = MFPCapable; |
| 5712 | pConfig->mfpRequired = MFPRequired; |
| 5713 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 5714 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 5715 | #endif |
| 5716 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5717 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5718 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5719 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 5720 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 5721 | (int)pConfig->channel); |
| 5722 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 5723 | pConfig->SapHw_mode, pConfig->privacy, |
| 5724 | pConfig->authType); |
| 5725 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 5726 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 5727 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 5728 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5729 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5730 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5731 | { |
| 5732 | //Bss already started. just return. |
| 5733 | //TODO Probably it should update some beacon params. |
| 5734 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 5735 | EXIT(); |
| 5736 | return 0; |
| 5737 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5738 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 5739 | if (vos_max_concurrent_connections_reached()) { |
| 5740 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 5741 | return -EINVAL; |
| 5742 | } |
| 5743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5744 | pConfig->persona = pHostapdAdapter->device_mode; |
| 5745 | |
| 5746 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 5747 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 5748 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 5749 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5750 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5751 | return -EINVAL; |
| 5752 | } |
| 5753 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5754 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5755 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 5756 | |
| 5757 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5760 | { |
| 5761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5762 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 5763 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | VOS_ASSERT(0); |
| 5765 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5767 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 5768 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5769 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 5770 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 5771 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 5772 | { |
| 5773 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 5774 | { |
| 5775 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 5776 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 5777 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 5778 | } |
| 5779 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 5780 | { |
| 5781 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 5782 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 5783 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 5784 | } |
| 5785 | } |
| 5786 | #endif |
| 5787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | pHostapdState->bCommit = TRUE; |
| 5789 | EXIT(); |
| 5790 | |
| 5791 | return 0; |
| 5792 | } |
| 5793 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5794 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5795 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 5796 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5797 | struct beacon_parameters *params) |
| 5798 | { |
| 5799 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5800 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5801 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5802 | |
| 5803 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5804 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5805 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5806 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 5807 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5808 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 5809 | hdd_device_modetoString(pAdapter->device_mode), |
| 5810 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5812 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5813 | status = wlan_hdd_validate_context(pHddCtx); |
| 5814 | |
| 5815 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5816 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5817 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5818 | "%s: HDD context is not valid", __func__); |
| 5819 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5820 | } |
| 5821 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 5822 | if (vos_max_concurrent_connections_reached()) { |
| 5823 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 5824 | return -EINVAL; |
| 5825 | } |
| 5826 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5827 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5828 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | ) |
| 5830 | { |
| 5831 | beacon_data_t *old,*new; |
| 5832 | |
| 5833 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5835 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5836 | { |
| 5837 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 5838 | FL("already beacon info added to session(%d)"), |
| 5839 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5840 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5842 | |
| 5843 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 5844 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5845 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | { |
| 5847 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5848 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5849 | return -EINVAL; |
| 5850 | } |
| 5851 | |
| 5852 | pAdapter->sessionCtx.ap.beacon = new; |
| 5853 | |
| 5854 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 5855 | } |
| 5856 | |
| 5857 | EXIT(); |
| 5858 | return status; |
| 5859 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5860 | |
| 5861 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5862 | struct net_device *dev, |
| 5863 | struct beacon_parameters *params) |
| 5864 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5865 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5866 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5867 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5868 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | |
| 5870 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5871 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5872 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 5873 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 5874 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 5875 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5876 | pAdapter->device_mode); |
| 5877 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5878 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5879 | status = wlan_hdd_validate_context(pHddCtx); |
| 5880 | |
| 5881 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5882 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5884 | "%s: HDD context is not valid", __func__); |
| 5885 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5886 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5887 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5888 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5890 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5891 | { |
| 5892 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5894 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5895 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5896 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5897 | { |
| 5898 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5899 | FL("session(%d) old and new heads points to NULL"), |
| 5900 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5901 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5902 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5903 | |
| 5904 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 5905 | |
| 5906 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5907 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5908 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5909 | return -EINVAL; |
| 5910 | } |
| 5911 | |
| 5912 | pAdapter->sessionCtx.ap.beacon = new; |
| 5913 | |
| 5914 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 5915 | } |
| 5916 | |
| 5917 | EXIT(); |
| 5918 | return status; |
| 5919 | } |
| 5920 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5921 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 5922 | |
| 5923 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 5925 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5926 | #else |
| 5927 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 5928 | struct net_device *dev) |
| 5929 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | { |
| 5931 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5932 | hdd_context_t *pHddCtx = NULL; |
| 5933 | hdd_scaninfo_t *pScanInfo = NULL; |
| 5934 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5935 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5936 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | |
| 5938 | ENTER(); |
| 5939 | |
| 5940 | if (NULL == pAdapter) |
| 5941 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5942 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5943 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5944 | return -ENODEV; |
| 5945 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 5946 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5947 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5948 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 5949 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5950 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5951 | status = wlan_hdd_validate_context(pHddCtx); |
| 5952 | |
| 5953 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 5954 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5955 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5956 | "%s: HDD context is not valid", __func__); |
| 5957 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5958 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 5959 | |
| 5960 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 5961 | if (NULL == staAdapter) |
| 5962 | { |
| 5963 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 5964 | if (NULL == staAdapter) |
| 5965 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 5966 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5967 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 5968 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 5969 | } |
| 5970 | } |
| 5971 | |
| 5972 | pScanInfo = &pHddCtx->scan_info; |
| 5973 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5974 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 5975 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5976 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5978 | ret = wlan_hdd_scan_abort(pAdapter); |
| 5979 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 5980 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5981 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5982 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5983 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5984 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5985 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5986 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5987 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5988 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 5989 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5990 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5991 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5992 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 5993 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5994 | } |
| 5995 | |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 5996 | hdd_hostapd_stop(dev); |
| 5997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5999 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6000 | ) |
| 6001 | { |
| 6002 | beacon_data_t *old; |
| 6003 | |
| 6004 | old = pAdapter->sessionCtx.ap.beacon; |
| 6005 | |
| 6006 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6007 | { |
| 6008 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6009 | FL("session(%d) beacon data points to NULL"), |
| 6010 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6011 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6015 | |
| 6016 | mutex_lock(&pHddCtx->sap_lock); |
| 6017 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 6018 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6019 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6020 | { |
| 6021 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 6022 | |
| 6023 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 6024 | |
| 6025 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 6026 | { |
| 6027 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6028 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6029 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6030 | } |
| 6031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6033 | /* BSS stopped, clear the active sessions for this device mode */ |
| 6034 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6035 | } |
| 6036 | mutex_unlock(&pHddCtx->sap_lock); |
| 6037 | |
| 6038 | if(status != VOS_STATUS_SUCCESS) |
| 6039 | { |
| 6040 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6041 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6042 | return -EINVAL; |
| 6043 | } |
| 6044 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6045 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6046 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 6047 | ==eHAL_STATUS_FAILURE) |
| 6048 | { |
| 6049 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6050 | "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] | 6051 | } |
| 6052 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6053 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6054 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6055 | eANI_BOOLEAN_FALSE) ) |
| 6056 | { |
| 6057 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6058 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6059 | } |
| 6060 | |
| 6061 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6062 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 6063 | |
| 6064 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 6065 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6066 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6067 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 6068 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 6069 | { |
| 6070 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 6071 | "GO got removed"); |
| 6072 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 6073 | } |
| 6074 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6075 | } |
| 6076 | EXIT(); |
| 6077 | return status; |
| 6078 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6079 | |
| 6080 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6081 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6082 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 6083 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6084 | struct cfg80211_ap_settings *params) |
| 6085 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6086 | hdd_adapter_t *pAdapter; |
| 6087 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6088 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6089 | |
| 6090 | ENTER(); |
| 6091 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6092 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6093 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6094 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6095 | "%s: Device is Null", __func__); |
| 6096 | return -ENODEV; |
| 6097 | } |
| 6098 | |
| 6099 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6100 | if (NULL == pAdapter) |
| 6101 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6102 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6103 | "%s: HDD adapter is Null", __func__); |
| 6104 | return -ENODEV; |
| 6105 | } |
| 6106 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6107 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6108 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 6109 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6110 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 6111 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6113 | "%s: HDD adapter magic is invalid", __func__); |
| 6114 | return -ENODEV; |
| 6115 | } |
| 6116 | |
| 6117 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6118 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6119 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6120 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6121 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6122 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6123 | "%s: HDD context is not valid", __func__); |
| 6124 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6125 | } |
| 6126 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6127 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 6128 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6129 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6130 | |
| 6131 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6132 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6133 | ) |
| 6134 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6135 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6136 | |
| 6137 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6138 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6139 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6140 | { |
| 6141 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 6142 | FL("already beacon info added to session(%d)"), |
| 6143 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6144 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6145 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6146 | |
| 6147 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 6148 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6149 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6150 | { |
| 6151 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6152 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6153 | return -EINVAL; |
| 6154 | } |
| 6155 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6156 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6157 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 6158 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 6159 | params->channel, params->channel_type); |
| 6160 | #else |
| 6161 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 6162 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6163 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6164 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 6165 | params->ssid_len, params->hidden_ssid); |
| 6166 | } |
| 6167 | |
| 6168 | EXIT(); |
| 6169 | return status; |
| 6170 | } |
| 6171 | |
| 6172 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6173 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6174 | struct net_device *dev, |
| 6175 | struct cfg80211_beacon_data *params) |
| 6176 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6177 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6178 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6179 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6180 | |
| 6181 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6182 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6183 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6184 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 6185 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6186 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6187 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6188 | |
| 6189 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6190 | status = wlan_hdd_validate_context(pHddCtx); |
| 6191 | |
| 6192 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6193 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6194 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6195 | "%s: HDD context is not valid", __func__); |
| 6196 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6197 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6198 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6199 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6200 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6201 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6202 | { |
| 6203 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6204 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6205 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6206 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6207 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6208 | { |
| 6209 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6210 | FL("session(%d) beacon data points to NULL"), |
| 6211 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6212 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6213 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6214 | |
| 6215 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 6216 | |
| 6217 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6218 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6219 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6220 | return -EINVAL; |
| 6221 | } |
| 6222 | |
| 6223 | pAdapter->sessionCtx.ap.beacon = new; |
| 6224 | |
| 6225 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 6226 | } |
| 6227 | |
| 6228 | EXIT(); |
| 6229 | return status; |
| 6230 | } |
| 6231 | |
| 6232 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6233 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6234 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6235 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6236 | struct net_device *dev, |
| 6237 | struct bss_parameters *params) |
| 6238 | { |
| 6239 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6240 | |
| 6241 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6242 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6243 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6244 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 6245 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6246 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6247 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6248 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6249 | |
| 6250 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6251 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6252 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6253 | { |
| 6254 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 6255 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6256 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6257 | { |
| 6258 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | } |
| 6261 | |
| 6262 | EXIT(); |
| 6263 | return 0; |
| 6264 | } |
| 6265 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6266 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 6267 | struct net_device *dev, |
| 6268 | struct bss_parameters *params) |
| 6269 | { |
| 6270 | int ret; |
| 6271 | |
| 6272 | vos_ssr_protect(__func__); |
| 6273 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 6274 | vos_ssr_unprotect(__func__); |
| 6275 | |
| 6276 | return ret; |
| 6277 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6278 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 6279 | * to wait for contry code completion |
| 6280 | */ |
| 6281 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 6282 | { |
| 6283 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 6284 | complete(&call_back_pAdapter->change_country_code); |
| 6285 | return NULL; |
| 6286 | } |
| 6287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6288 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6289 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6290 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 6291 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6292 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6293 | struct net_device *ndev, |
| 6294 | enum nl80211_iftype type, |
| 6295 | u32 *flags, |
| 6296 | struct vif_params *params |
| 6297 | ) |
| 6298 | { |
| 6299 | struct wireless_dev *wdev; |
| 6300 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6301 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6302 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6303 | tCsrRoamProfile *pRoamProfile = NULL; |
| 6304 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6305 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | eMib_dot11DesiredBssType connectedBssType; |
| 6307 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6308 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6309 | |
| 6310 | ENTER(); |
| 6311 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6312 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6313 | { |
| 6314 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6315 | "%s: Adapter context is null", __func__); |
| 6316 | return VOS_STATUS_E_FAILURE; |
| 6317 | } |
| 6318 | |
| 6319 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6320 | if (!pHddCtx) |
| 6321 | { |
| 6322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6323 | "%s: HDD context is null", __func__); |
| 6324 | return VOS_STATUS_E_FAILURE; |
| 6325 | } |
| 6326 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6327 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6328 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 6329 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6330 | status = wlan_hdd_validate_context(pHddCtx); |
| 6331 | |
| 6332 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6334 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6335 | "%s: HDD context is not valid", __func__); |
| 6336 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6337 | } |
| 6338 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6339 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6340 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6341 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6342 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6343 | if (vos_max_concurrent_connections_reached()) { |
| 6344 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6345 | return -EINVAL; |
| 6346 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6347 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | wdev = ndev->ieee80211_ptr; |
| 6349 | |
| 6350 | #ifdef WLAN_BTAMP_FEATURE |
| 6351 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 6352 | (NL80211_IFTYPE_ADHOC == type)|| |
| 6353 | (NL80211_IFTYPE_AP == type)|| |
| 6354 | (NL80211_IFTYPE_P2P_GO == type)) |
| 6355 | { |
| 6356 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 6357 | // stop AMP traffic |
| 6358 | status = WLANBAP_StopAmp(); |
| 6359 | if(VOS_STATUS_SUCCESS != status ) |
| 6360 | { |
| 6361 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 6362 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6363 | "%s: Failed to stop AMP", __func__); |
| 6364 | return -EINVAL; |
| 6365 | } |
| 6366 | } |
| 6367 | #endif //WLAN_BTAMP_FEATURE |
| 6368 | /* Reset the current device mode bit mask*/ |
| 6369 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 6370 | |
| 6371 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6372 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6373 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | ) |
| 6375 | { |
| 6376 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6377 | if (!pWextState) |
| 6378 | { |
| 6379 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6380 | "%s: pWextState is null", __func__); |
| 6381 | return VOS_STATUS_E_FAILURE; |
| 6382 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6383 | pRoamProfile = &pWextState->roamProfile; |
| 6384 | LastBSSType = pRoamProfile->BSSType; |
| 6385 | |
| 6386 | switch (type) |
| 6387 | { |
| 6388 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6389 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6390 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6391 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 6392 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6393 | #ifdef WLAN_FEATURE_11AC |
| 6394 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 6395 | { |
| 6396 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 6397 | } |
| 6398 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6399 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6400 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6401 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6402 | //Check for sub-string p2p to confirm its a p2p interface |
| 6403 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6404 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6405 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 6406 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 6407 | } |
| 6408 | else |
| 6409 | { |
| 6410 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6411 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6412 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6413 | #ifdef FEATURE_WLAN_TDLS |
| 6414 | /* The open adapter for the p2p shall skip initializations in |
| 6415 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 6416 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 6417 | * tdls_init when the change_iface sets the device mode to |
| 6418 | * WLAN_HDD_P2P_CLIENT. |
| 6419 | */ |
| 6420 | |
| 6421 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 6422 | { |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 6423 | if (0 != wlan_hdd_sta_tdls_init (pAdapter)) |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6424 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6425 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6426 | "%s: tdls initialization failed", __func__); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6427 | return -EINVAL; |
| 6428 | } |
| 6429 | } |
| 6430 | #endif |
| 6431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6432 | break; |
| 6433 | case NL80211_IFTYPE_ADHOC: |
| 6434 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6435 | "%s: setting interface Type to ADHOC", __func__); |
| 6436 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 6437 | pRoamProfile->phyMode = |
| 6438 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 6439 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6440 | wdev->iftype = type; |
| 6441 | break; |
| 6442 | |
| 6443 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6444 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6445 | { |
| 6446 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6447 | "%s: setting interface Type to %s", __func__, |
| 6448 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 6449 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6450 | //Cancel any remain on channel for GO mode |
| 6451 | if (NL80211_IFTYPE_P2P_GO == type) |
| 6452 | { |
| 6453 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 6454 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6455 | if (NL80211_IFTYPE_AP == type) |
| 6456 | { |
| 6457 | /* As Loading WLAN Driver one interface being created for p2p device |
| 6458 | * address. This will take one HW STA and the max number of clients |
| 6459 | * that can connect to softAP will be reduced by one. so while changing |
| 6460 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 6461 | * interface as it is not required in SoftAP mode. |
| 6462 | */ |
| 6463 | |
| 6464 | // Get P2P Adapter |
| 6465 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 6466 | |
| 6467 | if (pP2pAdapter) |
| 6468 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 6469 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6470 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 6471 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 6472 | } |
| 6473 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 6474 | //Disable IMPS & BMPS for SAP/GO |
| 6475 | if(VOS_STATUS_E_FAILURE == |
| 6476 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 6477 | { |
| 6478 | //Fail to Exit BMPS |
| 6479 | VOS_ASSERT(0); |
| 6480 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6481 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6482 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6483 | /* A Mutex Lock is introduced while changing the mode to |
| 6484 | * protect the concurrent access for the Adapters by TDLS |
| 6485 | * module. |
| 6486 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6487 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6488 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6489 | //De-init the adapter. |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 6490 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6491 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 6492 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6493 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 6494 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6495 | #ifdef FEATURE_WLAN_TDLS |
| 6496 | mutex_unlock(&pHddCtx->tdls_lock); |
| 6497 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 6498 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 6499 | (pConfig->apRandomBssidEnabled)) |
| 6500 | { |
| 6501 | /* To meet Android requirements create a randomized |
| 6502 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 6503 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 6504 | ndev->dev_addr[0] = 0x02; |
| 6505 | ndev->dev_addr[1] = 0x1A; |
| 6506 | ndev->dev_addr[2] = 0x11; |
| 6507 | ndev->dev_addr[3] |= 0xF0; |
| 6508 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 6509 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 6510 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 6511 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 6512 | } |
| 6513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | hdd_set_ap_ops( pAdapter->dev ); |
| 6515 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6516 | /* This is for only SAP mode where users can |
| 6517 | * control country through ini. |
| 6518 | * P2P GO follows station country code |
| 6519 | * acquired during the STA scanning. */ |
| 6520 | if((NL80211_IFTYPE_AP == type) && |
| 6521 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 6522 | { |
| 6523 | int status = 0; |
| 6524 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 6525 | "%s: setting country code from INI ", __func__); |
| 6526 | init_completion(&pAdapter->change_country_code); |
| 6527 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 6528 | (void *)(tSmeChangeCountryCallback) |
| 6529 | wlan_hdd_change_country_code_cb, |
| 6530 | pConfig->apCntryCode, pAdapter, |
| 6531 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 6532 | eSIR_FALSE, |
| 6533 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6534 | if (eHAL_STATUS_SUCCESS == status) |
| 6535 | { |
| 6536 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6537 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6538 | &pAdapter->change_country_code, |
| 6539 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6540 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6541 | { |
| 6542 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6543 | FL("SME Timed out while setting country code %ld"), |
| 6544 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 6545 | |
| 6546 | if (pHddCtx->isLogpInProgress) |
| 6547 | { |
| 6548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6549 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 6550 | return -EAGAIN; |
| 6551 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6552 | } |
| 6553 | } |
| 6554 | else |
| 6555 | { |
| 6556 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6557 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6558 | return -EINVAL; |
| 6559 | } |
| 6560 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6561 | status = hdd_init_ap_mode(pAdapter); |
| 6562 | if(status != VOS_STATUS_SUCCESS) |
| 6563 | { |
| 6564 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6565 | "%s: Error initializing the ap mode", __func__); |
| 6566 | return -EINVAL; |
| 6567 | } |
| 6568 | hdd_set_conparam(1); |
| 6569 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6570 | /*interface type changed update in wiphy structure*/ |
| 6571 | if(wdev) |
| 6572 | { |
| 6573 | wdev->iftype = type; |
| 6574 | pHddCtx->change_iface = type; |
| 6575 | } |
| 6576 | else |
| 6577 | { |
| 6578 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6579 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 6580 | return -EINVAL; |
| 6581 | } |
| 6582 | goto done; |
| 6583 | } |
| 6584 | |
| 6585 | default: |
| 6586 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 6587 | __func__); |
| 6588 | return -EOPNOTSUPP; |
| 6589 | } |
| 6590 | } |
| 6591 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6592 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | ) |
| 6594 | { |
| 6595 | switch(type) |
| 6596 | { |
| 6597 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6598 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6599 | case NL80211_IFTYPE_ADHOC: |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6600 | #ifdef FEATURE_WLAN_TDLS |
| 6601 | |
| 6602 | /* A Mutex Lock is introduced while changing the mode to |
| 6603 | * protect the concurrent access for the Adapters by TDLS |
| 6604 | * module. |
| 6605 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6606 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6607 | #endif |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 6608 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6609 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6610 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6611 | //Check for sub-string p2p to confirm its a p2p interface |
| 6612 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6613 | { |
| 6614 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 6615 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 6616 | } |
| 6617 | else |
| 6618 | { |
| 6619 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6621 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6622 | hdd_set_conparam(0); |
| 6623 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6624 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 6625 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6626 | #ifdef FEATURE_WLAN_TDLS |
| 6627 | mutex_unlock(&pHddCtx->tdls_lock); |
| 6628 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 6629 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | if( VOS_STATUS_SUCCESS != status ) |
| 6631 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6632 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 6633 | * This is the right place to enable back bmps_imps() |
| 6634 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 6635 | if (pHddCtx->hdd_wlan_suspended) |
| 6636 | { |
| 6637 | hdd_set_pwrparams(pHddCtx); |
| 6638 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6639 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6640 | goto done; |
| 6641 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6643 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6644 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 6645 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | goto done; |
| 6647 | default: |
| 6648 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 6649 | __func__); |
| 6650 | return -EOPNOTSUPP; |
| 6651 | |
| 6652 | } |
| 6653 | |
| 6654 | } |
| 6655 | else |
| 6656 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6657 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 6658 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6659 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | return -EOPNOTSUPP; |
| 6661 | } |
| 6662 | |
| 6663 | |
| 6664 | if(pRoamProfile) |
| 6665 | { |
| 6666 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 6667 | { |
| 6668 | /*interface type changed update in wiphy structure*/ |
| 6669 | wdev->iftype = type; |
| 6670 | |
| 6671 | /*the BSS mode changed, We need to issue disconnect |
| 6672 | if connected or in IBSS disconnect state*/ |
| 6673 | if ( hdd_connGetConnectedBssType( |
| 6674 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 6675 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 6676 | { |
| 6677 | /*need to issue a disconnect to CSR.*/ |
| 6678 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 6679 | if( eHAL_STATUS_SUCCESS == |
| 6680 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6681 | pAdapter->sessionId, |
| 6682 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 6683 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6684 | ret = wait_for_completion_interruptible_timeout( |
| 6685 | &pAdapter->disconnect_comp_var, |
| 6686 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 6687 | if (ret <= 0) |
| 6688 | { |
| 6689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6690 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 6691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6692 | } |
| 6693 | } |
| 6694 | } |
| 6695 | } |
| 6696 | |
| 6697 | done: |
| 6698 | /*set bitmask based on updated value*/ |
| 6699 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 6700 | |
| 6701 | /* Only STA mode support TM now |
| 6702 | * all other mode, TM feature should be disabled */ |
| 6703 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 6704 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 6705 | { |
| 6706 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 6707 | } |
| 6708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6709 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6710 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6711 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6712 | { |
| 6713 | //we are ok to do AMP |
| 6714 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 6715 | } |
| 6716 | #endif //WLAN_BTAMP_FEATURE |
| 6717 | EXIT(); |
| 6718 | return 0; |
| 6719 | } |
| 6720 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6721 | /* |
| 6722 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 6723 | * wrapper function to protect the actual implementation from SSR. |
| 6724 | */ |
| 6725 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 6726 | struct net_device *ndev, |
| 6727 | enum nl80211_iftype type, |
| 6728 | u32 *flags, |
| 6729 | struct vif_params *params |
| 6730 | ) |
| 6731 | { |
| 6732 | int ret; |
| 6733 | |
| 6734 | vos_ssr_protect(__func__); |
| 6735 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 6736 | vos_ssr_unprotect(__func__); |
| 6737 | |
| 6738 | return ret; |
| 6739 | } |
| 6740 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6741 | #ifdef FEATURE_WLAN_TDLS |
| 6742 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 6743 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 6744 | { |
| 6745 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6746 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6747 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6748 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6749 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6750 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6751 | |
| 6752 | ENTER(); |
| 6753 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 6754 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6755 | { |
| 6756 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6757 | "Invalid arguments"); |
| 6758 | return -EINVAL; |
| 6759 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 6760 | |
| 6761 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 6762 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 6763 | { |
| 6764 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6765 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 6766 | MAC_ADDRESS_STR " Request declined.", |
| 6767 | __func__, MAC_ADDR_ARRAY(mac)); |
| 6768 | return -ENOTSUPP; |
| 6769 | } |
| 6770 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6771 | if (pHddCtx->isLogpInProgress) |
| 6772 | { |
| 6773 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6774 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 6775 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6776 | return -EBUSY; |
| 6777 | } |
| 6778 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 6779 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6780 | |
| 6781 | if ( NULL == pTdlsPeer ) { |
| 6782 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6783 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 6784 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 6785 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 6786 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6787 | |
| 6788 | /* in add station, we accept existing valid staId if there is */ |
| 6789 | if ((0 == update) && |
| 6790 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 6791 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6792 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6793 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6794 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6795 | " link_status %d. staId %d. add station ignored.", |
| 6796 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 6797 | return 0; |
| 6798 | } |
| 6799 | /* in change station, we accept only when staId is valid */ |
| 6800 | if ((1 == update) && |
| 6801 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 6802 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 6803 | { |
| 6804 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6805 | "%s: " MAC_ADDRESS_STR |
| 6806 | " link status %d. staId %d. change station %s.", |
| 6807 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 6808 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 6809 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6810 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 6811 | |
| 6812 | /* 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] | 6813 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6814 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6815 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6816 | "%s: " MAC_ADDRESS_STR |
| 6817 | " TDLS setup is ongoing. Request declined.", |
| 6818 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 6819 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6820 | } |
| 6821 | |
| 6822 | /* first to check if we reached to maximum supported TDLS peer. |
| 6823 | TODO: for now, return -EPERM looks working fine, |
| 6824 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6825 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 6826 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6827 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6828 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6829 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6830 | " TDLS Max peer already connected. Request declined." |
| 6831 | " Num of peers (%d), Max allowed (%d).", |
| 6832 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 6833 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 6834 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6835 | } |
| 6836 | else |
| 6837 | { |
| 6838 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6839 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6840 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6841 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6842 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6843 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 6844 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6845 | return -EPERM; |
| 6846 | } |
| 6847 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6848 | if (0 == update) |
| 6849 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_CONNECTING); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6850 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 6851 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 6852 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6853 | { |
| 6854 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6855 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 6856 | if(StaParams->htcap_present) |
| 6857 | { |
| 6858 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6859 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 6860 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6861 | "ht_capa->extended_capabilities: %0x", |
| 6862 | StaParams->HTCap.extendedHtCapInfo); |
| 6863 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6864 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6865 | "params->capability: %0x",StaParams->capability); |
| 6866 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 6867 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 6868 | if(StaParams->vhtcap_present) |
| 6869 | { |
| 6870 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6871 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 6872 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 6873 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 6874 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6875 | { |
| 6876 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 6877 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6878 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 6879 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 6880 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 6881 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 6882 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 6883 | else if ((1 == update) && (NULL == StaParams)) |
| 6884 | { |
| 6885 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6886 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 6887 | return -EPERM; |
| 6888 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6889 | |
| 6890 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 6891 | |
| 6892 | if (!update) |
| 6893 | { |
| 6894 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6895 | pAdapter->sessionId, mac); |
| 6896 | } |
| 6897 | else |
| 6898 | { |
| 6899 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6900 | pAdapter->sessionId, mac, StaParams); |
| 6901 | } |
| 6902 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6903 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6904 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 6905 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6906 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6907 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6908 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6909 | "%s: timeout waiting for tdls add station indication %ld", |
| 6910 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 6911 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6912 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6913 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6914 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 6915 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 6916 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6917 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 6918 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6919 | } |
| 6920 | |
| 6921 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 6922 | |
| 6923 | error: |
| 6924 | wlan_hdd_tdls_set_link_status(pAdapter, mac, eTDLS_LINK_IDLE); |
| 6925 | return -EPERM; |
| 6926 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6927 | } |
| 6928 | #endif |
| 6929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6930 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 6931 | struct net_device *dev, |
| 6932 | u8 *mac, |
| 6933 | struct station_parameters *params) |
| 6934 | { |
| 6935 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 6936 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6937 | hdd_context_t *pHddCtx; |
| 6938 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6939 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 6940 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6941 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6942 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 6943 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 6944 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6945 | ENTER(); |
| 6946 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6947 | if ((NULL == pAdapter)) |
| 6948 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6950 | "invalid adapter "); |
| 6951 | return -EINVAL; |
| 6952 | } |
| 6953 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6954 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6955 | TRACE_CODE_HDD_CHANGE_STATION, |
| 6956 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6957 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6958 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6959 | |
| 6960 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 6961 | { |
| 6962 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6963 | "invalid HDD state or HDD station context"); |
| 6964 | return -EINVAL; |
| 6965 | } |
| 6966 | |
| 6967 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6968 | { |
| 6969 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6970 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6971 | return -EAGAIN; |
| 6972 | } |
| 6973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6974 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 6975 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6976 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 6977 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6978 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6979 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6980 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6981 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6982 | WLANTL_STA_AUTHENTICATED); |
| 6983 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6984 | if (status != VOS_STATUS_SUCCESS) |
| 6985 | { |
| 6986 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6987 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 6988 | return -EINVAL; |
| 6989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | } |
| 6991 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 6992 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 6993 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 6994 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 6995 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 6996 | StaParams.capability = params->capability; |
| 6997 | StaParams.uapsd_queues = params->uapsd_queues; |
| 6998 | StaParams.max_sp = params->max_sp; |
| 6999 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7000 | /* Convert (first channel , number of channels) tuple to |
| 7001 | * the total list of channels. This goes with the assumption |
| 7002 | * that if the first channel is < 14, then the next channels |
| 7003 | * are an incremental of 1 else an incremental of 4 till the number |
| 7004 | * of channels. |
| 7005 | */ |
| 7006 | if (0 != params->supported_channels_len) { |
| 7007 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 7008 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 7009 | { |
| 7010 | int wifi_chan_index; |
| 7011 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 7012 | wifi_chan_index = |
| 7013 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 7014 | no_of_channels = params->supported_channels[i+1]; |
| 7015 | for(k=1; k <= no_of_channels; k++) |
| 7016 | { |
| 7017 | StaParams.supported_channels[j+1] = |
| 7018 | StaParams.supported_channels[j] + wifi_chan_index; |
| 7019 | j+=1; |
| 7020 | } |
| 7021 | } |
| 7022 | StaParams.supported_channels_len = j; |
| 7023 | } |
| 7024 | vos_mem_copy(StaParams.supported_oper_classes, |
| 7025 | params->supported_oper_classes, |
| 7026 | params->supported_oper_classes_len); |
| 7027 | StaParams.supported_oper_classes_len = |
| 7028 | params->supported_oper_classes_len; |
| 7029 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7030 | if (0 != params->ext_capab_len) |
| 7031 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 7032 | sizeof(StaParams.extn_capability)); |
| 7033 | |
| 7034 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7035 | { |
| 7036 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7037 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7038 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7039 | |
| 7040 | StaParams.supported_rates_len = params->supported_rates_len; |
| 7041 | |
| 7042 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 7043 | * The supported_rates array , for all the structures propogating till Add Sta |
| 7044 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 7045 | * modified to send more rates. |
| 7046 | */ |
| 7047 | |
| 7048 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 7049 | */ |
| 7050 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 7051 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 7052 | |
| 7053 | if (0 != StaParams.supported_rates_len) { |
| 7054 | int i = 0; |
| 7055 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 7056 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7057 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7058 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 7059 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7060 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7061 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 7062 | } |
| 7063 | |
| 7064 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7065 | { |
| 7066 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7067 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7068 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7069 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7070 | if (0 != params->ext_capab_len ) { |
| 7071 | /*Define A Macro : TODO Sunil*/ |
| 7072 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 7073 | isBufSta = 1; |
| 7074 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7075 | /* TDLS Channel Switching Support */ |
| 7076 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 7077 | isOffChannelSupported = 1; |
| 7078 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7079 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7080 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 7081 | &StaParams, isBufSta, |
| 7082 | isOffChannelSupported); |
| 7083 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 7084 | if (VOS_STATUS_SUCCESS != status) { |
| 7085 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7086 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 7087 | return -EINVAL; |
| 7088 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7089 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 7090 | |
| 7091 | if (VOS_STATUS_SUCCESS != status) { |
| 7092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7093 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 7094 | return -EINVAL; |
| 7095 | } |
| 7096 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7097 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 7098 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7099 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7100 | return status; |
| 7101 | } |
| 7102 | |
| 7103 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7104 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | * This function is used to initialize the key information |
| 7106 | */ |
| 7107 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7108 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7109 | struct net_device *ndev, |
| 7110 | u8 key_index, bool pairwise, |
| 7111 | const u8 *mac_addr, |
| 7112 | struct key_params *params |
| 7113 | ) |
| 7114 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7115 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7116 | struct net_device *ndev, |
| 7117 | u8 key_index, const u8 *mac_addr, |
| 7118 | struct key_params *params |
| 7119 | ) |
| 7120 | #endif |
| 7121 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7122 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7123 | tCsrRoamSetKey setKey; |
| 7124 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7125 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7126 | v_U32_t roamId= 0xFF; |
| 7127 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7128 | hdd_hostapd_state_t *pHostapdState; |
| 7129 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7130 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7131 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7132 | |
| 7133 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7134 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7135 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7136 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 7137 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7138 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7139 | status = wlan_hdd_validate_context(pHddCtx); |
| 7140 | |
| 7141 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7142 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7143 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7144 | "%s: HDD context is not valid", __func__); |
| 7145 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7146 | } |
| 7147 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7148 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7149 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7150 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7151 | |
| 7152 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7153 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7154 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7155 | key_index); |
| 7156 | |
| 7157 | return -EINVAL; |
| 7158 | } |
| 7159 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7160 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 7161 | { |
| 7162 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 7163 | params->key_len); |
| 7164 | |
| 7165 | return -EINVAL; |
| 7166 | } |
| 7167 | |
| 7168 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7169 | "%s: called with key index = %d & key length %d", |
| 7170 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7171 | |
| 7172 | /*extract key idx, key len and key*/ |
| 7173 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7174 | setKey.keyId = key_index; |
| 7175 | setKey.keyLength = params->key_len; |
| 7176 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 7177 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7178 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7179 | { |
| 7180 | case WLAN_CIPHER_SUITE_WEP40: |
| 7181 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 7182 | break; |
| 7183 | |
| 7184 | case WLAN_CIPHER_SUITE_WEP104: |
| 7185 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 7186 | break; |
| 7187 | |
| 7188 | case WLAN_CIPHER_SUITE_TKIP: |
| 7189 | { |
| 7190 | u8 *pKey = &setKey.Key[0]; |
| 7191 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 7192 | |
| 7193 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 7194 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7195 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | |
| 7197 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7198 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7199 | |--------------|----------|----------| |
| 7200 | <---16bytes---><--8bytes--><--8bytes--> |
| 7201 | |
| 7202 | */ |
| 7203 | /*Sme expects the 32 bytes key to be in the below order |
| 7204 | |
| 7205 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7206 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7207 | |--------------|----------|----------| |
| 7208 | <---16bytes---><--8bytes--><--8bytes--> |
| 7209 | */ |
| 7210 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7211 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7212 | |
| 7213 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7214 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7215 | |
| 7216 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7217 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7218 | |
| 7219 | |
| 7220 | break; |
| 7221 | } |
| 7222 | |
| 7223 | case WLAN_CIPHER_SUITE_CCMP: |
| 7224 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 7225 | break; |
| 7226 | |
| 7227 | #ifdef FEATURE_WLAN_WAPI |
| 7228 | case WLAN_CIPHER_SUITE_SMS4: |
| 7229 | { |
| 7230 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7231 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 7232 | params->key, params->key_len); |
| 7233 | return 0; |
| 7234 | } |
| 7235 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7236 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7237 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7238 | case WLAN_CIPHER_SUITE_KRK: |
| 7239 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 7240 | break; |
| 7241 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7242 | |
| 7243 | #ifdef WLAN_FEATURE_11W |
| 7244 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 7245 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 7246 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7247 | #endif |
| 7248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7249 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7250 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7251 | __func__, params->cipher); |
| 7252 | return -EOPNOTSUPP; |
| 7253 | } |
| 7254 | |
| 7255 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 7256 | __func__, setKey.encType); |
| 7257 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7258 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7259 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7260 | (!pairwise) |
| 7261 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7262 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7263 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7264 | ) |
| 7265 | { |
| 7266 | /* set group key*/ |
| 7267 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7268 | "%s- %d: setting Broadcast key", |
| 7269 | __func__, __LINE__); |
| 7270 | setKey.keyDirection = eSIR_RX_ONLY; |
| 7271 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 7272 | } |
| 7273 | else |
| 7274 | { |
| 7275 | /* set pairwise key*/ |
| 7276 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7277 | "%s- %d: setting pairwise key", |
| 7278 | __func__, __LINE__); |
| 7279 | setKey.keyDirection = eSIR_TX_RX; |
| 7280 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 7281 | } |
| 7282 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 7283 | { |
| 7284 | setKey.keyDirection = eSIR_TX_RX; |
| 7285 | /*Set the group key*/ |
| 7286 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7287 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7288 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7289 | if ( 0 != status ) |
| 7290 | { |
| 7291 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7292 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 7293 | return -EINVAL; |
| 7294 | } |
| 7295 | /*Save the keys here and call sme_RoamSetKey for setting |
| 7296 | the PTK after peer joins the IBSS network*/ |
| 7297 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 7298 | &setKey, sizeof(tCsrRoamSetKey)); |
| 7299 | return status; |
| 7300 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7301 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 7302 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7303 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7304 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7305 | if( pHostapdState->bssState == BSS_START ) |
| 7306 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 7307 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7308 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 7309 | |
| 7310 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 7311 | { |
| 7312 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7313 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 7314 | __LINE__, vos_status ); |
| 7315 | |
| 7316 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7317 | |
| 7318 | return -EINVAL; |
| 7319 | } |
| 7320 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7321 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 7322 | |
| 7323 | if ( status != eHAL_STATUS_SUCCESS ) |
| 7324 | { |
| 7325 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7326 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 7327 | __LINE__, status ); |
| 7328 | } |
| 7329 | } |
| 7330 | |
| 7331 | /* Saving WEP keys */ |
| 7332 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 7333 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 7334 | { |
| 7335 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 7336 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 7337 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 7338 | } |
| 7339 | else |
| 7340 | { |
| 7341 | //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] | 7342 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7343 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 7344 | } |
| 7345 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7346 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 7347 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7348 | { |
| 7349 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7350 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7351 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7352 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7353 | if (!pairwise) |
| 7354 | #else |
| 7355 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 7356 | #endif |
| 7357 | { |
| 7358 | /* set group key*/ |
| 7359 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 7360 | { |
| 7361 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7362 | "%s- %d: Perform Set key Complete", |
| 7363 | __func__, __LINE__); |
| 7364 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 7365 | } |
| 7366 | } |
| 7367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7368 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 7369 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 7370 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 7371 | |
| 7372 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7373 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7374 | params->key, params->key_len); |
| 7375 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7377 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 7378 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7379 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7380 | "%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] | 7381 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 7382 | setKey.peerMac[2], setKey.peerMac[3], |
| 7383 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7384 | setKey.keyDirection); |
| 7385 | |
| 7386 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 7387 | |
| 7388 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 7389 | { |
| 7390 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7391 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 7392 | __LINE__, vos_status ); |
| 7393 | |
| 7394 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7395 | |
| 7396 | return -EINVAL; |
| 7397 | |
| 7398 | } |
| 7399 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7400 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7401 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 7402 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 7403 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7404 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7405 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7406 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7407 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 7408 | "%s: Update PreAuth Key success", __func__); |
| 7409 | return 0; |
| 7410 | } |
| 7411 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 7412 | { |
| 7413 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7414 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 7415 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7416 | } |
| 7417 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7418 | |
| 7419 | /* issue set key request to SME*/ |
| 7420 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7421 | pAdapter->sessionId, &setKey, &roamId ); |
| 7422 | |
| 7423 | if ( 0 != status ) |
| 7424 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7425 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7426 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 7427 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7428 | return -EINVAL; |
| 7429 | } |
| 7430 | |
| 7431 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7432 | /* in case of IBSS as there was no information available about WEP keys during |
| 7433 | * 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] | 7434 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7435 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 7436 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 7437 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7438 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 7439 | ) |
| 7440 | && |
| 7441 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 7442 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 7443 | ) |
| 7444 | ) |
| 7445 | { |
| 7446 | setKey.keyDirection = eSIR_RX_ONLY; |
| 7447 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 7448 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7449 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7450 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7451 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 7452 | setKey.peerMac[2], setKey.peerMac[3], |
| 7453 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7454 | setKey.keyDirection); |
| 7455 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7456 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7457 | pAdapter->sessionId, &setKey, &roamId ); |
| 7458 | |
| 7459 | if ( 0 != status ) |
| 7460 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7461 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7462 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7463 | __func__, status); |
| 7464 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7465 | return -EINVAL; |
| 7466 | } |
| 7467 | } |
| 7468 | } |
| 7469 | |
| 7470 | return 0; |
| 7471 | } |
| 7472 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7473 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7474 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 7475 | struct net_device *ndev, |
| 7476 | u8 key_index, bool pairwise, |
| 7477 | const u8 *mac_addr, |
| 7478 | struct key_params *params |
| 7479 | ) |
| 7480 | #else |
| 7481 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 7482 | struct net_device *ndev, |
| 7483 | u8 key_index, const u8 *mac_addr, |
| 7484 | struct key_params *params |
| 7485 | ) |
| 7486 | #endif |
| 7487 | { |
| 7488 | int ret; |
| 7489 | vos_ssr_protect(__func__); |
| 7490 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7491 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 7492 | mac_addr, params); |
| 7493 | #else |
| 7494 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 7495 | params); |
| 7496 | #endif |
| 7497 | vos_ssr_unprotect(__func__); |
| 7498 | |
| 7499 | return ret; |
| 7500 | } |
| 7501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7502 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7503 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7504 | * This function is used to get the key information |
| 7505 | */ |
| 7506 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7507 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7508 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7509 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7510 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7511 | const u8 *mac_addr, void *cookie, |
| 7512 | void (*callback)(void *cookie, struct key_params*) |
| 7513 | ) |
| 7514 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7515 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7516 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7517 | struct net_device *ndev, |
| 7518 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 7519 | void (*callback)(void *cookie, struct key_params*) |
| 7520 | ) |
| 7521 | #endif |
| 7522 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7523 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7524 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7525 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7526 | struct key_params params; |
| 7527 | |
| 7528 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7529 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7530 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7531 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7532 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7534 | memset(¶ms, 0, sizeof(params)); |
| 7535 | |
| 7536 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7537 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7538 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7539 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7540 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7541 | |
| 7542 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 7543 | { |
| 7544 | case eCSR_ENCRYPT_TYPE_NONE: |
| 7545 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 7546 | break; |
| 7547 | |
| 7548 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 7549 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 7550 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 7551 | break; |
| 7552 | |
| 7553 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 7554 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 7555 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 7556 | break; |
| 7557 | |
| 7558 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 7559 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 7560 | break; |
| 7561 | |
| 7562 | case eCSR_ENCRYPT_TYPE_AES: |
| 7563 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 7564 | break; |
| 7565 | |
| 7566 | default: |
| 7567 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 7568 | break; |
| 7569 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7570 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 7571 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7572 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 7573 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7575 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 7576 | params.seq_len = 0; |
| 7577 | params.seq = NULL; |
| 7578 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 7579 | callback(cookie, ¶ms); |
| 7580 | return 0; |
| 7581 | } |
| 7582 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7583 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7584 | static int wlan_hdd_cfg80211_get_key( |
| 7585 | struct wiphy *wiphy, |
| 7586 | struct net_device *ndev, |
| 7587 | u8 key_index, bool pairwise, |
| 7588 | const u8 *mac_addr, void *cookie, |
| 7589 | void (*callback)(void *cookie, struct key_params*) |
| 7590 | ) |
| 7591 | #else |
| 7592 | static int wlan_hdd_cfg80211_get_key( |
| 7593 | struct wiphy *wiphy, |
| 7594 | struct net_device *ndev, |
| 7595 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 7596 | void (*callback)(void *cookie, struct key_params*) |
| 7597 | ) |
| 7598 | #endif |
| 7599 | { |
| 7600 | int ret; |
| 7601 | |
| 7602 | vos_ssr_protect(__func__); |
| 7603 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7604 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 7605 | mac_addr, cookie, callback); |
| 7606 | #else |
| 7607 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 7608 | callback); |
| 7609 | #endif |
| 7610 | vos_ssr_unprotect(__func__); |
| 7611 | |
| 7612 | return ret; |
| 7613 | } |
| 7614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7615 | /* |
| 7616 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 7617 | * This function is used to delete the key information |
| 7618 | */ |
| 7619 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7620 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7621 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7622 | u8 key_index, |
| 7623 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7624 | const u8 *mac_addr |
| 7625 | ) |
| 7626 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7627 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7628 | struct net_device *ndev, |
| 7629 | u8 key_index, |
| 7630 | const u8 *mac_addr |
| 7631 | ) |
| 7632 | #endif |
| 7633 | { |
| 7634 | int status = 0; |
| 7635 | |
| 7636 | //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] | 7637 | //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] | 7638 | //it is observed that this is invalidating peer |
| 7639 | //key index whenever re-key is done. This is affecting data link. |
| 7640 | //It should be ok to ignore del_key. |
| 7641 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7642 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 7643 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7644 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 7645 | tCsrRoamSetKey setKey; |
| 7646 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7648 | ENTER(); |
| 7649 | |
| 7650 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 7651 | __func__,pAdapter->device_mode); |
| 7652 | |
| 7653 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7654 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7655 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7656 | key_index); |
| 7657 | |
| 7658 | return -EINVAL; |
| 7659 | } |
| 7660 | |
| 7661 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7662 | setKey.keyId = key_index; |
| 7663 | |
| 7664 | if (mac_addr) |
| 7665 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 7666 | else |
| 7667 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 7668 | |
| 7669 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 7670 | |
| 7671 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7672 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7673 | ) |
| 7674 | { |
| 7675 | |
| 7676 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7677 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7678 | if( pHostapdState->bssState == BSS_START) |
| 7679 | { |
| 7680 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7681 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7682 | if ( status != eHAL_STATUS_SUCCESS ) |
| 7683 | { |
| 7684 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7685 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 7686 | __LINE__, status ); |
| 7687 | } |
| 7688 | } |
| 7689 | } |
| 7690 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7691 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7692 | ) |
| 7693 | { |
| 7694 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7695 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7696 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 7697 | |
| 7698 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7699 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7700 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 7701 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7702 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7703 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 7704 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7705 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7706 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7707 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7709 | if ( 0 != status ) |
| 7710 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7712 | "%s: sme_RoamSetKey failure, returned %d", |
| 7713 | __func__, status); |
| 7714 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7715 | return -EINVAL; |
| 7716 | } |
| 7717 | } |
| 7718 | } |
| 7719 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7720 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7721 | return status; |
| 7722 | } |
| 7723 | |
| 7724 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7725 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7726 | * This function is used to set the default tx key index |
| 7727 | */ |
| 7728 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7729 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7730 | struct net_device *ndev, |
| 7731 | u8 key_index, |
| 7732 | bool unicast, bool multicast) |
| 7733 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7734 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | struct net_device *ndev, |
| 7736 | u8 key_index) |
| 7737 | #endif |
| 7738 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7739 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7740 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7741 | hdd_wext_state_t *pWextState; |
| 7742 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7743 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7744 | |
| 7745 | ENTER(); |
| 7746 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7747 | if ((NULL == pAdapter)) |
| 7748 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7749 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7750 | "invalid adapter"); |
| 7751 | return -EINVAL; |
| 7752 | } |
| 7753 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7754 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7755 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 7756 | pAdapter->sessionId, key_index)); |
| 7757 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7758 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7759 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7760 | |
| 7761 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 7762 | { |
| 7763 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7764 | "invalid Wext state or HDD context"); |
| 7765 | return -EINVAL; |
| 7766 | } |
| 7767 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7768 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7769 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7771 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7772 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7773 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7774 | key_index); |
| 7775 | |
| 7776 | return -EINVAL; |
| 7777 | } |
| 7778 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7779 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7780 | status = wlan_hdd_validate_context(pHddCtx); |
| 7781 | |
| 7782 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7783 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7784 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7785 | "%s: HDD context is not valid", __func__); |
| 7786 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7787 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7788 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7789 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7790 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7791 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7792 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7793 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 7794 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7795 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 7796 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7798 | { |
| 7799 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7800 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7802 | tCsrRoamSetKey setKey; |
| 7803 | v_U32_t roamId= 0xFF; |
| 7804 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7805 | |
| 7806 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7807 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | Keys->defaultIndex = (u8)key_index; |
| 7810 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7811 | setKey.keyId = key_index; |
| 7812 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7813 | |
| 7814 | vos_mem_copy(&setKey.Key[0], |
| 7815 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7816 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7817 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7818 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7819 | |
| 7820 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7821 | &pHddStaCtx->conn_info.bssId[0], |
| 7822 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7823 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7824 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 7825 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 7826 | eCSR_ENCRYPT_TYPE_WEP104) |
| 7827 | { |
| 7828 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 7829 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 7830 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 7831 | type(104) and switching encryption type to 40*/ |
| 7832 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 7833 | eCSR_ENCRYPT_TYPE_WEP40; |
| 7834 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 7835 | eCSR_ENCRYPT_TYPE_WEP40; |
| 7836 | } |
| 7837 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7838 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7839 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7841 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7842 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7845 | if ( 0 != status ) |
| 7846 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7847 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7848 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7849 | status); |
| 7850 | return -EINVAL; |
| 7851 | } |
| 7852 | } |
| 7853 | } |
| 7854 | |
| 7855 | /* In SoftAp mode setting key direction for default mode */ |
| 7856 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 7857 | { |
| 7858 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 7859 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 7860 | (eCSR_ENCRYPT_TYPE_AES != |
| 7861 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 7862 | ) |
| 7863 | { |
| 7864 | /* Saving key direction for default key index to TX default */ |
| 7865 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 7866 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 7867 | } |
| 7868 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7870 | return status; |
| 7871 | } |
| 7872 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7873 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7874 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 7875 | struct net_device *ndev, |
| 7876 | u8 key_index, |
| 7877 | bool unicast, bool multicast) |
| 7878 | #else |
| 7879 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 7880 | struct net_device *ndev, |
| 7881 | u8 key_index) |
| 7882 | #endif |
| 7883 | { |
| 7884 | int ret; |
| 7885 | vos_ssr_protect(__func__); |
| 7886 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7887 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 7888 | multicast); |
| 7889 | #else |
| 7890 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 7891 | #endif |
| 7892 | vos_ssr_unprotect(__func__); |
| 7893 | |
| 7894 | return ret; |
| 7895 | } |
| 7896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7897 | /* |
| 7898 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 7899 | * This function is used to inform the BSS details to nl80211 interface. |
| 7900 | */ |
| 7901 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 7902 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 7903 | { |
| 7904 | struct net_device *dev = pAdapter->dev; |
| 7905 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 7906 | struct wiphy *wiphy = wdev->wiphy; |
| 7907 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 7908 | int chan_no; |
| 7909 | int ie_length; |
| 7910 | const char *ie; |
| 7911 | unsigned int freq; |
| 7912 | struct ieee80211_channel *chan; |
| 7913 | int rssi = 0; |
| 7914 | struct cfg80211_bss *bss = NULL; |
| 7915 | |
| 7916 | ENTER(); |
| 7917 | |
| 7918 | if( NULL == pBssDesc ) |
| 7919 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7920 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7921 | return bss; |
| 7922 | } |
| 7923 | |
| 7924 | chan_no = pBssDesc->channelId; |
| 7925 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 7926 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 7927 | |
| 7928 | if( NULL == ie ) |
| 7929 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7930 | 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] | 7931 | return bss; |
| 7932 | } |
| 7933 | |
| 7934 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 7935 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 7936 | { |
| 7937 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 7938 | } |
| 7939 | else |
| 7940 | { |
| 7941 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 7942 | } |
| 7943 | #else |
| 7944 | freq = ieee80211_channel_to_frequency(chan_no); |
| 7945 | #endif |
| 7946 | |
| 7947 | chan = __ieee80211_get_channel(wiphy, freq); |
| 7948 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 7949 | if (!chan) { |
| 7950 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 7951 | return NULL; |
| 7952 | } |
| 7953 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 7954 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7955 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 7956 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7957 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7958 | pBssDesc->capabilityInfo, |
| 7959 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 7960 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7961 | } |
| 7962 | |
| 7963 | |
| 7964 | |
| 7965 | /* |
| 7966 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 7967 | * This function is used to inform the BSS details to nl80211 interface. |
| 7968 | */ |
| 7969 | struct cfg80211_bss* |
| 7970 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 7971 | tSirBssDescription *bss_desc |
| 7972 | ) |
| 7973 | { |
| 7974 | /* |
| 7975 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 7976 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 7977 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 7978 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 7979 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 7980 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 7981 | cfg80211_inform_bss_frame. |
| 7982 | */ |
| 7983 | struct net_device *dev = pAdapter->dev; |
| 7984 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 7985 | struct wiphy *wiphy = wdev->wiphy; |
| 7986 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 7987 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 7988 | qcom_ie_age *qie_age = NULL; |
| 7989 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 7990 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7991 | 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] | 7992 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7993 | const char *ie = |
| 7994 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 7995 | unsigned int freq; |
| 7996 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 7997 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7998 | struct cfg80211_bss *bss_status = NULL; |
| 7999 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 8000 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8001 | hdd_context_t *pHddCtx; |
| 8002 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8003 | #ifdef WLAN_OPEN_SOURCE |
| 8004 | struct timespec ts; |
| 8005 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8007 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8008 | status = wlan_hdd_validate_context(pHddCtx); |
| 8009 | |
| 8010 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8011 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8012 | { |
| 8013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8014 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8015 | return NULL; |
| 8016 | } |
| 8017 | |
| 8018 | |
| 8019 | if (0 != status) |
| 8020 | { |
| 8021 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8022 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8023 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8024 | } |
| 8025 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 8026 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8027 | if (!mgmt) |
| 8028 | { |
| 8029 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8030 | "%s: memory allocation failed ", __func__); |
| 8031 | return NULL; |
| 8032 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8033 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8034 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8035 | |
| 8036 | #ifdef WLAN_OPEN_SOURCE |
| 8037 | /* Android does not want the timestamp from the frame. |
| 8038 | Instead it wants a monotonic increasing value */ |
| 8039 | get_monotonic_boottime(&ts); |
| 8040 | mgmt->u.probe_resp.timestamp = |
| 8041 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 8042 | #else |
| 8043 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8044 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 8045 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8046 | |
| 8047 | #endif |
| 8048 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8049 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 8050 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 8051 | |
| 8052 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 8053 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 8054 | /* Assuming this is the last IE, copy at the end */ |
| 8055 | ie_length -=sizeof(qcom_ie_age); |
| 8056 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 8057 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 8058 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 8059 | qie_age->oui_1 = QCOM_OUI1; |
| 8060 | qie_age->oui_2 = QCOM_OUI2; |
| 8061 | qie_age->oui_3 = QCOM_OUI3; |
| 8062 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 8063 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 8064 | #endif |
| 8065 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8066 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 8067 | if (bss_desc->fProbeRsp) |
| 8068 | { |
| 8069 | mgmt->frame_control |= |
| 8070 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 8071 | } |
| 8072 | else |
| 8073 | { |
| 8074 | mgmt->frame_control |= |
| 8075 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 8076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8077 | |
| 8078 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8079 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8080 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 8081 | { |
| 8082 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 8083 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8084 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 8086 | |
| 8087 | { |
| 8088 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 8089 | } |
| 8090 | else |
| 8091 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8092 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 8093 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8094 | kfree(mgmt); |
| 8095 | return NULL; |
| 8096 | } |
| 8097 | #else |
| 8098 | freq = ieee80211_channel_to_frequency(chan_no); |
| 8099 | #endif |
| 8100 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8101 | /*when the band is changed on the fly using the GUI, three things are done |
| 8102 | * 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) |
| 8103 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 8104 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 8105 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 8106 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 8107 | * 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 |
| 8108 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 8109 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 8110 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 8111 | * So drop the bss and continue to next bss. |
| 8112 | */ |
| 8113 | if(chan == NULL) |
| 8114 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8115 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8116 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8117 | return NULL; |
| 8118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8119 | /*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] | 8120 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8121 | * */ |
| 8122 | if (( eConnectionState_Associated == |
| 8123 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 8124 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 8125 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 8126 | WNI_CFG_BSSID_LEN))) |
| 8127 | { |
| 8128 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 8129 | rssi = (pAdapter->rssi * 100); |
| 8130 | } |
| 8131 | else |
| 8132 | { |
| 8133 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 8134 | } |
| 8135 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8136 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 8137 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 8138 | chan->center_freq, (int)(rssi/100)); |
| 8139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8140 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 8141 | frame_len, rssi, GFP_KERNEL); |
| 8142 | kfree(mgmt); |
| 8143 | return bss_status; |
| 8144 | } |
| 8145 | |
| 8146 | /* |
| 8147 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 8148 | * This function is used to update the BSS data base of CFG8011 |
| 8149 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8150 | 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] | 8151 | tCsrRoamInfo *pRoamInfo |
| 8152 | ) |
| 8153 | { |
| 8154 | tCsrRoamConnectedProfile roamProfile; |
| 8155 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8156 | struct cfg80211_bss *bss = NULL; |
| 8157 | |
| 8158 | ENTER(); |
| 8159 | |
| 8160 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 8161 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 8162 | |
| 8163 | if (NULL != roamProfile.pBssDesc) |
| 8164 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8165 | bss = wlan_hdd_cfg80211_inform_bss(pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8166 | &roamProfile); |
| 8167 | |
| 8168 | if (NULL == bss) |
| 8169 | { |
| 8170 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 8171 | __func__); |
| 8172 | } |
| 8173 | |
| 8174 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 8175 | } |
| 8176 | else |
| 8177 | { |
| 8178 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 8179 | __func__); |
| 8180 | } |
| 8181 | return bss; |
| 8182 | } |
| 8183 | |
| 8184 | /* |
| 8185 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 8186 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8187 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 8188 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8189 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8190 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8191 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8192 | tCsrScanResultInfo *pScanResult; |
| 8193 | eHalStatus status = 0; |
| 8194 | tScanResultHandle pResult; |
| 8195 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8196 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8197 | |
| 8198 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8199 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8200 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8201 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 8202 | NO_SESSION, pAdapter->sessionId)); |
| 8203 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8204 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8205 | |
| 8206 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8207 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8208 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8209 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 8210 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8211 | } |
| 8212 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8213 | |
| 8214 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8215 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8216 | { |
| 8217 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8218 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8219 | return VOS_STATUS_E_PERM; |
| 8220 | } |
| 8221 | |
| 8222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8223 | /* |
| 8224 | * start getting scan results and populate cgf80211 BSS database |
| 8225 | */ |
| 8226 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 8227 | |
| 8228 | /* no scan results */ |
| 8229 | if (NULL == pResult) |
| 8230 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8231 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 8232 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8233 | return status; |
| 8234 | } |
| 8235 | |
| 8236 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 8237 | |
| 8238 | while (pScanResult) |
| 8239 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8240 | /* |
| 8241 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 8242 | * entry already exists in bss data base of cfg80211 for that |
| 8243 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 8244 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 8245 | * mgmt packet as input. As of now there is no possibility to get |
| 8246 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8247 | * ieee80211_mgmt(probe response) and passing to c |
| 8248 | * fg80211_inform_bss_frame. |
| 8249 | * */ |
| 8250 | |
| 8251 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 8252 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8254 | |
| 8255 | if (NULL == bss_status) |
| 8256 | { |
| 8257 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8258 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8259 | } |
| 8260 | else |
| 8261 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8262 | cfg80211_put_bss( |
| 8263 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 8264 | wiphy, |
| 8265 | #endif |
| 8266 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8267 | } |
| 8268 | |
| 8269 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 8270 | } |
| 8271 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8272 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8273 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8274 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8275 | } |
| 8276 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8277 | void |
| 8278 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 8279 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8280 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 8281 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8282 | } /****** end hddPrintMacAddr() ******/ |
| 8283 | |
| 8284 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 8285 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8286 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8287 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8288 | "%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] | 8289 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 8290 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 8291 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8292 | } /****** end hddPrintPmkId() ******/ |
| 8293 | |
| 8294 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 8295 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 8296 | |
| 8297 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 8298 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 8299 | |
| 8300 | #define dump_bssid(bssid) \ |
| 8301 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8302 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 8303 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8304 | } |
| 8305 | |
| 8306 | #define dump_pmkid(pMac, pmkid) \ |
| 8307 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8308 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 8309 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8310 | } |
| 8311 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 8312 | #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] | 8313 | /* |
| 8314 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 8315 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 8316 | */ |
| 8317 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8318 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8319 | int index, bool preauth ) |
| 8320 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8321 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8322 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8323 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8324 | |
| 8325 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8326 | 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] | 8327 | |
| 8328 | if( NULL == pRoamInfo ) |
| 8329 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8330 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8331 | return -EINVAL; |
| 8332 | } |
| 8333 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8334 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 8335 | { |
| 8336 | dump_bssid(pRoamInfo->bssid); |
| 8337 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8338 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8339 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8340 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8341 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8342 | } |
| 8343 | #endif //FEATURE_WLAN_LFR |
| 8344 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 8345 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 8346 | /* |
| 8347 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 8348 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 8349 | * |
| 8350 | */ |
| 8351 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 8352 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 8353 | tCsrRoamInfo *pRoamInfo) |
| 8354 | { |
| 8355 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8356 | union iwreq_data wrqu; |
| 8357 | |
| 8358 | ENTER(); |
| 8359 | |
| 8360 | if (NULL == pAdapter) |
| 8361 | { |
| 8362 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8363 | return VOS_STATUS_E_FAILURE; |
| 8364 | } |
| 8365 | |
| 8366 | /* create the event */ |
| 8367 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8368 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8369 | |
| 8370 | wrqu.data.pointer = metrics_notification; |
| 8371 | wrqu.data.length = scnprintf(metrics_notification, |
| 8372 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 8373 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8374 | |
| 8375 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8376 | |
| 8377 | EXIT(); |
| 8378 | |
| 8379 | return VOS_STATUS_SUCCESS; |
| 8380 | } |
| 8381 | |
| 8382 | /* |
| 8383 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 8384 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 8385 | * or failure |
| 8386 | */ |
| 8387 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 8388 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 8389 | { |
| 8390 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8391 | union iwreq_data wrqu; |
| 8392 | |
| 8393 | ENTER(); |
| 8394 | |
| 8395 | if (NULL == pAdapter) |
| 8396 | { |
| 8397 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8398 | return VOS_STATUS_E_FAILURE; |
| 8399 | } |
| 8400 | |
| 8401 | /* create the event */ |
| 8402 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8403 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8404 | |
| 8405 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 8406 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 8407 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8408 | |
| 8409 | if (1 == preauth_status) |
| 8410 | strncat(metrics_notification, " TRUE", 5); |
| 8411 | else |
| 8412 | strncat(metrics_notification, " FALSE", 6); |
| 8413 | |
| 8414 | wrqu.data.pointer = metrics_notification; |
| 8415 | wrqu.data.length = strlen(metrics_notification); |
| 8416 | |
| 8417 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8418 | |
| 8419 | EXIT(); |
| 8420 | |
| 8421 | return VOS_STATUS_SUCCESS; |
| 8422 | } |
| 8423 | |
| 8424 | /* |
| 8425 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 8426 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 8427 | * |
| 8428 | */ |
| 8429 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 8430 | tCsrRoamInfo *pRoamInfo) |
| 8431 | { |
| 8432 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8433 | union iwreq_data wrqu; |
| 8434 | |
| 8435 | ENTER(); |
| 8436 | |
| 8437 | if (NULL == pAdapter) |
| 8438 | { |
| 8439 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8440 | return VOS_STATUS_E_FAILURE; |
| 8441 | } |
| 8442 | |
| 8443 | /* create the event */ |
| 8444 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8445 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8446 | |
| 8447 | wrqu.data.pointer = metrics_notification; |
| 8448 | wrqu.data.length = scnprintf(metrics_notification, |
| 8449 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 8450 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8451 | |
| 8452 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8453 | |
| 8454 | EXIT(); |
| 8455 | |
| 8456 | return VOS_STATUS_SUCCESS; |
| 8457 | } |
| 8458 | #endif |
| 8459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8460 | /* |
| 8461 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 8462 | * scanning callback function, called after finishing scan |
| 8463 | * |
| 8464 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8465 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8466 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 8467 | { |
| 8468 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8469 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8470 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8471 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8472 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8473 | struct cfg80211_scan_request *req = NULL; |
| 8474 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8475 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8476 | long waitRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8477 | |
| 8478 | ENTER(); |
| 8479 | |
| 8480 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8481 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8482 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8483 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 8484 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 8485 | pScanInfo->mScanPendingCounter = 0; |
| 8486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8487 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8488 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8489 | &pScanInfo->scan_req_completion_event, |
| 8490 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8491 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8492 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8494 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8495 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8496 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8497 | } |
| 8498 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 8499 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8500 | { |
| 8501 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8502 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8503 | } |
| 8504 | |
| 8505 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8506 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | { |
| 8508 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8509 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8510 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8511 | (int) scanId); |
| 8512 | } |
| 8513 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8514 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8515 | pAdapter); |
| 8516 | |
| 8517 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8518 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8519 | |
| 8520 | |
| 8521 | /* If any client wait scan result through WEXT |
| 8522 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8523 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8524 | { |
| 8525 | /* The other scan request waiting for current scan finish |
| 8526 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8527 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8528 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8529 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8530 | } |
| 8531 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8532 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8533 | { |
| 8534 | struct net_device *dev = pAdapter->dev; |
| 8535 | union iwreq_data wrqu; |
| 8536 | int we_event; |
| 8537 | char *msg; |
| 8538 | |
| 8539 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 8540 | we_event = SIOCGIWSCAN; |
| 8541 | msg = NULL; |
| 8542 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 8543 | } |
| 8544 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8545 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8546 | |
| 8547 | /* Get the Scan Req */ |
| 8548 | req = pAdapter->request; |
| 8549 | |
| 8550 | if (!req) |
| 8551 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8552 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 8553 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8554 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8555 | } |
| 8556 | |
| 8557 | /* |
| 8558 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8559 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8560 | req->n_ssids = 0; |
| 8561 | req->n_channels = 0; |
| 8562 | req->ie = 0; |
| 8563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8564 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8565 | /* Scan is no longer pending */ |
| 8566 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8567 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 8568 | /* |
| 8569 | * cfg80211_scan_done informing NL80211 about completion |
| 8570 | * of scanning |
| 8571 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8572 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 8573 | { |
| 8574 | aborted = true; |
| 8575 | } |
| 8576 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 8577 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8578 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8579 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 8580 | /* release the wake lock at the end of the scan*/ |
| 8581 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8582 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 8583 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 8584 | * immediatly after the driver gets connect request(i.e after scan) |
| 8585 | * from supplicant, this result in app's is suspending and not able |
| 8586 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 8587 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 8588 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8589 | #ifdef FEATURE_WLAN_TDLS |
c_hpothu | 3c8f8e8 | 2014-06-02 18:01:50 +0530 | [diff] [blame] | 8590 | if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) |
| 8591 | { |
| 8592 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 8593 | } |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8594 | #endif |
| 8595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8596 | EXIT(); |
| 8597 | return 0; |
| 8598 | } |
| 8599 | |
| 8600 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8601 | * FUNCTION: hdd_isConnectionInProgress |
| 8602 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8603 | * |
| 8604 | */ |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8605 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx ) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8606 | { |
| 8607 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 8608 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 8609 | hdd_adapter_t *pAdapter = NULL; |
| 8610 | VOS_STATUS status = 0; |
| 8611 | v_U8_t staId = 0; |
| 8612 | v_U8_t *staMac = NULL; |
| 8613 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 8614 | if (TRUE == pHddCtx->btCoexModeSet) |
| 8615 | { |
| 8616 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8617 | FL("BTCoex Mode operation in progress")); |
| 8618 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 8619 | } |
| 8620 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8621 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 8622 | |
| 8623 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 8624 | { |
| 8625 | pAdapter = pAdapterNode->pAdapter; |
| 8626 | |
| 8627 | if( pAdapter ) |
| 8628 | { |
| 8629 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8630 | "%s: Adapter with device mode %s (%d) exists", |
| 8631 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8632 | pAdapter->device_mode); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8633 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 8634 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 8635 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 8636 | (eConnectionState_Connecting == |
| 8637 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 8638 | { |
| 8639 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8640 | "%s: %p(%d) Connection is in progress", __func__, |
| 8641 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 8642 | return VOS_TRUE; |
| 8643 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8644 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8645 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 8646 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8647 | { |
| 8648 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8649 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8650 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8651 | { |
| 8652 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 8653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8654 | "%s: client " MAC_ADDRESS_STR |
| 8655 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 8656 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8657 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8658 | } |
| 8659 | } |
| 8660 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 8661 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 8662 | { |
| 8663 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 8664 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8665 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8666 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 8667 | { |
| 8668 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 8669 | |
| 8670 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8671 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 8672 | "middle of WPS/EAPOL exchange.", __func__, |
| 8673 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8674 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8675 | } |
| 8676 | } |
| 8677 | } |
| 8678 | } |
| 8679 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 8680 | pAdapterNode = pNext; |
| 8681 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8682 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8683 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8684 | |
| 8685 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8686 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8687 | * this scan respond to scan trigger and update cfg80211 scan database |
| 8688 | * later, scan dump command can be used to recieve scan results |
| 8689 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 8690 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 8691 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 8692 | struct net_device *dev, |
| 8693 | #endif |
| 8694 | struct cfg80211_scan_request *request) |
| 8695 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 8696 | hdd_adapter_t *pAdapter = NULL; |
| 8697 | hdd_context_t *pHddCtx = NULL; |
| 8698 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8699 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8700 | tCsrScanRequest scanRequest; |
| 8701 | tANI_U8 *channelList = NULL, i; |
| 8702 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8703 | int status; |
| 8704 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8705 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8706 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 8707 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 8708 | struct net_device *dev = NULL; |
| 8709 | if (NULL == request) |
| 8710 | { |
| 8711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8712 | "%s: scan req param null", __func__); |
| 8713 | return -EINVAL; |
| 8714 | } |
| 8715 | dev = request->wdev->netdev; |
| 8716 | #endif |
| 8717 | |
| 8718 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 8719 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 8720 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8721 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8722 | ENTER(); |
| 8723 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8724 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8725 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8726 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8727 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8728 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8729 | status = wlan_hdd_validate_context(pHddCtx); |
| 8730 | |
| 8731 | if (0 != status) |
| 8732 | { |
| 8733 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8734 | "%s: HDD context is not valid", __func__); |
| 8735 | return status; |
| 8736 | } |
| 8737 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 8738 | if (NULL == pwextBuf) |
| 8739 | { |
| 8740 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 8741 | __func__); |
| 8742 | return -EIO; |
| 8743 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8744 | cfg_param = pHddCtx->cfg_ini; |
| 8745 | pScanInfo = &pHddCtx->scan_info; |
| 8746 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8747 | #ifdef WLAN_BTAMP_FEATURE |
| 8748 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8749 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8750 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 8751 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8752 | "%s: No scanning when AMP is on", __func__); |
| 8753 | return -EOPNOTSUPP; |
| 8754 | } |
| 8755 | #endif |
| 8756 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8757 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8758 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8759 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8760 | "%s: Not scanning on device_mode = %s (%d)", |
| 8761 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8762 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8763 | return -EOPNOTSUPP; |
| 8764 | } |
| 8765 | |
| 8766 | if (TRUE == pScanInfo->mScanPending) |
| 8767 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 8768 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 8769 | { |
| 8770 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 8771 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8772 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8773 | } |
| 8774 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8775 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8776 | //Channel and action frame is pending |
| 8777 | //Otherwise Cancel Remain On Channel and allow Scan |
| 8778 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8779 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8780 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 8781 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8782 | return -EBUSY; |
| 8783 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8784 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8785 | /* if tdls disagree scan right now, return immediately. |
| 8786 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 8787 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 8788 | */ |
| 8789 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 8790 | wiphy, |
| 8791 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 8792 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 8793 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8794 | request); |
| 8795 | if(status <= 0) |
| 8796 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8797 | if(!status) |
| 8798 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 8799 | "scan rejected %d", __func__, status); |
| 8800 | else |
| 8801 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 8802 | __func__, status); |
| 8803 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8804 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8805 | } |
| 8806 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8808 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 8809 | { |
| 8810 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 8811 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8812 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8813 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 8815 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8816 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8817 | "%s: MAX TM Level Scan not allowed", __func__); |
| 8818 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8819 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8820 | } |
| 8821 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 8822 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8823 | /* Check if scan is allowed at this point of time. |
| 8824 | */ |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8825 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8826 | { |
| 8827 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 8828 | return -EBUSY; |
| 8829 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 8832 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8833 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 8834 | (int)request->n_ssids); |
| 8835 | |
| 8836 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 8837 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 8838 | * is not aging out the scan results. |
| 8839 | */ |
| 8840 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8841 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8842 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8843 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8844 | |
| 8845 | if ((request->ssids) && (0 < request->n_ssids)) |
| 8846 | { |
| 8847 | tCsrSSIDInfo *SsidInfo; |
| 8848 | int j; |
| 8849 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 8850 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 8851 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 8852 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 8853 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 8854 | |
| 8855 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 8856 | { |
| 8857 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8858 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 8859 | return -ENOMEM; |
| 8860 | } |
| 8861 | |
| 8862 | /* copy all the ssid's and their length */ |
| 8863 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 8864 | { |
| 8865 | /* get the ssid length */ |
| 8866 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 8867 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 8868 | SsidInfo->SSID.length); |
| 8869 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 8870 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 8871 | j, SsidInfo->SSID.ssId); |
| 8872 | } |
| 8873 | /* set the scan type to active */ |
| 8874 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 8875 | } |
| 8876 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8877 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 8878 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8879 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 8880 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8881 | /* set the scan type to active */ |
| 8882 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8883 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8884 | else |
| 8885 | { |
| 8886 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 8887 | scanRequest.scanType = pScanInfo->scan_mode; |
| 8888 | } |
| 8889 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 8890 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8891 | |
| 8892 | /* set BSSType to default type */ |
| 8893 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 8894 | |
| 8895 | /*TODO: scan the requested channels only*/ |
| 8896 | |
| 8897 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8898 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8899 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8900 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 8901 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 8902 | request->n_channels = MAX_CHANNEL; |
| 8903 | } |
| 8904 | |
| 8905 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8906 | "No of Scan Channels: %d", request->n_channels); |
| 8907 | |
| 8908 | |
| 8909 | if( request->n_channels ) |
| 8910 | { |
| 8911 | char chList [(request->n_channels*5)+1]; |
| 8912 | int len; |
| 8913 | channelList = vos_mem_malloc( request->n_channels ); |
| 8914 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 8915 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8916 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8917 | "%s: memory alloc failed channelList", __func__); |
| 8918 | status = -ENOMEM; |
| 8919 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 8920 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8921 | |
| 8922 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 8923 | { |
| 8924 | channelList[i] = request->channels[i]->hw_value; |
| 8925 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 8926 | } |
| 8927 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8928 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8929 | "Channel-List: %s ", chList); |
| 8930 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 8931 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8932 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 8933 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 8934 | |
| 8935 | /* set requestType to full scan */ |
| 8936 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 8937 | |
| 8938 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 8939 | * search (Flush on both full scan and social scan but not on single |
| 8940 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 8941 | */ |
| 8942 | |
| 8943 | /* Supplicant does single channel scan after 8-way handshake |
| 8944 | * and in that case driver shoudnt flush scan results. If |
| 8945 | * driver flushes the scan results here and unfortunately if |
| 8946 | * the AP doesnt respond to our probe req then association |
| 8947 | * fails which is not desired |
| 8948 | */ |
| 8949 | |
| 8950 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 8951 | { |
| 8952 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 8953 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8954 | pAdapter->sessionId ); |
| 8955 | } |
| 8956 | |
| 8957 | if( request->ie_len ) |
| 8958 | { |
| 8959 | /* save this for future association (join requires this) */ |
| 8960 | /*TODO: Array needs to be converted to dynamic allocation, |
| 8961 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 8962 | * CR 597966 |
| 8963 | */ |
| 8964 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 8965 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 8966 | pScanInfo->scanAddIE.length = request->ie_len; |
| 8967 | |
| 8968 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 8969 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 8970 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8971 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8972 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8973 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8974 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 8975 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 8976 | request->ie, request->ie_len); |
| 8977 | } |
| 8978 | else |
| 8979 | { |
| 8980 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 8981 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8982 | } |
| 8983 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8984 | } |
| 8985 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 8986 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 8987 | |
| 8988 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 8989 | request->ie_len); |
| 8990 | if (pP2pIe != NULL) |
| 8991 | { |
| 8992 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 8993 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 8994 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 8995 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8996 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 8997 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 8998 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 8999 | "Go nego completed to Connection is started"); |
| 9000 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9001 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9002 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9003 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 9004 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9005 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9006 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 9007 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 9008 | "Disconnected state to Connection is started"); |
| 9009 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9010 | "for 4way Handshake"); |
| 9011 | } |
| 9012 | #endif |
| 9013 | |
| 9014 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 9015 | if(TRUE == request->no_cck) |
| 9016 | { |
| 9017 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9018 | "%s: This is a P2P Search", __func__); |
| 9019 | scanRequest.p2pSearch = 1; |
| 9020 | |
| 9021 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9022 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9023 | /* set requestType to P2P Discovery */ |
| 9024 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 9025 | } |
| 9026 | |
| 9027 | /* |
| 9028 | Skip Dfs Channel in case of P2P Search |
| 9029 | if it is set in ini file |
| 9030 | */ |
| 9031 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 9032 | { |
| 9033 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9034 | } |
| 9035 | else |
| 9036 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9037 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9039 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9041 | } |
| 9042 | } |
| 9043 | |
| 9044 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 9045 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9046 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 9047 | * address the following issues. |
| 9048 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 9049 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 9050 | * for long time, this result in apps running at full power for long time. |
| 9051 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 9052 | * be stuck in full power because of resume BMPS |
| 9053 | */ |
| 9054 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9055 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9056 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9057 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9058 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 9059 | scanRequest.requestType, scanRequest.scanType, |
| 9060 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9061 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 9062 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9063 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9064 | pAdapter->sessionId, &scanRequest, &scanId, |
| 9065 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9067 | if (eHAL_STATUS_SUCCESS != status) |
| 9068 | { |
| 9069 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9070 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 9071 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9072 | if(eHAL_STATUS_RESOURCES == status) |
| 9073 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9074 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 9075 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9076 | status = -EBUSY; |
| 9077 | } else { |
| 9078 | status = -EIO; |
| 9079 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9080 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9081 | goto free_mem; |
| 9082 | } |
| 9083 | |
| 9084 | pScanInfo->mScanPending = TRUE; |
| 9085 | pAdapter->request = request; |
| 9086 | pScanInfo->scanId = scanId; |
| 9087 | |
| 9088 | complete(&pScanInfo->scan_req_completion_event); |
| 9089 | |
| 9090 | free_mem: |
| 9091 | if( scanRequest.SSIDs.SSIDList ) |
| 9092 | { |
| 9093 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 9094 | } |
| 9095 | |
| 9096 | if( channelList ) |
| 9097 | vos_mem_free( channelList ); |
| 9098 | |
| 9099 | EXIT(); |
| 9100 | |
| 9101 | return status; |
| 9102 | } |
| 9103 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9104 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 9105 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9106 | struct net_device *dev, |
| 9107 | #endif |
| 9108 | struct cfg80211_scan_request *request) |
| 9109 | { |
| 9110 | int ret; |
| 9111 | |
| 9112 | vos_ssr_protect(__func__); |
| 9113 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 9114 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9115 | dev, |
| 9116 | #endif |
| 9117 | request); |
| 9118 | vos_ssr_unprotect(__func__); |
| 9119 | |
| 9120 | return ret; |
| 9121 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9122 | |
| 9123 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 9124 | { |
| 9125 | v_U8_t iniDot11Mode = |
| 9126 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 9127 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 9128 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9129 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 9130 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9131 | switch ( iniDot11Mode ) |
| 9132 | { |
| 9133 | case eHDD_DOT11_MODE_AUTO: |
| 9134 | case eHDD_DOT11_MODE_11ac: |
| 9135 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 9136 | #ifdef WLAN_FEATURE_11AC |
| 9137 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 9138 | #else |
| 9139 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9140 | #endif |
| 9141 | break; |
| 9142 | case eHDD_DOT11_MODE_11n: |
| 9143 | case eHDD_DOT11_MODE_11n_ONLY: |
| 9144 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9145 | break; |
| 9146 | default: |
| 9147 | hddDot11Mode = iniDot11Mode; |
| 9148 | break; |
| 9149 | } |
| 9150 | /* This call decides required channel bonding mode */ |
| 9151 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 9152 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 9153 | operationChannel); |
| 9154 | } |
| 9155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9156 | /* |
| 9157 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9158 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9159 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9160 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9161 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9162 | { |
| 9163 | int status = 0; |
| 9164 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9165 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9166 | v_U32_t roamId; |
| 9167 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9168 | eCsrAuthType RSNAuthType; |
| 9169 | |
| 9170 | ENTER(); |
| 9171 | |
| 9172 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9173 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9174 | |
| 9175 | status = wlan_hdd_validate_context(pHddCtx); |
| 9176 | if (status) |
| 9177 | { |
| 9178 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9179 | "%s: HDD context is not valid!", __func__); |
| 9180 | return status; |
| 9181 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9183 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 9184 | { |
| 9185 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 9186 | return -EINVAL; |
| 9187 | } |
| 9188 | |
| 9189 | pRoamProfile = &pWextState->roamProfile; |
| 9190 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9191 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9192 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9193 | hdd_station_ctx_t *pHddStaCtx; |
| 9194 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9195 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9196 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9197 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 9198 | { |
| 9199 | /*QoS not enabled in cfg file*/ |
| 9200 | pRoamProfile->uapsd_mask = 0; |
| 9201 | } |
| 9202 | else |
| 9203 | { |
| 9204 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9205 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9206 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 9207 | } |
| 9208 | |
| 9209 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 9210 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 9211 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9212 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9213 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 9214 | ssid, ssid_len); |
| 9215 | |
| 9216 | if (bssid) |
| 9217 | { |
| 9218 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 9219 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 9220 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9221 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 9222 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9223 | case of join failure we should send valid BSSID to supplicant |
| 9224 | */ |
| 9225 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 9226 | WNI_CFG_BSSID_LEN); |
| 9227 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 9228 | else |
| 9229 | { |
| 9230 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 9231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9232 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9233 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 9234 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9235 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 9236 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9237 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9238 | /*set gen ie*/ |
| 9239 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 9240 | /*set auth*/ |
| 9241 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 9242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | #ifdef FEATURE_WLAN_WAPI |
| 9244 | if (pAdapter->wapi_info.nWapiMode) |
| 9245 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9246 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9247 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 9248 | { |
| 9249 | case WAPI_AUTH_MODE_PSK: |
| 9250 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9251 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9252 | pAdapter->wapi_info.wapiAuthMode); |
| 9253 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 9254 | break; |
| 9255 | } |
| 9256 | case WAPI_AUTH_MODE_CERT: |
| 9257 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9258 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9259 | pAdapter->wapi_info.wapiAuthMode); |
| 9260 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 9261 | break; |
| 9262 | } |
| 9263 | } // End of switch |
| 9264 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 9265 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 9266 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9267 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9268 | pRoamProfile->AuthType.numEntries = 1; |
| 9269 | pRoamProfile->EncryptionType.numEntries = 1; |
| 9270 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9271 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 9272 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9273 | } |
| 9274 | } |
| 9275 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9276 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9277 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9278 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9279 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 9280 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9281 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 9282 | sizeof (tSirGtkOffloadParams)); |
| 9283 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9284 | } |
| 9285 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9286 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 9287 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9288 | if( operatingChannel ) |
| 9289 | { |
| 9290 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 9291 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9292 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9293 | else |
| 9294 | { |
| 9295 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9296 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9297 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9298 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 9299 | { |
| 9300 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 9301 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9302 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9303 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 9304 | * 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] | 9305 | * 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] | 9306 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9307 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 9308 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9309 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9310 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9311 | { |
| 9312 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9313 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 9314 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9315 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 9316 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9317 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9318 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9319 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 9320 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9321 | if ((eHAL_STATUS_SUCCESS != status) && |
| 9322 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9323 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9324 | |
| 9325 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9326 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 9327 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 9328 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9329 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9330 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9331 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9332 | |
| 9333 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9334 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9336 | } |
| 9337 | else |
| 9338 | { |
| 9339 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 9340 | return -EINVAL; |
| 9341 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9342 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9343 | return status; |
| 9344 | } |
| 9345 | |
| 9346 | /* |
| 9347 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 9348 | * This function is used to set the authentication type (OPEN/SHARED). |
| 9349 | * |
| 9350 | */ |
| 9351 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 9352 | enum nl80211_auth_type auth_type) |
| 9353 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9354 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9355 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9356 | |
| 9357 | ENTER(); |
| 9358 | |
| 9359 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9360 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9361 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9362 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9363 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9364 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 9365 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 9366 | break; |
| 9367 | |
| 9368 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9369 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9370 | case NL80211_AUTHTYPE_FT: |
| 9371 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9372 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9373 | "%s: set authentication type to OPEN", __func__); |
| 9374 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 9375 | break; |
| 9376 | |
| 9377 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9378 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9379 | "%s: set authentication type to SHARED", __func__); |
| 9380 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 9381 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9382 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9383 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9384 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9385 | "%s: set authentication type to CCKM WPA", __func__); |
| 9386 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 9387 | break; |
| 9388 | #endif |
| 9389 | |
| 9390 | |
| 9391 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9393 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9394 | auth_type); |
| 9395 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 9396 | return -EINVAL; |
| 9397 | } |
| 9398 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9399 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9400 | pHddStaCtx->conn_info.authType; |
| 9401 | return 0; |
| 9402 | } |
| 9403 | |
| 9404 | /* |
| 9405 | * FUNCTION: wlan_hdd_set_akm_suite |
| 9406 | * This function is used to set the key mgmt type(PSK/8021x). |
| 9407 | * |
| 9408 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9409 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9410 | u32 key_mgmt |
| 9411 | ) |
| 9412 | { |
| 9413 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9414 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9416 | /*set key mgmt type*/ |
| 9417 | switch(key_mgmt) |
| 9418 | { |
| 9419 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 9420 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9421 | case WLAN_AKM_SUITE_FT_PSK: |
| 9422 | #endif |
| 9423 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9424 | __func__); |
| 9425 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 9426 | break; |
| 9427 | |
| 9428 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 9429 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9430 | case WLAN_AKM_SUITE_FT_8021X: |
| 9431 | #endif |
| 9432 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | __func__); |
| 9434 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 9435 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9436 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9437 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 9438 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 9439 | case WLAN_AKM_SUITE_CCKM: |
| 9440 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 9441 | __func__); |
| 9442 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 9443 | break; |
| 9444 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 9445 | #ifndef WLAN_AKM_SUITE_OSEN |
| 9446 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 9447 | case WLAN_AKM_SUITE_OSEN: |
| 9448 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 9449 | __func__); |
| 9450 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 9451 | break; |
| 9452 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9453 | |
| 9454 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9455 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9456 | __func__, key_mgmt); |
| 9457 | return -EINVAL; |
| 9458 | |
| 9459 | } |
| 9460 | return 0; |
| 9461 | } |
| 9462 | |
| 9463 | /* |
| 9464 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9465 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9466 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 9467 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9468 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 9469 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9470 | bool ucast |
| 9471 | ) |
| 9472 | { |
| 9473 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9474 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9475 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9476 | |
| 9477 | ENTER(); |
| 9478 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9479 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9480 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9481 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9482 | __func__, cipher); |
| 9483 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 9484 | } |
| 9485 | else |
| 9486 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9487 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9488 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9489 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9490 | { |
| 9491 | case IW_AUTH_CIPHER_NONE: |
| 9492 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 9493 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9495 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9496 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9497 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9499 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9500 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9501 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9503 | case WLAN_CIPHER_SUITE_TKIP: |
| 9504 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 9505 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9507 | case WLAN_CIPHER_SUITE_CCMP: |
| 9508 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 9509 | break; |
| 9510 | #ifdef FEATURE_WLAN_WAPI |
| 9511 | case WLAN_CIPHER_SUITE_SMS4: |
| 9512 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 9513 | break; |
| 9514 | #endif |
| 9515 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9516 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9517 | case WLAN_CIPHER_SUITE_KRK: |
| 9518 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 9519 | break; |
| 9520 | #endif |
| 9521 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9522 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9523 | __func__, cipher); |
| 9524 | return -EOPNOTSUPP; |
| 9525 | } |
| 9526 | } |
| 9527 | |
| 9528 | if (ucast) |
| 9529 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9530 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9531 | __func__, encryptionType); |
| 9532 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 9533 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9534 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9535 | encryptionType; |
| 9536 | } |
| 9537 | else |
| 9538 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9539 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9540 | __func__, encryptionType); |
| 9541 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 9542 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 9543 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 9544 | } |
| 9545 | |
| 9546 | return 0; |
| 9547 | } |
| 9548 | |
| 9549 | |
| 9550 | /* |
| 9551 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 9552 | * This function is used to parse WPA/RSN IE's. |
| 9553 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9554 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 9555 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9556 | size_t ie_len |
| 9557 | ) |
| 9558 | { |
| 9559 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9560 | u8 *genie = ie; |
| 9561 | v_U16_t remLen = ie_len; |
| 9562 | #ifdef FEATURE_WLAN_WAPI |
| 9563 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 9564 | u16 *tmp; |
| 9565 | v_U16_t akmsuiteCount; |
| 9566 | int *akmlist; |
| 9567 | #endif |
| 9568 | ENTER(); |
| 9569 | |
| 9570 | /* clear previous assocAddIE */ |
| 9571 | pWextState->assocAddIE.length = 0; |
| 9572 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 9573 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9574 | |
| 9575 | while (remLen >= 2) |
| 9576 | { |
| 9577 | v_U16_t eLen = 0; |
| 9578 | v_U8_t elementId; |
| 9579 | elementId = *genie++; |
| 9580 | eLen = *genie++; |
| 9581 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9582 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9583 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9584 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9585 | |
| 9586 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9587 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9588 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9589 | 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] | 9590 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9591 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9592 | "%s: Invalid WPA IE", __func__); |
| 9593 | return -EINVAL; |
| 9594 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9595 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9596 | { |
| 9597 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9598 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9599 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9601 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9602 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9603 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 9604 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9605 | VOS_ASSERT(0); |
| 9606 | return -ENOMEM; |
| 9607 | } |
| 9608 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 9609 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9610 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9611 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9612 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 9613 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9614 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9615 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9616 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 9617 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9618 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 9619 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 9620 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 9621 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 9622 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 9623 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9624 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 9625 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9626 | { |
| 9627 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9628 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9629 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9631 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9632 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9633 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9634 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9635 | VOS_ASSERT(0); |
| 9636 | return -ENOMEM; |
| 9637 | } |
| 9638 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 9639 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9640 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9642 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9643 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9644 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9646 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 9647 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9648 | /*Consider WFD IE, only for P2P Client */ |
| 9649 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 9650 | { |
| 9651 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9652 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9653 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9656 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9657 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9658 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9659 | VOS_ASSERT(0); |
| 9660 | return -ENOMEM; |
| 9661 | } |
| 9662 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 9663 | // WPS IE + P2P IE + WFD IE |
| 9664 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9665 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9666 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9667 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9668 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9669 | } |
| 9670 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9671 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9672 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 9673 | HS20_OUI_TYPE_SIZE)) ) |
| 9674 | { |
| 9675 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9676 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 9677 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9678 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 9679 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9680 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9681 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9682 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 9683 | VOS_ASSERT(0); |
| 9684 | return -ENOMEM; |
| 9685 | } |
| 9686 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9687 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9688 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 9689 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9690 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9691 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 9692 | /* Appending OSEN Information Element in Assiciation Request */ |
| 9693 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 9694 | OSEN_OUI_TYPE_SIZE)) ) |
| 9695 | { |
| 9696 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 9697 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 9698 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9699 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 9700 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9701 | { |
| 9702 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9703 | "Need bigger buffer space"); |
| 9704 | VOS_ASSERT(0); |
| 9705 | return -ENOMEM; |
| 9706 | } |
| 9707 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9708 | pWextState->assocAddIE.length += eLen + 2; |
| 9709 | |
| 9710 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 9711 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9712 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9713 | } |
| 9714 | |
| 9715 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 9716 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 9717 | |
| 9718 | /* populating as ADDIE in beacon frames */ |
| 9719 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9720 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 9721 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 9722 | { |
| 9723 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9724 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 9725 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9726 | { |
| 9727 | hddLog(LOGE, |
| 9728 | "Coldn't pass " |
| 9729 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 9730 | } |
| 9731 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 9732 | else |
| 9733 | hddLog(LOGE, |
| 9734 | "Could not pass on " |
| 9735 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 9736 | |
| 9737 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 9738 | beaconIE's need to be populated in probe response frames */ |
| 9739 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 9740 | { |
| 9741 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 9742 | u8 probe_rsp_ie_len[3] = {0}; |
| 9743 | u8 counter = 0; |
| 9744 | |
| 9745 | /* Check Probe Resp Length if it is greater then 255 then |
| 9746 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 9747 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 9748 | not able Store More then 255 bytes into One Variable */ |
| 9749 | |
| 9750 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 9751 | { |
| 9752 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 9753 | { |
| 9754 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 9755 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 9756 | } |
| 9757 | else |
| 9758 | { |
| 9759 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 9760 | rem_probe_resp_ie_len = 0; |
| 9761 | } |
| 9762 | } |
| 9763 | |
| 9764 | rem_probe_resp_ie_len = 0; |
| 9765 | |
| 9766 | if (probe_rsp_ie_len[0] > 0) |
| 9767 | { |
| 9768 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9769 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 9770 | (tANI_U8*)(genie - 2), |
| 9771 | probe_rsp_ie_len[0], NULL, |
| 9772 | eANI_BOOLEAN_FALSE) |
| 9773 | == eHAL_STATUS_FAILURE) |
| 9774 | { |
| 9775 | hddLog(LOGE, |
| 9776 | "Could not pass" |
| 9777 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 9778 | } |
| 9779 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 9780 | } |
| 9781 | |
| 9782 | if (probe_rsp_ie_len[1] > 0) |
| 9783 | { |
| 9784 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9785 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 9786 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 9787 | probe_rsp_ie_len[1], NULL, |
| 9788 | eANI_BOOLEAN_FALSE) |
| 9789 | == eHAL_STATUS_FAILURE) |
| 9790 | { |
| 9791 | hddLog(LOGE, |
| 9792 | "Could not pass" |
| 9793 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 9794 | } |
| 9795 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 9796 | } |
| 9797 | |
| 9798 | if (probe_rsp_ie_len[2] > 0) |
| 9799 | { |
| 9800 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9801 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 9802 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 9803 | probe_rsp_ie_len[2], NULL, |
| 9804 | eANI_BOOLEAN_FALSE) |
| 9805 | == eHAL_STATUS_FAILURE) |
| 9806 | { |
| 9807 | hddLog(LOGE, |
| 9808 | "Could not pass" |
| 9809 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 9810 | } |
| 9811 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 9812 | } |
| 9813 | |
| 9814 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9815 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 9816 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9817 | { |
| 9818 | hddLog(LOGE, |
| 9819 | "Could not pass" |
| 9820 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 9821 | } |
| 9822 | } |
| 9823 | else |
| 9824 | { |
| 9825 | // Reset WNI_CFG_PROBE_RSP Flags |
| 9826 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 9827 | |
| 9828 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9829 | "%s: No Probe Response IE received in set beacon", |
| 9830 | __func__); |
| 9831 | } |
| 9832 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | break; |
| 9834 | case DOT11F_EID_RSN: |
| 9835 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 9836 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 9837 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 9838 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 9839 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 9840 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9841 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 9842 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9843 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9844 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9845 | 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] | 9846 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9847 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9848 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9849 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9850 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9851 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9852 | VOS_ASSERT(0); |
| 9853 | return -ENOMEM; |
| 9854 | } |
| 9855 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9856 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9857 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9858 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9859 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9860 | break; |
| 9861 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9862 | #ifdef FEATURE_WLAN_WAPI |
| 9863 | case WLAN_EID_WAPI: |
| 9864 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9865 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9866 | pAdapter->wapi_info.nWapiMode); |
| 9867 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9868 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9869 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 9870 | tmp = tmp + 1; |
| 9871 | akmlist = (int *)(tmp); |
| 9872 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 9873 | { |
| 9874 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 9875 | } |
| 9876 | else |
| 9877 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9878 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9879 | VOS_ASSERT(0); |
| 9880 | return -EINVAL; |
| 9881 | } |
| 9882 | |
| 9883 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 9884 | { |
| 9885 | 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] | 9886 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9887 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9889 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9890 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9891 | 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] | 9892 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9893 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 9894 | } |
| 9895 | break; |
| 9896 | #endif |
| 9897 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9898 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9899 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9900 | /* when Unknown IE is received we should break and continue |
| 9901 | * to the next IE in the buffer instead we were returning |
| 9902 | * so changing this to break */ |
| 9903 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9904 | } |
| 9905 | genie += eLen; |
| 9906 | remLen -= eLen; |
| 9907 | } |
| 9908 | EXIT(); |
| 9909 | return 0; |
| 9910 | } |
| 9911 | |
| 9912 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 9913 | * FUNCTION: hdd_isWPAIEPresent |
| 9914 | * Parse the received IE to find the WPA IE |
| 9915 | * |
| 9916 | */ |
| 9917 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 9918 | { |
| 9919 | v_U8_t eLen = 0; |
| 9920 | v_U16_t remLen = ie_len; |
| 9921 | v_U8_t elementId = 0; |
| 9922 | |
| 9923 | while (remLen >= 2) |
| 9924 | { |
| 9925 | elementId = *ie++; |
| 9926 | eLen = *ie++; |
| 9927 | remLen -= 2; |
| 9928 | if (eLen > remLen) |
| 9929 | { |
| 9930 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9931 | "%s: IE length is wrong %d", __func__, eLen); |
| 9932 | return FALSE; |
| 9933 | } |
| 9934 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 9935 | { |
| 9936 | /* OUI - 0x00 0X50 0XF2 |
| 9937 | WPA Information Element - 0x01 |
| 9938 | WPA version - 0x01*/ |
| 9939 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 9940 | return TRUE; |
| 9941 | } |
| 9942 | ie += eLen; |
| 9943 | remLen -= eLen; |
| 9944 | } |
| 9945 | return FALSE; |
| 9946 | } |
| 9947 | |
| 9948 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9949 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9950 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | * parameters during connect operation. |
| 9952 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9953 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9954 | struct cfg80211_connect_params *req |
| 9955 | ) |
| 9956 | { |
| 9957 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9958 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | ENTER(); |
| 9960 | |
| 9961 | /*set wpa version*/ |
| 9962 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 9963 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9964 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9965 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 9966 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9967 | { |
| 9968 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 9969 | } |
| 9970 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 9971 | { |
| 9972 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 9973 | } |
| 9974 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9975 | |
| 9976 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9977 | pWextState->wpaVersion); |
| 9978 | |
| 9979 | /*set authentication type*/ |
| 9980 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 9981 | |
| 9982 | if (0 > status) |
| 9983 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9984 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9985 | "%s: failed to set authentication type ", __func__); |
| 9986 | return status; |
| 9987 | } |
| 9988 | |
| 9989 | /*set key mgmt type*/ |
| 9990 | if (req->crypto.n_akm_suites) |
| 9991 | { |
| 9992 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 9993 | if (0 > status) |
| 9994 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9995 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9996 | __func__); |
| 9997 | return status; |
| 9998 | } |
| 9999 | } |
| 10000 | |
| 10001 | /*set pairwise cipher type*/ |
| 10002 | if (req->crypto.n_ciphers_pairwise) |
| 10003 | { |
| 10004 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 10005 | req->crypto.ciphers_pairwise[0], true); |
| 10006 | if (0 > status) |
| 10007 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10008 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10009 | "%s: failed to set unicast cipher type", __func__); |
| 10010 | return status; |
| 10011 | } |
| 10012 | } |
| 10013 | else |
| 10014 | { |
| 10015 | /*Reset previous cipher suite to none*/ |
| 10016 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 10017 | if (0 > status) |
| 10018 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10019 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10020 | "%s: failed to set unicast cipher type", __func__); |
| 10021 | return status; |
| 10022 | } |
| 10023 | } |
| 10024 | |
| 10025 | /*set group cipher type*/ |
| 10026 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 10027 | false); |
| 10028 | |
| 10029 | if (0 > status) |
| 10030 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10031 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10032 | __func__); |
| 10033 | return status; |
| 10034 | } |
| 10035 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10036 | #ifdef WLAN_FEATURE_11W |
| 10037 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 10038 | #endif |
| 10039 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10040 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 10041 | if (req->ie_len) |
| 10042 | { |
| 10043 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 10044 | if ( 0 > status) |
| 10045 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10046 | 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] | 10047 | __func__); |
| 10048 | return status; |
| 10049 | } |
| 10050 | } |
| 10051 | |
| 10052 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10053 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10054 | { |
| 10055 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 10056 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 10057 | ) |
| 10058 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10059 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10060 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 10061 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10062 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10063 | __func__); |
| 10064 | return -EOPNOTSUPP; |
| 10065 | } |
| 10066 | else |
| 10067 | { |
| 10068 | u8 key_len = req->key_len; |
| 10069 | u8 key_idx = req->key_idx; |
| 10070 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10071 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10072 | && (CSR_MAX_NUM_KEY > key_idx) |
| 10073 | ) |
| 10074 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10075 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10076 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10077 | __func__, key_idx, key_len); |
| 10078 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10079 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10080 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10081 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10082 | (u8)key_len; |
| 10083 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 10084 | } |
| 10085 | } |
| 10086 | } |
| 10087 | } |
| 10088 | |
| 10089 | return status; |
| 10090 | } |
| 10091 | |
| 10092 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10093 | * FUNCTION: wlan_hdd_try_disconnect |
| 10094 | * This function is used to disconnect from previous |
| 10095 | * connection |
| 10096 | */ |
| 10097 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 10098 | { |
| 10099 | long ret = 0; |
| 10100 | hdd_station_ctx_t *pHddStaCtx; |
| 10101 | eMib_dot11DesiredBssType connectedBssType; |
| 10102 | |
| 10103 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10104 | |
| 10105 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 10106 | |
| 10107 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 10108 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 10109 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 10110 | { |
| 10111 | /* Issue disconnect to CSR */ |
| 10112 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10113 | if( eHAL_STATUS_SUCCESS == |
| 10114 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10115 | pAdapter->sessionId, |
| 10116 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 10117 | { |
| 10118 | ret = wait_for_completion_interruptible_timeout( |
| 10119 | &pAdapter->disconnect_comp_var, |
| 10120 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10121 | if (0 >= ret) |
| 10122 | { |
| 10123 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10124 | return -EALREADY; |
| 10125 | } |
| 10126 | } |
| 10127 | } |
| 10128 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 10129 | { |
| 10130 | ret = wait_for_completion_interruptible_timeout( |
| 10131 | &pAdapter->disconnect_comp_var, |
| 10132 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10133 | if (0 >= ret) |
| 10134 | { |
| 10135 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10136 | return -EALREADY; |
| 10137 | } |
| 10138 | } |
| 10139 | |
| 10140 | return 0; |
| 10141 | } |
| 10142 | |
| 10143 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10144 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 10145 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10146 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10147 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10148 | struct net_device *ndev, |
| 10149 | struct cfg80211_connect_params *req |
| 10150 | ) |
| 10151 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10152 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10153 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 10154 | hdd_adapter_t *pHostapdAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10155 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 10156 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10157 | |
| 10158 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10159 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10160 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10161 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 10162 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10163 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10164 | "%s: device_mode = %s (%d)", __func__, |
| 10165 | hdd_device_modetoString(pAdapter->device_mode), |
| 10166 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10167 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10168 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10169 | if (!pHddCtx) |
| 10170 | { |
| 10171 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10172 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10173 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10174 | } |
| 10175 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10176 | status = wlan_hdd_validate_context(pHddCtx); |
| 10177 | |
| 10178 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10179 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10180 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10181 | "%s: HDD context is not valid", __func__); |
| 10182 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10183 | } |
| 10184 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10185 | if (vos_max_concurrent_connections_reached()) { |
| 10186 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10187 | return -ECONNREFUSED; |
| 10188 | } |
| 10189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10190 | #ifdef WLAN_BTAMP_FEATURE |
| 10191 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10192 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10193 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10194 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 10196 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10197 | } |
| 10198 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10199 | |
| 10200 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 10201 | //P2P Mode will be taken care in Open/close adapter |
| 10202 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10203 | (vos_concurrent_open_sessions_running())) { |
| 10204 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 10205 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10206 | } |
| 10207 | |
| 10208 | /*Try disconnecting if already in connected state*/ |
| 10209 | status = wlan_hdd_try_disconnect(pAdapter); |
| 10210 | if ( 0 > status) |
| 10211 | { |
| 10212 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 10213 | " connection")); |
| 10214 | return -EALREADY; |
| 10215 | } |
| 10216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10217 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10218 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10219 | |
| 10220 | if ( 0 > status) |
| 10221 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10222 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10223 | __func__); |
| 10224 | return status; |
| 10225 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 10226 | /* For SAP + STA concurrency , driver only supports SCC. |
| 10227 | * if SAP is ON, driver will stop it and after assoc completion, |
| 10228 | * or failure, SAP will be started on STA channel to force SCC. |
| 10229 | */ |
| 10230 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 10231 | if (pHostapdAdapter != NULL) |
| 10232 | { |
| 10233 | hddLog(VOS_TRACE_LEVEL_INFO, "Close SAP until STA is connected"); |
| 10234 | if (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
| 10235 | { |
| 10236 | WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext); |
| 10237 | clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
| 10238 | } |
| 10239 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10240 | if ( req->channel ) |
| 10241 | { |
| 10242 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 10243 | req->ssid_len, req->bssid, |
| 10244 | req->channel->hw_value); |
| 10245 | } |
| 10246 | else |
| 10247 | { |
| 10248 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10249 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10250 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10251 | |
| 10252 | if (0 > status) |
| 10253 | { |
| 10254 | //ReEnable BMPS if disabled |
| 10255 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 10256 | (NULL != pHddCtx)) |
| 10257 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 10258 | if (pHddCtx->hdd_wlan_suspended) |
| 10259 | { |
| 10260 | hdd_set_pwrparams(pHddCtx); |
| 10261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10262 | //ReEnable Bmps and Imps back |
| 10263 | hdd_enable_bmps_imps(pHddCtx); |
| 10264 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10265 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10266 | return status; |
| 10267 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10268 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10269 | EXIT(); |
| 10270 | return status; |
| 10271 | } |
| 10272 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10273 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 10274 | struct net_device *ndev, |
| 10275 | struct cfg80211_connect_params *req) |
| 10276 | { |
| 10277 | int ret; |
| 10278 | vos_ssr_protect(__func__); |
| 10279 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 10280 | vos_ssr_unprotect(__func__); |
| 10281 | |
| 10282 | return ret; |
| 10283 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10284 | |
| 10285 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10286 | * FUNCTION: wlan_hdd_disconnect |
| 10287 | * This function is used to issue a disconnect request to SME |
| 10288 | */ |
| 10289 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 10290 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10291 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10292 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10293 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10294 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10295 | |
| 10296 | status = wlan_hdd_validate_context(pHddCtx); |
| 10297 | |
| 10298 | if (0 != status) |
| 10299 | { |
| 10300 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10301 | "%s: HDD context is not valid", __func__); |
| 10302 | return status; |
| 10303 | } |
| 10304 | |
| 10305 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10306 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10307 | "%s: Set HDD connState to eConnectionState_Disconnecting", |
| 10308 | __func__); |
Vinay Krishna Eranna | b09d3e7 | 2014-03-26 21:23:55 +0530 | [diff] [blame] | 10309 | pHddStaCtx->conn_info.connState = eConnectionState_Disconnecting; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10310 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10311 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10312 | /*issue disconnect*/ |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10313 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10314 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10315 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10316 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 10317 | { |
| 10318 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10319 | FL("status = %d, already disconnected"), |
| 10320 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10321 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10322 | } |
| 10323 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10324 | { |
| 10325 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10326 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10327 | __func__, (int)status ); |
| 10328 | return -EINVAL; |
| 10329 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10330 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10331 | &pAdapter->disconnect_comp_var, |
| 10332 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10333 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10334 | { |
| 10335 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10336 | "%s: Failed to disconnect, timed out", __func__); |
| 10337 | return -ETIMEDOUT; |
| 10338 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10339 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10340 | { |
| 10341 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10342 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10343 | return ret; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10344 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10345 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10346 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 10347 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 10348 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10349 | /*stop tx queues*/ |
| 10350 | netif_tx_disable(pAdapter->dev); |
| 10351 | netif_carrier_off(pAdapter->dev); |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10352 | return 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10353 | } |
| 10354 | |
| 10355 | |
| 10356 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10357 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10358 | * This function is used to issue a disconnect request to SME |
| 10359 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10360 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10361 | struct net_device *dev, |
| 10362 | u16 reason |
| 10363 | ) |
| 10364 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10365 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10366 | tCsrRoamProfile *pRoamProfile = |
| 10367 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10368 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10369 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10370 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10371 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10372 | tANI_U8 staIdx; |
| 10373 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10375 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10376 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10377 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10378 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 10379 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10380 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 10381 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10382 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10383 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10384 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 10385 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10386 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10387 | status = wlan_hdd_validate_context(pHddCtx); |
| 10388 | |
| 10389 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10390 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10391 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10392 | "%s: HDD context is not valid", __func__); |
| 10393 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10394 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10396 | if (NULL != pRoamProfile) |
| 10397 | { |
| 10398 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 10399 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 10400 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10401 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10402 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10403 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10404 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10405 | switch(reason) |
| 10406 | { |
| 10407 | case WLAN_REASON_MIC_FAILURE: |
| 10408 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 10409 | break; |
| 10410 | |
| 10411 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 10412 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 10413 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 10414 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 10415 | break; |
| 10416 | |
| 10417 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 10418 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 10419 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10420 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 10421 | break; |
| 10422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10423 | default: |
| 10424 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 10425 | break; |
| 10426 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10427 | pScanInfo = &pHddCtx->scan_info; |
| 10428 | if (pScanInfo->mScanPending) |
| 10429 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 10430 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10431 | "Aborting Scan"); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 10432 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 10433 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10434 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10435 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10436 | #ifdef FEATURE_WLAN_TDLS |
| 10437 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10438 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10439 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10440 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 10441 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10442 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10443 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10444 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10445 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10446 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10447 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10448 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10449 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10450 | pAdapter->sessionId, |
| 10451 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10452 | } |
| 10453 | } |
| 10454 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10455 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10456 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 10457 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10458 | { |
| 10459 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10460 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10461 | __func__, (int)status ); |
| 10462 | return -EINVAL; |
| 10463 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10464 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 10465 | else |
| 10466 | { |
| 10467 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 10468 | "called while in %d state", __func__, |
| 10469 | pHddStaCtx->conn_info.connState); |
| 10470 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10471 | } |
| 10472 | else |
| 10473 | { |
| 10474 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 10475 | } |
| 10476 | |
| 10477 | return status; |
| 10478 | } |
| 10479 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10480 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 10481 | struct net_device *dev, |
| 10482 | u16 reason |
| 10483 | ) |
| 10484 | { |
| 10485 | int ret; |
| 10486 | vos_ssr_protect(__func__); |
| 10487 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 10488 | vos_ssr_unprotect(__func__); |
| 10489 | |
| 10490 | return ret; |
| 10491 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10493 | /* |
| 10494 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10495 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10496 | * settings in IBSS mode. |
| 10497 | */ |
| 10498 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10499 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10500 | struct cfg80211_ibss_params *params |
| 10501 | ) |
| 10502 | { |
| 10503 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10504 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10505 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10506 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10508 | ENTER(); |
| 10509 | |
| 10510 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 10511 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10512 | |
| 10513 | if (params->ie_len && ( NULL != params->ie) ) |
| 10514 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10515 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 10516 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10517 | { |
| 10518 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 10519 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 10520 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10521 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10522 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10523 | tDot11fIEWPA dot11WPAIE; |
| 10524 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10525 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10526 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 10527 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10528 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 10529 | params->ie_len, DOT11F_EID_WPA); |
| 10530 | if ( NULL != ie ) |
| 10531 | { |
| 10532 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 10533 | // Unpack the WPA IE |
| 10534 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 10535 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 10536 | &ie[2+4], |
| 10537 | ie[1] - 4, |
| 10538 | &dot11WPAIE); |
| 10539 | /*Extract the multicast cipher, the encType for unicast |
| 10540 | cipher for wpa-none is none*/ |
| 10541 | encryptionType = |
| 10542 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 10543 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10544 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10545 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10546 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 10547 | |
| 10548 | if (0 > status) |
| 10549 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10550 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10551 | __func__); |
| 10552 | return status; |
| 10553 | } |
| 10554 | } |
| 10555 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10556 | pWextState->roamProfile.AuthType.authType[0] = |
| 10557 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10558 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 10559 | |
| 10560 | if (params->privacy) |
| 10561 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10562 | /* Security enabled IBSS, At this time there is no information available |
| 10563 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10564 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10565 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10567 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10568 | *enable privacy bit in beacons */ |
| 10569 | |
| 10570 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 10571 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10572 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10573 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10574 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 10575 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 10576 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10577 | return status; |
| 10578 | } |
| 10579 | |
| 10580 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10581 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10582 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10583 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10584 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10585 | struct net_device *dev, |
| 10586 | struct cfg80211_ibss_params *params |
| 10587 | ) |
| 10588 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10589 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10590 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10591 | tCsrRoamProfile *pRoamProfile; |
| 10592 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 10593 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10594 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10595 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | |
| 10597 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10598 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10599 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10600 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 10601 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10602 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10603 | "%s: device_mode = %s (%d)", __func__, |
| 10604 | hdd_device_modetoString(pAdapter->device_mode), |
| 10605 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10607 | status = wlan_hdd_validate_context(pHddCtx); |
| 10608 | |
| 10609 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10610 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10611 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10612 | "%s: HDD context is not valid", __func__); |
| 10613 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10614 | } |
| 10615 | |
| 10616 | if (NULL == pWextState) |
| 10617 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10618 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10619 | __func__); |
| 10620 | return -EIO; |
| 10621 | } |
| 10622 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10623 | if (vos_max_concurrent_connections_reached()) { |
| 10624 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10625 | return -ECONNREFUSED; |
| 10626 | } |
| 10627 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10628 | /*Try disconnecting if already in connected state*/ |
| 10629 | status = wlan_hdd_try_disconnect(pAdapter); |
| 10630 | if ( 0 > status) |
| 10631 | { |
| 10632 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 10633 | " IBSS connection")); |
| 10634 | return -EALREADY; |
| 10635 | } |
| 10636 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10637 | pRoamProfile = &pWextState->roamProfile; |
| 10638 | |
| 10639 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 10640 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10641 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10642 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10643 | return -EINVAL; |
| 10644 | } |
| 10645 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 10646 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 10647 | if (NULL != params->bssid) { |
| 10648 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 10649 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 10650 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 10651 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 10652 | return -EIO; |
| 10653 | } |
| 10654 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 10655 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 10656 | { |
| 10657 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 10658 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 10659 | { |
| 10660 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 10661 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 10662 | return -EIO; |
| 10663 | } |
| 10664 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 10665 | if (!params->bssid) |
| 10666 | { |
| 10667 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 10668 | "%s:Failed memory allocation", __func__); |
| 10669 | return -EIO; |
| 10670 | } |
| 10671 | vos_mem_copy((v_U8_t *)params->bssid, |
| 10672 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 10673 | VOS_MAC_ADDR_SIZE); |
| 10674 | alloc_bssid = VOS_TRUE; |
| 10675 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 10676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10677 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10678 | if (NULL != |
| 10679 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 10680 | params->chandef.chan) |
| 10681 | #else |
| 10682 | params->channel) |
| 10683 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10684 | { |
| 10685 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10686 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 10687 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 10688 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10689 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10690 | |
| 10691 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10692 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10693 | ieee80211_frequency_to_channel( |
| 10694 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 10695 | params->chandef.chan->center_freq); |
| 10696 | #else |
| 10697 | params->channel->center_freq); |
| 10698 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10699 | |
| 10700 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 10701 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10702 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10703 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 10704 | __func__); |
| 10705 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10706 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10707 | |
| 10708 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10709 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10710 | if (channelNum == validChan[indx]) |
| 10711 | { |
| 10712 | break; |
| 10713 | } |
| 10714 | } |
| 10715 | if (indx >= numChans) |
| 10716 | { |
| 10717 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10718 | __func__, channelNum); |
| 10719 | return -EINVAL; |
| 10720 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10721 | /* Set the Operational Channel */ |
| 10722 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 10723 | channelNum); |
| 10724 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 10725 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 10726 | pRoamProfile->ChannelInfo.ChannelList = |
| 10727 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10728 | } |
| 10729 | |
| 10730 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10731 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10732 | if (status < 0) |
| 10733 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10734 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10735 | __func__); |
| 10736 | return status; |
| 10737 | } |
| 10738 | |
| 10739 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10740 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10741 | params->ssid_len, params->bssid, |
| 10742 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10743 | |
| 10744 | if (0 > status) |
| 10745 | { |
| 10746 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 10747 | return status; |
| 10748 | } |
| 10749 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 10750 | if (NULL != params->bssid && |
| 10751 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 10752 | alloc_bssid == VOS_TRUE) |
| 10753 | { |
| 10754 | vos_mem_free(params->bssid); |
| 10755 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10756 | return 0; |
| 10757 | } |
| 10758 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10759 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 10760 | struct net_device *dev, |
| 10761 | struct cfg80211_ibss_params *params |
| 10762 | ) |
| 10763 | { |
| 10764 | int ret = 0; |
| 10765 | |
| 10766 | vos_ssr_protect(__func__); |
| 10767 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 10768 | vos_ssr_unprotect(__func__); |
| 10769 | |
| 10770 | return ret; |
| 10771 | } |
| 10772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10773 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10774 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10775 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10776 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10777 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10778 | struct net_device *dev |
| 10779 | ) |
| 10780 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10781 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10782 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10783 | tCsrRoamProfile *pRoamProfile; |
| 10784 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10785 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10786 | |
| 10787 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10788 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10789 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10790 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 10791 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10792 | status = wlan_hdd_validate_context(pHddCtx); |
| 10793 | |
| 10794 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10795 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10796 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10797 | "%s: HDD context is not valid", __func__); |
| 10798 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10799 | } |
| 10800 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10801 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 10802 | hdd_device_modetoString(pAdapter->device_mode), |
| 10803 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10804 | if (NULL == pWextState) |
| 10805 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10806 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10807 | __func__); |
| 10808 | return -EIO; |
| 10809 | } |
| 10810 | |
| 10811 | pRoamProfile = &pWextState->roamProfile; |
| 10812 | |
| 10813 | /* Issue disconnect only if interface type is set to IBSS */ |
| 10814 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 10815 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10816 | 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] | 10817 | __func__); |
| 10818 | return -EINVAL; |
| 10819 | } |
| 10820 | |
| 10821 | /* Issue Disconnect request */ |
| 10822 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10823 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 10824 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 10825 | |
| 10826 | return 0; |
| 10827 | } |
| 10828 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10829 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 10830 | struct net_device *dev |
| 10831 | ) |
| 10832 | { |
| 10833 | int ret = 0; |
| 10834 | |
| 10835 | vos_ssr_protect(__func__); |
| 10836 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 10837 | vos_ssr_unprotect(__func__); |
| 10838 | |
| 10839 | return ret; |
| 10840 | } |
| 10841 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10842 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10843 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10844 | * This function is used to set the phy parameters |
| 10845 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 10846 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10847 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10848 | u32 changed) |
| 10849 | { |
| 10850 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 10851 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10852 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10853 | |
| 10854 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10855 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10856 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 10857 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10858 | status = wlan_hdd_validate_context(pHddCtx); |
| 10859 | |
| 10860 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10861 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10862 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10863 | "%s: HDD context is not valid", __func__); |
| 10864 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10865 | } |
| 10866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10867 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 10868 | { |
| 10869 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 10870 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 10871 | wiphy->rts_threshold; |
| 10872 | |
| 10873 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10874 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10875 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10876 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10877 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10878 | __func__, rts_threshold); |
| 10879 | return -EINVAL; |
| 10880 | } |
| 10881 | |
| 10882 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 10883 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10884 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10885 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10886 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10887 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10888 | __func__, rts_threshold); |
| 10889 | return -EIO; |
| 10890 | } |
| 10891 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10892 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10893 | rts_threshold); |
| 10894 | } |
| 10895 | |
| 10896 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 10897 | { |
| 10898 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 10899 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 10900 | wiphy->frag_threshold; |
| 10901 | |
| 10902 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10903 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10904 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10905 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10906 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10907 | frag_threshold); |
| 10908 | return -EINVAL; |
| 10909 | } |
| 10910 | |
| 10911 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 10912 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10913 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10914 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10915 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10916 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10917 | __func__, frag_threshold); |
| 10918 | return -EIO; |
| 10919 | } |
| 10920 | |
| 10921 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 10922 | frag_threshold); |
| 10923 | } |
| 10924 | |
| 10925 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 10926 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 10927 | { |
| 10928 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 10929 | wiphy->retry_short : |
| 10930 | wiphy->retry_long; |
| 10931 | |
| 10932 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 10933 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 10934 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10935 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10936 | __func__, retry_value); |
| 10937 | return -EINVAL; |
| 10938 | } |
| 10939 | |
| 10940 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 10941 | { |
| 10942 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 10943 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10944 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10945 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10946 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10947 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10948 | __func__, retry_value); |
| 10949 | return -EIO; |
| 10950 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10951 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10952 | __func__, retry_value); |
| 10953 | } |
| 10954 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 10955 | { |
| 10956 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 10957 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10958 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10959 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10960 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10961 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10962 | __func__, retry_value); |
| 10963 | return -EIO; |
| 10964 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10965 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10966 | __func__, retry_value); |
| 10967 | } |
| 10968 | } |
| 10969 | |
| 10970 | return 0; |
| 10971 | } |
| 10972 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10973 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 10974 | u32 changed) |
| 10975 | { |
| 10976 | int ret; |
| 10977 | |
| 10978 | vos_ssr_protect(__func__); |
| 10979 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 10980 | vos_ssr_unprotect(__func__); |
| 10981 | |
| 10982 | return ret; |
| 10983 | } |
| 10984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10985 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10986 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10987 | * This function is used to set the txpower |
| 10988 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10989 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10990 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 10991 | struct wireless_dev *wdev, |
| 10992 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10993 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10994 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10995 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10996 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10997 | #endif |
| 10998 | int dbm) |
| 10999 | { |
| 11000 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11001 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11002 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 11003 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11004 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11005 | |
| 11006 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11007 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11008 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 11009 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11010 | status = wlan_hdd_validate_context(pHddCtx); |
| 11011 | |
| 11012 | if (0 != status) |
| 11013 | { |
| 11014 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11015 | "%s: HDD context is not valid", __func__); |
| 11016 | return status; |
| 11017 | } |
| 11018 | |
| 11019 | hHal = pHddCtx->hHal; |
| 11020 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11021 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 11022 | dbm, ccmCfgSetCallback, |
| 11023 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11024 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11025 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11026 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 11027 | return -EIO; |
| 11028 | } |
| 11029 | |
| 11030 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 11031 | dbm); |
| 11032 | |
| 11033 | switch(type) |
| 11034 | { |
| 11035 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 11036 | /* Fall through */ |
| 11037 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 11038 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 11039 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11040 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 11041 | __func__); |
| 11042 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11043 | } |
| 11044 | break; |
| 11045 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11046 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11047 | __func__); |
| 11048 | return -EOPNOTSUPP; |
| 11049 | break; |
| 11050 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11051 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 11052 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11053 | return -EIO; |
| 11054 | } |
| 11055 | |
| 11056 | return 0; |
| 11057 | } |
| 11058 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11059 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 11060 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11061 | struct wireless_dev *wdev, |
| 11062 | #endif |
| 11063 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11064 | enum tx_power_setting type, |
| 11065 | #else |
| 11066 | enum nl80211_tx_power_setting type, |
| 11067 | #endif |
| 11068 | int dbm) |
| 11069 | { |
| 11070 | int ret; |
| 11071 | vos_ssr_protect(__func__); |
| 11072 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 11073 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11074 | wdev, |
| 11075 | #endif |
| 11076 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11077 | type, |
| 11078 | #else |
| 11079 | type, |
| 11080 | #endif |
| 11081 | dbm); |
| 11082 | vos_ssr_unprotect(__func__); |
| 11083 | |
| 11084 | return ret; |
| 11085 | } |
| 11086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11087 | /* |
| 11088 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 11089 | * This function is used to read the txpower |
| 11090 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11091 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 11092 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11093 | struct wireless_dev *wdev, |
| 11094 | #endif |
| 11095 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11096 | { |
| 11097 | |
| 11098 | hdd_adapter_t *pAdapter; |
| 11099 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11100 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11101 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11102 | ENTER(); |
| 11103 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11104 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11105 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11106 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11107 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11108 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11109 | "%s: HDD context is not valid", __func__); |
| 11110 | *dbm = 0; |
| 11111 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11112 | } |
| 11113 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11114 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 11115 | if (NULL == pAdapter) |
| 11116 | { |
| 11117 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 11118 | return -ENOENT; |
| 11119 | } |
| 11120 | |
| 11121 | wlan_hdd_get_classAstats(pAdapter); |
| 11122 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 11123 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11124 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11125 | return 0; |
| 11126 | } |
| 11127 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11128 | static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11129 | u8* mac, struct station_info *sinfo) |
| 11130 | { |
| 11131 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 11132 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11133 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11134 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11135 | |
| 11136 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 11137 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11138 | |
| 11139 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 11140 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 11141 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 11142 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 11143 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 11144 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 11145 | tANI_U16 maxRate = 0; |
| 11146 | tANI_U16 myRate; |
| 11147 | tANI_U16 currentRate = 0; |
| 11148 | tANI_U8 maxSpeedMCS = 0; |
| 11149 | tANI_U8 maxMCSIdx = 0; |
| 11150 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11151 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 11152 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11153 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11154 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11155 | #ifdef WLAN_FEATURE_11AC |
| 11156 | tANI_U32 vht_mcs_map; |
| 11157 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 11158 | #endif /* WLAN_FEATURE_11AC */ |
| 11159 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11160 | ENTER(); |
| 11161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11162 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 11163 | (0 == ssidlen)) |
| 11164 | { |
| 11165 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 11166 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 11167 | /*To keep GUI happy*/ |
| 11168 | return 0; |
| 11169 | } |
| 11170 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 11171 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 11172 | { |
| 11173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11174 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 11175 | return 0; |
| 11176 | } |
| 11177 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11178 | status = wlan_hdd_validate_context(pHddCtx); |
| 11179 | |
| 11180 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11181 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11182 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11183 | "%s: HDD context is not valid", __func__); |
| 11184 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11185 | } |
| 11186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11187 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 11188 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 11189 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 11190 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 11191 | wlan_hdd_get_station_stats(pAdapter); |
| 11192 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 11193 | |
| 11194 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11195 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 11196 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11197 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11198 | { |
| 11199 | rate_flags = pAdapter->maxRateFlags; |
| 11200 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11201 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11202 | //convert to the UI units of 100kbps |
| 11203 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 11204 | |
| 11205 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11206 | 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] | 11207 | sinfo->signal, |
| 11208 | pCfg->reportMaxLinkSpeed, |
| 11209 | myRate, |
| 11210 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11211 | (int) pCfg->linkSpeedRssiMid, |
| 11212 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11213 | (int) rate_flags, |
| 11214 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11215 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11216 | |
| 11217 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 11218 | { |
| 11219 | // we do not want to necessarily report the current speed |
| 11220 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 11221 | { |
| 11222 | // report the max possible speed |
| 11223 | rssidx = 0; |
| 11224 | } |
| 11225 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 11226 | { |
| 11227 | // report the max possible speed with RSSI scaling |
| 11228 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 11229 | { |
| 11230 | // report the max possible speed |
| 11231 | rssidx = 0; |
| 11232 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11233 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11234 | { |
| 11235 | // report middle speed |
| 11236 | rssidx = 1; |
| 11237 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11238 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 11239 | { |
| 11240 | // report middle speed |
| 11241 | rssidx = 2; |
| 11242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11243 | else |
| 11244 | { |
| 11245 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11246 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11247 | } |
| 11248 | } |
| 11249 | else |
| 11250 | { |
| 11251 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 11252 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11253 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 11254 | __func__, pCfg->reportMaxLinkSpeed); |
| 11255 | rssidx = 0; |
| 11256 | } |
| 11257 | |
| 11258 | maxRate = 0; |
| 11259 | |
| 11260 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11261 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 11262 | OperationalRates, &ORLeng)) |
| 11263 | { |
| 11264 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11265 | /*To keep GUI happy*/ |
| 11266 | return 0; |
| 11267 | } |
| 11268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11269 | for (i = 0; i < ORLeng; i++) |
| 11270 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11271 | 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] | 11272 | { |
| 11273 | /* Validate Rate Set */ |
| 11274 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 11275 | { |
| 11276 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11277 | break; |
| 11278 | } |
| 11279 | } |
| 11280 | /* Update MAX rate */ |
| 11281 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11282 | } |
| 11283 | |
| 11284 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11285 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 11286 | ExtendedRates, &ERLeng)) |
| 11287 | { |
| 11288 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11289 | /*To keep GUI happy*/ |
| 11290 | return 0; |
| 11291 | } |
| 11292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11293 | for (i = 0; i < ERLeng; i++) |
| 11294 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11295 | 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] | 11296 | { |
| 11297 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 11298 | { |
| 11299 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11300 | break; |
| 11301 | } |
| 11302 | } |
| 11303 | /* Update MAX rate */ |
| 11304 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11305 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11306 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11307 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 11308 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11309 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11310 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11311 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11312 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11313 | mode = 2; |
| 11314 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 11315 | mode = 1; |
| 11316 | else |
| 11317 | mode = 0; |
| 11318 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11319 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 11320 | MCSRates, &MCSLeng)) |
| 11321 | { |
| 11322 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11323 | /*To keep GUI happy*/ |
| 11324 | return 0; |
| 11325 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11326 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11327 | #ifdef WLAN_FEATURE_11AC |
| 11328 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11329 | 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] | 11330 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11331 | 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] | 11332 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11333 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11334 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11335 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11336 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11337 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11338 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11339 | maxMCSIdx = 7; |
| 11340 | } |
| 11341 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 11342 | { |
| 11343 | maxMCSIdx = 8; |
| 11344 | } |
| 11345 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 11346 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11347 | //VHT20 is supporting 0~8 |
| 11348 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11349 | maxMCSIdx = 8; |
| 11350 | else |
| 11351 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11352 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11353 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11354 | if (0 != rssidx)/*check for scaled */ |
| 11355 | { |
| 11356 | //get middle rate MCS index if rssi=1/2 |
| 11357 | for (i=0; i <= maxMCSIdx; i++) |
| 11358 | { |
| 11359 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 11360 | { |
| 11361 | maxMCSIdx = i; |
| 11362 | break; |
| 11363 | } |
| 11364 | } |
| 11365 | } |
| 11366 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11367 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11368 | { |
| 11369 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 11370 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 11371 | } |
| 11372 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 11373 | { |
| 11374 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 11375 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 11376 | } |
| 11377 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11378 | { |
| 11379 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 11380 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 11381 | } |
| 11382 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11383 | maxSpeedMCS = 1; |
| 11384 | if (currentRate > maxRate) |
| 11385 | { |
| 11386 | maxRate = currentRate; |
| 11387 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11388 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11389 | } |
| 11390 | else |
| 11391 | #endif /* WLAN_FEATURE_11AC */ |
| 11392 | { |
| 11393 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11394 | { |
| 11395 | rateFlag |= 1; |
| 11396 | } |
| 11397 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11398 | { |
| 11399 | rateFlag |= 2; |
| 11400 | } |
| 11401 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11402 | if (rssidx == 1 || rssidx == 2) |
| 11403 | { |
| 11404 | //get middle rate MCS index if rssi=1/2 |
| 11405 | for (i=0; i <= 7; i++) |
| 11406 | { |
| 11407 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 11408 | { |
| 11409 | temp = i+1; |
| 11410 | break; |
| 11411 | } |
| 11412 | } |
| 11413 | } |
| 11414 | else |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11415 | { |
| 11416 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11417 | } |
| 11418 | |
| 11419 | for (i = 0; i < MCSLeng; i++) |
| 11420 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11421 | for (j = 0; j < temp; j++) |
| 11422 | { |
| 11423 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 11424 | { |
| 11425 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 11426 | break; |
| 11427 | } |
| 11428 | } |
| 11429 | if ((j < temp) && (currentRate > maxRate)) |
| 11430 | { |
| 11431 | maxRate = currentRate; |
| 11432 | maxSpeedMCS = 1; |
| 11433 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 11434 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11435 | } |
| 11436 | } |
| 11437 | } |
| 11438 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11439 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 11440 | { |
| 11441 | maxRate = myRate; |
| 11442 | maxSpeedMCS = 1; |
| 11443 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 11444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | // make sure we report a value at least as big as our current rate |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11446 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11447 | { |
| 11448 | maxRate = myRate; |
| 11449 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 11450 | { |
| 11451 | maxSpeedMCS = 0; |
| 11452 | } |
| 11453 | else |
| 11454 | { |
| 11455 | maxSpeedMCS = 1; |
| 11456 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 11457 | } |
| 11458 | } |
| 11459 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11460 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | { |
| 11462 | sinfo->txrate.legacy = maxRate; |
| 11463 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11464 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 11465 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11466 | } |
| 11467 | else |
| 11468 | { |
| 11469 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11470 | #ifdef WLAN_FEATURE_11AC |
| 11471 | sinfo->txrate.nss = 1; |
| 11472 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11473 | { |
| 11474 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11475 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11476 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11477 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11478 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11479 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11480 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11481 | } |
| 11482 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11483 | { |
| 11484 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11485 | } |
| 11486 | #endif /* WLAN_FEATURE_11AC */ |
| 11487 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 11488 | { |
| 11489 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 11490 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11491 | { |
| 11492 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11493 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11495 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11496 | { |
| 11497 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 11498 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11500 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11501 | pr_info("Reporting MCS rate %d flags %x\n", |
| 11502 | sinfo->txrate.mcs, |
| 11503 | sinfo->txrate.flags ); |
| 11504 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11505 | } |
| 11506 | } |
| 11507 | else |
| 11508 | { |
| 11509 | // report current rate instead of max rate |
| 11510 | |
| 11511 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 11512 | { |
| 11513 | //provide to the UI in units of 100kbps |
| 11514 | sinfo->txrate.legacy = myRate; |
| 11515 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11516 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 11517 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11518 | } |
| 11519 | else |
| 11520 | { |
| 11521 | //must be MCS |
| 11522 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11523 | #ifdef WLAN_FEATURE_11AC |
| 11524 | sinfo->txrate.nss = 1; |
| 11525 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11526 | { |
| 11527 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11528 | } |
| 11529 | else |
| 11530 | #endif /* WLAN_FEATURE_11AC */ |
| 11531 | { |
| 11532 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 11533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11534 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11535 | { |
| 11536 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 11537 | } |
| 11538 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11539 | { |
| 11540 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11541 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11542 | #ifdef WLAN_FEATURE_11AC |
| 11543 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11544 | { |
| 11545 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 11546 | } |
| 11547 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11548 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11549 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 11550 | sinfo->txrate.mcs, |
| 11551 | sinfo->txrate.flags ); |
| 11552 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11553 | } |
| 11554 | } |
| 11555 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 11556 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 11557 | sinfo->tx_packets = |
| 11558 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 11559 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 11560 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 11561 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 11562 | |
| 11563 | sinfo->tx_retries = |
| 11564 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 11565 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 11566 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 11567 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 11568 | |
| 11569 | sinfo->tx_failed = |
| 11570 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 11571 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 11572 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 11573 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 11574 | |
| 11575 | sinfo->filled |= |
| 11576 | STATION_INFO_TX_PACKETS | |
| 11577 | STATION_INFO_TX_RETRIES | |
| 11578 | STATION_INFO_TX_FAILED; |
| 11579 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11580 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11581 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 11582 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 11583 | EXIT(); |
| 11584 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11585 | } |
| 11586 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11587 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 11588 | u8* mac, struct station_info *sinfo) |
| 11589 | { |
| 11590 | int ret; |
| 11591 | |
| 11592 | vos_ssr_protect(__func__); |
| 11593 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 11594 | vos_ssr_unprotect(__func__); |
| 11595 | |
| 11596 | return ret; |
| 11597 | } |
| 11598 | |
| 11599 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 11600 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11601 | { |
| 11602 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11603 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11604 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11605 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11606 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11607 | ENTER(); |
| 11608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11609 | if (NULL == pAdapter) |
| 11610 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11611 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11612 | return -ENODEV; |
| 11613 | } |
| 11614 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11615 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11616 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 11617 | pAdapter->sessionId, timeout)); |
| 11618 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11619 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11620 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11621 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11622 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11623 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11624 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11625 | "%s: HDD context is not valid", __func__); |
| 11626 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11627 | } |
| 11628 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11629 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 11630 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 11631 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 11632 | (eConnectionState_Associated == |
| 11633 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 11634 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 11635 | |
| 11636 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11637 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 11638 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11639 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 11640 | { |
| 11641 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11642 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11643 | __func__, vos_status); |
| 11644 | } |
| 11645 | } |
| 11646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11647 | /**The get power cmd from the supplicant gets updated by the nl only |
| 11648 | *on successful execution of the function call |
| 11649 | *we are oppositely mapped w.r.t mode in the driver |
| 11650 | **/ |
| 11651 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 11652 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11653 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 11655 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11656 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11657 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11658 | return -EINVAL; |
| 11659 | } |
| 11660 | return 0; |
| 11661 | } |
| 11662 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11663 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 11664 | struct net_device *dev, bool mode, int timeout) |
| 11665 | { |
| 11666 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11667 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11668 | vos_ssr_protect(__func__); |
| 11669 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 11670 | vos_ssr_unprotect(__func__); |
| 11671 | |
| 11672 | return ret; |
| 11673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11674 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11675 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 11676 | struct net_device *netdev, |
| 11677 | u8 key_index) |
| 11678 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11679 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11680 | return 0; |
| 11681 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11682 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11683 | |
| 11684 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 11685 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 11686 | struct net_device *dev, |
| 11687 | struct ieee80211_txq_params *params) |
| 11688 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11689 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11690 | return 0; |
| 11691 | } |
| 11692 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11693 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 11694 | struct ieee80211_txq_params *params) |
| 11695 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11696 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11697 | return 0; |
| 11698 | } |
| 11699 | #endif //LINUX_VERSION_CODE |
| 11700 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11701 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11702 | struct net_device *dev, u8 *mac) |
| 11703 | { |
| 11704 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11705 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11706 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11707 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11708 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11709 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11710 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11711 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11712 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11713 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11714 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | return -EINVAL; |
| 11716 | } |
| 11717 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11718 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11719 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 11720 | pAdapter->sessionId, pAdapter->device_mode)); |
| 11721 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11722 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11723 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11724 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11725 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11726 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11727 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11728 | "%s: HDD context is not valid", __func__); |
| 11729 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11730 | } |
| 11731 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11732 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11733 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | ) |
| 11735 | { |
| 11736 | if( NULL == mac ) |
| 11737 | { |
| 11738 | v_U16_t i; |
| 11739 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 11740 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 11741 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 11742 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11743 | { |
| 11744 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 11745 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11746 | "%s: Delete STA with MAC::" |
| 11747 | MAC_ADDRESS_STR, |
| 11748 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 11749 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 11750 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 11751 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11752 | } |
| 11753 | } |
| 11754 | } |
| 11755 | else |
| 11756 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11757 | |
| 11758 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 11759 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 11760 | { |
| 11761 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11762 | "%s: Skip this DEL STA as this is not used::" |
| 11763 | MAC_ADDRESS_STR, |
| 11764 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11765 | return -ENOENT; |
| 11766 | } |
| 11767 | |
| 11768 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 11769 | { |
| 11770 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11771 | "%s: Skip this DEL STA as deauth is in progress::" |
| 11772 | MAC_ADDRESS_STR, |
| 11773 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11774 | return -ENOENT; |
| 11775 | } |
| 11776 | |
| 11777 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 11778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11779 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11780 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11781 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11782 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11783 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11784 | |
| 11785 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 11786 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 11787 | { |
| 11788 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 11789 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11790 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11791 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11792 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11793 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 11794 | return -ENOENT; |
| 11795 | } |
| 11796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11797 | } |
| 11798 | } |
| 11799 | |
| 11800 | EXIT(); |
| 11801 | |
| 11802 | return 0; |
| 11803 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11804 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 11805 | struct net_device *dev, u8 *mac) |
| 11806 | { |
| 11807 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11809 | vos_ssr_protect(__func__); |
| 11810 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, mac); |
| 11811 | vos_ssr_unprotect(__func__); |
| 11812 | |
| 11813 | return ret; |
| 11814 | } |
| 11815 | |
| 11816 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11817 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 11818 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11819 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 11820 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11821 | #ifdef FEATURE_WLAN_TDLS |
| 11822 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11823 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11824 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11825 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11826 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 11827 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 11828 | mask = params->sta_flags_mask; |
| 11829 | |
| 11830 | set = params->sta_flags_set; |
| 11831 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11832 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 11833 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11834 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 11835 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 11836 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 11837 | |
| 11838 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 11839 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11840 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 11841 | } |
| 11842 | } |
| 11843 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 11844 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11845 | } |
| 11846 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11847 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 11848 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 11849 | { |
| 11850 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11851 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11852 | vos_ssr_protect(__func__); |
| 11853 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 11854 | vos_ssr_unprotect(__func__); |
| 11855 | |
| 11856 | return ret; |
| 11857 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11858 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11859 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 11860 | 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] | 11861 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11862 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11863 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11864 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11865 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11866 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11867 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11868 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11869 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11870 | hdd_context_t *pHddCtx; |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11871 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 11872 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11873 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11874 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11875 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11876 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11877 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11878 | return -EINVAL; |
| 11879 | } |
| 11880 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11881 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11882 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11883 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11884 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11885 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11886 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11887 | "%s: HDD context is not valid", __func__); |
| 11888 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11889 | } |
| 11890 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11891 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11892 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11893 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11894 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11895 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11896 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11897 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11898 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 11899 | { |
| 11900 | /* BSSID matched previous entry. Overwrite it. */ |
| 11901 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11902 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11903 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11904 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11905 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11906 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11907 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11908 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11909 | dump_bssid(pmksa->bssid); |
| 11910 | dump_pmkid(halHandle, pmksa->pmkid); |
| 11911 | break; |
| 11912 | } |
| 11913 | } |
| 11914 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 11915 | /* Check we compared all entries,if then take the first slot now */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11916 | if (j == MAX_PMKSAIDS_IN_CACHE) pHddStaCtx->PMKIDCacheIndex=0; |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 11917 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11918 | if (!BSSIDMatched) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11919 | { |
| 11920 | // 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] | 11921 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].BSSID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11922 | pmksa->bssid, ETHER_ADDR_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11923 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11924 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11925 | CSR_RSN_PMKID_SIZE); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11926 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Adding a new cache entry %d.", |
| 11927 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11928 | dump_bssid(pmksa->bssid); |
| 11929 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11930 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11931 | // 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] | 11932 | if (pHddStaCtx->PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) |
| 11933 | pHddStaCtx->PMKIDCacheIndex++; |
| 11934 | else |
| 11935 | pHddStaCtx->PMKIDCacheIndex = 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11936 | } |
| 11937 | |
| 11938 | |
| 11939 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11940 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
| 11941 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
| 11942 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11943 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11944 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11945 | pHddStaCtx->PMKIDCache, |
| 11946 | pHddStaCtx->PMKIDCacheIndex); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11947 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11948 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 11949 | pAdapter->sessionId, result)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11950 | return 0; |
| 11951 | } |
| 11952 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 11953 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 11954 | struct cfg80211_pmksa *pmksa) |
| 11955 | { |
| 11956 | int ret; |
| 11957 | |
| 11958 | vos_ssr_protect(__func__); |
| 11959 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 11960 | vos_ssr_unprotect(__func__); |
| 11961 | |
| 11962 | return ret; |
| 11963 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11964 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11965 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 11966 | 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] | 11967 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11968 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11969 | tANI_U32 j=0; |
| 11970 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11971 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11972 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11973 | tANI_U8 BSSIDMatched = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11974 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 11975 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11976 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11977 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 11978 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 11979 | |
| 11980 | /* Validate pAdapter */ |
| 11981 | if (NULL == pAdapter) |
| 11982 | { |
| 11983 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 11984 | return -EINVAL; |
| 11985 | } |
| 11986 | |
| 11987 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11988 | status = wlan_hdd_validate_context(pHddCtx); |
| 11989 | |
| 11990 | if (0 != status) |
| 11991 | { |
| 11992 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11993 | "%s: HDD context is not valid", __func__); |
| 11994 | return status; |
| 11995 | } |
| 11996 | |
| 11997 | /*Retrieve halHandle*/ |
| 11998 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 11999 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12000 | |
| 12001 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12002 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12003 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12004 | hddLog(VOS_TRACE_LEVEL_INFO, FL("No entries to flush")); |
| 12005 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12006 | } |
| 12007 | |
| 12008 | /*find the matching PMKSA entry from j=0 to (index-1), |
| 12009 | * and delete the matched one |
| 12010 | */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12011 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12012 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12013 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12014 | pmksa->bssid, |
| 12015 | WNI_CFG_BSSID_LEN)) |
| 12016 | { |
| 12017 | /* BSSID matched entry */ |
| 12018 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12019 | if (j < pHddStaCtx->PMKIDCacheIndex-1) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12020 | { |
| 12021 | /*replace the matching entry with the last entry in HDD local cache*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12022 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
| 12023 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 12024 | VOS_MAC_ADDR_SIZE); |
| 12025 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
| 12026 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 12027 | CSR_RSN_PMKID_SIZE); |
| 12028 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12029 | |
| 12030 | /*clear the last entry in HDD cache ---[index-1]*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12031 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 12032 | VOS_MAC_ADDR_SIZE); |
| 12033 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 12034 | CSR_RSN_PMKID_SIZE); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12035 | /*reduce the PMKID array index*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12036 | pHddStaCtx->PMKIDCacheIndex--; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12037 | /*delete the last PMKID cache in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12038 | if (eHAL_STATUS_SUCCESS != |
| 12039 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12040 | { |
| 12041 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12042 | __func__, pHddStaCtx->PMKIDCacheIndex); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12043 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12044 | } |
| 12045 | |
| 12046 | dump_bssid(pmksa->bssid); |
| 12047 | dump_pmkid(halHandle,pmksa->pmkid); |
| 12048 | |
| 12049 | break; |
| 12050 | } |
| 12051 | } |
| 12052 | |
| 12053 | /* we compare all entries,but cannot find matching entry */ |
| 12054 | if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched) |
| 12055 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12056 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 12057 | "%s: No such PMKSA entry existed " MAC_ADDRESS_STR, |
| 12058 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12059 | dump_bssid(pmksa->bssid); |
| 12060 | dump_pmkid(halHandle, pmksa->pmkid); |
| 12061 | return -EINVAL; |
| 12062 | } |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12063 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12064 | } |
| 12065 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12066 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12067 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 12068 | struct cfg80211_pmksa *pmksa) |
| 12069 | { |
| 12070 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12071 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12072 | vos_ssr_protect(__func__); |
| 12073 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 12074 | vos_ssr_unprotect(__func__); |
| 12075 | |
| 12076 | return ret; |
| 12077 | |
| 12078 | } |
| 12079 | |
| 12080 | 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] | 12081 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12082 | tANI_U32 j=0; |
| 12083 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12084 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12085 | tHalHandle halHandle; |
| 12086 | hdd_context_t *pHddCtx; |
| 12087 | tANI_U8 *pBSSId; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12088 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12089 | |
| 12090 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 12091 | |
| 12092 | /* Validate pAdapter */ |
| 12093 | if (NULL == pAdapter) |
| 12094 | { |
| 12095 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12096 | "%s: Invalid Adapter" ,__func__); |
| 12097 | return -EINVAL; |
| 12098 | } |
| 12099 | |
| 12100 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12101 | status = wlan_hdd_validate_context(pHddCtx); |
| 12102 | |
| 12103 | if (0 != status) |
| 12104 | { |
| 12105 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12106 | "%s: HDD context is not valid", __func__); |
| 12107 | return status; |
| 12108 | } |
| 12109 | |
| 12110 | /*Retrieve halHandle*/ |
| 12111 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12112 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12113 | |
| 12114 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12115 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12116 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12117 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("No entries to flush")); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12118 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12119 | } |
| 12120 | |
| 12121 | /*delete all the PMKSA one by one */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12122 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12123 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12124 | pBSSId =(tANI_U8 *)(pHddStaCtx->PMKIDCache[j].BSSID); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12125 | /*delete the PMKID in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12126 | if (eHAL_STATUS_SUCCESS != |
| 12127 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12128 | { |
| 12129 | hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.", |
| 12130 | __func__,j); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12131 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12132 | } |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 12133 | /*clear the entry in HDD cache 0--index-1 */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12134 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].BSSID, VOS_MAC_ADDR_SIZE); |
| 12135 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); |
| 12136 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12137 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12138 | pHddStaCtx->PMKIDCacheIndex = 0; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12139 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12140 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12141 | |
| 12142 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 12143 | { |
| 12144 | int ret; |
| 12145 | |
| 12146 | vos_ssr_protect(__func__); |
| 12147 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 12148 | vos_ssr_unprotect(__func__); |
| 12149 | |
| 12150 | return ret; |
| 12151 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12152 | #endif |
| 12153 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12154 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12155 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12156 | struct net_device *dev, |
| 12157 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12158 | { |
| 12159 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12160 | hdd_station_ctx_t *pHddStaCtx; |
| 12161 | |
| 12162 | if (NULL == pAdapter) |
| 12163 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12164 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12165 | return -ENODEV; |
| 12166 | } |
| 12167 | |
| 12168 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12169 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12170 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12171 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 12172 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12173 | // Added for debug on reception of Re-assoc Req. |
| 12174 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 12175 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12176 | 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] | 12177 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12178 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12179 | } |
| 12180 | |
| 12181 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12182 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12183 | ftie->ie_len); |
| 12184 | #endif |
| 12185 | |
| 12186 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 12187 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12188 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12189 | ftie->ie_len); |
| 12190 | return 0; |
| 12191 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12192 | |
| 12193 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12194 | struct net_device *dev, |
| 12195 | struct cfg80211_update_ft_ies_params *ftie) |
| 12196 | { |
| 12197 | int ret; |
| 12198 | |
| 12199 | vos_ssr_protect(__func__); |
| 12200 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 12201 | vos_ssr_unprotect(__func__); |
| 12202 | |
| 12203 | return ret; |
| 12204 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12205 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12206 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12207 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 12208 | |
| 12209 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 12210 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 12211 | { |
| 12212 | int ret; |
| 12213 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 12214 | hdd_context_t *pHddCtx; |
| 12215 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12216 | ENTER(); |
| 12217 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12218 | if (NULL == pAdapter) |
| 12219 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 12220 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12221 | "%s: HDD adapter is Null", __func__); |
| 12222 | return ; |
| 12223 | } |
| 12224 | |
| 12225 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12226 | if (NULL == pHddCtx) |
| 12227 | { |
| 12228 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12229 | "%s: HDD context is Null!!!", __func__); |
| 12230 | return ; |
| 12231 | } |
| 12232 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12233 | spin_lock(&pHddCtx->schedScan_lock); |
| 12234 | if (TRUE == pHddCtx->isWiphySuspended) |
| 12235 | { |
| 12236 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 12237 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12238 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12239 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 12240 | return ; |
| 12241 | } |
| 12242 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12243 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12244 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 12245 | |
| 12246 | if (0 > ret) |
| 12247 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 12248 | |
| 12249 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12250 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12251 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12252 | } |
| 12253 | |
| 12254 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12255 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12256 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12257 | */ |
| 12258 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 12259 | { |
| 12260 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 12261 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12262 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12263 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12264 | int status = 0; |
| 12265 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 12266 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12267 | /* The current firmware design does not allow PNO during any |
| 12268 | * active sessions. Hence, determine the active sessions |
| 12269 | * and return a failure. |
| 12270 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12271 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 12272 | { |
| 12273 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12274 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12275 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12276 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 12277 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 12278 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 12279 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 12280 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
| 12281 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12282 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12283 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12284 | } |
| 12285 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 12286 | pAdapterNode = pNext; |
| 12287 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12288 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12289 | } |
| 12290 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12291 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 12292 | { |
| 12293 | hdd_adapter_t *pAdapter = callbackContext; |
| 12294 | hdd_context_t *pHddCtx; |
| 12295 | |
| 12296 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 12297 | { |
| 12298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12299 | FL("Invalid adapter or adapter has invalid magic")); |
| 12300 | return; |
| 12301 | } |
| 12302 | |
| 12303 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12304 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 12305 | { |
| 12306 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12307 | FL("HDD context is not valid")); |
| 12308 | return; |
| 12309 | } |
| 12310 | |
| 12311 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12312 | FL("PNO enable response status = %d"), status); |
| 12313 | |
| 12314 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 12315 | complete(&pAdapter->pno_comp_var); |
| 12316 | } |
| 12317 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12318 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12319 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 12320 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12321 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12322 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12323 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 12324 | { |
| 12325 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12326 | tpSirPNOScanReq pPnoRequest = NULL; |
| 12327 | hdd_context_t *pHddCtx; |
| 12328 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame^] | 12329 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 12330 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 12331 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12332 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12333 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12334 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12335 | |
| 12336 | if (NULL == pAdapter) |
| 12337 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12338 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12339 | "%s: HDD adapter is Null", __func__); |
| 12340 | return -ENODEV; |
| 12341 | } |
| 12342 | |
| 12343 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12344 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12345 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12346 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12347 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 12348 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12349 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12350 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12351 | } |
| 12352 | |
| 12353 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12354 | if (NULL == hHal) |
| 12355 | { |
| 12356 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12357 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12358 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12359 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12360 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12361 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 12362 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12363 | { |
| 12364 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12365 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 12366 | return -EBUSY; |
| 12367 | } |
| 12368 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12369 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12370 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12371 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12372 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12373 | return -EBUSY; |
| 12374 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12375 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12376 | if (TRUE == pHddCtx->isPnoEnable) |
| 12377 | { |
| 12378 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 12379 | FL("already PNO is enabled")); |
| 12380 | return -EBUSY; |
| 12381 | } |
| 12382 | pHddCtx->isPnoEnable = TRUE; |
| 12383 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12384 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 12385 | if (NULL == pPnoRequest) |
| 12386 | { |
| 12387 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12388 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12389 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12390 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12391 | } |
| 12392 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 12393 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12394 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 12395 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 12396 | |
| 12397 | if (( !pPnoRequest->ucNetworksCount ) || |
| 12398 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 12399 | { |
| 12400 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 12401 | "%s: Network input is not correct %d Max Network supported is %d", |
| 12402 | __func__, pPnoRequest->ucNetworksCount, |
| 12403 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12404 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12405 | goto error; |
| 12406 | } |
| 12407 | |
| 12408 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 12409 | { |
| 12410 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12411 | "%s: Incorrect number of channels %d", |
| 12412 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12413 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12414 | goto error; |
| 12415 | } |
| 12416 | |
| 12417 | /* Framework provides one set of channels(all) |
| 12418 | * common for all saved profile */ |
| 12419 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12420 | channels_allowed, &num_channels_allowed)) |
| 12421 | { |
| 12422 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12423 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12424 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12425 | goto error; |
| 12426 | } |
| 12427 | /* Checking each channel against allowed channel list */ |
| 12428 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12429 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12430 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12431 | char chList [(request->n_channels*5)+1]; |
| 12432 | int len; |
| 12433 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12434 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12435 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12436 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12437 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 12438 | { |
| 12439 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 12440 | len += snprintf(chList+len, 5, "%d ", |
| 12441 | request->channels[i]->hw_value); |
| 12442 | break ; |
| 12443 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12444 | } |
| 12445 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12446 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
| 12447 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12448 | |
| 12449 | /* Filling per profile params */ |
| 12450 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 12451 | { |
| 12452 | pPnoRequest->aNetworks[i].ssId.length = |
| 12453 | request->match_sets[i].ssid.ssid_len; |
| 12454 | |
| 12455 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 12456 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 12457 | { |
| 12458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12459 | "%s: SSID Len %d is not correct for network %d", |
| 12460 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12461 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12462 | goto error; |
| 12463 | } |
| 12464 | |
| 12465 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 12466 | request->match_sets[i].ssid.ssid, |
| 12467 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 12468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12469 | "%s: SSID of network %d is %s ", __func__, |
| 12470 | i, pPnoRequest->aNetworks[i].ssId.ssId); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12471 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 12472 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 12473 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 12474 | |
| 12475 | /*Copying list of valid channel into request */ |
| 12476 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 12477 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 12478 | |
| 12479 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 12480 | } |
| 12481 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame^] | 12482 | for (i = 0; i < request->n_ssids; i++) |
| 12483 | { |
| 12484 | j = 0; |
| 12485 | while (j < pPnoRequest->ucNetworksCount) |
| 12486 | { |
| 12487 | if ((pPnoRequest->aNetworks[j].ssId.length == |
| 12488 | request->ssids[i].ssid_len) && |
| 12489 | (0 == memcmp(pPnoRequest->aNetworks[j].ssId.ssId, |
| 12490 | request->ssids[i].ssid, |
| 12491 | pPnoRequest->aNetworks[j].ssId.length))) |
| 12492 | { |
| 12493 | pPnoRequest->aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
| 12494 | break; |
| 12495 | } |
| 12496 | j++; |
| 12497 | } |
| 12498 | } |
| 12499 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12500 | "Number of hidden networks being Configured = %d", |
| 12501 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 12502 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 12503 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 12504 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 12505 | { |
| 12506 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 12507 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 12508 | pPnoRequest->us24GProbeTemplateLen); |
| 12509 | |
| 12510 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 12511 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 12512 | pPnoRequest->us5GProbeTemplateLen); |
| 12513 | } |
| 12514 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 12515 | /* Driver gets only one time interval which is hardcoded in |
| 12516 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 12517 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 12518 | * 80,160,320 secs. And number of scan cycle for each timer |
| 12519 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 12520 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 12521 | * will be repeated after each interval specified by supplicant |
| 12522 | * till PNO is disabled. |
| 12523 | */ |
| 12524 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 12525 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 12526 | else |
| 12527 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 12528 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 12529 | |
| 12530 | tempInterval = (request->interval)/1000; |
| 12531 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12532 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 12533 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 12534 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 12535 | { |
| 12536 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 12537 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 12538 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 12539 | tempInterval *= 2; |
| 12540 | } |
| 12541 | //Repeat last timer until pno disabled. |
| 12542 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 12543 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 12544 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12545 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12546 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 12547 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 12548 | pPnoRequest->callbackContext = pAdapter; |
| 12549 | pAdapter->pno_req_status = 0; |
| 12550 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12551 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12552 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 12553 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 12554 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 12555 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12556 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12557 | pPnoRequest, pAdapter->sessionId, |
| 12558 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 12559 | if (eHAL_STATUS_SUCCESS != status) |
| 12560 | { |
| 12561 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12562 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12563 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12564 | goto error; |
| 12565 | } |
| 12566 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12567 | ret = wait_for_completion_timeout( |
| 12568 | &pAdapter->pno_comp_var, |
| 12569 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 12570 | if (0 >= ret) |
| 12571 | { |
| 12572 | // Did not receive the response for PNO enable in time. |
| 12573 | // Assuming the PNO enable was success. |
| 12574 | // Returning error from here, because we timeout, results |
| 12575 | // in side effect of Wifi (Wifi Setting) not to work. |
| 12576 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12577 | FL("Timed out waiting for PNO to be Enabled")); |
| 12578 | ret = 0; |
| 12579 | goto error; |
| 12580 | } |
| 12581 | |
c_hpothu | 3c986b2 | 2014-07-09 14:45:09 +0530 | [diff] [blame] | 12582 | vos_mem_free(pPnoRequest); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12583 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12584 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12585 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12586 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12588 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12589 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12590 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12591 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12592 | } |
| 12593 | |
| 12594 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12595 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 12596 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12597 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12598 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 12599 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 12600 | { |
| 12601 | int ret; |
| 12602 | |
| 12603 | vos_ssr_protect(__func__); |
| 12604 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 12605 | vos_ssr_unprotect(__func__); |
| 12606 | |
| 12607 | return ret; |
| 12608 | } |
| 12609 | |
| 12610 | /* |
| 12611 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 12612 | * Function to disable PNO |
| 12613 | */ |
| 12614 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12615 | struct net_device *dev) |
| 12616 | { |
| 12617 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12618 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12619 | hdd_context_t *pHddCtx; |
| 12620 | tHalHandle hHal; |
| 12621 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12622 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12623 | |
| 12624 | ENTER(); |
| 12625 | |
| 12626 | if (NULL == pAdapter) |
| 12627 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12629 | "%s: HDD adapter is Null", __func__); |
| 12630 | return -ENODEV; |
| 12631 | } |
| 12632 | |
| 12633 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12634 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12635 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12636 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 12637 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12638 | "%s: HDD context is Null", __func__); |
| 12639 | return -ENODEV; |
| 12640 | } |
| 12641 | |
| 12642 | /* The return 0 is intentional when isLogpInProgress and |
| 12643 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 12644 | * failure in sched_scan_stop , especially for a case where the unload |
| 12645 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 12646 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 12647 | * success. If it returns a failure , then its next invocation due to the |
| 12648 | * clean up of the second interface will have the dev pointer corresponding |
| 12649 | * to the first one leading to a crash. |
| 12650 | */ |
| 12651 | if (pHddCtx->isLogpInProgress) |
| 12652 | { |
| 12653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12654 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 12655 | return ret; |
| 12656 | } |
| 12657 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 12658 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12659 | { |
| 12660 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12661 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 12662 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12663 | } |
| 12664 | |
| 12665 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12666 | if (NULL == hHal) |
| 12667 | { |
| 12668 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12669 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12670 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12671 | } |
| 12672 | |
| 12673 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 12674 | if (NULL == pPnoRequest) |
| 12675 | { |
| 12676 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12677 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12678 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12679 | } |
| 12680 | |
| 12681 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 12682 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 12683 | pPnoRequest->ucNetworksCount = 0; |
| 12684 | |
| 12685 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 12686 | pAdapter->sessionId, |
| 12687 | NULL, pAdapter); |
| 12688 | if (eHAL_STATUS_SUCCESS != status) |
| 12689 | { |
| 12690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12691 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12692 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12693 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12694 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12695 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12696 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12697 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12698 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12699 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12700 | vos_mem_free(pPnoRequest); |
| 12701 | |
| 12702 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12703 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12704 | } |
| 12705 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12706 | /* |
| 12707 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 12708 | * NL interface to disable PNO |
| 12709 | */ |
| 12710 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 12711 | struct net_device *dev) |
| 12712 | { |
| 12713 | int ret; |
| 12714 | |
| 12715 | vos_ssr_protect(__func__); |
| 12716 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 12717 | vos_ssr_unprotect(__func__); |
| 12718 | |
| 12719 | return ret; |
| 12720 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12721 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 12722 | |
| 12723 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12724 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 12725 | #if TDLS_MGMT_VERSION2 |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12726 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 12727 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 12728 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 12729 | #else |
| 12730 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 12731 | u8 *peer, u8 action_code, u8 dialog_token, |
| 12732 | u16 status_code, const u8 *buf, size_t len) |
| 12733 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12734 | { |
| 12735 | |
| 12736 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12737 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12738 | u8 peerMac[6]; |
| 12739 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12740 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12741 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 12742 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 12743 | #if !(TDLS_MGMT_VERSION2) |
| 12744 | u32 peer_capability = 0; |
| 12745 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12746 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12747 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12748 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12749 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 12750 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12751 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12752 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12753 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12754 | "Invalid arguments"); |
| 12755 | return -EINVAL; |
| 12756 | } |
| 12757 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 12758 | if (pHddCtx->isLogpInProgress) |
| 12759 | { |
| 12760 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12761 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12762 | wlan_hdd_tdls_set_link_status(pAdapter, peer, eTDLS_LINK_IDLE); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 12763 | return -EBUSY; |
| 12764 | } |
| 12765 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12766 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12767 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12768 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 12769 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 12770 | MAC_ADDRESS_STR " action %d declined.", |
| 12771 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12772 | return -ENOTSUPP; |
| 12773 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12774 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12775 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 12776 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 12777 | { |
| 12778 | /* if tdls_mode is disabled to respond to peer's request */ |
| 12779 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 12780 | { |
| 12781 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 12782 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 12783 | " TDLS mode is disabled. action %d declined.", |
| 12784 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12785 | |
| 12786 | return -ENOTSUPP; |
| 12787 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 12788 | |
| 12789 | if (vos_max_concurrent_connections_reached()) |
| 12790 | { |
| 12791 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12792 | return -EINVAL; |
| 12793 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12794 | } |
| 12795 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12796 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 12797 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12798 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12799 | { |
| 12800 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12801 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 12802 | " TDLS setup is ongoing. action %d declined.", |
| 12803 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 12804 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12805 | } |
| 12806 | } |
| 12807 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12808 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 12809 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12810 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12811 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 12812 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12813 | { |
| 12814 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 12815 | we return error code at 'add_station()'. Hence we have this |
| 12816 | check again in addtion to add_station(). |
| 12817 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12818 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12819 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12820 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12821 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12822 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 12823 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 12824 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 12825 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12826 | } |
| 12827 | else |
| 12828 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12829 | /* maximum reached. tweak to send error code to peer and return |
| 12830 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12831 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12832 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12833 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12834 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 12835 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 12836 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12837 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12838 | /* fall through to send setup resp with failure status |
| 12839 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12840 | } |
| 12841 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12842 | else |
| 12843 | { |
| 12844 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12845 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12846 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12847 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12848 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 12849 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 12850 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12851 | return -EPERM; |
| 12852 | } |
| 12853 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 12854 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12855 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12856 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 12857 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 12858 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 12859 | "%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] | 12860 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 12861 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 12862 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12863 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12864 | /*Except teardown responder will not be used so just make 0*/ |
| 12865 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12866 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12867 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 12868 | |
| 12869 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12870 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 12871 | |
| 12872 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 12873 | responder = pTdlsPeer->is_responder; |
| 12874 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12875 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 12876 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 12877 | "%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] | 12878 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 12879 | dialog_token, status_code, len); |
| 12880 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12881 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12882 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12883 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 12884 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 12885 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12886 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 12887 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 12888 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12889 | { |
| 12890 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 12891 | { |
| 12892 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 12893 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12894 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12895 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 12896 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 12897 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12898 | } |
| 12899 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12900 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 12901 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 12902 | { |
| 12903 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12904 | "%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] | 12905 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 12906 | return -EBUSY; |
| 12907 | } |
| 12908 | |
| 12909 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12910 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 12911 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12912 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 12913 | 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] | 12914 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12915 | if (VOS_STATUS_SUCCESS != status) |
| 12916 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12917 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12918 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12919 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12920 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 12921 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12922 | } |
| 12923 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 12924 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 12925 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 12926 | |
| 12927 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12928 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 12929 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12930 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 12931 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12932 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 12933 | |
| 12934 | if (pHddCtx->isLogpInProgress) |
| 12935 | { |
| 12936 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12937 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 12938 | return -EAGAIN; |
| 12939 | } |
| 12940 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 12941 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 12942 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12943 | } |
| 12944 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12945 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12946 | { |
| 12947 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12948 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 12949 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12950 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12951 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 12952 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12953 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12954 | } |
| 12955 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 12956 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12957 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 12958 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12959 | |
| 12960 | return 0; |
| 12961 | } |
| 12962 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12963 | static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12964 | u8 *peer, enum nl80211_tdls_operation oper) |
| 12965 | { |
| 12966 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12967 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12968 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12969 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12970 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12971 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12972 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 12973 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12974 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12975 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12976 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 12977 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12978 | return -EINVAL; |
| 12979 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 12980 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12981 | status = wlan_hdd_validate_context(pHddCtx); |
| 12982 | |
| 12983 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 12984 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12985 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12986 | "%s: HDD context is not valid", __func__); |
| 12987 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 12988 | } |
| 12989 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12990 | |
| 12991 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 12992 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12993 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 12994 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 12995 | "TDLS Disabled in INI OR not enabled in FW. " |
| 12996 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12997 | return -ENOTSUPP; |
| 12998 | } |
| 12999 | |
| 13000 | switch (oper) { |
| 13001 | case NL80211_TDLS_ENABLE_LINK: |
| 13002 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13003 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13004 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13005 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13006 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13007 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13008 | |
| 13009 | if ( NULL == pTdlsPeer ) { |
| 13010 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13011 | " (oper %d) not exsting. ignored", |
| 13012 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13013 | return -EINVAL; |
| 13014 | } |
| 13015 | |
| 13016 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13017 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13018 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13019 | "NL80211_TDLS_ENABLE_LINK"); |
| 13020 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 13021 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 13022 | { |
| 13023 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 13024 | MAC_ADDRESS_STR " failed", |
| 13025 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 13026 | return -EINVAL; |
| 13027 | } |
| 13028 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13029 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13030 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13031 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 13032 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13033 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 13034 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 13035 | return -EINVAL; |
| 13036 | } |
| 13037 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13038 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13039 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13040 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 13041 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 13042 | * register with the TL on after the response for this operation |
| 13043 | * is received . |
| 13044 | */ |
| 13045 | ret = wait_for_completion_interruptible_timeout( |
| 13046 | &pAdapter->tdls_link_establish_req_comp, |
| 13047 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 13048 | if (ret <= 0) |
| 13049 | { |
| 13050 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13051 | "%s: Link Establish Request Faled Status %ld", |
| 13052 | __func__, ret); |
| 13053 | return -EINVAL; |
| 13054 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13055 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13056 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 13057 | /* Mark TDLS client Authenticated .*/ |
| 13058 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 13059 | pTdlsPeer->staId, |
| 13060 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13061 | if (VOS_STATUS_SUCCESS == status) |
| 13062 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13063 | if (pTdlsPeer->is_responder == 0) |
| 13064 | { |
| 13065 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 13066 | |
| 13067 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 13068 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 13069 | WAIT_TIME_TDLS_INITIATOR); |
| 13070 | /* suspend initiator TX until it receives direct packet from the |
| 13071 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 13072 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13073 | &staId, NULL); |
| 13074 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13075 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 13076 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13077 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13078 | |
| 13079 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13080 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 13081 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13082 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13083 | int ac; |
| 13084 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 13085 | WLANTL_AC_VI, |
| 13086 | WLANTL_AC_BK, |
| 13087 | WLANTL_AC_BE }; |
| 13088 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 13089 | for(ac=0; ac < 4; ac++) |
| 13090 | { |
| 13091 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13092 | pTdlsPeer->staId, ucAc[ac], |
| 13093 | tlTid[ac], tlTid[ac], 0, 0, |
| 13094 | WLANTL_BI_DIR ); |
| 13095 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13096 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13097 | } |
| 13098 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13099 | } |
| 13100 | break; |
| 13101 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13102 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13103 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13104 | |
| 13105 | if ( NULL == pTdlsPeer ) { |
| 13106 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13107 | " (oper %d) not exsting. ignored", |
| 13108 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13109 | return -EINVAL; |
| 13110 | } |
| 13111 | |
| 13112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13113 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13114 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13115 | "NL80211_TDLS_DISABLE_LINK"); |
| 13116 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13117 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13118 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13119 | long status; |
| 13120 | |
| 13121 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 13122 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13123 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13124 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13125 | |
| 13126 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 13127 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
| 13128 | if (status <= 0) |
| 13129 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13130 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13131 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13132 | "%s: Del station failed status %ld", |
| 13133 | __func__, status); |
| 13134 | return -EPERM; |
| 13135 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13136 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_IDLE); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13137 | } |
| 13138 | else |
| 13139 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13141 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13142 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13143 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13144 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13145 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13146 | { |
| 13147 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13148 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 13149 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13150 | |
| 13151 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13152 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13153 | |
| 13154 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13155 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13156 | __func__); |
| 13157 | return -ENOTSUPP; |
| 13158 | } |
| 13159 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13160 | |
| 13161 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13162 | |
| 13163 | if ( NULL == pTdlsPeer ) { |
| 13164 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 13165 | " peer not exsting", |
| 13166 | __func__, MAC_ADDR_ARRAY(peer)); |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 13167 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13168 | } |
| 13169 | else { |
| 13170 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 13171 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 13172 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 13173 | |
| 13174 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 13175 | return -EINVAL; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13176 | break; |
| 13177 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13178 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13179 | { |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 13180 | hddTdlsPeer_t *pTdlsPeer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13181 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13182 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 13183 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13184 | |
| 13185 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13186 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13187 | |
| 13188 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13189 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13190 | __func__); |
| 13191 | return -ENOTSUPP; |
| 13192 | } |
| 13193 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 13194 | /* To cater the requirement of establishing the TDLS link |
| 13195 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 13196 | */ |
| 13197 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 13198 | if (pTdlsPeer == NULL) { |
| 13199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13200 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 13201 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13202 | return -EINVAL; |
| 13203 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 13204 | |
| 13205 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 13206 | |
| 13207 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13208 | " %s TDLS Add Force Peer Failed", |
| 13209 | __func__); |
| 13210 | return -EINVAL; |
| 13211 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 13212 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13213 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13214 | case NL80211_TDLS_DISCOVERY_REQ: |
| 13215 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13216 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13217 | "%s: We don't support in-driver setup/teardown/discovery " |
| 13218 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13219 | return -ENOTSUPP; |
| 13220 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13221 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13222 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13223 | return -ENOTSUPP; |
| 13224 | } |
| 13225 | return 0; |
| 13226 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13227 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13228 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 13229 | u8 *peer, enum nl80211_tdls_operation oper) |
| 13230 | { |
| 13231 | int ret; |
| 13232 | |
| 13233 | vos_ssr_protect(__func__); |
| 13234 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 13235 | vos_ssr_unprotect(__func__); |
| 13236 | |
| 13237 | return ret; |
| 13238 | } |
| 13239 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13240 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 13241 | struct net_device *dev, u8 *peer) |
| 13242 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 13243 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13244 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 13245 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13246 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13247 | #if TDLS_MGMT_VERSION2 |
| 13248 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13249 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 13250 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13251 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13252 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13253 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13254 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13255 | #endif |
| 13256 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13257 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 13258 | /* |
| 13259 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 13260 | * Callback rountine called upon receiving response for |
| 13261 | * get offload info |
| 13262 | */ |
| 13263 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 13264 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 13265 | { |
| 13266 | |
| 13267 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13268 | tANI_U8 tempReplayCounter[8]; |
| 13269 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13270 | |
| 13271 | ENTER(); |
| 13272 | |
| 13273 | if (NULL == pAdapter) |
| 13274 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13275 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13276 | "%s: HDD adapter is Null", __func__); |
| 13277 | return ; |
| 13278 | } |
| 13279 | |
| 13280 | if (NULL == pGtkOffloadGetInfoRsp) |
| 13281 | { |
| 13282 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13283 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 13284 | return ; |
| 13285 | } |
| 13286 | |
| 13287 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 13288 | { |
| 13289 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13290 | "%s: wlan Failed to get replay counter value", |
| 13291 | __func__); |
| 13292 | return ; |
| 13293 | } |
| 13294 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13295 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13296 | /* Update replay counter */ |
| 13297 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 13298 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13299 | |
| 13300 | { |
| 13301 | /* changing from little to big endian since supplicant |
| 13302 | * works on big endian format |
| 13303 | */ |
| 13304 | int i; |
| 13305 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13306 | |
| 13307 | for (i = 0; i < 8; i++) |
| 13308 | { |
| 13309 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 13310 | } |
| 13311 | } |
| 13312 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13313 | /* Update replay counter to NL */ |
| 13314 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13315 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13316 | } |
| 13317 | |
| 13318 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13319 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13320 | * This function is used to offload GTK rekeying job to the firmware. |
| 13321 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13322 | int __wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13323 | struct cfg80211_gtk_rekey_data *data) |
| 13324 | { |
| 13325 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13326 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13327 | hdd_station_ctx_t *pHddStaCtx; |
| 13328 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13329 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13330 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13331 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13332 | |
| 13333 | ENTER(); |
| 13334 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13335 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13336 | if (NULL == pAdapter) |
| 13337 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13338 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13339 | "%s: HDD adapter is Null", __func__); |
| 13340 | return -ENODEV; |
| 13341 | } |
| 13342 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13343 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13344 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 13345 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13346 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13347 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13348 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13349 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13350 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13351 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13352 | "%s: HDD context is not valid", __func__); |
| 13353 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13354 | } |
| 13355 | |
| 13356 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13357 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13358 | if (NULL == hHal) |
| 13359 | { |
| 13360 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13361 | "%s: HAL context is Null!!!", __func__); |
| 13362 | return -EAGAIN; |
| 13363 | } |
| 13364 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13365 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 13366 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 13367 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 13368 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13369 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13370 | { |
| 13371 | /* changing from big to little endian since driver |
| 13372 | * works on little endian format |
| 13373 | */ |
| 13374 | tANI_U8 *p = |
| 13375 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 13376 | int i; |
| 13377 | |
| 13378 | for (i = 0; i < 8; i++) |
| 13379 | { |
| 13380 | p[7-i] = data->replay_ctr[i]; |
| 13381 | } |
| 13382 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13383 | |
| 13384 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 13385 | { |
| 13386 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13387 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 13388 | sizeof (tSirGtkOffloadParams)); |
| 13389 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13390 | pAdapter->sessionId); |
| 13391 | |
| 13392 | if (eHAL_STATUS_SUCCESS != status) |
| 13393 | { |
| 13394 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13395 | "%s: sme_SetGTKOffload failed, returned %d", |
| 13396 | __func__, status); |
| 13397 | return status; |
| 13398 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13399 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13400 | "%s: sme_SetGTKOffload successfull", __func__); |
| 13401 | } |
| 13402 | else |
| 13403 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13404 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13405 | "%s: wlan not suspended GTKOffload request is stored", |
| 13406 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13407 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13408 | |
| 13409 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13410 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13411 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13412 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 13413 | struct cfg80211_gtk_rekey_data *data) |
| 13414 | { |
| 13415 | int ret; |
| 13416 | |
| 13417 | vos_ssr_protect(__func__); |
| 13418 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 13419 | vos_ssr_unprotect(__func__); |
| 13420 | |
| 13421 | return ret; |
| 13422 | } |
| 13423 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13424 | /* |
| 13425 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 13426 | * This function is used to set access control policy |
| 13427 | */ |
| 13428 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 13429 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 13430 | { |
| 13431 | int i; |
| 13432 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13433 | hdd_hostapd_state_t *pHostapdState; |
| 13434 | tsap_Config_t *pConfig; |
| 13435 | v_CONTEXT_t pVosContext = NULL; |
| 13436 | hdd_context_t *pHddCtx; |
| 13437 | int status; |
| 13438 | |
| 13439 | ENTER(); |
| 13440 | |
| 13441 | if (NULL == pAdapter) |
| 13442 | { |
| 13443 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13444 | "%s: HDD adapter is Null", __func__); |
| 13445 | return -ENODEV; |
| 13446 | } |
| 13447 | |
| 13448 | if (NULL == params) |
| 13449 | { |
| 13450 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13451 | "%s: params is Null", __func__); |
| 13452 | return -EINVAL; |
| 13453 | } |
| 13454 | |
| 13455 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13456 | status = wlan_hdd_validate_context(pHddCtx); |
| 13457 | |
| 13458 | if (0 != status) |
| 13459 | { |
| 13460 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13461 | "%s: HDD context is not valid", __func__); |
| 13462 | return status; |
| 13463 | } |
| 13464 | |
| 13465 | pVosContext = pHddCtx->pvosContext; |
| 13466 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 13467 | |
| 13468 | if (NULL == pHostapdState) |
| 13469 | { |
| 13470 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13471 | "%s: pHostapdState is Null", __func__); |
| 13472 | return -EINVAL; |
| 13473 | } |
| 13474 | |
| 13475 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 13476 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 13477 | |
| 13478 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 13479 | { |
| 13480 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 13481 | |
| 13482 | /* default value */ |
| 13483 | pConfig->num_accept_mac = 0; |
| 13484 | pConfig->num_deny_mac = 0; |
| 13485 | |
| 13486 | /** |
| 13487 | * access control policy |
| 13488 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 13489 | * listed in hostapd.deny file. |
| 13490 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 13491 | * listed in hostapd.accept file. |
| 13492 | */ |
| 13493 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 13494 | { |
| 13495 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 13496 | } |
| 13497 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 13498 | { |
| 13499 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 13500 | } |
| 13501 | else |
| 13502 | { |
| 13503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13504 | "%s:Acl Policy : %d is not supported", |
| 13505 | __func__, params->acl_policy); |
| 13506 | return -ENOTSUPP; |
| 13507 | } |
| 13508 | |
| 13509 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 13510 | { |
| 13511 | pConfig->num_accept_mac = params->n_acl_entries; |
| 13512 | for (i = 0; i < params->n_acl_entries; i++) |
| 13513 | { |
| 13514 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13515 | "** Add ACL MAC entry %i in WhiletList :" |
| 13516 | MAC_ADDRESS_STR, i, |
| 13517 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 13518 | |
| 13519 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 13520 | sizeof(qcmacaddr)); |
| 13521 | } |
| 13522 | } |
| 13523 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 13524 | { |
| 13525 | pConfig->num_deny_mac = params->n_acl_entries; |
| 13526 | for (i = 0; i < params->n_acl_entries; i++) |
| 13527 | { |
| 13528 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13529 | "** Add ACL MAC entry %i in BlackList :" |
| 13530 | MAC_ADDRESS_STR, i, |
| 13531 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 13532 | |
| 13533 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 13534 | sizeof(qcmacaddr)); |
| 13535 | } |
| 13536 | } |
| 13537 | |
| 13538 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 13539 | { |
| 13540 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13541 | "%s: SAP Set Mac Acl fail", __func__); |
| 13542 | return -EINVAL; |
| 13543 | } |
| 13544 | } |
| 13545 | else |
| 13546 | { |
| 13547 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13548 | "%s: Invalid device_mode = %s (%d)", |
| 13549 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13550 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13551 | return -EINVAL; |
| 13552 | } |
| 13553 | |
| 13554 | return 0; |
| 13555 | } |
| 13556 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13557 | #ifdef WLAN_NL80211_TESTMODE |
| 13558 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13559 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13560 | ( |
| 13561 | void *pAdapter, |
| 13562 | void *indCont |
| 13563 | ) |
| 13564 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13565 | tSirLPHBInd *lphbInd; |
| 13566 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 13567 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13568 | |
| 13569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13570 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13571 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 13572 | if (pAdapter == NULL) |
| 13573 | { |
| 13574 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13575 | "%s: pAdapter is NULL\n",__func__); |
| 13576 | return; |
| 13577 | } |
| 13578 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13579 | if (NULL == indCont) |
| 13580 | { |
| 13581 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13582 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13583 | return; |
| 13584 | } |
| 13585 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 13586 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13587 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13588 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 13589 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13590 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13591 | GFP_ATOMIC); |
| 13592 | if (!skb) |
| 13593 | { |
| 13594 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13595 | "LPHB timeout, NL buffer alloc fail"); |
| 13596 | return; |
| 13597 | } |
| 13598 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 13599 | 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] | 13600 | { |
| 13601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13602 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 13603 | goto nla_put_failure; |
| 13604 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 13605 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13606 | { |
| 13607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13608 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 13609 | goto nla_put_failure; |
| 13610 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 13611 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13612 | sizeof(tSirLPHBInd), lphbInd)) |
| 13613 | { |
| 13614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13615 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 13616 | goto nla_put_failure; |
| 13617 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13618 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 13619 | return; |
| 13620 | |
| 13621 | nla_put_failure: |
| 13622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13623 | "NLA Put fail"); |
| 13624 | kfree_skb(skb); |
| 13625 | |
| 13626 | return; |
| 13627 | } |
| 13628 | #endif /* FEATURE_WLAN_LPHB */ |
| 13629 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13630 | static int __wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13631 | { |
| 13632 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 13633 | int err = 0; |
| 13634 | #ifdef FEATURE_WLAN_LPHB |
| 13635 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13636 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13637 | #endif /* FEATURE_WLAN_LPHB */ |
| 13638 | |
| 13639 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 13640 | if (err) |
| 13641 | { |
| 13642 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13643 | "%s Testmode INV ATTR", __func__); |
| 13644 | return err; |
| 13645 | } |
| 13646 | |
| 13647 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 13648 | { |
| 13649 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13650 | "%s Testmode INV CMD", __func__); |
| 13651 | return -EINVAL; |
| 13652 | } |
| 13653 | |
| 13654 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 13655 | { |
| 13656 | #ifdef FEATURE_WLAN_LPHB |
| 13657 | /* Low Power Heartbeat configuration request */ |
| 13658 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 13659 | { |
| 13660 | int buf_len; |
| 13661 | void *buf; |
| 13662 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 13663 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13664 | |
| 13665 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 13666 | { |
| 13667 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13668 | "%s Testmode INV DATA", __func__); |
| 13669 | return -EINVAL; |
| 13670 | } |
| 13671 | |
| 13672 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 13673 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 13674 | |
| 13675 | hb_params_temp =(tSirLPHBReq *)buf; |
| 13676 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 13677 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 13678 | return -EINVAL; |
| 13679 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13680 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 13681 | if (NULL == hb_params) |
| 13682 | { |
| 13683 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13684 | "%s Request Buffer Alloc Fail", __func__); |
| 13685 | return -EINVAL; |
| 13686 | } |
| 13687 | |
| 13688 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13689 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 13690 | hb_params, |
| 13691 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 13692 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13693 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13695 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13696 | vos_mem_free(hb_params); |
| 13697 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13698 | return 0; |
| 13699 | } |
| 13700 | #endif /* FEATURE_WLAN_LPHB */ |
| 13701 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13702 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13703 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13704 | return -EOPNOTSUPP; |
| 13705 | } |
| 13706 | |
| 13707 | return err; |
| 13708 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13709 | |
| 13710 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 13711 | { |
| 13712 | int ret; |
| 13713 | |
| 13714 | vos_ssr_protect(__func__); |
| 13715 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 13716 | vos_ssr_unprotect(__func__); |
| 13717 | |
| 13718 | return ret; |
| 13719 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13720 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 13721 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13722 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13723 | struct net_device *dev, |
| 13724 | int idx, struct survey_info *survey) |
| 13725 | { |
| 13726 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13727 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 13728 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13729 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 13730 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13731 | v_S7_t snr,rssi; |
| 13732 | int status, i, j, filled = 0; |
| 13733 | |
| 13734 | ENTER(); |
| 13735 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13736 | if (NULL == pAdapter) |
| 13737 | { |
| 13738 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13739 | "%s: HDD adapter is Null", __func__); |
| 13740 | return -ENODEV; |
| 13741 | } |
| 13742 | |
| 13743 | if (NULL == wiphy) |
| 13744 | { |
| 13745 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13746 | "%s: wiphy is Null", __func__); |
| 13747 | return -ENODEV; |
| 13748 | } |
| 13749 | |
| 13750 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13751 | status = wlan_hdd_validate_context(pHddCtx); |
| 13752 | |
| 13753 | if (0 != status) |
| 13754 | { |
| 13755 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13756 | "%s: HDD context is not valid", __func__); |
| 13757 | return status; |
| 13758 | } |
| 13759 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 13760 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13761 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13762 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 13763 | 0 != pAdapter->survey_idx || |
| 13764 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 13765 | { |
| 13766 | /* The survey dump ops when implemented completely is expected to |
| 13767 | * return a survey of all channels and the ops is called by the |
| 13768 | * kernel with incremental values of the argument 'idx' till it |
| 13769 | * returns -ENONET. But we can only support the survey for the |
| 13770 | * operating channel for now. survey_idx is used to track |
| 13771 | * that the ops is called only once and then return -ENONET for |
| 13772 | * the next iteration |
| 13773 | */ |
| 13774 | pAdapter->survey_idx = 0; |
| 13775 | return -ENONET; |
| 13776 | } |
| 13777 | |
| 13778 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13779 | |
| 13780 | wlan_hdd_get_snr(pAdapter, &snr); |
| 13781 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 13782 | |
| 13783 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 13784 | hdd_wlan_get_freq(channel, &freq); |
| 13785 | |
| 13786 | |
| 13787 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 13788 | { |
| 13789 | if (NULL == wiphy->bands[i]) |
| 13790 | { |
| 13791 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 13792 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 13793 | continue; |
| 13794 | } |
| 13795 | |
| 13796 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 13797 | { |
| 13798 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 13799 | |
| 13800 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 13801 | { |
| 13802 | survey->channel = &band->channels[j]; |
| 13803 | /* The Rx BDs contain SNR values in dB for the received frames |
| 13804 | * while the supplicant expects noise. So we calculate and |
| 13805 | * return the value of noise (dBm) |
| 13806 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 13807 | */ |
| 13808 | survey->noise = rssi - snr; |
| 13809 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 13810 | filled = 1; |
| 13811 | } |
| 13812 | } |
| 13813 | } |
| 13814 | |
| 13815 | if (filled) |
| 13816 | pAdapter->survey_idx = 1; |
| 13817 | else |
| 13818 | { |
| 13819 | pAdapter->survey_idx = 0; |
| 13820 | return -ENONET; |
| 13821 | } |
| 13822 | |
| 13823 | return 0; |
| 13824 | } |
| 13825 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13826 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 13827 | struct net_device *dev, |
| 13828 | int idx, struct survey_info *survey) |
| 13829 | { |
| 13830 | int ret; |
| 13831 | |
| 13832 | vos_ssr_protect(__func__); |
| 13833 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 13834 | vos_ssr_unprotect(__func__); |
| 13835 | |
| 13836 | return ret; |
| 13837 | } |
| 13838 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13839 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13840 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13841 | * this is called when cfg80211 driver resume |
| 13842 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 13843 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13844 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13845 | { |
| 13846 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13847 | hdd_adapter_t *pAdapter; |
| 13848 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 13849 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 13850 | |
| 13851 | ENTER(); |
| 13852 | |
| 13853 | if ( NULL == pHddCtx ) |
| 13854 | { |
| 13855 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13856 | "%s: HddCtx validation failed", __func__); |
| 13857 | return 0; |
| 13858 | } |
| 13859 | |
| 13860 | if (pHddCtx->isLogpInProgress) |
| 13861 | { |
| 13862 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13863 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13864 | return 0; |
| 13865 | } |
| 13866 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 13867 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13868 | { |
| 13869 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13870 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 13871 | return 0; |
| 13872 | } |
| 13873 | |
| 13874 | spin_lock(&pHddCtx->schedScan_lock); |
| 13875 | pHddCtx->isWiphySuspended = FALSE; |
| 13876 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 13877 | { |
| 13878 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13879 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13880 | "%s: Return resume is not due to PNO indication", __func__); |
| 13881 | return 0; |
| 13882 | } |
| 13883 | // Reset flag to avoid updatating cfg80211 data old results again |
| 13884 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 13885 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13886 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 13887 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13888 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 13889 | |
| 13890 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 13891 | { |
| 13892 | pAdapter = pAdapterNode->pAdapter; |
| 13893 | if ( (NULL != pAdapter) && |
| 13894 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 13895 | { |
| 13896 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 13897 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13899 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 13900 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13901 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 13902 | { |
| 13903 | /* Acquire wakelock to handle the case where APP's tries to |
| 13904 | * suspend immediately after updating the scan results. Whis |
| 13905 | * results in app's is in suspended state and not able to |
| 13906 | * process the connect request to AP |
| 13907 | */ |
| 13908 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13909 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 13910 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13911 | |
| 13912 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13913 | "%s : cfg80211 scan result database updated", __func__); |
| 13914 | |
| 13915 | return 0; |
| 13916 | |
| 13917 | } |
| 13918 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 13919 | pAdapterNode = pNext; |
| 13920 | } |
| 13921 | |
| 13922 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13923 | "%s: Failed to find Adapter", __func__); |
| 13924 | return 0; |
| 13925 | } |
| 13926 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13927 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 13928 | { |
| 13929 | int ret; |
| 13930 | |
| 13931 | vos_ssr_protect(__func__); |
| 13932 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 13933 | vos_ssr_unprotect(__func__); |
| 13934 | |
| 13935 | return ret; |
| 13936 | } |
| 13937 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13938 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13939 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13940 | * this is called when cfg80211 driver suspends |
| 13941 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13942 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13943 | struct cfg80211_wowlan *wow) |
| 13944 | { |
| 13945 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13946 | |
| 13947 | ENTER(); |
| 13948 | if (NULL == pHddCtx) |
| 13949 | { |
| 13950 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13951 | "%s: HddCtx validation failed", __func__); |
| 13952 | return 0; |
| 13953 | } |
| 13954 | |
| 13955 | pHddCtx->isWiphySuspended = TRUE; |
| 13956 | |
| 13957 | EXIT(); |
| 13958 | |
| 13959 | return 0; |
| 13960 | } |
| 13961 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 13962 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 13963 | struct cfg80211_wowlan *wow) |
| 13964 | { |
| 13965 | int ret; |
| 13966 | |
| 13967 | vos_ssr_protect(__func__); |
| 13968 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 13969 | vos_ssr_unprotect(__func__); |
| 13970 | |
| 13971 | return ret; |
| 13972 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13973 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13974 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13975 | { |
| 13976 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 13977 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 13978 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 13979 | .change_station = wlan_hdd_change_station, |
| 13980 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 13981 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 13982 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 13983 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13984 | #else |
| 13985 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 13986 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 13987 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13988 | #endif |
| 13989 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 13990 | .add_key = wlan_hdd_cfg80211_add_key, |
| 13991 | .get_key = wlan_hdd_cfg80211_get_key, |
| 13992 | .del_key = wlan_hdd_cfg80211_del_key, |
| 13993 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 13994 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13995 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 13996 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13997 | .scan = wlan_hdd_cfg80211_scan, |
| 13998 | .connect = wlan_hdd_cfg80211_connect, |
| 13999 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 14000 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 14001 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 14002 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 14003 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 14004 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14005 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 14006 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 14007 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14008 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14009 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 14010 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 14011 | .set_txq_params = wlan_hdd_set_txq_params, |
| 14012 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14013 | .get_station = wlan_hdd_cfg80211_get_station, |
| 14014 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 14015 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14016 | .add_station = wlan_hdd_cfg80211_add_station, |
| 14017 | #ifdef FEATURE_WLAN_LFR |
| 14018 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 14019 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 14020 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 14021 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14022 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 14023 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 14024 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14025 | #ifdef FEATURE_WLAN_TDLS |
| 14026 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 14027 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 14028 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14029 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 14030 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 14031 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14032 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14033 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 14034 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 14035 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14036 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 14037 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14038 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14039 | #ifdef WLAN_NL80211_TESTMODE |
| 14040 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 14041 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14042 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14043 | }; |
| 14044 | |