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 | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | /**======================================================================== |
| 32 | |
| 33 | \file wlan_hdd_cfg80211.c |
| 34 | |
| 35 | \brief WLAN Host Device Driver implementation |
| 36 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 37 | ========================================================================*/ |
| 38 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 39 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 40 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 41 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | |
| 43 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 44 | This section contains comments describing changes made to the module. |
| 45 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 46 | |
| 47 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 48 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | |
| 50 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 51 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 52 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 53 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | |
| 55 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 56 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | ==========================================================================*/ |
| 58 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 59 | |
| 60 | #include <linux/version.h> |
| 61 | #include <linux/module.h> |
| 62 | #include <linux/kernel.h> |
| 63 | #include <linux/init.h> |
| 64 | #include <linux/wireless.h> |
| 65 | #include <wlan_hdd_includes.h> |
| 66 | #include <net/arp.h> |
| 67 | #include <net/cfg80211.h> |
| 68 | #include <linux/wireless.h> |
| 69 | #include <wlan_hdd_wowl.h> |
| 70 | #include <aniGlobal.h> |
| 71 | #include "ccmApi.h" |
| 72 | #include "sirParams.h" |
| 73 | #include "dot11f.h" |
| 74 | #include "wlan_hdd_assoc.h" |
| 75 | #include "wlan_hdd_wext.h" |
| 76 | #include "sme_Api.h" |
| 77 | #include "wlan_hdd_p2p.h" |
| 78 | #include "wlan_hdd_cfg80211.h" |
| 79 | #include "wlan_hdd_hostapd.h" |
| 80 | #include "sapInternal.h" |
| 81 | #include "wlan_hdd_softap_tx_rx.h" |
| 82 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 83 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_trace.h" |
| 86 | #include "vos_types.h" |
| 87 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 88 | #ifdef WLAN_BTAMP_FEATURE |
| 89 | #include "bap_hdd_misc.h" |
| 90 | #endif |
| 91 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 92 | #ifdef FEATURE_WLAN_TDLS |
| 93 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 94 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 95 | #include "wlan_qct_wda.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 96 | #endif |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 97 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 98 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | |
| 100 | #define g_mode_rates_size (12) |
| 101 | #define a_mode_rates_size (8) |
| 102 | #define FREQ_BASE_80211G (2407) |
| 103 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 104 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 105 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 107 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | |
| 109 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 110 | .band = IEEE80211_BAND_2GHZ, \ |
| 111 | .center_freq = (freq), \ |
| 112 | .hw_value = (chan),\ |
| 113 | .flags = (flag), \ |
| 114 | .max_antenna_gain = 0 ,\ |
| 115 | .max_power = 30, \ |
| 116 | } |
| 117 | |
| 118 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 119 | .band = IEEE80211_BAND_5GHZ, \ |
| 120 | .center_freq = (freq), \ |
| 121 | .hw_value = (chan),\ |
| 122 | .flags = (flag), \ |
| 123 | .max_antenna_gain = 0 ,\ |
| 124 | .max_power = 30, \ |
| 125 | } |
| 126 | |
| 127 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 128 | {\ |
| 129 | .bitrate = rate, \ |
| 130 | .hw_value = rate_id, \ |
| 131 | .flags = flag, \ |
| 132 | } |
| 133 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 134 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 135 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 136 | #else |
| 137 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 138 | #endif |
| 139 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 140 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 141 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 142 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 143 | #endif |
| 144 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 145 | #define HDD_CHANNEL_14 14 |
| 146 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 147 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 148 | /* |
| 149 | * Used to allocate the size of 4096 for the link layer stats. |
| 150 | * The size of 4096 is considered assuming that all data per |
| 151 | * respective event fit with in the limit.Please take a call |
| 152 | * on the limit based on the data requirements on link layer |
| 153 | * statistics. |
| 154 | */ |
| 155 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 156 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 157 | #ifdef WLAN_FEATURE_EXTSCAN |
| 158 | /* |
| 159 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 160 | * The size of 4096 is considered assuming that all data per |
| 161 | * respective event fit with in the limit.Please take a call |
| 162 | * on the limit based on the data requirements. |
| 163 | */ |
| 164 | |
| 165 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 166 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 167 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 168 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 169 | /*EXT TDLS*/ |
| 170 | /* |
| 171 | * Used to allocate the size of 4096 for the TDLS. |
| 172 | * The size of 4096 is considered assuming that all data per |
| 173 | * respective event fit with in the limit.Please take a call |
| 174 | * on the limit based on the data requirements on link layer |
| 175 | * statistics. |
| 176 | */ |
| 177 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 178 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 179 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | { |
| 181 | WLAN_CIPHER_SUITE_WEP40, |
| 182 | WLAN_CIPHER_SUITE_WEP104, |
| 183 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 184 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 185 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 186 | WLAN_CIPHER_SUITE_KRK, |
| 187 | WLAN_CIPHER_SUITE_CCMP, |
| 188 | #else |
| 189 | WLAN_CIPHER_SUITE_CCMP, |
| 190 | #endif |
| 191 | #ifdef FEATURE_WLAN_WAPI |
| 192 | WLAN_CIPHER_SUITE_SMS4, |
| 193 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 194 | #ifdef WLAN_FEATURE_11W |
| 195 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 196 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 200 | { |
| 201 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 202 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 203 | } |
| 204 | |
| 205 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 206 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | HDD2GHZCHAN(2412, 1, 0) , |
| 208 | HDD2GHZCHAN(2417, 2, 0) , |
| 209 | HDD2GHZCHAN(2422, 3, 0) , |
| 210 | HDD2GHZCHAN(2427, 4, 0) , |
| 211 | HDD2GHZCHAN(2432, 5, 0) , |
| 212 | HDD2GHZCHAN(2437, 6, 0) , |
| 213 | HDD2GHZCHAN(2442, 7, 0) , |
| 214 | HDD2GHZCHAN(2447, 8, 0) , |
| 215 | HDD2GHZCHAN(2452, 9, 0) , |
| 216 | HDD2GHZCHAN(2457, 10, 0) , |
| 217 | HDD2GHZCHAN(2462, 11, 0) , |
| 218 | HDD2GHZCHAN(2467, 12, 0) , |
| 219 | HDD2GHZCHAN(2472, 13, 0) , |
| 220 | HDD2GHZCHAN(2484, 14, 0) , |
| 221 | }; |
| 222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 224 | { |
| 225 | HDD2GHZCHAN(2412, 1, 0) , |
| 226 | HDD2GHZCHAN(2437, 6, 0) , |
| 227 | HDD2GHZCHAN(2462, 11, 0) , |
| 228 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | |
| 230 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 231 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 232 | HDD5GHZCHAN(4920, 240, 0) , |
| 233 | HDD5GHZCHAN(4940, 244, 0) , |
| 234 | HDD5GHZCHAN(4960, 248, 0) , |
| 235 | HDD5GHZCHAN(4980, 252, 0) , |
| 236 | HDD5GHZCHAN(5040, 208, 0) , |
| 237 | HDD5GHZCHAN(5060, 212, 0) , |
| 238 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 239 | HDD5GHZCHAN(5180, 36, 0) , |
| 240 | HDD5GHZCHAN(5200, 40, 0) , |
| 241 | HDD5GHZCHAN(5220, 44, 0) , |
| 242 | HDD5GHZCHAN(5240, 48, 0) , |
| 243 | HDD5GHZCHAN(5260, 52, 0) , |
| 244 | HDD5GHZCHAN(5280, 56, 0) , |
| 245 | HDD5GHZCHAN(5300, 60, 0) , |
| 246 | HDD5GHZCHAN(5320, 64, 0) , |
| 247 | HDD5GHZCHAN(5500,100, 0) , |
| 248 | HDD5GHZCHAN(5520,104, 0) , |
| 249 | HDD5GHZCHAN(5540,108, 0) , |
| 250 | HDD5GHZCHAN(5560,112, 0) , |
| 251 | HDD5GHZCHAN(5580,116, 0) , |
| 252 | HDD5GHZCHAN(5600,120, 0) , |
| 253 | HDD5GHZCHAN(5620,124, 0) , |
| 254 | HDD5GHZCHAN(5640,128, 0) , |
| 255 | HDD5GHZCHAN(5660,132, 0) , |
| 256 | HDD5GHZCHAN(5680,136, 0) , |
| 257 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 258 | #ifdef FEATURE_WLAN_CH144 |
| 259 | HDD5GHZCHAN(5720,144, 0) , |
| 260 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | HDD5GHZCHAN(5745,149, 0) , |
| 262 | HDD5GHZCHAN(5765,153, 0) , |
| 263 | HDD5GHZCHAN(5785,157, 0) , |
| 264 | HDD5GHZCHAN(5805,161, 0) , |
| 265 | HDD5GHZCHAN(5825,165, 0) , |
| 266 | }; |
| 267 | |
| 268 | static struct ieee80211_rate g_mode_rates[] = |
| 269 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 270 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 271 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 272 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 273 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 274 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 275 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 276 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 277 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 278 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 279 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 280 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 282 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
| 284 | static struct ieee80211_rate a_mode_rates[] = |
| 285 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 286 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 287 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 288 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 289 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 290 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 291 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 292 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 294 | }; |
| 295 | |
| 296 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 297 | { |
| 298 | .channels = hdd_channels_2_4_GHZ, |
| 299 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 300 | .band = IEEE80211_BAND_2GHZ, |
| 301 | .bitrates = g_mode_rates, |
| 302 | .n_bitrates = g_mode_rates_size, |
| 303 | .ht_cap.ht_supported = 1, |
| 304 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 305 | | IEEE80211_HT_CAP_GRN_FLD |
| 306 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 307 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 308 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 309 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 310 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 311 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 312 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 313 | }; |
| 314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 316 | { |
| 317 | .channels = hdd_social_channels_2_4_GHZ, |
| 318 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 319 | .band = IEEE80211_BAND_2GHZ, |
| 320 | .bitrates = g_mode_rates, |
| 321 | .n_bitrates = g_mode_rates_size, |
| 322 | .ht_cap.ht_supported = 1, |
| 323 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 324 | | IEEE80211_HT_CAP_GRN_FLD |
| 325 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 326 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 327 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 328 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 329 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 330 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 331 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 332 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | |
| 334 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 335 | { |
| 336 | .channels = hdd_channels_5_GHZ, |
| 337 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 338 | .band = IEEE80211_BAND_5GHZ, |
| 339 | .bitrates = a_mode_rates, |
| 340 | .n_bitrates = a_mode_rates_size, |
| 341 | .ht_cap.ht_supported = 1, |
| 342 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 343 | | IEEE80211_HT_CAP_GRN_FLD |
| 344 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 345 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 346 | | IEEE80211_HT_CAP_SGI_40 |
| 347 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 348 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 349 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 350 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 351 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 352 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 353 | }; |
| 354 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 355 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 356 | TX/RX direction for each kind of interface */ |
| 357 | static const struct ieee80211_txrx_stypes |
| 358 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 359 | [NL80211_IFTYPE_STATION] = { |
| 360 | .tx = 0xffff, |
| 361 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 362 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 363 | }, |
| 364 | [NL80211_IFTYPE_AP] = { |
| 365 | .tx = 0xffff, |
| 366 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 367 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 368 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 369 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 370 | BIT(SIR_MAC_MGMT_AUTH) | |
| 371 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 372 | BIT(SIR_MAC_MGMT_ACTION), |
| 373 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 374 | [NL80211_IFTYPE_ADHOC] = { |
| 375 | .tx = 0xffff, |
| 376 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 377 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 378 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 379 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 380 | BIT(SIR_MAC_MGMT_AUTH) | |
| 381 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 382 | BIT(SIR_MAC_MGMT_ACTION), |
| 383 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 385 | .tx = 0xffff, |
| 386 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 387 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 388 | }, |
| 389 | [NL80211_IFTYPE_P2P_GO] = { |
| 390 | /* This is also same as for SoftAP */ |
| 391 | .tx = 0xffff, |
| 392 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 393 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 394 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 395 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 396 | BIT(SIR_MAC_MGMT_AUTH) | |
| 397 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 398 | BIT(SIR_MAC_MGMT_ACTION), |
| 399 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | }; |
| 401 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 402 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 403 | static const struct ieee80211_iface_limit |
| 404 | wlan_hdd_iface_limit[] = { |
| 405 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 406 | /* max = 3 ; Our driver create two interfaces during driver init |
| 407 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 408 | * interface until a group is formed. In JB architecture, once the |
| 409 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 410 | * Client. |
| 411 | * When supplicant remove the group, it first issue a set interface |
| 412 | * cmd to change the mode back to Station. In JB this works fine as |
| 413 | * we advertize two station type interface during driver init. |
| 414 | * Some vendors create separate interface for P2P GO/Client, |
| 415 | * after group formation(Third one). But while group remove |
| 416 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 417 | * But as we advertized only two sta type interfaces nl80211 was |
| 418 | * returning error for the third one which was leading to failure in |
| 419 | * delete interface. Ideally while removing the group, supplicant |
| 420 | * should not try to change the 3rd interface mode to Station type. |
| 421 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 422 | * interface type to 3 |
| 423 | */ |
| 424 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 425 | .types = BIT(NL80211_IFTYPE_STATION), |
| 426 | }, |
| 427 | { |
| 428 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 429 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 430 | }, |
| 431 | { |
| 432 | .max = 1, |
| 433 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 434 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 435 | }, |
| 436 | }; |
| 437 | |
| 438 | /* By default, only single channel concurrency is allowed */ |
| 439 | static struct ieee80211_iface_combination |
| 440 | wlan_hdd_iface_combination = { |
| 441 | .limits = wlan_hdd_iface_limit, |
| 442 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 443 | /* |
| 444 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 445 | * and p2p0 interfaces during driver init |
| 446 | * Some vendors create separate interface for P2P operations. |
| 447 | * wlan0: STA interface |
| 448 | * p2p0: P2P Device interface, action frames goes |
| 449 | * through this interface. |
| 450 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 451 | * created for p2p operations(GO/CLIENT interface). |
| 452 | */ |
| 453 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 454 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 455 | .beacon_int_infra_match = false, |
| 456 | }; |
| 457 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 460 | |
| 461 | /* Data rate 100KBPS based on IE Index */ |
| 462 | struct index_data_rate_type |
| 463 | { |
| 464 | v_U8_t beacon_rate_index; |
| 465 | v_U16_t supported_rate[4]; |
| 466 | }; |
| 467 | |
| 468 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 469 | The IDX field is the rate index |
| 470 | The HI field is the rate when RSSI is strong or being ignored |
| 471 | (in this case we report actual rate) |
| 472 | The MID field is the rate when RSSI is moderate |
| 473 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 474 | The LO field is the rate when RSSI is low |
| 475 | (in this case we don't report rates, actual current rate used) |
| 476 | */ |
| 477 | static const struct |
| 478 | { |
| 479 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 480 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | } supported_data_rate[] = |
| 482 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 483 | /* IDX HI HM LM LO (RSSI-based index */ |
| 484 | {2, { 10, 10, 10, 0}}, |
| 485 | {4, { 20, 20, 10, 0}}, |
| 486 | {11, { 55, 20, 10, 0}}, |
| 487 | {12, { 60, 55, 20, 0}}, |
| 488 | {18, { 90, 55, 20, 0}}, |
| 489 | {22, {110, 55, 20, 0}}, |
| 490 | {24, {120, 90, 60, 0}}, |
| 491 | {36, {180, 120, 60, 0}}, |
| 492 | {44, {220, 180, 60, 0}}, |
| 493 | {48, {240, 180, 90, 0}}, |
| 494 | {66, {330, 180, 90, 0}}, |
| 495 | {72, {360, 240, 90, 0}}, |
| 496 | {96, {480, 240, 120, 0}}, |
| 497 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | }; |
| 499 | |
| 500 | /* MCS Based rate table */ |
| 501 | static struct index_data_rate_type supported_mcs_rate[] = |
| 502 | { |
| 503 | /* MCS L20 L40 S20 S40 */ |
| 504 | {0, {65, 135, 72, 150}}, |
| 505 | {1, {130, 270, 144, 300}}, |
| 506 | {2, {195, 405, 217, 450}}, |
| 507 | {3, {260, 540, 289, 600}}, |
| 508 | {4, {390, 810, 433, 900}}, |
| 509 | {5, {520, 1080, 578, 1200}}, |
| 510 | {6, {585, 1215, 650, 1350}}, |
| 511 | {7, {650, 1350, 722, 1500}} |
| 512 | }; |
| 513 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 514 | #ifdef WLAN_FEATURE_11AC |
| 515 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 516 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 517 | |
| 518 | struct index_vht_data_rate_type |
| 519 | { |
| 520 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 521 | v_U16_t supported_VHT80_rate[2]; |
| 522 | v_U16_t supported_VHT40_rate[2]; |
| 523 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 524 | }; |
| 525 | |
| 526 | typedef enum |
| 527 | { |
| 528 | DATA_RATE_11AC_MAX_MCS_7, |
| 529 | DATA_RATE_11AC_MAX_MCS_8, |
| 530 | DATA_RATE_11AC_MAX_MCS_9, |
| 531 | DATA_RATE_11AC_MAX_MCS_NA |
| 532 | } eDataRate11ACMaxMcs; |
| 533 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 534 | /* SSID broadcast type */ |
| 535 | typedef enum eSSIDBcastType |
| 536 | { |
| 537 | eBCAST_UNKNOWN = 0, |
| 538 | eBCAST_NORMAL = 1, |
| 539 | eBCAST_HIDDEN = 2, |
| 540 | } tSSIDBcastType; |
| 541 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 542 | /* MCS Based VHT rate table */ |
| 543 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 544 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 545 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 546 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 547 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 548 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 549 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 550 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 551 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 552 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 553 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 554 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 555 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 556 | }; |
| 557 | #endif /* WLAN_FEATURE_11AC */ |
| 558 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 559 | /*array index points to MCS and array value points respective rssi*/ |
| 560 | static int rssiMcsTbl[][10] = |
| 561 | { |
| 562 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 563 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 564 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 565 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 566 | }; |
| 567 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 568 | extern struct net_device_ops net_ops_struct; |
| 569 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 570 | #ifdef WLAN_NL80211_TESTMODE |
| 571 | enum wlan_hdd_tm_attr |
| 572 | { |
| 573 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 574 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 575 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 576 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 577 | /* keep last */ |
| 578 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 579 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 580 | }; |
| 581 | |
| 582 | enum wlan_hdd_tm_cmd |
| 583 | { |
| 584 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 585 | }; |
| 586 | |
| 587 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 588 | |
| 589 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 590 | { |
| 591 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 592 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 593 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 594 | }; |
| 595 | #endif /* WLAN_NL80211_TESTMODE */ |
| 596 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 597 | #ifdef FEATURE_WLAN_CH_AVOID |
| 598 | /* |
| 599 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 600 | * This is called when wlan driver needs to send vendor specific |
| 601 | * avoid frequency range event to userspace |
| 602 | */ |
| 603 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 604 | tHddAvoidFreqList *pAvoidFreqList) |
| 605 | { |
| 606 | struct sk_buff *vendor_event; |
| 607 | |
| 608 | ENTER(); |
| 609 | |
| 610 | if (!pHddCtx) |
| 611 | { |
| 612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 613 | "%s: HDD context is null", __func__); |
| 614 | return -1; |
| 615 | } |
| 616 | |
| 617 | if (!pAvoidFreqList) |
| 618 | { |
| 619 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 620 | "%s: pAvoidFreqList is null", __func__); |
| 621 | return -1; |
| 622 | } |
| 623 | |
| 624 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 625 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 626 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 627 | GFP_KERNEL); |
| 628 | if (!vendor_event) |
| 629 | { |
| 630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 631 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 632 | return -1; |
| 633 | } |
| 634 | |
| 635 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 636 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 637 | |
| 638 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 639 | |
| 640 | EXIT(); |
| 641 | return 0; |
| 642 | } |
| 643 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 644 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 645 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 646 | |
| 647 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 648 | struct sk_buff *vendor_event) |
| 649 | { |
| 650 | if (nla_put_u8(vendor_event, |
| 651 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 652 | stats->rate.preamble) || |
| 653 | nla_put_u8(vendor_event, |
| 654 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 655 | stats->rate.nss) || |
| 656 | nla_put_u8(vendor_event, |
| 657 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 658 | stats->rate.bw) || |
| 659 | nla_put_u8(vendor_event, |
| 660 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 661 | stats->rate.rateMcsIdx) || |
| 662 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 663 | stats->rate.bitrate ) || |
| 664 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 665 | stats->txMpdu ) || |
| 666 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 667 | stats->rxMpdu ) || |
| 668 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 669 | stats->mpduLost ) || |
| 670 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 671 | stats->retries) || |
| 672 | nla_put_u32(vendor_event, |
| 673 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 674 | stats->retriesShort ) || |
| 675 | nla_put_u32(vendor_event, |
| 676 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 677 | stats->retriesLong)) |
| 678 | { |
| 679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 680 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 681 | return FALSE; |
| 682 | } |
| 683 | return TRUE; |
| 684 | } |
| 685 | |
| 686 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 687 | struct sk_buff *vendor_event) |
| 688 | { |
| 689 | u32 i = 0; |
| 690 | struct nlattr *rateInfo; |
| 691 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 692 | stats->type) || |
| 693 | nla_put(vendor_event, |
| 694 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 695 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 696 | nla_put_u32(vendor_event, |
| 697 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 698 | stats->capabilities) || |
| 699 | nla_put_u32(vendor_event, |
| 700 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 701 | stats->numRate)) |
| 702 | { |
| 703 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 704 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 705 | goto error; |
| 706 | } |
| 707 | |
| 708 | rateInfo = nla_nest_start(vendor_event, |
| 709 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
| 710 | for (i = 0; i < stats->numRate; i++) |
| 711 | { |
| 712 | struct nlattr *rates; |
| 713 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 714 | stats->rateStats + |
| 715 | (i * sizeof(tSirWifiRateStat))); |
| 716 | rates = nla_nest_start(vendor_event, i); |
| 717 | |
| 718 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 719 | { |
| 720 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 721 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 722 | return FALSE; |
| 723 | } |
| 724 | nla_nest_end(vendor_event, rates); |
| 725 | } |
| 726 | nla_nest_end(vendor_event, rateInfo); |
| 727 | |
| 728 | return TRUE; |
| 729 | error: |
| 730 | return FALSE; |
| 731 | } |
| 732 | |
| 733 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 734 | struct sk_buff *vendor_event) |
| 735 | { |
| 736 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 737 | stats->ac ) || |
| 738 | nla_put_u32(vendor_event, |
| 739 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 740 | stats->txMpdu ) || |
| 741 | nla_put_u32(vendor_event, |
| 742 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 743 | stats->rxMpdu ) || |
| 744 | nla_put_u32(vendor_event, |
| 745 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 746 | stats->txMcast ) || |
| 747 | nla_put_u32(vendor_event, |
| 748 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 749 | stats->rxMcast ) || |
| 750 | nla_put_u32(vendor_event, |
| 751 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 752 | stats->rxAmpdu ) || |
| 753 | nla_put_u32(vendor_event, |
| 754 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 755 | stats->txAmpdu ) || |
| 756 | nla_put_u32(vendor_event, |
| 757 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 758 | stats->mpduLost )|| |
| 759 | nla_put_u32(vendor_event, |
| 760 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 761 | stats->retries ) || |
| 762 | nla_put_u32(vendor_event, |
| 763 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 764 | stats->retriesShort ) || |
| 765 | nla_put_u32(vendor_event, |
| 766 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 767 | stats->retriesLong ) || |
| 768 | nla_put_u32(vendor_event, |
| 769 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 770 | stats->contentionTimeMin ) || |
| 771 | nla_put_u32(vendor_event, |
| 772 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 773 | stats->contentionTimeMax ) || |
| 774 | nla_put_u32(vendor_event, |
| 775 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 776 | stats->contentionTimeAvg ) || |
| 777 | nla_put_u32(vendor_event, |
| 778 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 779 | stats->contentionNumSamples )) |
| 780 | { |
| 781 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 782 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 783 | return FALSE; |
| 784 | } |
| 785 | return TRUE; |
| 786 | } |
| 787 | |
| 788 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 789 | struct sk_buff *vendor_event) |
| 790 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 791 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 792 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 793 | nla_put(vendor_event, |
| 794 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 795 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 796 | nla_put_u32(vendor_event, |
| 797 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 798 | stats->state ) || |
| 799 | nla_put_u32(vendor_event, |
| 800 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 801 | stats->roaming ) || |
| 802 | nla_put_u32(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 804 | stats->capabilities ) || |
| 805 | nla_put(vendor_event, |
| 806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 807 | strlen(stats->ssid), stats->ssid) || |
| 808 | nla_put(vendor_event, |
| 809 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 810 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 811 | nla_put(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 813 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 814 | nla_put(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 816 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 817 | ) |
| 818 | { |
| 819 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 820 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 821 | return FALSE; |
| 822 | } |
| 823 | return TRUE; |
| 824 | } |
| 825 | |
| 826 | static v_BOOL_t put_wifi_iface_stats(tpSirWifiIfaceStat pWifiIfaceStat, |
| 827 | struct sk_buff *vendor_event) |
| 828 | { |
| 829 | int i = 0; |
| 830 | struct nlattr *wmmInfo; |
| 831 | if (FALSE == put_wifi_interface_info( |
| 832 | &pWifiIfaceStat->info, |
| 833 | vendor_event)) |
| 834 | { |
| 835 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 836 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 837 | return FALSE; |
| 838 | |
| 839 | } |
| 840 | |
| 841 | if (nla_put_u32(vendor_event, |
| 842 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 843 | pWifiIfaceStat->beaconRx) || |
| 844 | nla_put_u32(vendor_event, |
| 845 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 846 | pWifiIfaceStat->mgmtRx) || |
| 847 | nla_put_u32(vendor_event, |
| 848 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 849 | pWifiIfaceStat->mgmtActionRx) || |
| 850 | nla_put_u32(vendor_event, |
| 851 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 852 | pWifiIfaceStat->mgmtActionTx) || |
| 853 | nla_put_u32(vendor_event, |
| 854 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 855 | pWifiIfaceStat->rssiMgmt) || |
| 856 | nla_put_u32(vendor_event, |
| 857 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 858 | pWifiIfaceStat->rssiData) || |
| 859 | nla_put_u32(vendor_event, |
| 860 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 861 | pWifiIfaceStat->rssiAck)) |
| 862 | { |
| 863 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 864 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 865 | return FALSE; |
| 866 | } |
| 867 | |
| 868 | wmmInfo = nla_nest_start(vendor_event, |
| 869 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
| 870 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 871 | { |
| 872 | struct nlattr *wmmStats; |
| 873 | wmmStats = nla_nest_start(vendor_event, i); |
| 874 | if (FALSE == put_wifi_wmm_ac_stat( |
| 875 | &pWifiIfaceStat->AccessclassStats[i], |
| 876 | vendor_event)) |
| 877 | { |
| 878 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 879 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
| 880 | return FALSE; |
| 881 | } |
| 882 | |
| 883 | nla_nest_end(vendor_event, wmmStats); |
| 884 | } |
| 885 | nla_nest_end(vendor_event, wmmInfo); |
| 886 | return TRUE; |
| 887 | } |
| 888 | |
| 889 | static tSirWifiInterfaceMode |
| 890 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 891 | { |
| 892 | switch (deviceMode) |
| 893 | { |
| 894 | case WLAN_HDD_INFRA_STATION: |
| 895 | return WIFI_INTERFACE_STA; |
| 896 | case WLAN_HDD_SOFTAP: |
| 897 | return WIFI_INTERFACE_SOFTAP; |
| 898 | case WLAN_HDD_P2P_CLIENT: |
| 899 | return WIFI_INTERFACE_P2P_CLIENT; |
| 900 | case WLAN_HDD_P2P_GO: |
| 901 | return WIFI_INTERFACE_P2P_GO; |
| 902 | case WLAN_HDD_IBSS: |
| 903 | return WIFI_INTERFACE_IBSS; |
| 904 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 905 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 906 | } |
| 907 | } |
| 908 | |
| 909 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 910 | tpSirWifiInterfaceInfo pInfo) |
| 911 | { |
| 912 | v_U8_t *staMac = NULL; |
| 913 | hdd_station_ctx_t *pHddStaCtx; |
| 914 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 915 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 916 | |
| 917 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 918 | |
| 919 | vos_mem_copy(pInfo->macAddr, |
| 920 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 921 | |
| 922 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 923 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 924 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 925 | { |
| 926 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 927 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 928 | { |
| 929 | pInfo->state = WIFI_DISCONNECTED; |
| 930 | } |
| 931 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 932 | { |
| 933 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 934 | "%s: Session ID %d, Connection is in progress", __func__, |
| 935 | pAdapter->sessionId); |
| 936 | pInfo->state = WIFI_ASSOCIATING; |
| 937 | } |
| 938 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 939 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 940 | { |
| 941 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 942 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 943 | "%s: client " MAC_ADDRESS_STR |
| 944 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 945 | MAC_ADDR_ARRAY(staMac)); |
| 946 | pInfo->state = WIFI_AUTHENTICATING; |
| 947 | } |
| 948 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 949 | { |
| 950 | pInfo->state = WIFI_ASSOCIATED; |
| 951 | vos_mem_copy(pInfo->bssid, |
| 952 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 953 | vos_mem_copy(pInfo->ssid, |
| 954 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 955 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 956 | //NULL Terminate the string. |
| 957 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 958 | } |
| 959 | } |
| 960 | vos_mem_copy(pInfo->countryStr, |
| 961 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 962 | |
| 963 | vos_mem_copy(pInfo->apCountryStr, |
| 964 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 965 | |
| 966 | return TRUE; |
| 967 | } |
| 968 | |
| 969 | /* |
| 970 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 971 | * receiving Link Layer Peer statistics from FW.This function converts |
| 972 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 973 | * layers. |
| 974 | */ |
| 975 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 976 | v_VOID_t *pData) |
| 977 | { |
| 978 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 979 | tpSirWifiRateStat pWifiRateStat; |
| 980 | tpSirWifiPeerStat pWifiPeerStat; |
| 981 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 982 | struct nlattr *peerInfo; |
| 983 | struct sk_buff *vendor_event; |
| 984 | int status, i; |
| 985 | |
| 986 | status = wlan_hdd_validate_context(pHddCtx); |
| 987 | if (0 != status) |
| 988 | { |
| 989 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 990 | FL("HDD context is not valid") ); |
| 991 | return; |
| 992 | } |
| 993 | |
| 994 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 995 | |
| 996 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 997 | "LL_STATS_PEER_ALL : numPeers %u", |
| 998 | pWifiPeerStat->numPeers); |
| 999 | { |
| 1000 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1001 | { |
| 1002 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1003 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1004 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1005 | |
| 1006 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1007 | " %d) LL_STATS Channel Stats " |
| 1008 | " Peer Type %u " |
| 1009 | " peerMacAddress %pM " |
| 1010 | " capabilities 0x%x " |
| 1011 | " numRate %u ", |
| 1012 | i, |
| 1013 | pWifiPeerInfo->type, |
| 1014 | pWifiPeerInfo->peerMacAddress, |
| 1015 | pWifiPeerInfo->capabilities, |
| 1016 | pWifiPeerInfo->numRate); |
| 1017 | { |
| 1018 | int j; |
| 1019 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1020 | { |
| 1021 | pWifiRateStat = (tpSirWifiRateStat) |
| 1022 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1023 | ( j * sizeof(tSirWifiRateStat))); |
| 1024 | |
| 1025 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1026 | " peer Rate Stats " |
| 1027 | " preamble %u " |
| 1028 | " nss %u " |
| 1029 | " bw %u " |
| 1030 | " rateMcsIdx %u " |
| 1031 | " reserved %u " |
| 1032 | " bitrate %u " |
| 1033 | " txMpdu %u " |
| 1034 | " rxMpdu %u " |
| 1035 | " mpduLost %u " |
| 1036 | " retries %u " |
| 1037 | " retriesShort %u " |
| 1038 | " retriesLong %u", |
| 1039 | pWifiRateStat->rate.preamble, |
| 1040 | pWifiRateStat->rate.nss, |
| 1041 | pWifiRateStat->rate.bw, |
| 1042 | pWifiRateStat->rate.rateMcsIdx, |
| 1043 | pWifiRateStat->rate.reserved, |
| 1044 | pWifiRateStat->rate.bitrate, |
| 1045 | pWifiRateStat->txMpdu, |
| 1046 | pWifiRateStat->rxMpdu, |
| 1047 | pWifiRateStat->mpduLost, |
| 1048 | pWifiRateStat->retries, |
| 1049 | pWifiRateStat->retriesShort, |
| 1050 | pWifiRateStat->retriesLong); |
| 1051 | } |
| 1052 | } |
| 1053 | } |
| 1054 | } |
| 1055 | |
| 1056 | /* |
| 1057 | * Allocate a size of 4096 for the peer stats comprising |
| 1058 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1059 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1060 | * NL attribute.The size of 4096 is considered assuming |
| 1061 | * that number of rates shall not exceed beyond 50 with |
| 1062 | * the sizeof (tSirWifiRateStat) being 32. |
| 1063 | */ |
| 1064 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1065 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1066 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1067 | GFP_KERNEL); |
| 1068 | if (!vendor_event) |
| 1069 | { |
| 1070 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1071 | "%s: cfg80211_vendor_event_alloc failed", |
| 1072 | __func__); |
| 1073 | return; |
| 1074 | } |
| 1075 | if (nla_put_u32(vendor_event, |
| 1076 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1077 | pWifiPeerStat->numPeers)) |
| 1078 | { |
| 1079 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1080 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1081 | kfree_skb(vendor_event); |
| 1082 | return; |
| 1083 | } |
| 1084 | |
| 1085 | peerInfo = nla_nest_start(vendor_event, |
| 1086 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
| 1087 | |
| 1088 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1089 | pWifiPeerStat->peerInfo); |
| 1090 | |
| 1091 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1092 | { |
| 1093 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
| 1094 | int numRate = pWifiPeerInfo->numRate; |
| 1095 | |
| 1096 | if (FALSE == put_wifi_peer_info( |
| 1097 | pWifiPeerInfo, vendor_event)) |
| 1098 | { |
| 1099 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1100 | "%s: put_wifi_peer_info put fail", __func__); |
| 1101 | kfree_skb(vendor_event); |
| 1102 | return; |
| 1103 | } |
| 1104 | |
| 1105 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1106 | pWifiPeerStat->peerInfo + |
| 1107 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1108 | (numRate * sizeof (tSirWifiRateStat))); |
| 1109 | nla_nest_end(vendor_event, peers); |
| 1110 | } |
| 1111 | nla_nest_end(vendor_event, peerInfo); |
| 1112 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1113 | } |
| 1114 | |
| 1115 | /* |
| 1116 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1117 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1118 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1119 | * layers. |
| 1120 | */ |
| 1121 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1122 | v_VOID_t *pData) |
| 1123 | { |
| 1124 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1125 | struct sk_buff *vendor_event; |
| 1126 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1127 | int status; |
| 1128 | |
| 1129 | status = wlan_hdd_validate_context(pHddCtx); |
| 1130 | if (0 != status) |
| 1131 | { |
| 1132 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1133 | FL("HDD context is not valid") ); |
| 1134 | return; |
| 1135 | } |
| 1136 | /* |
| 1137 | * Allocate a size of 4096 for the interface stats comprising |
| 1138 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1139 | * assuming that all these fit with in the limit.Please take |
| 1140 | * a call on the limit based on the data requirements on |
| 1141 | * interface statistics. |
| 1142 | */ |
| 1143 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1144 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1145 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1146 | GFP_KERNEL); |
| 1147 | if (!vendor_event) |
| 1148 | { |
| 1149 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1150 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1151 | return; |
| 1152 | } |
| 1153 | |
| 1154 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1155 | |
| 1156 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1157 | "WMI_LINK_STATS_IFACE Data"); |
| 1158 | |
| 1159 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1160 | "LL_STATS_IFACE: " |
| 1161 | " Mode %u " |
| 1162 | " MAC %pM " |
| 1163 | " State %u " |
| 1164 | " Roaming %u " |
| 1165 | " capabilities 0x%x " |
| 1166 | " SSID %s " |
| 1167 | " BSSID %pM", |
| 1168 | pWifiIfaceStat->info.mode, |
| 1169 | pWifiIfaceStat->info.macAddr, |
| 1170 | pWifiIfaceStat->info.state, |
| 1171 | pWifiIfaceStat->info.roaming, |
| 1172 | pWifiIfaceStat->info.capabilities, |
| 1173 | pWifiIfaceStat->info.ssid, |
| 1174 | pWifiIfaceStat->info.bssid); |
| 1175 | |
| 1176 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1177 | " AP country str: %c%c%c", |
| 1178 | pWifiIfaceStat->info.apCountryStr[0], |
| 1179 | pWifiIfaceStat->info.apCountryStr[1], |
| 1180 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1181 | |
| 1182 | |
| 1183 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1184 | " Country Str Association: %c%c%c", |
| 1185 | pWifiIfaceStat->info.countryStr[0], |
| 1186 | pWifiIfaceStat->info.countryStr[1], |
| 1187 | pWifiIfaceStat->info.countryStr[2]); |
| 1188 | |
| 1189 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1190 | " beaconRx %u " |
| 1191 | " mgmtRx %u " |
| 1192 | " mgmtActionRx %u " |
| 1193 | " mgmtActionTx %u " |
| 1194 | " rssiMgmt %u " |
| 1195 | " rssiData %u " |
| 1196 | " rssiAck %u", |
| 1197 | pWifiIfaceStat->beaconRx, |
| 1198 | pWifiIfaceStat->mgmtRx, |
| 1199 | pWifiIfaceStat->mgmtActionRx, |
| 1200 | pWifiIfaceStat->mgmtActionTx, |
| 1201 | pWifiIfaceStat->rssiMgmt, |
| 1202 | pWifiIfaceStat->rssiData, |
| 1203 | pWifiIfaceStat->rssiAck ); |
| 1204 | |
| 1205 | |
| 1206 | { |
| 1207 | int i; |
| 1208 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1209 | { |
| 1210 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1211 | |
| 1212 | " %d) LL_STATS IFACE: " |
| 1213 | " ac: %u txMpdu: %u " |
| 1214 | " rxMpdu: %u txMcast: %u " |
| 1215 | " rxMcast: %u rxAmpdu: %u " |
| 1216 | " txAmpdu: %u mpduLost: %u " |
| 1217 | " retries: %u retriesShort: %u " |
| 1218 | " retriesLong: %u contentionTimeMin: %u " |
| 1219 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1220 | " contentionNumSamples: %u", |
| 1221 | i, |
| 1222 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1223 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1224 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1225 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1226 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1227 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1228 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1229 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1230 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1231 | pWifiIfaceStat-> |
| 1232 | AccessclassStats[i].retriesShort, |
| 1233 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1234 | pWifiIfaceStat-> |
| 1235 | AccessclassStats[i].contentionTimeMin, |
| 1236 | pWifiIfaceStat-> |
| 1237 | AccessclassStats[i].contentionTimeMax, |
| 1238 | pWifiIfaceStat-> |
| 1239 | AccessclassStats[i].contentionTimeAvg, |
| 1240 | pWifiIfaceStat-> |
| 1241 | AccessclassStats[i].contentionNumSamples); |
| 1242 | |
| 1243 | } |
| 1244 | } |
| 1245 | |
| 1246 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1247 | &pWifiIfaceStat->info)) |
| 1248 | { |
| 1249 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1250 | FL("hdd_get_interface_info get fail") ); |
| 1251 | kfree_skb(vendor_event); |
| 1252 | return; |
| 1253 | } |
| 1254 | |
| 1255 | if (FALSE == put_wifi_iface_stats( pWifiIfaceStat, |
| 1256 | vendor_event)) |
| 1257 | { |
| 1258 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1259 | FL("put_wifi_iface_stats fail") ); |
| 1260 | kfree_skb(vendor_event); |
| 1261 | return; |
| 1262 | } |
| 1263 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1264 | } |
| 1265 | |
| 1266 | /* |
| 1267 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1268 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1269 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1270 | * layers. |
| 1271 | */ |
| 1272 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1273 | v_VOID_t *pData) |
| 1274 | { |
| 1275 | int status, i; |
| 1276 | tpSirWifiRadioStat pWifiRadioStat; |
| 1277 | tpSirWifiChannelStats pWifiChannelStats; |
| 1278 | struct sk_buff *vendor_event; |
| 1279 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1280 | struct nlattr *chList; |
| 1281 | |
| 1282 | status = wlan_hdd_validate_context(pHddCtx); |
| 1283 | if (0 != status) |
| 1284 | { |
| 1285 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1286 | FL("HDD context is not valid") ); |
| 1287 | return; |
| 1288 | } |
| 1289 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1290 | |
| 1291 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1292 | "LL_STATS_RADIO" |
| 1293 | " radio is %d onTime is %u " |
| 1294 | " txTime is %u rxTime is %u " |
| 1295 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1296 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1297 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1298 | " numChannels is %u", |
| 1299 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1300 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1301 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1302 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1303 | pWifiRadioStat->onTimeRoamScan, |
| 1304 | pWifiRadioStat->onTimePnoScan, |
| 1305 | pWifiRadioStat->onTimeHs20, |
| 1306 | pWifiRadioStat->numChannels); |
| 1307 | /* |
| 1308 | * Allocate a size of 4096 for the Radio stats comprising |
| 1309 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1310 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1311 | * NL attribute.The size of 4096 is considered assuming that |
| 1312 | * number of channels shall not exceed beyond 60 with the |
| 1313 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1314 | */ |
| 1315 | |
| 1316 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1317 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1318 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1319 | GFP_KERNEL); |
| 1320 | |
| 1321 | if (!vendor_event) |
| 1322 | { |
| 1323 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1324 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1325 | return; |
| 1326 | } |
| 1327 | |
| 1328 | if (nla_put_u32(vendor_event, |
| 1329 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1330 | pWifiRadioStat->radio) || |
| 1331 | nla_put_u32(vendor_event, |
| 1332 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1333 | pWifiRadioStat->onTime) || |
| 1334 | nla_put_u32(vendor_event, |
| 1335 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1336 | pWifiRadioStat->txTime) || |
| 1337 | nla_put_u32(vendor_event, |
| 1338 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1339 | pWifiRadioStat->rxTime) || |
| 1340 | nla_put_u32(vendor_event, |
| 1341 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1342 | pWifiRadioStat->onTimeScan) || |
| 1343 | nla_put_u32(vendor_event, |
| 1344 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1345 | pWifiRadioStat->onTimeNbd) || |
| 1346 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1347 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1348 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1349 | nla_put_u32(vendor_event, |
| 1350 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1351 | pWifiRadioStat->onTimeRoamScan) || |
| 1352 | nla_put_u32(vendor_event, |
| 1353 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1354 | pWifiRadioStat->onTimePnoScan) || |
| 1355 | nla_put_u32(vendor_event, |
| 1356 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1357 | pWifiRadioStat->onTimeHs20) || |
| 1358 | nla_put_u32(vendor_event, |
| 1359 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1360 | pWifiRadioStat->numChannels)) |
| 1361 | { |
| 1362 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1363 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1364 | kfree_skb(vendor_event); |
| 1365 | return ; |
| 1366 | } |
| 1367 | |
| 1368 | chList = nla_nest_start(vendor_event, |
| 1369 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
| 1370 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1371 | { |
| 1372 | struct nlattr *chInfo; |
| 1373 | |
| 1374 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1375 | pWifiRadioStat->channels + |
| 1376 | (i * sizeof(tSirWifiChannelStats))); |
| 1377 | |
| 1378 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1379 | " %d) Channel Info" |
| 1380 | " width is %u " |
| 1381 | " CenterFreq %u " |
| 1382 | " CenterFreq0 %u " |
| 1383 | " CenterFreq1 %u " |
| 1384 | " onTime %u " |
| 1385 | " ccaBusyTime %u", |
| 1386 | i, |
| 1387 | pWifiChannelStats->channel.width, |
| 1388 | pWifiChannelStats->channel.centerFreq, |
| 1389 | pWifiChannelStats->channel.centerFreq0, |
| 1390 | pWifiChannelStats->channel.centerFreq1, |
| 1391 | pWifiChannelStats->onTime, |
| 1392 | pWifiChannelStats->ccaBusyTime); |
| 1393 | |
| 1394 | |
| 1395 | chInfo = nla_nest_start(vendor_event, i); |
| 1396 | |
| 1397 | if (nla_put_u32(vendor_event, |
| 1398 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1399 | pWifiChannelStats->channel.width) || |
| 1400 | nla_put_u32(vendor_event, |
| 1401 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1402 | pWifiChannelStats->channel.centerFreq) || |
| 1403 | nla_put_u32(vendor_event, |
| 1404 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1405 | pWifiChannelStats->channel.centerFreq0) || |
| 1406 | nla_put_u32(vendor_event, |
| 1407 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1408 | pWifiChannelStats->channel.centerFreq1) || |
| 1409 | nla_put_u32(vendor_event, |
| 1410 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1411 | pWifiChannelStats->onTime) || |
| 1412 | nla_put_u32(vendor_event, |
| 1413 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1414 | pWifiChannelStats->ccaBusyTime)) |
| 1415 | { |
| 1416 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1417 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1418 | kfree_skb(vendor_event); |
| 1419 | return ; |
| 1420 | } |
| 1421 | nla_nest_end(vendor_event, chInfo); |
| 1422 | } |
| 1423 | nla_nest_end(vendor_event, chList); |
| 1424 | |
| 1425 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1426 | return; |
| 1427 | } |
| 1428 | |
| 1429 | /* |
| 1430 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1431 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1432 | * data to the NL data and send the same to the kernel/upper layers. |
| 1433 | */ |
| 1434 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1435 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1436 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1437 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1438 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1439 | hdd_adapter_t *pAdapter = NULL; |
| 1440 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1441 | int status; |
| 1442 | |
| 1443 | status = wlan_hdd_validate_context(pHddCtx); |
| 1444 | |
| 1445 | if (0 != status) |
| 1446 | { |
| 1447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1448 | FL("HDD context is not valid")); |
| 1449 | return; |
| 1450 | } |
| 1451 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1452 | |
| 1453 | |
| 1454 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1455 | if (NULL == pAdapter) |
| 1456 | { |
| 1457 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1458 | FL(" MAC address %pM does not exist with host"), |
| 1459 | macAddr); |
| 1460 | return; |
| 1461 | } |
| 1462 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1463 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1464 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1465 | pAdapter->dev->name, indType); |
| 1466 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1467 | switch (indType) |
| 1468 | { |
| 1469 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1470 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1471 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1472 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1473 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1474 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1475 | linkLayerStatsResults->paramId); |
| 1476 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1477 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1478 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1479 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1480 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1481 | linkLayerStatsResults->respId); |
| 1482 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1483 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1484 | linkLayerStatsResults->moreResultToFollow); |
| 1485 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1486 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1487 | linkLayerStatsResults->result); |
| 1488 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1489 | { |
| 1490 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1491 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1492 | } |
| 1493 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1494 | { |
| 1495 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1496 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1497 | } |
| 1498 | else if ( linkLayerStatsResults->paramId & |
| 1499 | WMI_LINK_STATS_ALL_PEER ) |
| 1500 | { |
| 1501 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1502 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1503 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1504 | else |
| 1505 | { |
| 1506 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1507 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1508 | } |
| 1509 | |
| 1510 | break; |
| 1511 | } |
| 1512 | default: |
| 1513 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1514 | break; |
| 1515 | } |
| 1516 | return; |
| 1517 | } |
| 1518 | |
| 1519 | const struct |
| 1520 | nla_policy |
| 1521 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1522 | { |
| 1523 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1524 | { .type = NLA_U32 }, |
| 1525 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1526 | { .type = NLA_U32 }, |
| 1527 | }; |
| 1528 | |
| 1529 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1530 | struct wireless_dev *wdev, |
| 1531 | void *data, |
| 1532 | int data_len) |
| 1533 | { |
| 1534 | int status; |
| 1535 | 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] | 1536 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1537 | struct net_device *dev = wdev->netdev; |
| 1538 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1539 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1540 | |
| 1541 | status = wlan_hdd_validate_context(pHddCtx); |
| 1542 | if (0 != status) |
| 1543 | { |
| 1544 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1545 | FL("HDD context is not valid")); |
| 1546 | return -EINVAL; |
| 1547 | } |
| 1548 | |
| 1549 | if (NULL == pAdapter) |
| 1550 | { |
| 1551 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1552 | FL("HDD adapter is Null")); |
| 1553 | return -ENODEV; |
| 1554 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1555 | /* check the LLStats Capability */ |
| 1556 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1557 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1558 | { |
| 1559 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1560 | FL("Link Layer Statistics not supported by Firmware")); |
| 1561 | return -EINVAL; |
| 1562 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1563 | |
| 1564 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1565 | (struct nlattr *)data, |
| 1566 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1567 | { |
| 1568 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1569 | return -EINVAL; |
| 1570 | } |
| 1571 | if (!tb_vendor |
| 1572 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1573 | { |
| 1574 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1575 | return -EINVAL; |
| 1576 | } |
| 1577 | if (!tb_vendor[ |
| 1578 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1579 | { |
| 1580 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1581 | return -EINVAL; |
| 1582 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1583 | // 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] | 1584 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1585 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1586 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1587 | nla_get_u32( |
| 1588 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1589 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1590 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1591 | nla_get_u32( |
| 1592 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1593 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1594 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1595 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1596 | |
| 1597 | |
| 1598 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1599 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1600 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1601 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1602 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1603 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1604 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1605 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1606 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1607 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1608 | |
| 1609 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1610 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1611 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1612 | { |
| 1613 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1614 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1615 | return -EINVAL; |
| 1616 | |
| 1617 | } |
| 1618 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1619 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1620 | { |
| 1621 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1622 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1623 | return -EINVAL; |
| 1624 | } |
| 1625 | |
| 1626 | pAdapter->isLinkLayerStatsSet = 1; |
| 1627 | |
| 1628 | return 0; |
| 1629 | } |
| 1630 | |
| 1631 | const struct |
| 1632 | nla_policy |
| 1633 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1634 | { |
| 1635 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1636 | * command. When reporting |
| 1637 | * the stats results, the driver uses the same value to indicate |
| 1638 | * which GET request the results |
| 1639 | * correspond to. |
| 1640 | */ |
| 1641 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1642 | |
| 1643 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1644 | requested for retrieval */ |
| 1645 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1646 | }; |
| 1647 | |
| 1648 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1649 | struct wireless_dev *wdev, |
| 1650 | void *data, |
| 1651 | int data_len) |
| 1652 | { |
| 1653 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1654 | 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] | 1655 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1656 | struct net_device *dev = wdev->netdev; |
| 1657 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1658 | int status; |
| 1659 | |
| 1660 | status = wlan_hdd_validate_context(pHddCtx); |
| 1661 | if (0 != status) |
| 1662 | { |
| 1663 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1664 | FL("HDD context is not valid")); |
| 1665 | return -EINVAL ; |
| 1666 | } |
| 1667 | |
| 1668 | if (NULL == pAdapter) |
| 1669 | { |
| 1670 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1671 | "%s: HDD adapter is Null", __func__); |
| 1672 | return -ENODEV; |
| 1673 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1674 | /* check the LLStats Capability */ |
| 1675 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1676 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1677 | { |
| 1678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1679 | FL("Link Layer Statistics not supported by Firmware")); |
| 1680 | return -EINVAL; |
| 1681 | } |
| 1682 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1683 | |
| 1684 | if (!pAdapter->isLinkLayerStatsSet) |
| 1685 | { |
| 1686 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1687 | "%s: isLinkLayerStatsSet : %d", |
| 1688 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1689 | return -EINVAL; |
| 1690 | } |
| 1691 | |
| 1692 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1693 | (struct nlattr *)data, |
| 1694 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1695 | { |
| 1696 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1697 | return -EINVAL; |
| 1698 | } |
| 1699 | |
| 1700 | if (!tb_vendor |
| 1701 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1702 | { |
| 1703 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1704 | return -EINVAL; |
| 1705 | } |
| 1706 | |
| 1707 | if (!tb_vendor |
| 1708 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1709 | { |
| 1710 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1711 | return -EINVAL; |
| 1712 | } |
| 1713 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1714 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1715 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1716 | nla_get_u32( tb_vendor[ |
| 1717 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1718 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1719 | nla_get_u32( tb_vendor[ |
| 1720 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1721 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1722 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1723 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1724 | |
| 1725 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1726 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1727 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1728 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1729 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1730 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1731 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1732 | |
| 1733 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1734 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1735 | { |
| 1736 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1737 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1738 | return -EINVAL; |
| 1739 | } |
| 1740 | return 0; |
| 1741 | } |
| 1742 | |
| 1743 | const struct |
| 1744 | nla_policy |
| 1745 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1746 | { |
| 1747 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1748 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1749 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1750 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1751 | }; |
| 1752 | |
| 1753 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1754 | struct wireless_dev *wdev, |
| 1755 | void *data, |
| 1756 | int data_len) |
| 1757 | { |
| 1758 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1759 | 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] | 1760 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1761 | struct net_device *dev = wdev->netdev; |
| 1762 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1763 | u32 statsClearReqMask; |
| 1764 | u8 stopReq; |
| 1765 | int status; |
| 1766 | |
| 1767 | status = wlan_hdd_validate_context(pHddCtx); |
| 1768 | if (0 != status) |
| 1769 | { |
| 1770 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1771 | FL("HDD context is not valid")); |
| 1772 | return -EINVAL; |
| 1773 | } |
| 1774 | |
| 1775 | if (NULL == pAdapter) |
| 1776 | { |
| 1777 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1778 | "%s: HDD adapter is Null", __func__); |
| 1779 | return -ENODEV; |
| 1780 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1781 | /* check the LLStats Capability */ |
| 1782 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1783 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1784 | { |
| 1785 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1786 | FL("Enable LLStats Capability")); |
| 1787 | return -EINVAL; |
| 1788 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1789 | |
| 1790 | if (!pAdapter->isLinkLayerStatsSet) |
| 1791 | { |
| 1792 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1793 | "%s: isLinkLayerStatsSet : %d", |
| 1794 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1795 | return -EINVAL; |
| 1796 | } |
| 1797 | |
| 1798 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1799 | (struct nlattr *)data, |
| 1800 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1801 | { |
| 1802 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1803 | return -EINVAL; |
| 1804 | } |
| 1805 | |
| 1806 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1807 | |
| 1808 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 1809 | { |
| 1810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 1811 | return -EINVAL; |
| 1812 | |
| 1813 | } |
| 1814 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1815 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1816 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1817 | nla_get_u32( |
| 1818 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 1819 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1820 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1821 | nla_get_u8( |
| 1822 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 1823 | |
| 1824 | // 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] | 1825 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1826 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1827 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 1828 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1829 | |
| 1830 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1831 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1832 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1833 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1834 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1835 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1836 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1837 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1838 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1839 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1840 | |
| 1841 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1842 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1843 | { |
| 1844 | struct sk_buff *temp_skbuff; |
| 1845 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 1846 | 2 * sizeof(u32) + |
| 1847 | NLMSG_HDRLEN); |
| 1848 | |
| 1849 | if (temp_skbuff != NULL) |
| 1850 | { |
| 1851 | |
| 1852 | if (nla_put_u32(temp_skbuff, |
| 1853 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 1854 | statsClearReqMask) || |
| 1855 | nla_put_u32(temp_skbuff, |
| 1856 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 1857 | stopReq)) |
| 1858 | { |
| 1859 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 1860 | kfree_skb(temp_skbuff); |
| 1861 | return -EINVAL; |
| 1862 | } |
| 1863 | /* If the ask is to stop the stats collection as part of clear |
| 1864 | * (stopReq = 1) , ensure that no further requests of get |
| 1865 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 1866 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1867 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1868 | * case the firmware is just asked to clear the statistics. |
| 1869 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1870 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1871 | pAdapter->isLinkLayerStatsSet = 0; |
| 1872 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 1873 | } |
| 1874 | return -ENOMEM; |
| 1875 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1876 | return -EINVAL; |
| 1877 | } |
| 1878 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1879 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1880 | #ifdef WLAN_FEATURE_EXTSCAN |
| 1881 | static const struct nla_policy |
| 1882 | wlan_hdd_extscan_config_policy |
| 1883 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 1884 | { |
| 1885 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 1886 | { .type = NLA_U32 }, |
| 1887 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 1888 | { .type = NLA_U32 }, |
| 1889 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 1890 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 1891 | { .type = NLA_U32 }, |
| 1892 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 1893 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 1894 | |
| 1895 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 1896 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 1897 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 1898 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 1899 | { .type = NLA_U8 }, |
| 1900 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 1901 | { .type = NLA_U32 }, |
| 1902 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 1903 | { .type = NLA_U32 }, |
| 1904 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 1905 | { .type = NLA_U32 }, |
| 1906 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 1907 | { .type = NLA_U8 }, |
| 1908 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 1909 | { .type = NLA_U8 }, |
| 1910 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 1911 | { .type = NLA_U8 }, |
| 1912 | |
| 1913 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 1914 | { .type = NLA_U32 }, |
| 1915 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 1916 | { .type = NLA_UNSPEC }, |
| 1917 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 1918 | { .type = NLA_S32 }, |
| 1919 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 1920 | { .type = NLA_S32 }, |
| 1921 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 1922 | { .type = NLA_U32 }, |
| 1923 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 1924 | { .type = NLA_U32 }, |
| 1925 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 1926 | { .type = NLA_U32 }, |
| 1927 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 1928 | = { .type = NLA_U32 }, |
| 1929 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 1930 | { .type = NLA_U32 }, |
| 1931 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 1932 | NLA_U32 }, |
| 1933 | }; |
| 1934 | |
| 1935 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 1936 | { |
| 1937 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 1938 | struct sk_buff *skb = NULL; |
| 1939 | tpSirEXTScanCapabilitiesEvent pData = |
| 1940 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 1941 | |
| 1942 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 1943 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 1944 | "or pData(%p) is null"), pData); |
| 1945 | return; |
| 1946 | } |
| 1947 | |
| 1948 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1949 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1950 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 1951 | GFP_KERNEL); |
| 1952 | |
| 1953 | if (!skb) { |
| 1954 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1955 | FL("cfg80211_vendor_event_alloc failed")); |
| 1956 | return; |
| 1957 | } |
| 1958 | |
| 1959 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 1960 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 1961 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 1962 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 1963 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 1964 | pData->maxRssiSampleSize); |
| 1965 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 1966 | pData->maxScanReportingThreshold); |
| 1967 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 1968 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 1969 | pData->maxSignificantWifiChangeAPs); |
| 1970 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 1971 | pData->maxBsidHistoryEntries); |
| 1972 | |
| 1973 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 1974 | pData->requestId) || |
| 1975 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 1976 | nla_put_u32(skb, |
| 1977 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 1978 | pData->scanCacheSize) || |
| 1979 | nla_put_u32(skb, |
| 1980 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 1981 | pData->scanBuckets) || |
| 1982 | nla_put_u32(skb, |
| 1983 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 1984 | pData->maxApPerScan) || |
| 1985 | nla_put_u32(skb, |
| 1986 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 1987 | pData->maxRssiSampleSize) || |
| 1988 | nla_put_u32(skb, |
| 1989 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 1990 | pData->maxScanReportingThreshold) || |
| 1991 | nla_put_u32(skb, |
| 1992 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 1993 | pData->maxHotlistAPs) || |
| 1994 | nla_put_u32(skb, |
| 1995 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 1996 | pData->maxSignificantWifiChangeAPs) || |
| 1997 | nla_put_u32(skb, |
| 1998 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 1999 | pData->maxBsidHistoryEntries)) { |
| 2000 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2001 | goto nla_put_failure; |
| 2002 | } |
| 2003 | |
| 2004 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2005 | return; |
| 2006 | |
| 2007 | nla_put_failure: |
| 2008 | kfree_skb(skb); |
| 2009 | return; |
| 2010 | } |
| 2011 | |
| 2012 | |
| 2013 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2014 | { |
| 2015 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2016 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2017 | struct sk_buff *skb = NULL; |
| 2018 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2019 | |
| 2020 | |
| 2021 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2022 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2023 | "or pData(%p) is null"), pData); |
| 2024 | return; |
| 2025 | } |
| 2026 | |
| 2027 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2028 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2029 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2030 | GFP_KERNEL); |
| 2031 | |
| 2032 | if (!skb) { |
| 2033 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2034 | FL("cfg80211_vendor_event_alloc failed")); |
| 2035 | return; |
| 2036 | } |
| 2037 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2038 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2039 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2040 | |
| 2041 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2042 | pData->requestId) || |
| 2043 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2044 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2045 | goto nla_put_failure; |
| 2046 | } |
| 2047 | |
| 2048 | /* |
| 2049 | * Store the Request ID for comparing with the requestID obtained |
| 2050 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2051 | * request is issued with a different requestId as that of the |
| 2052 | * extscan_start request. Also, This requestId shall be used while |
| 2053 | * indicating the full scan results to the upper layers. |
| 2054 | * The requestId is stored with the assumption that the firmware |
| 2055 | * shall return the ext scan start request's requestId in ext scan |
| 2056 | * start response. |
| 2057 | */ |
| 2058 | if (pData->status == 0) |
| 2059 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2060 | |
| 2061 | |
| 2062 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2063 | return; |
| 2064 | |
| 2065 | nla_put_failure: |
| 2066 | kfree_skb(skb); |
| 2067 | return; |
| 2068 | } |
| 2069 | |
| 2070 | |
| 2071 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2072 | { |
| 2073 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2074 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2075 | struct sk_buff *skb = NULL; |
| 2076 | |
| 2077 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2078 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2079 | "or pData(%p) is null"), pData); |
| 2080 | return; |
| 2081 | } |
| 2082 | |
| 2083 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2084 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2085 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2086 | GFP_KERNEL); |
| 2087 | |
| 2088 | if (!skb) { |
| 2089 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2090 | FL("cfg80211_vendor_event_alloc failed")); |
| 2091 | return; |
| 2092 | } |
| 2093 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2094 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2095 | |
| 2096 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2097 | pData->requestId) || |
| 2098 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2099 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2100 | goto nla_put_failure; |
| 2101 | } |
| 2102 | |
| 2103 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2104 | return; |
| 2105 | |
| 2106 | nla_put_failure: |
| 2107 | kfree_skb(skb); |
| 2108 | return; |
| 2109 | } |
| 2110 | |
| 2111 | |
| 2112 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2113 | void *pMsg) |
| 2114 | { |
| 2115 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2116 | struct sk_buff *skb = NULL; |
| 2117 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2118 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2119 | |
| 2120 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2121 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2122 | "or pData(%p) is null"), pData); |
| 2123 | return; |
| 2124 | } |
| 2125 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2126 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2127 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2128 | GFP_KERNEL); |
| 2129 | |
| 2130 | if (!skb) { |
| 2131 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2132 | FL("cfg80211_vendor_event_alloc failed")); |
| 2133 | return; |
| 2134 | } |
| 2135 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2136 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2137 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2138 | |
| 2139 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2140 | pData->requestId) || |
| 2141 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2142 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2143 | goto nla_put_failure; |
| 2144 | } |
| 2145 | |
| 2146 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2147 | return; |
| 2148 | |
| 2149 | nla_put_failure: |
| 2150 | kfree_skb(skb); |
| 2151 | return; |
| 2152 | } |
| 2153 | |
| 2154 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2155 | void *pMsg) |
| 2156 | { |
| 2157 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2158 | struct sk_buff *skb = NULL; |
| 2159 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2160 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2161 | |
| 2162 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2163 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2164 | "or pData(%p) is null"), pData); |
| 2165 | return; |
| 2166 | } |
| 2167 | |
| 2168 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2169 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2170 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2171 | GFP_KERNEL); |
| 2172 | |
| 2173 | if (!skb) { |
| 2174 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2175 | FL("cfg80211_vendor_event_alloc failed")); |
| 2176 | return; |
| 2177 | } |
| 2178 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2179 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2180 | |
| 2181 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2182 | pData->requestId) || |
| 2183 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2184 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2185 | goto nla_put_failure; |
| 2186 | } |
| 2187 | |
| 2188 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2189 | return; |
| 2190 | |
| 2191 | nla_put_failure: |
| 2192 | kfree_skb(skb); |
| 2193 | return; |
| 2194 | } |
| 2195 | |
| 2196 | |
| 2197 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2198 | void *pMsg) |
| 2199 | { |
| 2200 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2201 | struct sk_buff *skb = NULL; |
| 2202 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2203 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2204 | |
| 2205 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2206 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2207 | "or pData(%p) is null"), pData); |
| 2208 | return; |
| 2209 | } |
| 2210 | |
| 2211 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2212 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2213 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2214 | GFP_KERNEL); |
| 2215 | |
| 2216 | if (!skb) { |
| 2217 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2218 | FL("cfg80211_vendor_event_alloc failed")); |
| 2219 | return; |
| 2220 | } |
| 2221 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2222 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2223 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2224 | |
| 2225 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2226 | pData->requestId) || |
| 2227 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2228 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2229 | goto nla_put_failure; |
| 2230 | } |
| 2231 | |
| 2232 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2233 | return; |
| 2234 | |
| 2235 | nla_put_failure: |
| 2236 | kfree_skb(skb); |
| 2237 | return; |
| 2238 | } |
| 2239 | |
| 2240 | |
| 2241 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2242 | void *pMsg) |
| 2243 | { |
| 2244 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2245 | struct sk_buff *skb = NULL; |
| 2246 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2247 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2248 | |
| 2249 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2250 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2251 | "or pData(%p) is null"), pData); |
| 2252 | return; |
| 2253 | } |
| 2254 | |
| 2255 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2256 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2257 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2258 | GFP_KERNEL); |
| 2259 | |
| 2260 | if (!skb) { |
| 2261 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2262 | FL("cfg80211_vendor_event_alloc failed")); |
| 2263 | return; |
| 2264 | } |
| 2265 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2266 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2267 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2268 | |
| 2269 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2270 | pData->requestId) || |
| 2271 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2272 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2273 | goto nla_put_failure; |
| 2274 | } |
| 2275 | |
| 2276 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2277 | return; |
| 2278 | |
| 2279 | nla_put_failure: |
| 2280 | kfree_skb(skb); |
| 2281 | return; |
| 2282 | } |
| 2283 | |
| 2284 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2285 | void *pMsg) |
| 2286 | { |
| 2287 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2288 | struct sk_buff *skb = NULL; |
| 2289 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2290 | tANI_S32 totalResults; |
| 2291 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2292 | tpSirWifiScanResult pSirWifiScanResult; |
| 2293 | |
| 2294 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2295 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2296 | "or pData(%p) is null"), pData); |
| 2297 | return; |
| 2298 | } |
| 2299 | totalResults = pData->numOfAps; |
| 2300 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2301 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2302 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2303 | |
| 2304 | do{ |
| 2305 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2306 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2307 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2308 | |
| 2309 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2310 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2311 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2312 | GFP_KERNEL); |
| 2313 | |
| 2314 | if (!skb) { |
| 2315 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2316 | FL("cfg80211_vendor_event_alloc failed")); |
| 2317 | return; |
| 2318 | } |
| 2319 | |
| 2320 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2321 | |
| 2322 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2323 | pData->requestId) || |
| 2324 | nla_put_u32(skb, |
| 2325 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2326 | resultsPerEvent)) { |
| 2327 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2328 | goto fail; |
| 2329 | } |
| 2330 | if (nla_put_u8(skb, |
| 2331 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2332 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2333 | { |
| 2334 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2335 | goto fail; |
| 2336 | } |
| 2337 | |
| 2338 | if (resultsPerEvent) { |
| 2339 | struct nlattr *aps; |
| 2340 | |
| 2341 | aps = nla_nest_start(skb, |
| 2342 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2343 | if (!aps) |
| 2344 | { |
| 2345 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2346 | goto fail; |
| 2347 | } |
| 2348 | |
| 2349 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2350 | struct nlattr *ap; |
| 2351 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2352 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2353 | |
| 2354 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2355 | "Ssid (%s)" |
| 2356 | "Bssid: %pM " |
| 2357 | "Channel (%u)" |
| 2358 | "Rssi (%d)" |
| 2359 | "RTT (%u)" |
| 2360 | "RTT_SD (%u)", |
| 2361 | i, |
| 2362 | pSirWifiScanResult->ts, |
| 2363 | pSirWifiScanResult->ssid, |
| 2364 | pSirWifiScanResult->bssid, |
| 2365 | pSirWifiScanResult->channel, |
| 2366 | pSirWifiScanResult->rssi, |
| 2367 | pSirWifiScanResult->rtt, |
| 2368 | pSirWifiScanResult->rtt_sd); |
| 2369 | |
| 2370 | ap = nla_nest_start(skb, j + 1); |
| 2371 | if (!ap) |
| 2372 | { |
| 2373 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2374 | goto fail; |
| 2375 | } |
| 2376 | |
| 2377 | if (nla_put_u64(skb, |
| 2378 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2379 | pSirWifiScanResult->ts) ) |
| 2380 | { |
| 2381 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2382 | goto fail; |
| 2383 | } |
| 2384 | if (nla_put(skb, |
| 2385 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2386 | sizeof(pSirWifiScanResult->ssid), |
| 2387 | pSirWifiScanResult->ssid) ) |
| 2388 | { |
| 2389 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2390 | goto fail; |
| 2391 | } |
| 2392 | if (nla_put(skb, |
| 2393 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2394 | sizeof(pSirWifiScanResult->bssid), |
| 2395 | pSirWifiScanResult->bssid) ) |
| 2396 | { |
| 2397 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2398 | goto fail; |
| 2399 | } |
| 2400 | if (nla_put_u32(skb, |
| 2401 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2402 | pSirWifiScanResult->channel) ) |
| 2403 | { |
| 2404 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2405 | goto fail; |
| 2406 | } |
| 2407 | if (nla_put_u32(skb, |
| 2408 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2409 | pSirWifiScanResult->rssi) ) |
| 2410 | { |
| 2411 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2412 | goto fail; |
| 2413 | } |
| 2414 | if (nla_put_u32(skb, |
| 2415 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2416 | pSirWifiScanResult->rtt) ) |
| 2417 | { |
| 2418 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2419 | goto fail; |
| 2420 | } |
| 2421 | if (nla_put_u32(skb, |
| 2422 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2423 | pSirWifiScanResult->rtt_sd)) |
| 2424 | { |
| 2425 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2426 | goto fail; |
| 2427 | } |
| 2428 | |
| 2429 | nla_nest_end(skb, ap); |
| 2430 | } |
| 2431 | nla_nest_end(skb, aps); |
| 2432 | |
| 2433 | } |
| 2434 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2435 | } while (totalResults > 0); |
| 2436 | |
| 2437 | return; |
| 2438 | fail: |
| 2439 | kfree_skb(skb); |
| 2440 | return; |
| 2441 | } |
| 2442 | |
| 2443 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2444 | void *pMsg) |
| 2445 | { |
| 2446 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2447 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2448 | struct sk_buff *skb = NULL; |
| 2449 | tANI_U32 i; |
| 2450 | |
| 2451 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2452 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2453 | "or pData(%p) is null"), pData); |
| 2454 | return; |
| 2455 | } |
| 2456 | |
| 2457 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2458 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2459 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2460 | GFP_KERNEL); |
| 2461 | |
| 2462 | if (!skb) { |
| 2463 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2464 | FL("cfg80211_vendor_event_alloc failed")); |
| 2465 | return; |
| 2466 | } |
| 2467 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2468 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2469 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2470 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2471 | |
| 2472 | for (i = 0; i < pData->numOfAps; i++) { |
| 2473 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2474 | "Ssid (%s) " |
| 2475 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2476 | "Channel (%u) " |
| 2477 | "Rssi (%d) " |
| 2478 | "RTT (%u) " |
| 2479 | "RTT_SD (%u) ", |
| 2480 | i, |
| 2481 | pData->ap[i].ts, |
| 2482 | pData->ap[i].ssid, |
| 2483 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2484 | pData->ap[i].channel, |
| 2485 | pData->ap[i].rssi, |
| 2486 | pData->ap[i].rtt, |
| 2487 | pData->ap[i].rtt_sd); |
| 2488 | } |
| 2489 | |
| 2490 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2491 | pData->requestId) || |
| 2492 | nla_put_u32(skb, |
| 2493 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2494 | pData->numOfAps)) { |
| 2495 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2496 | goto fail; |
| 2497 | } |
| 2498 | if (pData->numOfAps) { |
| 2499 | struct nlattr *aps; |
| 2500 | |
| 2501 | aps = nla_nest_start(skb, |
| 2502 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2503 | if (!aps) |
| 2504 | goto fail; |
| 2505 | |
| 2506 | for (i = 0; i < pData->numOfAps; i++) { |
| 2507 | struct nlattr *ap; |
| 2508 | |
| 2509 | ap = nla_nest_start(skb, i + 1); |
| 2510 | if (!ap) |
| 2511 | goto fail; |
| 2512 | |
| 2513 | if (nla_put_u64(skb, |
| 2514 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2515 | pData->ap[i].ts) || |
| 2516 | nla_put(skb, |
| 2517 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2518 | sizeof(pData->ap[i].ssid), |
| 2519 | pData->ap[i].ssid) || |
| 2520 | nla_put(skb, |
| 2521 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2522 | sizeof(pData->ap[i].bssid), |
| 2523 | pData->ap[i].bssid) || |
| 2524 | nla_put_u32(skb, |
| 2525 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2526 | pData->ap[i].channel) || |
| 2527 | nla_put_s32(skb, |
| 2528 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2529 | pData->ap[i].rssi) || |
| 2530 | nla_put_u32(skb, |
| 2531 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2532 | pData->ap[i].rtt) || |
| 2533 | nla_put_u32(skb, |
| 2534 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2535 | pData->ap[i].rtt_sd)) |
| 2536 | goto fail; |
| 2537 | |
| 2538 | nla_nest_end(skb, ap); |
| 2539 | } |
| 2540 | nla_nest_end(skb, aps); |
| 2541 | |
| 2542 | if (nla_put_u8(skb, |
| 2543 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2544 | pData->moreData)) |
| 2545 | goto fail; |
| 2546 | } |
| 2547 | |
| 2548 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2549 | return; |
| 2550 | |
| 2551 | fail: |
| 2552 | kfree_skb(skb); |
| 2553 | return; |
| 2554 | |
| 2555 | } |
| 2556 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2557 | void *pMsg) |
| 2558 | { |
| 2559 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2560 | struct sk_buff *skb = NULL; |
| 2561 | tANI_U32 i, j; |
| 2562 | tpSirWifiSignificantChangeEvent pData = |
| 2563 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2564 | |
| 2565 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2566 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2567 | "or pData(%p) is null"), pData); |
| 2568 | return; |
| 2569 | } |
| 2570 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2571 | EXTSCAN_EVENT_BUF_SIZE, |
| 2572 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2573 | GFP_KERNEL); |
| 2574 | |
| 2575 | if (!skb) { |
| 2576 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2577 | FL("cfg80211_vendor_event_alloc failed")); |
| 2578 | return; |
| 2579 | } |
| 2580 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2581 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2582 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2583 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2584 | pData->numSigRssiBss); |
| 2585 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2586 | |
| 2587 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2588 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2589 | " num RSSI %u ", |
| 2590 | i, pData->sigRssiResult[i].bssid, |
| 2591 | pData->sigRssiResult[i].channel, |
| 2592 | pData->sigRssiResult[i].numRssi); |
| 2593 | |
| 2594 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2595 | |
| 2596 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2597 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2598 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2599 | |
| 2600 | } |
| 2601 | } |
| 2602 | |
| 2603 | |
| 2604 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2605 | pData->requestId) || |
| 2606 | nla_put_u32(skb, |
| 2607 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2608 | pData->numSigRssiBss)) { |
| 2609 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2610 | goto fail; |
| 2611 | } |
| 2612 | |
| 2613 | if (pData->numSigRssiBss) { |
| 2614 | struct nlattr *aps; |
| 2615 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2616 | if (!aps) |
| 2617 | goto fail; |
| 2618 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2619 | struct nlattr *ap; |
| 2620 | |
| 2621 | ap = nla_nest_start(skb, i); |
| 2622 | if (!ap) |
| 2623 | goto fail; |
| 2624 | if (nla_put(skb, |
| 2625 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2626 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2627 | nla_put_u32(skb, |
| 2628 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2629 | pData->sigRssiResult[i].channel) || |
| 2630 | nla_put_u32(skb, |
| 2631 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2632 | pData->sigRssiResult[i].numRssi) || |
| 2633 | nla_put(skb, |
| 2634 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2635 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2636 | pData->sigRssiResult[i].rssi)) |
| 2637 | goto fail; |
| 2638 | nla_nest_end(skb, ap); |
| 2639 | } |
| 2640 | nla_nest_end(skb, aps); |
| 2641 | if (nla_put_u8(skb, |
| 2642 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2643 | pData->moreData)) |
| 2644 | goto fail; |
| 2645 | } |
| 2646 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2647 | return; |
| 2648 | fail: |
| 2649 | kfree_skb(skb); |
| 2650 | return; |
| 2651 | } |
| 2652 | |
| 2653 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2654 | void *pMsg) |
| 2655 | { |
| 2656 | struct sk_buff *skb; |
| 2657 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2658 | tpSirWifiFullScanResultEvent pData = |
| 2659 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2660 | |
| 2661 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2662 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2663 | "or pData(%p) is null"), pData); |
| 2664 | return; |
| 2665 | } |
| 2666 | |
| 2667 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2668 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2669 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2670 | GFP_KERNEL); |
| 2671 | |
| 2672 | if (!skb) { |
| 2673 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2674 | FL("cfg80211_vendor_event_alloc failed")); |
| 2675 | return; |
| 2676 | } |
| 2677 | |
| 2678 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2679 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2680 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2681 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2682 | "Ssid (%s)" |
| 2683 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2684 | "Channel (%u)" |
| 2685 | "Rssi (%d)" |
| 2686 | "RTT (%u)" |
| 2687 | "RTT_SD (%u)"), |
| 2688 | pData->ap.ts, |
| 2689 | pData->ap.ssid, |
| 2690 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2691 | pData->ap.channel, |
| 2692 | pData->ap.rssi, |
| 2693 | pData->ap.rtt, |
| 2694 | pData->ap.rtt_sd); |
| 2695 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2696 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2697 | pData->requestId) || |
| 2698 | nla_put_u64(skb, |
| 2699 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2700 | pData->ap.ts) || |
| 2701 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2702 | sizeof(pData->ap.ssid), |
| 2703 | pData->ap.ssid) || |
| 2704 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2705 | WNI_CFG_BSSID_LEN, |
| 2706 | pData->ap.bssid) || |
| 2707 | nla_put_u32(skb, |
| 2708 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2709 | pData->ap.channel) || |
| 2710 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2711 | pData->ap.rssi) || |
| 2712 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2713 | pData->ap.rtt) || |
| 2714 | nla_put_u32(skb, |
| 2715 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2716 | pData->ap.rtt_sd) || |
| 2717 | nla_put_u16(skb, |
| 2718 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2719 | pData->ap.beaconPeriod) || |
| 2720 | nla_put_u16(skb, |
| 2721 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2722 | pData->ap.capability) || |
| 2723 | nla_put_u32(skb, |
| 2724 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2725 | pData->ieLength)) |
| 2726 | { |
| 2727 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2728 | goto nla_put_failure; |
| 2729 | } |
| 2730 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2731 | pData->ieLength, |
| 2732 | pData->ie)) |
| 2733 | { |
| 2734 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2735 | goto nla_put_failure; |
| 2736 | } |
| 2737 | |
| 2738 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2739 | return; |
| 2740 | |
| 2741 | nla_put_failure: |
| 2742 | kfree_skb(skb); |
| 2743 | return; |
| 2744 | } |
| 2745 | |
| 2746 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 2747 | void *pMsg) |
| 2748 | { |
| 2749 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2750 | struct sk_buff *skb = NULL; |
| 2751 | tpSirEXTScanResultsAvailableIndParams pData = |
| 2752 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 2753 | |
| 2754 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2755 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2756 | "or pData(%p) is null"), pData); |
| 2757 | return; |
| 2758 | } |
| 2759 | |
| 2760 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2761 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2762 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 2763 | GFP_KERNEL); |
| 2764 | |
| 2765 | if (!skb) { |
| 2766 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2767 | FL("cfg80211_vendor_event_alloc failed")); |
| 2768 | return; |
| 2769 | } |
| 2770 | |
| 2771 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2772 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2773 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 2774 | pData->numResultsAvailable); |
| 2775 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2776 | pData->requestId) || |
| 2777 | nla_put_u32(skb, |
| 2778 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2779 | pData->numResultsAvailable)) { |
| 2780 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2781 | goto nla_put_failure; |
| 2782 | } |
| 2783 | |
| 2784 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2785 | return; |
| 2786 | |
| 2787 | nla_put_failure: |
| 2788 | kfree_skb(skb); |
| 2789 | return; |
| 2790 | } |
| 2791 | |
| 2792 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 2793 | { |
| 2794 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2795 | struct sk_buff *skb = NULL; |
| 2796 | tpSirEXTScanProgressIndParams pData = |
| 2797 | (tpSirEXTScanProgressIndParams) pMsg; |
| 2798 | |
| 2799 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2800 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2801 | "or pData(%p) is null"), pData); |
| 2802 | return; |
| 2803 | } |
| 2804 | |
| 2805 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2806 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2807 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 2808 | GFP_KERNEL); |
| 2809 | |
| 2810 | if (!skb) { |
| 2811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2812 | FL("cfg80211_vendor_event_alloc failed")); |
| 2813 | return; |
| 2814 | } |
| 2815 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2816 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 2817 | pData->extScanEventType); |
| 2818 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 2819 | pData->status); |
| 2820 | |
| 2821 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 2822 | pData->extScanEventType) || |
| 2823 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 2824 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2825 | pData->requestId) || |
| 2826 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2827 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 2828 | pData->status)) { |
| 2829 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2830 | goto nla_put_failure; |
| 2831 | } |
| 2832 | |
| 2833 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2834 | return; |
| 2835 | |
| 2836 | nla_put_failure: |
| 2837 | kfree_skb(skb); |
| 2838 | return; |
| 2839 | } |
| 2840 | |
| 2841 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 2842 | void *pMsg) |
| 2843 | { |
| 2844 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2845 | |
| 2846 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2847 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 2848 | return; |
| 2849 | } |
| 2850 | |
| 2851 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 2852 | |
| 2853 | |
| 2854 | switch(evType) { |
| 2855 | case SIR_HAL_EXTSCAN_START_RSP: |
| 2856 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 2857 | break; |
| 2858 | |
| 2859 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 2860 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 2861 | break; |
| 2862 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 2863 | /* There is no need to send this response to upper layer |
| 2864 | Just log the message */ |
| 2865 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2866 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 2867 | break; |
| 2868 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 2869 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 2870 | break; |
| 2871 | |
| 2872 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 2873 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 2874 | break; |
| 2875 | |
| 2876 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 2877 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 2878 | break; |
| 2879 | |
| 2880 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 2881 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 2882 | break; |
| 2883 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 2884 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 2885 | break; |
| 2886 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 2887 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 2888 | break; |
| 2889 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 2890 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 2891 | break; |
| 2892 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 2893 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 2894 | break; |
| 2895 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 2896 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 2897 | break; |
| 2898 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 2899 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 2900 | break; |
| 2901 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 2902 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 2903 | break; |
| 2904 | default: |
| 2905 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 2906 | break; |
| 2907 | } |
| 2908 | } |
| 2909 | |
| 2910 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 2911 | struct wireless_dev *wdev, |
| 2912 | void *data, int dataLen) |
| 2913 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2914 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2915 | struct net_device *dev = wdev->netdev; |
| 2916 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2917 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2918 | struct nlattr |
| 2919 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 2920 | eHalStatus status; |
| 2921 | |
| 2922 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 2923 | status = wlan_hdd_validate_context(pHddCtx); |
| 2924 | if (0 != status) |
| 2925 | { |
| 2926 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2927 | FL("HDD context is not valid")); |
| 2928 | return -EINVAL; |
| 2929 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2930 | /* check the EXTScan Capability */ |
| 2931 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 2932 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 2933 | { |
| 2934 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2935 | FL("EXTScan not enabled/supported by Firmware")); |
| 2936 | return -EINVAL; |
| 2937 | } |
| 2938 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2939 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 2940 | data, dataLen, |
| 2941 | wlan_hdd_extscan_config_policy)) { |
| 2942 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 2943 | return -EINVAL; |
| 2944 | } |
| 2945 | |
| 2946 | /* Parse and fetch request Id */ |
| 2947 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 2948 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 2949 | return -EINVAL; |
| 2950 | } |
| 2951 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2952 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2953 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2954 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2955 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2956 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2957 | reqMsg.sessionId = pAdapter->sessionId; |
| 2958 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2959 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2960 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2961 | if (!HAL_STATUS_SUCCESS(status)) { |
| 2962 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2963 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2964 | return -EINVAL; |
| 2965 | } |
| 2966 | |
| 2967 | return 0; |
| 2968 | } |
| 2969 | |
| 2970 | |
| 2971 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 2972 | struct wireless_dev *wdev, |
| 2973 | void *data, int dataLen) |
| 2974 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2975 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2976 | struct net_device *dev = wdev->netdev; |
| 2977 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2978 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2979 | struct nlattr |
| 2980 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 2981 | eHalStatus status; |
| 2982 | |
| 2983 | status = wlan_hdd_validate_context(pHddCtx); |
| 2984 | if (0 != status) |
| 2985 | { |
| 2986 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2987 | FL("HDD context is not valid")); |
| 2988 | return -EINVAL; |
| 2989 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 2990 | /* check the EXTScan Capability */ |
| 2991 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 2992 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 2993 | { |
| 2994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2995 | FL("EXTScan not enabled/supported by Firmware")); |
| 2996 | return -EINVAL; |
| 2997 | } |
| 2998 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2999 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3000 | data, dataLen, |
| 3001 | wlan_hdd_extscan_config_policy)) { |
| 3002 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3003 | return -EINVAL; |
| 3004 | } |
| 3005 | /* Parse and fetch request Id */ |
| 3006 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3007 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3008 | return -EINVAL; |
| 3009 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3010 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3011 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3012 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3013 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3014 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3015 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3016 | reqMsg.sessionId = pAdapter->sessionId; |
| 3017 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3018 | |
| 3019 | /* Parse and fetch flush parameter */ |
| 3020 | if (!tb |
| 3021 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3022 | { |
| 3023 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3024 | goto failed; |
| 3025 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3026 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3027 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3028 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3029 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3030 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3031 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3032 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3033 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3034 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3035 | return -EINVAL; |
| 3036 | } |
| 3037 | return 0; |
| 3038 | |
| 3039 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3040 | return -EINVAL; |
| 3041 | } |
| 3042 | |
| 3043 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3044 | struct wireless_dev *wdev, |
| 3045 | void *data, int dataLen) |
| 3046 | { |
| 3047 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3048 | struct net_device *dev = wdev->netdev; |
| 3049 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3050 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3051 | struct nlattr |
| 3052 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3053 | struct nlattr |
| 3054 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3055 | struct nlattr *apTh; |
| 3056 | eHalStatus status; |
| 3057 | tANI_U8 i = 0; |
| 3058 | int rem; |
| 3059 | |
| 3060 | status = wlan_hdd_validate_context(pHddCtx); |
| 3061 | if (0 != status) |
| 3062 | { |
| 3063 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3064 | FL("HDD context is not valid")); |
| 3065 | return -EINVAL; |
| 3066 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3067 | /* check the EXTScan Capability */ |
| 3068 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3069 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3070 | { |
| 3071 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3072 | FL("EXTScan not enabled/supported by Firmware")); |
| 3073 | return -EINVAL; |
| 3074 | } |
| 3075 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3076 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3077 | data, dataLen, |
| 3078 | wlan_hdd_extscan_config_policy)) { |
| 3079 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3080 | return -EINVAL; |
| 3081 | } |
| 3082 | |
| 3083 | /* Parse and fetch request Id */ |
| 3084 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3085 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3086 | return -EINVAL; |
| 3087 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3088 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3089 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3090 | if (!pReqMsg) { |
| 3091 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3092 | return -ENOMEM; |
| 3093 | } |
| 3094 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3095 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3096 | pReqMsg->requestId = nla_get_u32( |
| 3097 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3098 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3099 | |
| 3100 | /* Parse and fetch number of APs */ |
| 3101 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3102 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3103 | goto fail; |
| 3104 | } |
| 3105 | |
| 3106 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3107 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3108 | |
| 3109 | pReqMsg->numAp = nla_get_u32( |
| 3110 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3111 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3112 | |
| 3113 | nla_for_each_nested(apTh, |
| 3114 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3115 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3116 | nla_data(apTh), nla_len(apTh), |
| 3117 | NULL)) { |
| 3118 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3119 | goto fail; |
| 3120 | } |
| 3121 | |
| 3122 | /* Parse and fetch MAC address */ |
| 3123 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3125 | goto fail; |
| 3126 | } |
| 3127 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3128 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3129 | sizeof(tSirMacAddr)); |
| 3130 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3131 | |
| 3132 | /* Parse and fetch low RSSI */ |
| 3133 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3134 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3135 | goto fail; |
| 3136 | } |
| 3137 | pReqMsg->ap[i].low = nla_get_s32( |
| 3138 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3139 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3140 | |
| 3141 | /* Parse and fetch high RSSI */ |
| 3142 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3143 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3144 | goto fail; |
| 3145 | } |
| 3146 | pReqMsg->ap[i].high = nla_get_s32( |
| 3147 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3148 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3149 | pReqMsg->ap[i].high); |
| 3150 | |
| 3151 | /* Parse and fetch channel */ |
| 3152 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3153 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3154 | goto fail; |
| 3155 | } |
| 3156 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3157 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3158 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3159 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3160 | i++; |
| 3161 | } |
| 3162 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3163 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3164 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3165 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3166 | vos_mem_free(pReqMsg); |
| 3167 | return -EINVAL; |
| 3168 | } |
| 3169 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3170 | vos_mem_free(pReqMsg); |
| 3171 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3172 | return 0; |
| 3173 | |
| 3174 | fail: |
| 3175 | vos_mem_free(pReqMsg); |
| 3176 | return -EINVAL; |
| 3177 | } |
| 3178 | |
| 3179 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3180 | struct wireless_dev *wdev, |
| 3181 | void *data, int dataLen) |
| 3182 | { |
| 3183 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3184 | struct net_device *dev = wdev->netdev; |
| 3185 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3186 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3187 | struct nlattr |
| 3188 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3189 | struct nlattr |
| 3190 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3191 | struct nlattr *apTh; |
| 3192 | eHalStatus status; |
| 3193 | int i = 0; |
| 3194 | int rem; |
| 3195 | |
| 3196 | status = wlan_hdd_validate_context(pHddCtx); |
| 3197 | if (0 != status) |
| 3198 | { |
| 3199 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3200 | FL("HDD context is not valid")); |
| 3201 | return -EINVAL; |
| 3202 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3203 | /* check the EXTScan Capability */ |
| 3204 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3205 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3206 | { |
| 3207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3208 | FL("EXTScan not enabled/supported by Firmware")); |
| 3209 | return -EINVAL; |
| 3210 | } |
| 3211 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3212 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3213 | data, dataLen, |
| 3214 | wlan_hdd_extscan_config_policy)) { |
| 3215 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3216 | return -EINVAL; |
| 3217 | } |
| 3218 | |
| 3219 | /* Parse and fetch request Id */ |
| 3220 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3221 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3222 | return -EINVAL; |
| 3223 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3224 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3225 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3226 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3227 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3228 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3229 | } |
| 3230 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3231 | |
| 3232 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3233 | pReqMsg->requestId = nla_get_u32( |
| 3234 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3235 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3236 | |
| 3237 | /* Parse and fetch RSSI sample size */ |
| 3238 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3239 | { |
| 3240 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3241 | goto fail; |
| 3242 | } |
| 3243 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3244 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3245 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3246 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3247 | |
| 3248 | /* Parse and fetch lost AP sample size */ |
| 3249 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3250 | { |
| 3251 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3252 | goto fail; |
| 3253 | } |
| 3254 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3255 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3256 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3257 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3258 | /* Parse and fetch minimum Breaching */ |
| 3259 | if (!tb |
| 3260 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3261 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3262 | goto fail; |
| 3263 | } |
| 3264 | pReqMsg->minBreaching = nla_get_u32( |
| 3265 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3266 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3267 | |
| 3268 | /* Parse and fetch number of APs */ |
| 3269 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3270 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3271 | goto fail; |
| 3272 | } |
| 3273 | pReqMsg->numAp = nla_get_u32( |
| 3274 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3275 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3276 | |
| 3277 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3278 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3279 | |
| 3280 | nla_for_each_nested(apTh, |
| 3281 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3282 | if(nla_parse(tb2, |
| 3283 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3284 | nla_data(apTh), nla_len(apTh), |
| 3285 | NULL)) { |
| 3286 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3287 | goto fail; |
| 3288 | } |
| 3289 | |
| 3290 | /* Parse and fetch MAC address */ |
| 3291 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3292 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3293 | goto fail; |
| 3294 | } |
| 3295 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3296 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3297 | sizeof(tSirMacAddr)); |
| 3298 | |
| 3299 | /* Parse and fetch low RSSI */ |
| 3300 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3301 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3302 | goto fail; |
| 3303 | } |
| 3304 | pReqMsg->ap[i].low = nla_get_s32( |
| 3305 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3306 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3307 | |
| 3308 | /* Parse and fetch high RSSI */ |
| 3309 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3310 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3311 | goto fail; |
| 3312 | } |
| 3313 | pReqMsg->ap[i].high = nla_get_s32( |
| 3314 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3315 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3316 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3317 | |
| 3318 | /* Parse and fetch channel */ |
| 3319 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3320 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3321 | goto fail; |
| 3322 | } |
| 3323 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3324 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3325 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3326 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3327 | i++; |
| 3328 | } |
| 3329 | |
| 3330 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3331 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3332 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3333 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3334 | vos_mem_free(pReqMsg); |
| 3335 | return -EINVAL; |
| 3336 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3337 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3338 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3339 | return 0; |
| 3340 | |
| 3341 | fail: |
| 3342 | vos_mem_free(pReqMsg); |
| 3343 | return -EINVAL; |
| 3344 | } |
| 3345 | |
| 3346 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3347 | struct wireless_dev *wdev, |
| 3348 | void *data, int dataLen) |
| 3349 | { |
| 3350 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3351 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3352 | tANI_U8 numChannels = 0; |
| 3353 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3354 | tANI_U32 requestId; |
| 3355 | tWifiBand wifiBand; |
| 3356 | eHalStatus status; |
| 3357 | struct sk_buff *replySkb; |
| 3358 | tANI_U8 i; |
| 3359 | |
| 3360 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3361 | status = wlan_hdd_validate_context(pHddCtx); |
| 3362 | if (0 != status) |
| 3363 | { |
| 3364 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3365 | FL("HDD context is not valid")); |
| 3366 | return -EINVAL; |
| 3367 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3368 | /* check the EXTScan Capability */ |
| 3369 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3370 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3371 | { |
| 3372 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3373 | FL("EXTScan not enabled/supported by Firmware")); |
| 3374 | return -EINVAL; |
| 3375 | } |
| 3376 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3377 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3378 | data, dataLen, |
| 3379 | wlan_hdd_extscan_config_policy)) { |
| 3380 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3381 | return -EINVAL; |
| 3382 | } |
| 3383 | |
| 3384 | /* Parse and fetch request Id */ |
| 3385 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3386 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3387 | return -EINVAL; |
| 3388 | } |
| 3389 | requestId = nla_get_u32( |
| 3390 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3391 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3392 | |
| 3393 | /* Parse and fetch wifi band */ |
| 3394 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3395 | { |
| 3396 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3397 | return -EINVAL; |
| 3398 | } |
| 3399 | wifiBand = nla_get_u32( |
| 3400 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3402 | |
| 3403 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3404 | wifiBand, ChannelList, |
| 3405 | &numChannels); |
| 3406 | if (eHAL_STATUS_SUCCESS != status) { |
| 3407 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3408 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3409 | return -EINVAL; |
| 3410 | } |
| 3411 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3412 | for (i = 0; i < numChannels; i++) |
| 3413 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3414 | |
| 3415 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3416 | sizeof(u32) * numChannels + |
| 3417 | NLMSG_HDRLEN); |
| 3418 | |
| 3419 | if (!replySkb) { |
| 3420 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3421 | FL("valid channels: buffer alloc fail")); |
| 3422 | return -EINVAL; |
| 3423 | } |
| 3424 | if (nla_put_u32(replySkb, |
| 3425 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3426 | numChannels) || |
| 3427 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3428 | sizeof(u32) * numChannels, ChannelList)) { |
| 3429 | |
| 3430 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3431 | kfree_skb(replySkb); |
| 3432 | return -EINVAL; |
| 3433 | } |
| 3434 | |
| 3435 | return cfg80211_vendor_cmd_reply(replySkb); |
| 3436 | } |
| 3437 | |
| 3438 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 3439 | struct wireless_dev *wdev, |
| 3440 | void *data, int dataLen) |
| 3441 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3442 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3443 | struct net_device *dev = wdev->netdev; |
| 3444 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3445 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3446 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3447 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3448 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3449 | struct nlattr *buckets; |
| 3450 | struct nlattr *channels; |
| 3451 | int rem1; |
| 3452 | int rem2; |
| 3453 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3454 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3455 | |
| 3456 | status = wlan_hdd_validate_context(pHddCtx); |
| 3457 | if (0 != status) |
| 3458 | { |
| 3459 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3460 | FL("HDD context is not valid")); |
| 3461 | return -EINVAL; |
| 3462 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3463 | /* check the EXTScan Capability */ |
| 3464 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3465 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3466 | { |
| 3467 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3468 | FL("EXTScan not enabled/supported by Firmware")); |
| 3469 | return -EINVAL; |
| 3470 | } |
| 3471 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3472 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3473 | data, dataLen, |
| 3474 | wlan_hdd_extscan_config_policy)) { |
| 3475 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3476 | return -EINVAL; |
| 3477 | } |
| 3478 | |
| 3479 | /* Parse and fetch request Id */ |
| 3480 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3481 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3482 | return -EINVAL; |
| 3483 | } |
| 3484 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3485 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3486 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3487 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3488 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3489 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3490 | } |
| 3491 | |
| 3492 | pReqMsg->requestId = nla_get_u32( |
| 3493 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3494 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3495 | |
| 3496 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3497 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3498 | |
| 3499 | /* Parse and fetch base period */ |
| 3500 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3501 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3502 | goto fail; |
| 3503 | } |
| 3504 | pReqMsg->basePeriod = nla_get_u32( |
| 3505 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3506 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3507 | pReqMsg->basePeriod); |
| 3508 | |
| 3509 | /* Parse and fetch max AP per scan */ |
| 3510 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3511 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3512 | goto fail; |
| 3513 | } |
| 3514 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3515 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3516 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3517 | pReqMsg->maxAPperScan); |
| 3518 | |
| 3519 | /* Parse and fetch report threshold */ |
| 3520 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3521 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3522 | goto fail; |
| 3523 | } |
| 3524 | pReqMsg->reportThreshold = nla_get_u8( |
| 3525 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3526 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3527 | pReqMsg->reportThreshold); |
| 3528 | |
| 3529 | /* Parse and fetch number of buckets */ |
| 3530 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3531 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3532 | goto fail; |
| 3533 | } |
| 3534 | pReqMsg->numBuckets = nla_get_u8( |
| 3535 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3536 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3537 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3538 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3539 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3540 | } |
| 3541 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3542 | pReqMsg->numBuckets); |
| 3543 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3544 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3545 | goto fail; |
| 3546 | } |
| 3547 | |
| 3548 | nla_for_each_nested(buckets, |
| 3549 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3550 | if(nla_parse(bucket, |
| 3551 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3552 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3553 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3554 | goto fail; |
| 3555 | } |
| 3556 | |
| 3557 | /* Parse and fetch bucket spec */ |
| 3558 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3559 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3560 | goto fail; |
| 3561 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3562 | |
| 3563 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 3564 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3565 | |
| 3566 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 3567 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3568 | |
| 3569 | /* Parse and fetch wifi band */ |
| 3570 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3571 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3572 | goto fail; |
| 3573 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3574 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3575 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3576 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3577 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3578 | |
| 3579 | /* Parse and fetch period */ |
| 3580 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3581 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3582 | goto fail; |
| 3583 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3584 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3585 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3586 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3587 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3588 | |
| 3589 | /* Parse and fetch report events */ |
| 3590 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3591 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3592 | goto fail; |
| 3593 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3594 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3595 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3596 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3597 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3598 | |
| 3599 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3600 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 3601 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3602 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3603 | goto fail; |
| 3604 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3605 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3606 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3607 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3608 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3609 | |
| 3610 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3611 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3612 | goto fail; |
| 3613 | } |
| 3614 | |
| 3615 | j = 0; |
| 3616 | nla_for_each_nested(channels, |
| 3617 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3618 | if(nla_parse(channel, |
| 3619 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3620 | nla_data(channels), nla_len(channels), |
| 3621 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 3622 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3623 | goto fail; |
| 3624 | } |
| 3625 | |
| 3626 | /* Parse and fetch channel */ |
| 3627 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 3628 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3629 | goto fail; |
| 3630 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3631 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3632 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 3633 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3634 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3635 | |
| 3636 | /* Parse and fetch dwell time */ |
| 3637 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 3638 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 3639 | goto fail; |
| 3640 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3641 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3642 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 3643 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3644 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3645 | |
| 3646 | /* Parse and fetch channel spec passive */ |
| 3647 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 3648 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3649 | FL("attr channel spec passive failed")); |
| 3650 | goto fail; |
| 3651 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3652 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3653 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 3654 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3655 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3656 | j++; |
| 3657 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3658 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3659 | } |
| 3660 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 3661 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3662 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3663 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 3664 | vos_mem_free(pReqMsg); |
| 3665 | return -EINVAL; |
| 3666 | } |
| 3667 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3668 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3669 | return 0; |
| 3670 | |
| 3671 | fail: |
| 3672 | vos_mem_free(pReqMsg); |
| 3673 | return -EINVAL; |
| 3674 | } |
| 3675 | |
| 3676 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 3677 | struct wireless_dev *wdev, |
| 3678 | void *data, int dataLen) |
| 3679 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3680 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3681 | struct net_device *dev = wdev->netdev; |
| 3682 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3683 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3684 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3685 | eHalStatus status; |
| 3686 | |
| 3687 | status = wlan_hdd_validate_context(pHddCtx); |
| 3688 | if (0 != status) |
| 3689 | { |
| 3690 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3691 | FL("HDD context is not valid")); |
| 3692 | return -EINVAL; |
| 3693 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3694 | /* check the EXTScan Capability */ |
| 3695 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3696 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3697 | { |
| 3698 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3699 | FL("EXTScan not enabled/supported by Firmware")); |
| 3700 | return -EINVAL; |
| 3701 | } |
| 3702 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3703 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3704 | data, dataLen, |
| 3705 | wlan_hdd_extscan_config_policy)) { |
| 3706 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3707 | return -EINVAL; |
| 3708 | } |
| 3709 | |
| 3710 | /* Parse and fetch request Id */ |
| 3711 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3712 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3713 | return -EINVAL; |
| 3714 | } |
| 3715 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3716 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3717 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3718 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3719 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3720 | reqMsg.sessionId = pAdapter->sessionId; |
| 3721 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3722 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3723 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3724 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3725 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3726 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3727 | return -EINVAL; |
| 3728 | } |
| 3729 | |
| 3730 | return 0; |
| 3731 | } |
| 3732 | |
| 3733 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 3734 | struct wireless_dev *wdev, |
| 3735 | void *data, int dataLen) |
| 3736 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3737 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3738 | struct net_device *dev = wdev->netdev; |
| 3739 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3740 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3741 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3742 | eHalStatus status; |
| 3743 | |
| 3744 | status = wlan_hdd_validate_context(pHddCtx); |
| 3745 | if (0 != status) |
| 3746 | { |
| 3747 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3748 | FL("HDD context is not valid")); |
| 3749 | return -EINVAL; |
| 3750 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3751 | /* check the EXTScan Capability */ |
| 3752 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3753 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3754 | { |
| 3755 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3756 | FL("EXTScan not enabled/supported by Firmware")); |
| 3757 | return -EINVAL; |
| 3758 | } |
| 3759 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3760 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3761 | data, dataLen, |
| 3762 | wlan_hdd_extscan_config_policy)) { |
| 3763 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3764 | return -EINVAL; |
| 3765 | } |
| 3766 | |
| 3767 | /* Parse and fetch request Id */ |
| 3768 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3769 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3770 | return -EINVAL; |
| 3771 | } |
| 3772 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3773 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3774 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3775 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3776 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3777 | reqMsg.sessionId = pAdapter->sessionId; |
| 3778 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3779 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3780 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3781 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3782 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3783 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3784 | return -EINVAL; |
| 3785 | } |
| 3786 | |
| 3787 | return 0; |
| 3788 | } |
| 3789 | |
| 3790 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 3791 | struct wiphy *wiphy, |
| 3792 | struct wireless_dev *wdev, |
| 3793 | void *data, int dataLen) |
| 3794 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3795 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3796 | struct net_device *dev = wdev->netdev; |
| 3797 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3798 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3799 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3800 | eHalStatus status; |
| 3801 | |
| 3802 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering")); |
| 3803 | status = wlan_hdd_validate_context(pHddCtx); |
| 3804 | if (0 != status) |
| 3805 | { |
| 3806 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3807 | FL("HDD context is not valid")); |
| 3808 | return -EINVAL; |
| 3809 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3810 | /* check the EXTScan Capability */ |
| 3811 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3812 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3813 | { |
| 3814 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3815 | FL("EXTScan not enabled/supported by Firmware")); |
| 3816 | return -EINVAL; |
| 3817 | } |
| 3818 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3819 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3820 | data, dataLen, |
| 3821 | wlan_hdd_extscan_config_policy)) { |
| 3822 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3823 | return -EINVAL; |
| 3824 | } |
| 3825 | |
| 3826 | /* Parse and fetch request Id */ |
| 3827 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3828 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3829 | return -EINVAL; |
| 3830 | } |
| 3831 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3832 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3833 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3834 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3835 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3836 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3837 | reqMsg.sessionId = pAdapter->sessionId; |
| 3838 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3839 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3840 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3841 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3843 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3844 | return -EINVAL; |
| 3845 | } |
| 3846 | |
| 3847 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3848 | return 0; |
| 3849 | } |
| 3850 | |
| 3851 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 3852 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3853 | /*EXT TDLS*/ |
| 3854 | static const struct nla_policy |
| 3855 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 3856 | { |
| 3857 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3858 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 3859 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 3860 | {.type = NLA_S32 }, |
| 3861 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 3862 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 3863 | |
| 3864 | }; |
| 3865 | |
| 3866 | static const struct nla_policy |
| 3867 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 3868 | { |
| 3869 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3870 | |
| 3871 | }; |
| 3872 | |
| 3873 | static const struct nla_policy |
| 3874 | wlan_hdd_tdls_config_state_change_policy[ |
| 3875 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 3876 | { |
| 3877 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3878 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 3879 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
| 3880 | |
| 3881 | }; |
| 3882 | |
| 3883 | static const struct nla_policy |
| 3884 | wlan_hdd_tdls_config_get_status_policy[ |
| 3885 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 3886 | { |
| 3887 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3888 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 3889 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
| 3890 | |
| 3891 | }; |
| 3892 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 3893 | struct wireless_dev *wdev, |
| 3894 | void *data, |
| 3895 | int data_len) |
| 3896 | { |
| 3897 | u8 peer[6] = {0}; |
| 3898 | struct net_device *dev = wdev->netdev; |
| 3899 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3900 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3901 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 3902 | eHalStatus ret; |
| 3903 | tANI_S32 state; |
| 3904 | tANI_S32 reason; |
| 3905 | struct sk_buff *skb = NULL; |
| 3906 | |
| 3907 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3908 | if (0 != ret) { |
| 3909 | |
| 3910 | return -EINVAL; |
| 3911 | } |
| 3912 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 3913 | |
| 3914 | return -ENOTSUPP; |
| 3915 | } |
| 3916 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 3917 | data, data_len, |
| 3918 | wlan_hdd_tdls_config_get_status_policy)) { |
| 3919 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3920 | return -EINVAL; |
| 3921 | } |
| 3922 | |
| 3923 | /* Parse and fetch mac address */ |
| 3924 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 3925 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 3926 | return -EINVAL; |
| 3927 | } |
| 3928 | |
| 3929 | memcpy(peer, nla_data( |
| 3930 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 3931 | sizeof(peer)); |
| 3932 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 3933 | |
| 3934 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 3935 | |
| 3936 | if (0 != ret) { |
| 3937 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3938 | FL("get status Failed")); |
| 3939 | return -EINVAL; |
| 3940 | } |
| 3941 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 3942 | 2 * sizeof(s32) + |
| 3943 | NLMSG_HDRLEN); |
| 3944 | |
| 3945 | if (!skb) { |
| 3946 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3947 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 3948 | return -EINVAL; |
| 3949 | } |
| 3950 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reason (%d) Status (%d) tdls peer" MAC_ADDRESS_STR), |
| 3951 | reason, |
| 3952 | state, |
| 3953 | MAC_ADDR_ARRAY(peer)); |
| 3954 | |
| 3955 | if (nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, state) || |
| 3956 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, reason)) { |
| 3957 | |
| 3958 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3959 | goto nla_put_failure; |
| 3960 | } |
| 3961 | |
| 3962 | return cfg80211_vendor_cmd_reply(skb); |
| 3963 | |
| 3964 | nla_put_failure: |
| 3965 | kfree_skb(skb); |
| 3966 | return -EINVAL; |
| 3967 | } |
| 3968 | |
| 3969 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 3970 | tANI_S32 state, |
| 3971 | tANI_S32 reason, |
| 3972 | void *ctx) |
| 3973 | { |
| 3974 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
| 3975 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3976 | struct sk_buff *skb = NULL; |
| 3977 | |
| 3978 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3979 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid ")); |
| 3980 | return -EINVAL; |
| 3981 | } |
| 3982 | |
| 3983 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 3984 | |
| 3985 | return -ENOTSUPP; |
| 3986 | } |
| 3987 | skb = cfg80211_vendor_event_alloc( |
| 3988 | pHddCtx->wiphy, |
| 3989 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3990 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 3991 | GFP_KERNEL); |
| 3992 | |
| 3993 | if (!skb) { |
| 3994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3995 | FL("cfg80211_vendor_event_alloc failed")); |
| 3996 | return -EINVAL; |
| 3997 | } |
| 3998 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3999 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason (%d) Status (%d)", reason, state); |
| 4000 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4001 | MAC_ADDR_ARRAY(mac)); |
| 4002 | |
| 4003 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4004 | VOS_MAC_ADDR_SIZE, mac) || |
| 4005 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, state) || |
| 4006 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, reason) |
| 4007 | ) { |
| 4008 | |
| 4009 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4010 | goto nla_put_failure; |
| 4011 | } |
| 4012 | |
| 4013 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 4014 | return (0); |
| 4015 | |
| 4016 | nla_put_failure: |
| 4017 | kfree_skb(skb); |
| 4018 | return -EINVAL; |
| 4019 | } |
| 4020 | |
| 4021 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4022 | struct wireless_dev *wdev, |
| 4023 | void *data, |
| 4024 | int data_len) |
| 4025 | { |
| 4026 | u8 peer[6] = {0}; |
| 4027 | struct net_device *dev = wdev->netdev; |
| 4028 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4029 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4030 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4031 | eHalStatus status; |
| 4032 | tdls_req_params_t pReqMsg = {0}; |
| 4033 | |
| 4034 | status = wlan_hdd_validate_context(pHddCtx); |
| 4035 | if (0 != status) { |
| 4036 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4037 | FL("HDD context is not valid")); |
| 4038 | return -EINVAL; |
| 4039 | } |
| 4040 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4041 | |
| 4042 | return -ENOTSUPP; |
| 4043 | } |
| 4044 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4045 | data, data_len, |
| 4046 | wlan_hdd_tdls_config_enable_policy)) { |
| 4047 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4048 | return -EINVAL; |
| 4049 | } |
| 4050 | |
| 4051 | /* Parse and fetch mac address */ |
| 4052 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4053 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4054 | return -EINVAL; |
| 4055 | } |
| 4056 | |
| 4057 | memcpy(peer, nla_data( |
| 4058 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4059 | sizeof(peer)); |
| 4060 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4061 | |
| 4062 | /* Parse and fetch channel */ |
| 4063 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4064 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4065 | return -EINVAL; |
| 4066 | } |
| 4067 | pReqMsg.channel = nla_get_s32( |
| 4068 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4069 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4070 | |
| 4071 | /* Parse and fetch global operating class */ |
| 4072 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4073 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4074 | return -EINVAL; |
| 4075 | } |
| 4076 | pReqMsg.global_operating_class = nla_get_s32( |
| 4077 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4078 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4079 | pReqMsg.global_operating_class); |
| 4080 | |
| 4081 | /* Parse and fetch latency ms */ |
| 4082 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4083 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4084 | return -EINVAL; |
| 4085 | } |
| 4086 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4087 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4088 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4089 | pReqMsg.max_latency_ms); |
| 4090 | |
| 4091 | /* Parse and fetch required bandwidth kbps */ |
| 4092 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4093 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4094 | return -EINVAL; |
| 4095 | } |
| 4096 | |
| 4097 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4098 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4099 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4100 | pReqMsg.min_bandwidth_kbps); |
| 4101 | |
| 4102 | return (wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 4103 | peer, |
| 4104 | wlan_hdd_cfg80211_exttdls_callback)); |
| 4105 | } |
| 4106 | |
| 4107 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4108 | struct wireless_dev *wdev, |
| 4109 | void *data, |
| 4110 | int data_len) |
| 4111 | { |
| 4112 | u8 peer[6] = {0}; |
| 4113 | struct net_device *dev = wdev->netdev; |
| 4114 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4115 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4116 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4117 | eHalStatus status; |
| 4118 | |
| 4119 | status = wlan_hdd_validate_context(pHddCtx); |
| 4120 | if (0 != status) { |
| 4121 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4122 | FL("HDD context is not valid")); |
| 4123 | return -EINVAL; |
| 4124 | } |
| 4125 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4126 | |
| 4127 | return -ENOTSUPP; |
| 4128 | } |
| 4129 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4130 | data, data_len, |
| 4131 | wlan_hdd_tdls_config_disable_policy)) { |
| 4132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4133 | return -EINVAL; |
| 4134 | } |
| 4135 | /* Parse and fetch mac address */ |
| 4136 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4137 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4138 | return -EINVAL; |
| 4139 | } |
| 4140 | |
| 4141 | memcpy(peer, nla_data( |
| 4142 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4143 | sizeof(peer)); |
| 4144 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4145 | |
| 4146 | return (wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer)); |
| 4147 | } |
| 4148 | |
| 4149 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4150 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 4151 | { |
| 4152 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4153 | { |
| 4154 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4155 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 4156 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4157 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4158 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4159 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
| 4160 | }, |
| 4161 | |
| 4162 | { |
| 4163 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4164 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 4165 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4166 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4167 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4168 | .doit = wlan_hdd_cfg80211_ll_stats_set |
| 4169 | }, |
| 4170 | |
| 4171 | { |
| 4172 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4173 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 4174 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4175 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4176 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4177 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4178 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4179 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4180 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4181 | { |
| 4182 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4183 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 4184 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4185 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4186 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4187 | .doit = wlan_hdd_cfg80211_extscan_start |
| 4188 | }, |
| 4189 | { |
| 4190 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4191 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 4192 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4193 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4194 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4195 | .doit = wlan_hdd_cfg80211_extscan_stop |
| 4196 | }, |
| 4197 | { |
| 4198 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4199 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 4200 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4201 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4202 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
| 4203 | }, |
| 4204 | { |
| 4205 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4206 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 4207 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4208 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4209 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4210 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
| 4211 | }, |
| 4212 | { |
| 4213 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4214 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 4215 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4216 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4217 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4218 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
| 4219 | }, |
| 4220 | { |
| 4221 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4222 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 4223 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4224 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4225 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4226 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
| 4227 | }, |
| 4228 | { |
| 4229 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4230 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 4231 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4232 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4233 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4234 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
| 4235 | }, |
| 4236 | { |
| 4237 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4238 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 4239 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4240 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4241 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4242 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
| 4243 | }, |
| 4244 | { |
| 4245 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4246 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 4247 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4248 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4249 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4250 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
| 4251 | }, |
| 4252 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4253 | /*EXT TDLS*/ |
| 4254 | { |
| 4255 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4256 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 4257 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4258 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4259 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4260 | .doit = wlan_hdd_cfg80211_exttdls_enable |
| 4261 | }, |
| 4262 | { |
| 4263 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4264 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 4265 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4266 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4267 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4268 | .doit = wlan_hdd_cfg80211_exttdls_disable |
| 4269 | }, |
| 4270 | { |
| 4271 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4272 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 4273 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4274 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4275 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
| 4276 | }, |
| 4277 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4278 | }; |
| 4279 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4280 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4281 | static const |
| 4282 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4283 | { |
| 4284 | #ifdef FEATURE_WLAN_CH_AVOID |
| 4285 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4286 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4287 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4288 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4289 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 4290 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4291 | { |
| 4292 | /* Index = 1*/ |
| 4293 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4294 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 4295 | }, |
| 4296 | { |
| 4297 | /* Index = 2*/ |
| 4298 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4299 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 4300 | }, |
| 4301 | { |
| 4302 | /* Index = 3*/ |
| 4303 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4304 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 4305 | }, |
| 4306 | { |
| 4307 | /* Index = 4*/ |
| 4308 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4309 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 4310 | }, |
| 4311 | { |
| 4312 | /* Index = 5*/ |
| 4313 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4314 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 4315 | }, |
| 4316 | { |
| 4317 | /* Index = 6*/ |
| 4318 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4319 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 4320 | }, |
| 4321 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4322 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4323 | { |
| 4324 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4325 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 4326 | }, |
| 4327 | { |
| 4328 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4329 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 4330 | }, |
| 4331 | { |
| 4332 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4333 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 4334 | }, |
| 4335 | { |
| 4336 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4337 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 4338 | }, |
| 4339 | { |
| 4340 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4341 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 4342 | }, |
| 4343 | { |
| 4344 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4345 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 4346 | }, |
| 4347 | { |
| 4348 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4349 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 4350 | }, |
| 4351 | { |
| 4352 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4353 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 4354 | }, |
| 4355 | { |
| 4356 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4357 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 4358 | }, |
| 4359 | { |
| 4360 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4361 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 4362 | }, |
| 4363 | { |
| 4364 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4365 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 4366 | }, |
| 4367 | { |
| 4368 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4369 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 4370 | }, |
| 4371 | { |
| 4372 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4373 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 4374 | }, |
| 4375 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4376 | /*EXT TDLS*/ |
| 4377 | { |
| 4378 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4379 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 4380 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4381 | }; |
| 4382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4383 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4384 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4385 | * This function is called by hdd_wlan_startup() |
| 4386 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4387 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4388 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4389 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4390 | { |
| 4391 | struct wiphy *wiphy; |
| 4392 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4393 | /* |
| 4394 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4395 | */ |
| 4396 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 4397 | |
| 4398 | if (!wiphy) |
| 4399 | { |
| 4400 | /* Print error and jump into err label and free the memory */ |
| 4401 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 4402 | return NULL; |
| 4403 | } |
| 4404 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4405 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | return wiphy; |
| 4407 | } |
| 4408 | |
| 4409 | /* |
| 4410 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4411 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4412 | * private ioctl to change the band value |
| 4413 | */ |
| 4414 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 4415 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4416 | int i, j; |
| 4417 | eNVChannelEnabledType channelEnabledState; |
| 4418 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4419 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4420 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4421 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4422 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4423 | |
| 4424 | if (NULL == wiphy->bands[i]) |
| 4425 | { |
| 4426 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4427 | __func__, i); |
| 4428 | continue; |
| 4429 | } |
| 4430 | |
| 4431 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4432 | { |
| 4433 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4434 | |
| 4435 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 4436 | band->channels[j].hw_value); |
| 4437 | |
| 4438 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 4439 | { |
| 4440 | // Enable Social channels for P2P |
| 4441 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 4442 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 4443 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4444 | else |
| 4445 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4446 | continue; |
| 4447 | } |
| 4448 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 4449 | { |
| 4450 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4451 | continue; |
| 4452 | } |
| 4453 | |
| 4454 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 4455 | NV_CHANNEL_INVALID == channelEnabledState) |
| 4456 | { |
| 4457 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4458 | } |
| 4459 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 4460 | { |
| 4461 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4462 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 4463 | } |
| 4464 | else |
| 4465 | { |
| 4466 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 4467 | |IEEE80211_CHAN_RADAR); |
| 4468 | } |
| 4469 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4470 | } |
| 4471 | return 0; |
| 4472 | } |
| 4473 | /* |
| 4474 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4475 | * This function is called by hdd_wlan_startup() |
| 4476 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4477 | * This function is used to initialize and register wiphy structure. |
| 4478 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4479 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | struct wiphy *wiphy, |
| 4481 | hdd_config_t *pCfg |
| 4482 | ) |
| 4483 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4484 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4485 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4486 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4487 | ENTER(); |
| 4488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4489 | /* Now bind the underlying wlan device with wiphy */ |
| 4490 | set_wiphy_dev(wiphy, dev); |
| 4491 | |
| 4492 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4493 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4494 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4495 | /* the flag for the other case would be initialzed in |
| 4496 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4497 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4498 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4499 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4500 | /* This will disable updating of NL channels from passive to |
| 4501 | * active if a beacon is received on passive channel. */ |
| 4502 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 4503 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4504 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4505 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4506 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4507 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 4508 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 4509 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4510 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4511 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4512 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4513 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4514 | #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] | 4515 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4516 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4517 | || pCfg->isFastRoamIniFeatureEnabled |
| 4518 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4519 | #ifdef FEATURE_WLAN_ESE |
| 4520 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4521 | #endif |
| 4522 | ) |
| 4523 | { |
| 4524 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 4525 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4526 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4527 | #ifdef FEATURE_WLAN_TDLS |
| 4528 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 4529 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 4530 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4531 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 4532 | if (pCfg->configPNOScanSupport) |
| 4533 | { |
| 4534 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 4535 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4536 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4537 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 4538 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4539 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4540 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4541 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4542 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 4543 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4544 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4545 | driver need to determine what to do with both |
| 4546 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4547 | |
| 4548 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4549 | #else |
| 4550 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4551 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4552 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4553 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 4554 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 4555 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4556 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 4557 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 4558 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4559 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4560 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4561 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4562 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 4563 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | | BIT(NL80211_IFTYPE_AP); |
| 4565 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4566 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4567 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4568 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 4569 | if( pCfg->enableMCC ) |
| 4570 | { |
| 4571 | /* Currently, supports up to two channels */ |
| 4572 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4573 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4574 | if( !pCfg->allowMCCGODiffBI ) |
| 4575 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4576 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4577 | } |
| 4578 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 4579 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4580 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4581 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4583 | /* Before registering we need to update the ht capabilitied based |
| 4584 | * on ini values*/ |
| 4585 | if( !pCfg->ShortGI20MhzEnable ) |
| 4586 | { |
| 4587 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4588 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4589 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4590 | } |
| 4591 | |
| 4592 | if( !pCfg->ShortGI40MhzEnable ) |
| 4593 | { |
| 4594 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 4595 | } |
| 4596 | |
| 4597 | if( !pCfg->nChannelBondingMode5GHz ) |
| 4598 | { |
| 4599 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 4600 | } |
| 4601 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4602 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4603 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 4604 | { |
| 4605 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 4606 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4607 | |
| 4608 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 4609 | { |
| 4610 | |
| 4611 | if (NULL == wiphy->bands[i]) |
| 4612 | { |
| 4613 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4614 | __func__, i); |
| 4615 | continue; |
| 4616 | } |
| 4617 | |
| 4618 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4619 | { |
| 4620 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4621 | |
| 4622 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 4623 | { |
| 4624 | // Enable social channels for P2P |
| 4625 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 4626 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4627 | else |
| 4628 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4629 | continue; |
| 4630 | } |
| 4631 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 4632 | { |
| 4633 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4634 | continue; |
| 4635 | } |
| 4636 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4637 | } |
| 4638 | /*Initialise the supported cipher suite details*/ |
| 4639 | wiphy->cipher_suites = hdd_cipher_suites; |
| 4640 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 4641 | |
| 4642 | /*signal strength in mBm (100*dBm) */ |
| 4643 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 4644 | |
| 4645 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 4646 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4647 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4648 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4649 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 4650 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4651 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 4652 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 4653 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4654 | EXIT(); |
| 4655 | return 0; |
| 4656 | } |
| 4657 | |
| 4658 | /* In this function we are registering wiphy. */ |
| 4659 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 4660 | { |
| 4661 | ENTER(); |
| 4662 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | if (0 > wiphy_register(wiphy)) |
| 4664 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4665 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4666 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 4667 | return -EIO; |
| 4668 | } |
| 4669 | |
| 4670 | EXIT(); |
| 4671 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4672 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4673 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4674 | /* In this function we are updating channel list when, |
| 4675 | regulatory domain is FCC and country code is US. |
| 4676 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 4677 | As per FCC smart phone is not a indoor device. |
| 4678 | GO should not opeate on indoor channels */ |
| 4679 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 4680 | { |
| 4681 | int j; |
| 4682 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4683 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 4684 | //Default counrtycode from NV at the time of wiphy initialization. |
| 4685 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 4686 | &defaultCountryCode[0])) |
| 4687 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4688 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4689 | } |
| 4690 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 4691 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4692 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 4693 | { |
| 4694 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 4695 | return; |
| 4696 | } |
| 4697 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 4698 | { |
| 4699 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 4700 | // Mark UNII -1 band channel as passive |
| 4701 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 4702 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 4703 | } |
| 4704 | } |
| 4705 | } |
| 4706 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 4707 | /* This function registers for all frame which supplicant is interested in */ |
| 4708 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4709 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4710 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4711 | /* Register for all P2P action, public action etc frames */ |
| 4712 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 4713 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4714 | ENTER(); |
| 4715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4716 | /* Right now we are registering these frame when driver is getting |
| 4717 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 4718 | frame register ops, we will move this code as a part of that */ |
| 4719 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4720 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 4722 | |
| 4723 | /* GAS Initial Response */ |
| 4724 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4725 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4726 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4727 | /* GAS Comeback Request */ |
| 4728 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4729 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 4730 | |
| 4731 | /* GAS Comeback Response */ |
| 4732 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4733 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 4734 | |
| 4735 | /* P2P Public Action */ |
| 4736 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4737 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4738 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 4739 | |
| 4740 | /* P2P Action */ |
| 4741 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4742 | (v_U8_t*)P2P_ACTION_FRAME, |
| 4743 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4744 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 4745 | /* WNM BSS Transition Request frame */ |
| 4746 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4747 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 4748 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 4749 | |
| 4750 | /* WNM-Notification */ |
| 4751 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4752 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 4753 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4754 | } |
| 4755 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 4756 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4757 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4758 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4759 | /* Register for all P2P action, public action etc frames */ |
| 4760 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 4761 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4762 | ENTER(); |
| 4763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4764 | /* Right now we are registering these frame when driver is getting |
| 4765 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 4766 | frame register ops, we will move this code as a part of that */ |
| 4767 | /* GAS Initial Request */ |
| 4768 | |
| 4769 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4770 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 4771 | |
| 4772 | /* GAS Initial Response */ |
| 4773 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4774 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4776 | /* GAS Comeback Request */ |
| 4777 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4778 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 4779 | |
| 4780 | /* GAS Comeback Response */ |
| 4781 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4782 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 4783 | |
| 4784 | /* P2P Public Action */ |
| 4785 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4786 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4787 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 4788 | |
| 4789 | /* P2P Action */ |
| 4790 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4791 | (v_U8_t*)P2P_ACTION_FRAME, |
| 4792 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 4793 | /* WNM-Notification */ |
| 4794 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 4795 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 4796 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4797 | } |
| 4798 | |
| 4799 | #ifdef FEATURE_WLAN_WAPI |
| 4800 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 4801 | const u8 *mac_addr, u8 *key , int key_Len) |
| 4802 | { |
| 4803 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4804 | tCsrRoamSetKey setKey; |
| 4805 | v_BOOL_t isConnected = TRUE; |
| 4806 | int status = 0; |
| 4807 | v_U32_t roamId= 0xFF; |
| 4808 | tANI_U8 *pKeyPtr = NULL; |
| 4809 | int n = 0; |
| 4810 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 4811 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 4812 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 4813 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4814 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 4815 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4816 | setKey.keyId = key_index; // Store Key ID |
| 4817 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 4818 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 4819 | setKey.paeRole = 0 ; // the PAE role |
| 4820 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 4821 | { |
| 4822 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 4823 | } |
| 4824 | else |
| 4825 | { |
| 4826 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 4827 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 4828 | } |
| 4829 | setKey.keyLength = key_Len; |
| 4830 | pKeyPtr = setKey.Key; |
| 4831 | memcpy( pKeyPtr, key, key_Len); |
| 4832 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4833 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4834 | __func__, key_Len); |
| 4835 | for (n = 0 ; n < key_Len; n++) |
| 4836 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 4837 | __func__,n,setKey.Key[n]); |
| 4838 | |
| 4839 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4840 | if ( isConnected ) |
| 4841 | { |
| 4842 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4843 | pAdapter->sessionId, &setKey, &roamId ); |
| 4844 | } |
| 4845 | if ( status != 0 ) |
| 4846 | { |
| 4847 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4848 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 4849 | __LINE__, status ); |
| 4850 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4851 | } |
| 4852 | } |
| 4853 | #endif /* FEATURE_WLAN_WAPI*/ |
| 4854 | |
| 4855 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4856 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4857 | beacon_data_t **ppBeacon, |
| 4858 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4859 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4860 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4861 | beacon_data_t **ppBeacon, |
| 4862 | struct cfg80211_beacon_data *params, |
| 4863 | int dtim_period) |
| 4864 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4865 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4866 | int size; |
| 4867 | beacon_data_t *beacon = NULL; |
| 4868 | beacon_data_t *old = NULL; |
| 4869 | int head_len,tail_len; |
| 4870 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4871 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4872 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4873 | { |
| 4874 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4875 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4877 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4878 | |
| 4879 | old = pAdapter->sessionCtx.ap.beacon; |
| 4880 | |
| 4881 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4882 | { |
| 4883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4884 | FL("session(%d) old and new heads points to NULL"), |
| 4885 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4886 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4887 | } |
| 4888 | |
| 4889 | if (params->tail && !params->tail_len) |
| 4890 | { |
| 4891 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4892 | FL("tail_len is zero but tail is not NULL")); |
| 4893 | return -EINVAL; |
| 4894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4896 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 4897 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 4898 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4899 | { |
| 4900 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4901 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4902 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4903 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | #endif |
| 4905 | |
| 4906 | if(params->head) |
| 4907 | head_len = params->head_len; |
| 4908 | else |
| 4909 | head_len = old->head_len; |
| 4910 | |
| 4911 | if(params->tail || !old) |
| 4912 | tail_len = params->tail_len; |
| 4913 | else |
| 4914 | tail_len = old->tail_len; |
| 4915 | |
| 4916 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 4917 | |
| 4918 | beacon = kzalloc(size, GFP_KERNEL); |
| 4919 | |
| 4920 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4921 | { |
| 4922 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4923 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4924 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 4925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4926 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4927 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4928 | if(params->dtim_period || !old ) |
| 4929 | beacon->dtim_period = params->dtim_period; |
| 4930 | else |
| 4931 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4932 | #else |
| 4933 | if(dtim_period || !old ) |
| 4934 | beacon->dtim_period = dtim_period; |
| 4935 | else |
| 4936 | beacon->dtim_period = old->dtim_period; |
| 4937 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4939 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 4940 | beacon->tail = beacon->head + head_len; |
| 4941 | beacon->head_len = head_len; |
| 4942 | beacon->tail_len = tail_len; |
| 4943 | |
| 4944 | if(params->head) { |
| 4945 | memcpy (beacon->head,params->head,beacon->head_len); |
| 4946 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4947 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | if(old) |
| 4949 | memcpy (beacon->head,old->head,beacon->head_len); |
| 4950 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4952 | if(params->tail) { |
| 4953 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 4954 | } |
| 4955 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4956 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4957 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 4958 | } |
| 4959 | |
| 4960 | *ppBeacon = beacon; |
| 4961 | |
| 4962 | kfree(old); |
| 4963 | |
| 4964 | return 0; |
| 4965 | |
| 4966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4967 | |
| 4968 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 4969 | { |
| 4970 | int left = length; |
| 4971 | v_U8_t *ptr = pIes; |
| 4972 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4974 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4975 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4976 | elem_id = ptr[0]; |
| 4977 | elem_len = ptr[1]; |
| 4978 | left -= 2; |
| 4979 | if(elem_len > left) |
| 4980 | { |
| 4981 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 4982 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4983 | eid,elem_len,left); |
| 4984 | return NULL; |
| 4985 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4986 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4987 | { |
| 4988 | return ptr; |
| 4989 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | left -= elem_len; |
| 4992 | ptr += (elem_len + 2); |
| 4993 | } |
| 4994 | return NULL; |
| 4995 | } |
| 4996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | /* Check if rate is 11g rate or not */ |
| 4998 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 4999 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 5000 | 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] | 5001 | u8 i; |
| 5002 | for (i = 0; i < 8; i++) |
| 5003 | { |
| 5004 | if(rate == gRateArray[i]) |
| 5005 | return TRUE; |
| 5006 | } |
| 5007 | return FALSE; |
| 5008 | } |
| 5009 | |
| 5010 | /* Check for 11g rate and set proper 11g only mode */ |
| 5011 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 5012 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 5013 | { |
| 5014 | u8 i, num_rates = pIe[0]; |
| 5015 | |
| 5016 | pIe += 1; |
| 5017 | for ( i = 0; i < num_rates; i++) |
| 5018 | { |
| 5019 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 5020 | { |
| 5021 | /* If rate set have 11g rate than change the mode to 11G */ |
| 5022 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 5023 | if (pIe[i] & BASIC_RATE_MASK) |
| 5024 | { |
| 5025 | /* If we have 11g rate as basic rate, it means mode |
| 5026 | is 11g only mode. |
| 5027 | */ |
| 5028 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 5029 | *pCheckRatesfor11g = FALSE; |
| 5030 | } |
| 5031 | } |
| 5032 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 5033 | { |
| 5034 | *require_ht = TRUE; |
| 5035 | } |
| 5036 | } |
| 5037 | return; |
| 5038 | } |
| 5039 | |
| 5040 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 5041 | { |
| 5042 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5043 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5044 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5045 | u8 checkRatesfor11g = TRUE; |
| 5046 | u8 require_ht = FALSE; |
| 5047 | u8 *pIe=NULL; |
| 5048 | |
| 5049 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 5050 | |
| 5051 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 5052 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 5053 | if (pIe != NULL) |
| 5054 | { |
| 5055 | pIe += 1; |
| 5056 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5057 | &pConfig->SapHw_mode); |
| 5058 | } |
| 5059 | |
| 5060 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5061 | WLAN_EID_EXT_SUPP_RATES); |
| 5062 | if (pIe != NULL) |
| 5063 | { |
| 5064 | |
| 5065 | pIe += 1; |
| 5066 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5067 | &pConfig->SapHw_mode); |
| 5068 | } |
| 5069 | |
| 5070 | if( pConfig->channel > 14 ) |
| 5071 | { |
| 5072 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 5073 | } |
| 5074 | |
| 5075 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5076 | WLAN_EID_HT_CAPABILITY); |
| 5077 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5078 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5079 | { |
| 5080 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 5081 | if(require_ht) |
| 5082 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 5083 | } |
| 5084 | } |
| 5085 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5086 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 5087 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 5088 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5089 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5090 | v_U8_t *pIe = NULL; |
| 5091 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5092 | |
| 5093 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 5094 | pBeacon->tail, pBeacon->tail_len); |
| 5095 | |
| 5096 | if (pIe) |
| 5097 | { |
| 5098 | ielen = pIe[1] + 2; |
| 5099 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5100 | { |
| 5101 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 5102 | } |
| 5103 | else |
| 5104 | { |
| 5105 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 5106 | return -EINVAL; |
| 5107 | } |
| 5108 | *total_ielen += ielen; |
| 5109 | } |
| 5110 | return 0; |
| 5111 | } |
| 5112 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5113 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 5114 | v_U8_t *genie, v_U8_t *total_ielen) |
| 5115 | { |
| 5116 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5117 | int left = pBeacon->tail_len; |
| 5118 | v_U8_t *ptr = pBeacon->tail; |
| 5119 | v_U8_t elem_id, elem_len; |
| 5120 | v_U16_t ielen = 0; |
| 5121 | |
| 5122 | if ( NULL == ptr || 0 == left ) |
| 5123 | return; |
| 5124 | |
| 5125 | while (left >= 2) |
| 5126 | { |
| 5127 | elem_id = ptr[0]; |
| 5128 | elem_len = ptr[1]; |
| 5129 | left -= 2; |
| 5130 | if (elem_len > left) |
| 5131 | { |
| 5132 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5133 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 5134 | elem_id, elem_len, left); |
| 5135 | return; |
| 5136 | } |
| 5137 | if (IE_EID_VENDOR == elem_id) |
| 5138 | { |
| 5139 | /* skipping the VSIE's which we don't want to include or |
| 5140 | * it will be included by existing code |
| 5141 | */ |
| 5142 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 5143 | #ifdef WLAN_FEATURE_WFD |
| 5144 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 5145 | #endif |
| 5146 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5147 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5148 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 5149 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5150 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 5151 | { |
| 5152 | ielen = ptr[1] + 2; |
| 5153 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5154 | { |
| 5155 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 5156 | *total_ielen += ielen; |
| 5157 | } |
| 5158 | else |
| 5159 | { |
| 5160 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5161 | "IE Length is too big " |
| 5162 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 5163 | elem_id, elem_len, *total_ielen); |
| 5164 | } |
| 5165 | } |
| 5166 | } |
| 5167 | |
| 5168 | left -= elem_len; |
| 5169 | ptr += (elem_len + 2); |
| 5170 | } |
| 5171 | return; |
| 5172 | } |
| 5173 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5174 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5175 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5176 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5177 | #else |
| 5178 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5179 | struct cfg80211_beacon_data *params) |
| 5180 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5181 | { |
| 5182 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5183 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5185 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5186 | |
| 5187 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 5188 | |
| 5189 | if(genie == NULL) { |
| 5190 | |
| 5191 | return -ENOMEM; |
| 5192 | } |
| 5193 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5194 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5195 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5196 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5197 | hddLog(LOGE, |
| 5198 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5199 | ret = -EINVAL; |
| 5200 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5201 | } |
| 5202 | |
| 5203 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5204 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5205 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 5206 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5207 | hddLog(LOGE, |
| 5208 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5209 | ret = -EINVAL; |
| 5210 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5211 | } |
| 5212 | #endif |
| 5213 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5214 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5215 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5216 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5217 | hddLog(LOGE, |
| 5218 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5219 | ret = -EINVAL; |
| 5220 | goto done; |
| 5221 | } |
| 5222 | |
| 5223 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 5224 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5225 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5227 | |
| 5228 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5229 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 5230 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 5231 | { |
| 5232 | hddLog(LOGE, |
| 5233 | "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] | 5234 | ret = -EINVAL; |
| 5235 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5236 | } |
| 5237 | |
| 5238 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5239 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 5240 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5241 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5242 | ==eHAL_STATUS_FAILURE) |
| 5243 | { |
| 5244 | hddLog(LOGE, |
| 5245 | "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] | 5246 | ret = -EINVAL; |
| 5247 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | } |
| 5249 | |
| 5250 | // Added for ProResp IE |
| 5251 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 5252 | { |
| 5253 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 5254 | u8 probe_rsp_ie_len[3] = {0}; |
| 5255 | u8 counter = 0; |
| 5256 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 5257 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 5258 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 5259 | Store More then 255 bytes into One Variable. |
| 5260 | */ |
| 5261 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 5262 | { |
| 5263 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 5264 | { |
| 5265 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 5266 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 5267 | } |
| 5268 | else |
| 5269 | { |
| 5270 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 5271 | rem_probe_resp_ie_len = 0; |
| 5272 | } |
| 5273 | } |
| 5274 | |
| 5275 | rem_probe_resp_ie_len = 0; |
| 5276 | |
| 5277 | if (probe_rsp_ie_len[0] > 0) |
| 5278 | { |
| 5279 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5280 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 5281 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5282 | probe_rsp_ie_len[0], NULL, |
| 5283 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5284 | { |
| 5285 | hddLog(LOGE, |
| 5286 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5287 | ret = -EINVAL; |
| 5288 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5289 | } |
| 5290 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 5291 | } |
| 5292 | |
| 5293 | if (probe_rsp_ie_len[1] > 0) |
| 5294 | { |
| 5295 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5296 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 5297 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5298 | probe_rsp_ie_len[1], NULL, |
| 5299 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5300 | { |
| 5301 | hddLog(LOGE, |
| 5302 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5303 | ret = -EINVAL; |
| 5304 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5305 | } |
| 5306 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 5307 | } |
| 5308 | |
| 5309 | if (probe_rsp_ie_len[2] > 0) |
| 5310 | { |
| 5311 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5312 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 5313 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5314 | probe_rsp_ie_len[2], NULL, |
| 5315 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5316 | { |
| 5317 | hddLog(LOGE, |
| 5318 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5319 | ret = -EINVAL; |
| 5320 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5321 | } |
| 5322 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 5323 | } |
| 5324 | |
| 5325 | if (probe_rsp_ie_len[1] == 0 ) |
| 5326 | { |
| 5327 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5328 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 5329 | eANI_BOOLEAN_FALSE) ) |
| 5330 | { |
| 5331 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5332 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | } |
| 5334 | } |
| 5335 | |
| 5336 | if (probe_rsp_ie_len[2] == 0 ) |
| 5337 | { |
| 5338 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5339 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 5340 | eANI_BOOLEAN_FALSE) ) |
| 5341 | { |
| 5342 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5343 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5344 | } |
| 5345 | } |
| 5346 | |
| 5347 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5348 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 5349 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5350 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5351 | == eHAL_STATUS_FAILURE) |
| 5352 | { |
| 5353 | hddLog(LOGE, |
| 5354 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5355 | ret = -EINVAL; |
| 5356 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5357 | } |
| 5358 | } |
| 5359 | else |
| 5360 | { |
| 5361 | // Reset WNI_CFG_PROBE_RSP Flags |
| 5362 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 5363 | |
| 5364 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5365 | "%s: No Probe Response IE received in set beacon", |
| 5366 | __func__); |
| 5367 | } |
| 5368 | |
| 5369 | // Added for AssocResp IE |
| 5370 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 5371 | { |
| 5372 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5373 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 5374 | params->assocresp_ies_len, NULL, |
| 5375 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5376 | { |
| 5377 | hddLog(LOGE, |
| 5378 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5379 | ret = -EINVAL; |
| 5380 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | } |
| 5382 | |
| 5383 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5384 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 5385 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5386 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5387 | == eHAL_STATUS_FAILURE) |
| 5388 | { |
| 5389 | hddLog(LOGE, |
| 5390 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5391 | ret = -EINVAL; |
| 5392 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5393 | } |
| 5394 | } |
| 5395 | else |
| 5396 | { |
| 5397 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5398 | "%s: No Assoc Response IE received in set beacon", |
| 5399 | __func__); |
| 5400 | |
| 5401 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5402 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 5403 | eANI_BOOLEAN_FALSE) ) |
| 5404 | { |
| 5405 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5406 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5407 | } |
| 5408 | } |
| 5409 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5410 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5411 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5412 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5413 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5414 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5415 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5416 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 5417 | * called by wlan_hdd_cfg80211_start_bss() and |
| 5418 | * wlan_hdd_cfg80211_set_channel() |
| 5419 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5420 | * channel list. |
| 5421 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 5422 | 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] | 5423 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | v_U32_t num_ch = 0; |
| 5426 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5427 | u32 indx = 0; |
| 5428 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5429 | v_U8_t fValidChannel = FALSE, count = 0; |
| 5430 | 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] | 5431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5432 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5433 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5434 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5435 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5436 | /* Validate the channel */ |
| 5437 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5438 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5439 | if ( channel == rfChannels[count].channelNum ) |
| 5440 | { |
| 5441 | fValidChannel = TRUE; |
| 5442 | break; |
| 5443 | } |
| 5444 | } |
| 5445 | if (fValidChannel != TRUE) |
| 5446 | { |
| 5447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5448 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5449 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5450 | } |
| 5451 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5452 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5453 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5454 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 5455 | valid_ch, &num_ch)) |
| 5456 | { |
| 5457 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5458 | "%s: failed to get valid channel list", __func__); |
| 5459 | return VOS_STATUS_E_FAILURE; |
| 5460 | } |
| 5461 | for (indx = 0; indx < num_ch; indx++) |
| 5462 | { |
| 5463 | if (channel == valid_ch[indx]) |
| 5464 | { |
| 5465 | break; |
| 5466 | } |
| 5467 | } |
| 5468 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5469 | if (indx >= num_ch) |
| 5470 | { |
| 5471 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5472 | { |
| 5473 | eCsrBand band; |
| 5474 | unsigned int freq; |
| 5475 | |
| 5476 | sme_GetFreqBand(hHal, &band); |
| 5477 | |
| 5478 | if (eCSR_BAND_5G == band) |
| 5479 | { |
| 5480 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 5481 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 5482 | { |
| 5483 | freq = ieee80211_channel_to_frequency(channel, |
| 5484 | IEEE80211_BAND_2GHZ); |
| 5485 | } |
| 5486 | else |
| 5487 | { |
| 5488 | freq = ieee80211_channel_to_frequency(channel, |
| 5489 | IEEE80211_BAND_5GHZ); |
| 5490 | } |
| 5491 | #else |
| 5492 | freq = ieee80211_channel_to_frequency(channel); |
| 5493 | #endif |
| 5494 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 5495 | return VOS_STATUS_SUCCESS; |
| 5496 | } |
| 5497 | } |
| 5498 | |
| 5499 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5500 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5501 | return VOS_STATUS_E_FAILURE; |
| 5502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5504 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5505 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | } |
| 5508 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5509 | /** |
| 5510 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 5511 | * This function is used to set the channel number |
| 5512 | */ |
| 5513 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 5514 | struct ieee80211_channel *chan, |
| 5515 | enum nl80211_channel_type channel_type |
| 5516 | ) |
| 5517 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5518 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5519 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5520 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5521 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5522 | hdd_context_t *pHddCtx; |
| 5523 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5524 | |
| 5525 | ENTER(); |
| 5526 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5527 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5528 | if( NULL == dev ) |
| 5529 | { |
| 5530 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5531 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5532 | return -ENODEV; |
| 5533 | } |
| 5534 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5535 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5536 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5537 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 5538 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5539 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5540 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 5541 | hdd_device_modetoString(pAdapter->device_mode), |
| 5542 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5543 | |
| 5544 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5545 | status = wlan_hdd_validate_context(pHddCtx); |
| 5546 | |
| 5547 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5548 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5550 | "%s: HDD context is not valid", __func__); |
| 5551 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5552 | } |
| 5553 | |
| 5554 | /* |
| 5555 | * Do freq to chan conversion |
| 5556 | * TODO: for 11a |
| 5557 | */ |
| 5558 | |
| 5559 | channel = ieee80211_frequency_to_channel(freq); |
| 5560 | |
| 5561 | /* Check freq range */ |
| 5562 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 5563 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 5564 | { |
| 5565 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5566 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5567 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 5568 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 5569 | return -EINVAL; |
| 5570 | } |
| 5571 | |
| 5572 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5573 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 5574 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 5575 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5576 | { |
| 5577 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5578 | { |
| 5579 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5580 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5581 | return -EINVAL; |
| 5582 | } |
| 5583 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5584 | "%s: set channel to [%d] for device mode =%d", |
| 5585 | __func__, channel,pAdapter->device_mode); |
| 5586 | } |
| 5587 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5588 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5589 | ) |
| 5590 | { |
| 5591 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5592 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 5593 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5594 | |
| 5595 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 5596 | { |
| 5597 | /* Link is up then return cant set channel*/ |
| 5598 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5599 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5600 | return -EINVAL; |
| 5601 | } |
| 5602 | |
| 5603 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5604 | pHddStaCtx->conn_info.operationChannel = channel; |
| 5605 | pRoamProfile->ChannelInfo.ChannelList = |
| 5606 | &pHddStaCtx->conn_info.operationChannel; |
| 5607 | } |
| 5608 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5609 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5610 | ) |
| 5611 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5612 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5613 | { |
| 5614 | if(VOS_STATUS_SUCCESS != |
| 5615 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5616 | { |
| 5617 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5618 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5619 | return -EINVAL; |
| 5620 | } |
| 5621 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5622 | } |
| 5623 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5624 | { |
| 5625 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 5626 | |
| 5627 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 5628 | channel set by supplicant |
| 5629 | */ |
| 5630 | if ( cfg_param->apAutoChannelSelection ) |
| 5631 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5632 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 5633 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5634 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5635 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 5636 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5637 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5638 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5639 | else |
| 5640 | { |
| 5641 | if(VOS_STATUS_SUCCESS != |
| 5642 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5643 | { |
| 5644 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5645 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5646 | return -EINVAL; |
| 5647 | } |
| 5648 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5649 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5650 | } |
| 5651 | } |
| 5652 | else |
| 5653 | { |
| 5654 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5655 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 5656 | return -EINVAL; |
| 5657 | } |
| 5658 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5659 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5660 | } |
| 5661 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5662 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 5663 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5664 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5665 | #else |
| 5666 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5667 | struct cfg80211_beacon_data *params, |
| 5668 | const u8 *ssid, size_t ssid_len, |
| 5669 | enum nl80211_hidden_ssid hidden_ssid) |
| 5670 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | { |
| 5672 | tsap_Config_t *pConfig; |
| 5673 | beacon_data_t *pBeacon = NULL; |
| 5674 | struct ieee80211_mgmt *pMgmt_frame; |
| 5675 | v_U8_t *pIe=NULL; |
| 5676 | v_U16_t capab_info; |
| 5677 | eCsrAuthType RSNAuthType; |
| 5678 | eCsrEncryptionType RSNEncryptType; |
| 5679 | eCsrEncryptionType mcRSNEncryptType; |
| 5680 | int status = VOS_STATUS_SUCCESS; |
| 5681 | tpWLAN_SAPEventCB pSapEventCallback; |
| 5682 | hdd_hostapd_state_t *pHostapdState; |
| 5683 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 5684 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5685 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5687 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5688 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 5689 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 5690 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 5691 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 5692 | v_BOOL_t MFPRequired = VOS_FALSE; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 5693 | eHddDot11Mode sapDot11Mode = |
| 5694 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5695 | |
| 5696 | ENTER(); |
| 5697 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5698 | iniConfig = pHddCtx->cfg_ini; |
| 5699 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5700 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 5701 | |
| 5702 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5703 | |
| 5704 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5705 | |
| 5706 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5707 | |
| 5708 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 5709 | |
| 5710 | //channel is already set in the set_channel Call back |
| 5711 | //pConfig->channel = pCommitConfig->channel; |
| 5712 | |
| 5713 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5714 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5715 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 5716 | |
| 5717 | pConfig->dtim_period = pBeacon->dtim_period; |
| 5718 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5719 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | pConfig->dtim_period); |
| 5721 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 5722 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5723 | { |
| 5724 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5725 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 5726 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 5727 | { |
| 5728 | tANI_BOOLEAN restartNeeded; |
| 5729 | pConfig->ieee80211d = 1; |
| 5730 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 5731 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 5732 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 5733 | } |
| 5734 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5736 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5737 | pConfig->ieee80211d = 1; |
| 5738 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 5739 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 5740 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5741 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5742 | else |
| 5743 | { |
| 5744 | pConfig->ieee80211d = 0; |
| 5745 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5746 | /* |
| 5747 | * If auto channel is configured i.e. channel is 0, |
| 5748 | * so skip channel validation. |
| 5749 | */ |
| 5750 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 5751 | { |
| 5752 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 5753 | { |
| 5754 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5755 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5756 | return -EINVAL; |
| 5757 | } |
| 5758 | } |
| 5759 | else |
| 5760 | { |
| 5761 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 5762 | { |
| 5763 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 5764 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 5765 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 5766 | } |
| 5767 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 5768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5769 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5770 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5771 | { |
| 5772 | pConfig->ieee80211d = 0; |
| 5773 | } |
| 5774 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 5775 | |
| 5776 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5777 | |
| 5778 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5779 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 5780 | |
| 5781 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 5782 | |
| 5783 | /*Set wps station to configured*/ |
| 5784 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 5785 | |
| 5786 | if(pIe) |
| 5787 | { |
| 5788 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 5789 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5790 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5791 | return -EINVAL; |
| 5792 | } |
| 5793 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 5794 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 5795 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 5797 | * WPS state |
| 5798 | */ |
| 5799 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 5800 | { |
| 5801 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 5802 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 5803 | { |
| 5804 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 5805 | } |
| 5806 | } |
| 5807 | } |
| 5808 | else |
| 5809 | { |
| 5810 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 5811 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5812 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5813 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 5814 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 5815 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 5816 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 5817 | eCSR_ENCRYPT_TYPE_NONE; |
| 5818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5819 | pConfig->RSNWPAReqIELength = 0; |
| 5820 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5821 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | WLAN_EID_RSN); |
| 5823 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5824 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5825 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 5826 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 5827 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5828 | /* The actual processing may eventually be more extensive than |
| 5829 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5830 | * by the app. |
| 5831 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5832 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5833 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 5834 | &RSNEncryptType, |
| 5835 | &mcRSNEncryptType, |
| 5836 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 5837 | &MFPCapable, |
| 5838 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5839 | pConfig->pRSNWPAReqIE[1]+2, |
| 5840 | pConfig->pRSNWPAReqIE ); |
| 5841 | |
| 5842 | if( VOS_STATUS_SUCCESS == status ) |
| 5843 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5844 | /* Now copy over all the security attributes you have |
| 5845 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | * */ |
| 5847 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 5848 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 5849 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 5850 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 5851 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5852 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 5854 | } |
| 5855 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5857 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5858 | pBeacon->tail, pBeacon->tail_len); |
| 5859 | |
| 5860 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 5861 | { |
| 5862 | if (pConfig->pRSNWPAReqIE) |
| 5863 | { |
| 5864 | /*Mixed mode WPA/WPA2*/ |
| 5865 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 5866 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 5867 | } |
| 5868 | else |
| 5869 | { |
| 5870 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 5871 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 5872 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5873 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5874 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 5875 | &RSNEncryptType, |
| 5876 | &mcRSNEncryptType, |
| 5877 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 5878 | &MFPCapable, |
| 5879 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5880 | pConfig->pRSNWPAReqIE[1]+2, |
| 5881 | pConfig->pRSNWPAReqIE ); |
| 5882 | |
| 5883 | if( VOS_STATUS_SUCCESS == status ) |
| 5884 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5885 | /* Now copy over all the security attributes you have |
| 5886 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5887 | * */ |
| 5888 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 5889 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 5890 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 5891 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 5892 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5893 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5894 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 5895 | } |
| 5896 | } |
| 5897 | } |
| 5898 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5899 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 5900 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 5901 | return -EINVAL; |
| 5902 | } |
| 5903 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5904 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 5905 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5906 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5907 | if (params->ssid != NULL) |
| 5908 | { |
| 5909 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 5910 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 5911 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 5912 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 5913 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5914 | #else |
| 5915 | if (ssid != NULL) |
| 5916 | { |
| 5917 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 5918 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 5919 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 5920 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 5921 | } |
| 5922 | #endif |
| 5923 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5924 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5927 | /* default value */ |
| 5928 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 5929 | pConfig->num_accept_mac = 0; |
| 5930 | pConfig->num_deny_mac = 0; |
| 5931 | |
| 5932 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5933 | pBeacon->tail, pBeacon->tail_len); |
| 5934 | |
| 5935 | /* pIe for black list is following form: |
| 5936 | type : 1 byte |
| 5937 | length : 1 byte |
| 5938 | OUI : 4 bytes |
| 5939 | acl type : 1 byte |
| 5940 | no of mac addr in black list: 1 byte |
| 5941 | 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] | 5942 | */ |
| 5943 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5944 | { |
| 5945 | pConfig->SapMacaddr_acl = pIe[6]; |
| 5946 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5947 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5948 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5949 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 5950 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 5952 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 5953 | { |
| 5954 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 5955 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5956 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5957 | } |
| 5958 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 5959 | pBeacon->tail, pBeacon->tail_len); |
| 5960 | |
| 5961 | /* pIe for white list is following form: |
| 5962 | type : 1 byte |
| 5963 | length : 1 byte |
| 5964 | OUI : 4 bytes |
| 5965 | acl type : 1 byte |
| 5966 | no of mac addr in white list: 1 byte |
| 5967 | 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] | 5968 | */ |
| 5969 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5970 | { |
| 5971 | pConfig->SapMacaddr_acl = pIe[6]; |
| 5972 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5973 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5974 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5975 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 5976 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 5978 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 5979 | { |
| 5980 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 5981 | acl_entry++; |
| 5982 | } |
| 5983 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5985 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 5986 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5987 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 5988 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 5989 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 5990 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 5991 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 5992 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 5993 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 5994 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 5995 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 5996 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 5997 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 5998 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 5999 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6000 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6001 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6002 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6003 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6004 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6005 | /* If ACS disable and selected channel <= 14 |
| 6006 | * OR |
| 6007 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 6008 | * AND |
| 6009 | * VHT in 2.4G Disabled |
| 6010 | * THEN |
| 6011 | * Fallback to 11N mode |
| 6012 | */ |
| 6013 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 6014 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6015 | operatingBand == RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6016 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6017 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6018 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 6019 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6020 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 6021 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6022 | } |
| 6023 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6024 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 6025 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6026 | { |
| 6027 | sme_SelectCBMode(hHal, |
| 6028 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 6029 | pConfig->channel); |
| 6030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6031 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 6032 | pConfig->ht_capab = |
| 6033 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 6034 | |
| 6035 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 6036 | { |
| 6037 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 6038 | return -EINVAL; |
| 6039 | } |
| 6040 | |
| 6041 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6042 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6043 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 6044 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6045 | pConfig->obssProtEnabled = |
| 6046 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6047 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6048 | #ifdef WLAN_FEATURE_11W |
| 6049 | pConfig->mfpCapable = MFPCapable; |
| 6050 | pConfig->mfpRequired = MFPRequired; |
| 6051 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 6052 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 6053 | #endif |
| 6054 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6055 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6056 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6057 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 6058 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 6059 | (int)pConfig->channel); |
| 6060 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 6061 | pConfig->SapHw_mode, pConfig->privacy, |
| 6062 | pConfig->authType); |
| 6063 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 6064 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 6065 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 6066 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6067 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6068 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6069 | { |
| 6070 | //Bss already started. just return. |
| 6071 | //TODO Probably it should update some beacon params. |
| 6072 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 6073 | EXIT(); |
| 6074 | return 0; |
| 6075 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6076 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6077 | if (vos_max_concurrent_connections_reached()) { |
| 6078 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6079 | return -EINVAL; |
| 6080 | } |
| 6081 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6082 | pConfig->persona = pHostapdAdapter->device_mode; |
| 6083 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6084 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 6085 | if ( NULL != psmeConfig) |
| 6086 | { |
| 6087 | sme_GetConfigParam(hHal, psmeConfig); |
| 6088 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
| 6089 | vos_mem_free(psmeConfig); |
| 6090 | } |
| 6091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6092 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 6093 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 6094 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 6095 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6096 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6097 | return -EINVAL; |
| 6098 | } |
| 6099 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6100 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6101 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 6102 | |
| 6103 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6106 | { |
| 6107 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6108 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 6109 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6110 | VOS_ASSERT(0); |
| 6111 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6113 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6114 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6115 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6116 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6117 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 6118 | { |
| 6119 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 6120 | { |
| 6121 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6122 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6123 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6124 | } |
| 6125 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 6126 | { |
| 6127 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6128 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6129 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6130 | } |
| 6131 | } |
| 6132 | #endif |
| 6133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6134 | pHostapdState->bCommit = TRUE; |
| 6135 | EXIT(); |
| 6136 | |
| 6137 | return 0; |
| 6138 | } |
| 6139 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6140 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6141 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 6142 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6143 | struct beacon_parameters *params) |
| 6144 | { |
| 6145 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6146 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6147 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6148 | |
| 6149 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6150 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6151 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6152 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 6153 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6154 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 6155 | hdd_device_modetoString(pAdapter->device_mode), |
| 6156 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6157 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6158 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6159 | status = wlan_hdd_validate_context(pHddCtx); |
| 6160 | |
| 6161 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6162 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6163 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6164 | "%s: HDD context is not valid", __func__); |
| 6165 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6166 | } |
| 6167 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6168 | if (vos_max_concurrent_connections_reached()) { |
| 6169 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6170 | return -EINVAL; |
| 6171 | } |
| 6172 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6173 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6174 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | ) |
| 6176 | { |
| 6177 | beacon_data_t *old,*new; |
| 6178 | |
| 6179 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6181 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6182 | { |
| 6183 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 6184 | FL("already beacon info added to session(%d)"), |
| 6185 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6186 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6188 | |
| 6189 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6190 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6191 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6192 | { |
| 6193 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6194 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6195 | return -EINVAL; |
| 6196 | } |
| 6197 | |
| 6198 | pAdapter->sessionCtx.ap.beacon = new; |
| 6199 | |
| 6200 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6201 | } |
| 6202 | |
| 6203 | EXIT(); |
| 6204 | return status; |
| 6205 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6206 | |
| 6207 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6208 | struct net_device *dev, |
| 6209 | struct beacon_parameters *params) |
| 6210 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6211 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6212 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6213 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6214 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6215 | |
| 6216 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6217 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6218 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 6219 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 6220 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6221 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6222 | pAdapter->device_mode); |
| 6223 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6224 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6225 | status = wlan_hdd_validate_context(pHddCtx); |
| 6226 | |
| 6227 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6228 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6229 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6230 | "%s: HDD context is not valid", __func__); |
| 6231 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6232 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6233 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6234 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6235 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6236 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | { |
| 6238 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6240 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6241 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6242 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6243 | { |
| 6244 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6245 | FL("session(%d) old and new heads points to NULL"), |
| 6246 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6247 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6249 | |
| 6250 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6251 | |
| 6252 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6253 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6254 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6255 | return -EINVAL; |
| 6256 | } |
| 6257 | |
| 6258 | pAdapter->sessionCtx.ap.beacon = new; |
| 6259 | |
| 6260 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6261 | } |
| 6262 | |
| 6263 | EXIT(); |
| 6264 | return status; |
| 6265 | } |
| 6266 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6267 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6268 | |
| 6269 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 6271 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6272 | #else |
| 6273 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 6274 | struct net_device *dev) |
| 6275 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | { |
| 6277 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6278 | hdd_context_t *pHddCtx = NULL; |
| 6279 | hdd_scaninfo_t *pScanInfo = NULL; |
| 6280 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6281 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6282 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6283 | |
| 6284 | ENTER(); |
| 6285 | |
| 6286 | if (NULL == pAdapter) |
| 6287 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6288 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6289 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6290 | return -ENODEV; |
| 6291 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6292 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6293 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6294 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 6295 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6296 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6297 | status = wlan_hdd_validate_context(pHddCtx); |
| 6298 | |
| 6299 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6300 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6302 | "%s: HDD context is not valid", __func__); |
| 6303 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6304 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6305 | |
| 6306 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6307 | if (NULL == staAdapter) |
| 6308 | { |
| 6309 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 6310 | if (NULL == staAdapter) |
| 6311 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 6312 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6313 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 6314 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6315 | } |
| 6316 | } |
| 6317 | |
| 6318 | pScanInfo = &pHddCtx->scan_info; |
| 6319 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6320 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6321 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6322 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6323 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6324 | ret = wlan_hdd_scan_abort(pAdapter); |
| 6325 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 6326 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6327 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6328 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6329 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6330 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6331 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6332 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6333 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6334 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 6335 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6336 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6337 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6338 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6339 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6340 | } |
| 6341 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 6342 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 6343 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 6344 | hdd_hostapd_stop(dev); |
| 6345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6346 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6347 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | ) |
| 6349 | { |
| 6350 | beacon_data_t *old; |
| 6351 | |
| 6352 | old = pAdapter->sessionCtx.ap.beacon; |
| 6353 | |
| 6354 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6355 | { |
| 6356 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6357 | FL("session(%d) beacon data points to NULL"), |
| 6358 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6359 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6360 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6362 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6363 | |
| 6364 | mutex_lock(&pHddCtx->sap_lock); |
| 6365 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 6366 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6367 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6368 | { |
| 6369 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 6370 | |
| 6371 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 6372 | |
| 6373 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 6374 | { |
| 6375 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6376 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6378 | } |
| 6379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6381 | /* BSS stopped, clear the active sessions for this device mode */ |
| 6382 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6383 | } |
| 6384 | mutex_unlock(&pHddCtx->sap_lock); |
| 6385 | |
| 6386 | if(status != VOS_STATUS_SUCCESS) |
| 6387 | { |
| 6388 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6389 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6390 | return -EINVAL; |
| 6391 | } |
| 6392 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6393 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6394 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 6395 | ==eHAL_STATUS_FAILURE) |
| 6396 | { |
| 6397 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6398 | "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] | 6399 | } |
| 6400 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6401 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6403 | eANI_BOOLEAN_FALSE) ) |
| 6404 | { |
| 6405 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6406 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6407 | } |
| 6408 | |
| 6409 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6410 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 6411 | |
| 6412 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 6413 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6414 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6415 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 6416 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 6417 | { |
| 6418 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 6419 | "GO got removed"); |
| 6420 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 6421 | } |
| 6422 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | } |
| 6424 | EXIT(); |
| 6425 | return status; |
| 6426 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6427 | |
| 6428 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6429 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6430 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 6431 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6432 | struct cfg80211_ap_settings *params) |
| 6433 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6434 | hdd_adapter_t *pAdapter; |
| 6435 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6436 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6437 | |
| 6438 | ENTER(); |
| 6439 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6440 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6441 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6442 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6443 | "%s: Device is Null", __func__); |
| 6444 | return -ENODEV; |
| 6445 | } |
| 6446 | |
| 6447 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6448 | if (NULL == pAdapter) |
| 6449 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6450 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6451 | "%s: HDD adapter is Null", __func__); |
| 6452 | return -ENODEV; |
| 6453 | } |
| 6454 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6455 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6456 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 6457 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6458 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 6459 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6460 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6461 | "%s: HDD adapter magic is invalid", __func__); |
| 6462 | return -ENODEV; |
| 6463 | } |
| 6464 | |
| 6465 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6466 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6467 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6468 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6469 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6470 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6471 | "%s: HDD context is not valid", __func__); |
| 6472 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6473 | } |
| 6474 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6475 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 6476 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6477 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6478 | |
| 6479 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6480 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6481 | ) |
| 6482 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6483 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6484 | |
| 6485 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6486 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6487 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6488 | { |
| 6489 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 6490 | FL("already beacon info added to session(%d)"), |
| 6491 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6492 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6493 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6494 | |
| 6495 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 6496 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6497 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6498 | { |
| 6499 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6500 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6501 | return -EINVAL; |
| 6502 | } |
| 6503 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6504 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6505 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 6506 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 6507 | params->channel, params->channel_type); |
| 6508 | #else |
| 6509 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 6510 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6511 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6512 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 6513 | params->ssid_len, params->hidden_ssid); |
| 6514 | } |
| 6515 | |
| 6516 | EXIT(); |
| 6517 | return status; |
| 6518 | } |
| 6519 | |
| 6520 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6521 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6522 | struct net_device *dev, |
| 6523 | struct cfg80211_beacon_data *params) |
| 6524 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6525 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6526 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6527 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6528 | |
| 6529 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6530 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6531 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6532 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 6533 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6534 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6535 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6536 | |
| 6537 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6538 | status = wlan_hdd_validate_context(pHddCtx); |
| 6539 | |
| 6540 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6541 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6542 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6543 | "%s: HDD context is not valid", __func__); |
| 6544 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6545 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6546 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6547 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6548 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6549 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6550 | { |
| 6551 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6552 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6553 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6554 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6555 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6556 | { |
| 6557 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6558 | FL("session(%d) beacon data points to NULL"), |
| 6559 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6560 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6561 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6562 | |
| 6563 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 6564 | |
| 6565 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6566 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6567 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6568 | return -EINVAL; |
| 6569 | } |
| 6570 | |
| 6571 | pAdapter->sessionCtx.ap.beacon = new; |
| 6572 | |
| 6573 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 6574 | } |
| 6575 | |
| 6576 | EXIT(); |
| 6577 | return status; |
| 6578 | } |
| 6579 | |
| 6580 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6581 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6582 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6583 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6584 | struct net_device *dev, |
| 6585 | struct bss_parameters *params) |
| 6586 | { |
| 6587 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6588 | |
| 6589 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6590 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6591 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6592 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 6593 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6594 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6595 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6596 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6597 | |
| 6598 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6599 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6600 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | { |
| 6602 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 6603 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6604 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | { |
| 6606 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6607 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6608 | } |
| 6609 | |
| 6610 | EXIT(); |
| 6611 | return 0; |
| 6612 | } |
| 6613 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6614 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 6615 | struct net_device *dev, |
| 6616 | struct bss_parameters *params) |
| 6617 | { |
| 6618 | int ret; |
| 6619 | |
| 6620 | vos_ssr_protect(__func__); |
| 6621 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 6622 | vos_ssr_unprotect(__func__); |
| 6623 | |
| 6624 | return ret; |
| 6625 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6626 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 6627 | * to wait for contry code completion |
| 6628 | */ |
| 6629 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 6630 | { |
| 6631 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 6632 | complete(&call_back_pAdapter->change_country_code); |
| 6633 | return NULL; |
| 6634 | } |
| 6635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6637 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6638 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 6639 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6640 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | struct net_device *ndev, |
| 6642 | enum nl80211_iftype type, |
| 6643 | u32 *flags, |
| 6644 | struct vif_params *params |
| 6645 | ) |
| 6646 | { |
| 6647 | struct wireless_dev *wdev; |
| 6648 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6649 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6650 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | tCsrRoamProfile *pRoamProfile = NULL; |
| 6652 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6653 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | eMib_dot11DesiredBssType connectedBssType; |
| 6655 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6656 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6657 | |
| 6658 | ENTER(); |
| 6659 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6660 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6661 | { |
| 6662 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6663 | "%s: Adapter context is null", __func__); |
| 6664 | return VOS_STATUS_E_FAILURE; |
| 6665 | } |
| 6666 | |
| 6667 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6668 | if (!pHddCtx) |
| 6669 | { |
| 6670 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6671 | "%s: HDD context is null", __func__); |
| 6672 | return VOS_STATUS_E_FAILURE; |
| 6673 | } |
| 6674 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6675 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6676 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 6677 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6678 | status = wlan_hdd_validate_context(pHddCtx); |
| 6679 | |
| 6680 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6681 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6682 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6683 | "%s: HDD context is not valid", __func__); |
| 6684 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6685 | } |
| 6686 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6687 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6688 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6689 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6691 | if (vos_max_concurrent_connections_reached()) { |
| 6692 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6693 | return -EINVAL; |
| 6694 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6695 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6696 | wdev = ndev->ieee80211_ptr; |
| 6697 | |
| 6698 | #ifdef WLAN_BTAMP_FEATURE |
| 6699 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 6700 | (NL80211_IFTYPE_ADHOC == type)|| |
| 6701 | (NL80211_IFTYPE_AP == type)|| |
| 6702 | (NL80211_IFTYPE_P2P_GO == type)) |
| 6703 | { |
| 6704 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 6705 | // stop AMP traffic |
| 6706 | status = WLANBAP_StopAmp(); |
| 6707 | if(VOS_STATUS_SUCCESS != status ) |
| 6708 | { |
| 6709 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 6710 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6711 | "%s: Failed to stop AMP", __func__); |
| 6712 | return -EINVAL; |
| 6713 | } |
| 6714 | } |
| 6715 | #endif //WLAN_BTAMP_FEATURE |
| 6716 | /* Reset the current device mode bit mask*/ |
| 6717 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 6718 | |
| 6719 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6720 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6721 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6722 | ) |
| 6723 | { |
| 6724 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6725 | if (!pWextState) |
| 6726 | { |
| 6727 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6728 | "%s: pWextState is null", __func__); |
| 6729 | return VOS_STATUS_E_FAILURE; |
| 6730 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | pRoamProfile = &pWextState->roamProfile; |
| 6732 | LastBSSType = pRoamProfile->BSSType; |
| 6733 | |
| 6734 | switch (type) |
| 6735 | { |
| 6736 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6737 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6738 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6739 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 6740 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6741 | #ifdef WLAN_FEATURE_11AC |
| 6742 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 6743 | { |
| 6744 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 6745 | } |
| 6746 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6747 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6748 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6749 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6750 | //Check for sub-string p2p to confirm its a p2p interface |
| 6751 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6752 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6753 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 6754 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 6755 | } |
| 6756 | else |
| 6757 | { |
| 6758 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6759 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6760 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6761 | #ifdef FEATURE_WLAN_TDLS |
| 6762 | /* The open adapter for the p2p shall skip initializations in |
| 6763 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 6764 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 6765 | * tdls_init when the change_iface sets the device mode to |
| 6766 | * WLAN_HDD_P2P_CLIENT. |
| 6767 | */ |
| 6768 | |
| 6769 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 6770 | { |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 6771 | if (0 != wlan_hdd_sta_tdls_init (pAdapter)) |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6772 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6773 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6774 | "%s: tdls initialization failed", __func__); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 6775 | return -EINVAL; |
| 6776 | } |
| 6777 | } |
| 6778 | #endif |
| 6779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6780 | break; |
| 6781 | case NL80211_IFTYPE_ADHOC: |
| 6782 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6783 | "%s: setting interface Type to ADHOC", __func__); |
| 6784 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 6785 | pRoamProfile->phyMode = |
| 6786 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 6787 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6788 | wdev->iftype = type; |
| 6789 | break; |
| 6790 | |
| 6791 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6792 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6793 | { |
| 6794 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6795 | "%s: setting interface Type to %s", __func__, |
| 6796 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 6797 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6798 | //Cancel any remain on channel for GO mode |
| 6799 | if (NL80211_IFTYPE_P2P_GO == type) |
| 6800 | { |
| 6801 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 6802 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6803 | if (NL80211_IFTYPE_AP == type) |
| 6804 | { |
| 6805 | /* As Loading WLAN Driver one interface being created for p2p device |
| 6806 | * address. This will take one HW STA and the max number of clients |
| 6807 | * that can connect to softAP will be reduced by one. so while changing |
| 6808 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 6809 | * interface as it is not required in SoftAP mode. |
| 6810 | */ |
| 6811 | |
| 6812 | // Get P2P Adapter |
| 6813 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 6814 | |
| 6815 | if (pP2pAdapter) |
| 6816 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 6817 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6818 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 6819 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 6820 | } |
| 6821 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 6822 | //Disable IMPS & BMPS for SAP/GO |
| 6823 | if(VOS_STATUS_E_FAILURE == |
| 6824 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 6825 | { |
| 6826 | //Fail to Exit BMPS |
| 6827 | VOS_ASSERT(0); |
| 6828 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 6829 | |
| 6830 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 6831 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6832 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6833 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6834 | /* A Mutex Lock is introduced while changing the mode to |
| 6835 | * protect the concurrent access for the Adapters by TDLS |
| 6836 | * module. |
| 6837 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6838 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6839 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6840 | //De-init the adapter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6841 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 6842 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6843 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 6844 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6845 | #ifdef FEATURE_WLAN_TDLS |
| 6846 | mutex_unlock(&pHddCtx->tdls_lock); |
| 6847 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 6848 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 6849 | (pConfig->apRandomBssidEnabled)) |
| 6850 | { |
| 6851 | /* To meet Android requirements create a randomized |
| 6852 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 6853 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 6854 | ndev->dev_addr[0] = 0x02; |
| 6855 | ndev->dev_addr[1] = 0x1A; |
| 6856 | ndev->dev_addr[2] = 0x11; |
| 6857 | ndev->dev_addr[3] |= 0xF0; |
| 6858 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 6859 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 6860 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 6861 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 6862 | } |
| 6863 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6864 | hdd_set_ap_ops( pAdapter->dev ); |
| 6865 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6866 | /* This is for only SAP mode where users can |
| 6867 | * control country through ini. |
| 6868 | * P2P GO follows station country code |
| 6869 | * acquired during the STA scanning. */ |
| 6870 | if((NL80211_IFTYPE_AP == type) && |
| 6871 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 6872 | { |
| 6873 | int status = 0; |
| 6874 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 6875 | "%s: setting country code from INI ", __func__); |
| 6876 | init_completion(&pAdapter->change_country_code); |
| 6877 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 6878 | (void *)(tSmeChangeCountryCallback) |
| 6879 | wlan_hdd_change_country_code_cb, |
| 6880 | pConfig->apCntryCode, pAdapter, |
| 6881 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 6882 | eSIR_FALSE, |
| 6883 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6884 | if (eHAL_STATUS_SUCCESS == status) |
| 6885 | { |
| 6886 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6887 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6888 | &pAdapter->change_country_code, |
| 6889 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6890 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6891 | { |
| 6892 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6893 | FL("SME Timed out while setting country code %ld"), |
| 6894 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 6895 | |
| 6896 | if (pHddCtx->isLogpInProgress) |
| 6897 | { |
| 6898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6899 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 6900 | return -EAGAIN; |
| 6901 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6902 | } |
| 6903 | } |
| 6904 | else |
| 6905 | { |
| 6906 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6907 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6908 | return -EINVAL; |
| 6909 | } |
| 6910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6911 | status = hdd_init_ap_mode(pAdapter); |
| 6912 | if(status != VOS_STATUS_SUCCESS) |
| 6913 | { |
| 6914 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6915 | "%s: Error initializing the ap mode", __func__); |
| 6916 | return -EINVAL; |
| 6917 | } |
| 6918 | hdd_set_conparam(1); |
| 6919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6920 | /*interface type changed update in wiphy structure*/ |
| 6921 | if(wdev) |
| 6922 | { |
| 6923 | wdev->iftype = type; |
| 6924 | pHddCtx->change_iface = type; |
| 6925 | } |
| 6926 | else |
| 6927 | { |
| 6928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6929 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 6930 | return -EINVAL; |
| 6931 | } |
| 6932 | goto done; |
| 6933 | } |
| 6934 | |
| 6935 | default: |
| 6936 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 6937 | __func__); |
| 6938 | return -EOPNOTSUPP; |
| 6939 | } |
| 6940 | } |
| 6941 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6942 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6943 | ) |
| 6944 | { |
| 6945 | switch(type) |
| 6946 | { |
| 6947 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6948 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6949 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 6950 | |
| 6951 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6952 | #ifdef FEATURE_WLAN_TDLS |
| 6953 | |
| 6954 | /* A Mutex Lock is introduced while changing the mode to |
| 6955 | * protect the concurrent access for the Adapters by TDLS |
| 6956 | * module. |
| 6957 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 6958 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6959 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6960 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6961 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 6962 | //Check for sub-string p2p to confirm its a p2p interface |
| 6963 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6964 | { |
| 6965 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 6966 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 6967 | } |
| 6968 | else |
| 6969 | { |
| 6970 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6971 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 6972 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6973 | hdd_set_conparam(0); |
| 6974 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6975 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 6976 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 6977 | #ifdef FEATURE_WLAN_TDLS |
| 6978 | mutex_unlock(&pHddCtx->tdls_lock); |
| 6979 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 6980 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | if( VOS_STATUS_SUCCESS != status ) |
| 6982 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6983 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 6984 | * This is the right place to enable back bmps_imps() |
| 6985 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 6986 | if (pHddCtx->hdd_wlan_suspended) |
| 6987 | { |
| 6988 | hdd_set_pwrparams(pHddCtx); |
| 6989 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6990 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6991 | goto done; |
| 6992 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6993 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6994 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 6996 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | goto done; |
| 6998 | default: |
| 6999 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7000 | __func__); |
| 7001 | return -EOPNOTSUPP; |
| 7002 | |
| 7003 | } |
| 7004 | |
| 7005 | } |
| 7006 | else |
| 7007 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7008 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 7009 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7010 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7011 | return -EOPNOTSUPP; |
| 7012 | } |
| 7013 | |
| 7014 | |
| 7015 | if(pRoamProfile) |
| 7016 | { |
| 7017 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 7018 | { |
| 7019 | /*interface type changed update in wiphy structure*/ |
| 7020 | wdev->iftype = type; |
| 7021 | |
| 7022 | /*the BSS mode changed, We need to issue disconnect |
| 7023 | if connected or in IBSS disconnect state*/ |
| 7024 | if ( hdd_connGetConnectedBssType( |
| 7025 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 7026 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 7027 | { |
| 7028 | /*need to issue a disconnect to CSR.*/ |
| 7029 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7030 | if( eHAL_STATUS_SUCCESS == |
| 7031 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7032 | pAdapter->sessionId, |
| 7033 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 7034 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7035 | ret = wait_for_completion_interruptible_timeout( |
| 7036 | &pAdapter->disconnect_comp_var, |
| 7037 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 7038 | if (ret <= 0) |
| 7039 | { |
| 7040 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7041 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 7042 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7043 | } |
| 7044 | } |
| 7045 | } |
| 7046 | } |
| 7047 | |
| 7048 | done: |
| 7049 | /*set bitmask based on updated value*/ |
| 7050 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 7051 | |
| 7052 | /* Only STA mode support TM now |
| 7053 | * all other mode, TM feature should be disabled */ |
| 7054 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 7055 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 7056 | { |
| 7057 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 7058 | } |
| 7059 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7060 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7061 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7062 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7063 | { |
| 7064 | //we are ok to do AMP |
| 7065 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7066 | } |
| 7067 | #endif //WLAN_BTAMP_FEATURE |
| 7068 | EXIT(); |
| 7069 | return 0; |
| 7070 | } |
| 7071 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7072 | /* |
| 7073 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 7074 | * wrapper function to protect the actual implementation from SSR. |
| 7075 | */ |
| 7076 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 7077 | struct net_device *ndev, |
| 7078 | enum nl80211_iftype type, |
| 7079 | u32 *flags, |
| 7080 | struct vif_params *params |
| 7081 | ) |
| 7082 | { |
| 7083 | int ret; |
| 7084 | |
| 7085 | vos_ssr_protect(__func__); |
| 7086 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 7087 | vos_ssr_unprotect(__func__); |
| 7088 | |
| 7089 | return ret; |
| 7090 | } |
| 7091 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7092 | #ifdef FEATURE_WLAN_TDLS |
| 7093 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 7094 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 7095 | { |
| 7096 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7097 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7098 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7099 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7100 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7101 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7102 | |
| 7103 | ENTER(); |
| 7104 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7105 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7106 | { |
| 7107 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7108 | "Invalid arguments"); |
| 7109 | return -EINVAL; |
| 7110 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7111 | |
| 7112 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 7113 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 7114 | { |
| 7115 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7116 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 7117 | MAC_ADDRESS_STR " Request declined.", |
| 7118 | __func__, MAC_ADDR_ARRAY(mac)); |
| 7119 | return -ENOTSUPP; |
| 7120 | } |
| 7121 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7122 | if (pHddCtx->isLogpInProgress) |
| 7123 | { |
| 7124 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7125 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7126 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7127 | mac, |
| 7128 | eTDLS_LINK_IDLE, |
| 7129 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7130 | return -EBUSY; |
| 7131 | } |
| 7132 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 7133 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7134 | |
| 7135 | if ( NULL == pTdlsPeer ) { |
| 7136 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7137 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 7138 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 7139 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7140 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7141 | |
| 7142 | /* in add station, we accept existing valid staId if there is */ |
| 7143 | if ((0 == update) && |
| 7144 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 7145 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7146 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7147 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7148 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7149 | " link_status %d. staId %d. add station ignored.", |
| 7150 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 7151 | return 0; |
| 7152 | } |
| 7153 | /* in change station, we accept only when staId is valid */ |
| 7154 | if ((1 == update) && |
| 7155 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 7156 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 7157 | { |
| 7158 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7159 | "%s: " MAC_ADDRESS_STR |
| 7160 | " link status %d. staId %d. change station %s.", |
| 7161 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 7162 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 7163 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7164 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7165 | |
| 7166 | /* 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] | 7167 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7168 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7169 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7170 | "%s: " MAC_ADDRESS_STR |
| 7171 | " TDLS setup is ongoing. Request declined.", |
| 7172 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7173 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7174 | } |
| 7175 | |
| 7176 | /* first to check if we reached to maximum supported TDLS peer. |
| 7177 | TODO: for now, return -EPERM looks working fine, |
| 7178 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7179 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 7180 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7181 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7182 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7183 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7184 | " TDLS Max peer already connected. Request declined." |
| 7185 | " Num of peers (%d), Max allowed (%d).", |
| 7186 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 7187 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7188 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7189 | } |
| 7190 | else |
| 7191 | { |
| 7192 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7193 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7194 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7195 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7196 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7197 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 7198 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7199 | return -EPERM; |
| 7200 | } |
| 7201 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7202 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7203 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7204 | mac, |
| 7205 | eTDLS_LINK_CONNECTING, |
| 7206 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7207 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7208 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7209 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7210 | { |
| 7211 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7212 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7213 | if(StaParams->htcap_present) |
| 7214 | { |
| 7215 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7216 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 7217 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7218 | "ht_capa->extended_capabilities: %0x", |
| 7219 | StaParams->HTCap.extendedHtCapInfo); |
| 7220 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7221 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7222 | "params->capability: %0x",StaParams->capability); |
| 7223 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7224 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7225 | if(StaParams->vhtcap_present) |
| 7226 | { |
| 7227 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7228 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 7229 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 7230 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 7231 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7232 | { |
| 7233 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7234 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7235 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 7236 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7237 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 7238 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7239 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7240 | else if ((1 == update) && (NULL == StaParams)) |
| 7241 | { |
| 7242 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7243 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 7244 | return -EPERM; |
| 7245 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7246 | |
| 7247 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 7248 | |
| 7249 | if (!update) |
| 7250 | { |
| 7251 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7252 | pAdapter->sessionId, mac); |
| 7253 | } |
| 7254 | else |
| 7255 | { |
| 7256 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7257 | pAdapter->sessionId, mac, StaParams); |
| 7258 | } |
| 7259 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7260 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7261 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 7262 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7263 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7264 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7266 | "%s: timeout waiting for tdls add station indication %ld", |
| 7267 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7268 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7269 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7270 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7271 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 7272 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7273 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7274 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7275 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7276 | } |
| 7277 | |
| 7278 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7279 | |
| 7280 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7281 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7282 | mac, |
| 7283 | eTDLS_LINK_IDLE, |
| 7284 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7285 | return -EPERM; |
| 7286 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7287 | } |
| 7288 | #endif |
| 7289 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7290 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 7291 | struct net_device *dev, |
| 7292 | u8 *mac, |
| 7293 | struct station_parameters *params) |
| 7294 | { |
| 7295 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 7296 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7297 | hdd_context_t *pHddCtx; |
| 7298 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7299 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7300 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7301 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7302 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7303 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7304 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7305 | ENTER(); |
| 7306 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7307 | if ((NULL == pAdapter)) |
| 7308 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7309 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7310 | "invalid adapter "); |
| 7311 | return -EINVAL; |
| 7312 | } |
| 7313 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7314 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7315 | TRACE_CODE_HDD_CHANGE_STATION, |
| 7316 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7317 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7318 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7319 | |
| 7320 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 7321 | { |
| 7322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7323 | "invalid HDD state or HDD station context"); |
| 7324 | return -EINVAL; |
| 7325 | } |
| 7326 | |
| 7327 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7328 | { |
| 7329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7330 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 7331 | return -EAGAIN; |
| 7332 | } |
| 7333 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7334 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 7335 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7336 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7337 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7338 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7339 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7341 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7342 | WLANTL_STA_AUTHENTICATED); |
| 7343 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7344 | if (status != VOS_STATUS_SUCCESS) |
| 7345 | { |
| 7346 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7347 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 7348 | return -EINVAL; |
| 7349 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7350 | } |
| 7351 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 7352 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 7353 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7354 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7355 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 7356 | StaParams.capability = params->capability; |
| 7357 | StaParams.uapsd_queues = params->uapsd_queues; |
| 7358 | StaParams.max_sp = params->max_sp; |
| 7359 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7360 | /* Convert (first channel , number of channels) tuple to |
| 7361 | * the total list of channels. This goes with the assumption |
| 7362 | * that if the first channel is < 14, then the next channels |
| 7363 | * are an incremental of 1 else an incremental of 4 till the number |
| 7364 | * of channels. |
| 7365 | */ |
| 7366 | if (0 != params->supported_channels_len) { |
| 7367 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 7368 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 7369 | { |
| 7370 | int wifi_chan_index; |
| 7371 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 7372 | wifi_chan_index = |
| 7373 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 7374 | no_of_channels = params->supported_channels[i+1]; |
| 7375 | for(k=1; k <= no_of_channels; k++) |
| 7376 | { |
| 7377 | StaParams.supported_channels[j+1] = |
| 7378 | StaParams.supported_channels[j] + wifi_chan_index; |
| 7379 | j+=1; |
| 7380 | } |
| 7381 | } |
| 7382 | StaParams.supported_channels_len = j; |
| 7383 | } |
| 7384 | vos_mem_copy(StaParams.supported_oper_classes, |
| 7385 | params->supported_oper_classes, |
| 7386 | params->supported_oper_classes_len); |
| 7387 | StaParams.supported_oper_classes_len = |
| 7388 | params->supported_oper_classes_len; |
| 7389 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7390 | if (0 != params->ext_capab_len) |
| 7391 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 7392 | sizeof(StaParams.extn_capability)); |
| 7393 | |
| 7394 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7395 | { |
| 7396 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7397 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7398 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7399 | |
| 7400 | StaParams.supported_rates_len = params->supported_rates_len; |
| 7401 | |
| 7402 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 7403 | * The supported_rates array , for all the structures propogating till Add Sta |
| 7404 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 7405 | * modified to send more rates. |
| 7406 | */ |
| 7407 | |
| 7408 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 7409 | */ |
| 7410 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 7411 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 7412 | |
| 7413 | if (0 != StaParams.supported_rates_len) { |
| 7414 | int i = 0; |
| 7415 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 7416 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7417 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7418 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 7419 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7420 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7421 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 7422 | } |
| 7423 | |
| 7424 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7425 | { |
| 7426 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7427 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7428 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7429 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7430 | if (0 != params->ext_capab_len ) { |
| 7431 | /*Define A Macro : TODO Sunil*/ |
| 7432 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 7433 | isBufSta = 1; |
| 7434 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7435 | /* TDLS Channel Switching Support */ |
| 7436 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 7437 | isOffChannelSupported = 1; |
| 7438 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7439 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7440 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 7441 | &StaParams, isBufSta, |
| 7442 | isOffChannelSupported); |
| 7443 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 7444 | if (VOS_STATUS_SUCCESS != status) { |
| 7445 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7446 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 7447 | return -EINVAL; |
| 7448 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7449 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 7450 | |
| 7451 | if (VOS_STATUS_SUCCESS != status) { |
| 7452 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7453 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 7454 | return -EINVAL; |
| 7455 | } |
| 7456 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7457 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 7458 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7459 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7460 | return status; |
| 7461 | } |
| 7462 | |
| 7463 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7464 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7465 | * This function is used to initialize the key information |
| 7466 | */ |
| 7467 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7468 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7469 | struct net_device *ndev, |
| 7470 | u8 key_index, bool pairwise, |
| 7471 | const u8 *mac_addr, |
| 7472 | struct key_params *params |
| 7473 | ) |
| 7474 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7475 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7476 | struct net_device *ndev, |
| 7477 | u8 key_index, const u8 *mac_addr, |
| 7478 | struct key_params *params |
| 7479 | ) |
| 7480 | #endif |
| 7481 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7482 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7483 | tCsrRoamSetKey setKey; |
| 7484 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7485 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7486 | v_U32_t roamId= 0xFF; |
| 7487 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7488 | hdd_hostapd_state_t *pHostapdState; |
| 7489 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7490 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7491 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7492 | |
| 7493 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7494 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7495 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7496 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 7497 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7498 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7499 | status = wlan_hdd_validate_context(pHddCtx); |
| 7500 | |
| 7501 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7502 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7503 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7504 | "%s: HDD context is not valid", __func__); |
| 7505 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7506 | } |
| 7507 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7508 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7509 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7510 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7511 | |
| 7512 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7513 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7514 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7515 | key_index); |
| 7516 | |
| 7517 | return -EINVAL; |
| 7518 | } |
| 7519 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7520 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 7521 | { |
| 7522 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 7523 | params->key_len); |
| 7524 | |
| 7525 | return -EINVAL; |
| 7526 | } |
| 7527 | |
| 7528 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7529 | "%s: called with key index = %d & key length %d", |
| 7530 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7531 | |
| 7532 | /*extract key idx, key len and key*/ |
| 7533 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7534 | setKey.keyId = key_index; |
| 7535 | setKey.keyLength = params->key_len; |
| 7536 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 7537 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7538 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7539 | { |
| 7540 | case WLAN_CIPHER_SUITE_WEP40: |
| 7541 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 7542 | break; |
| 7543 | |
| 7544 | case WLAN_CIPHER_SUITE_WEP104: |
| 7545 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 7546 | break; |
| 7547 | |
| 7548 | case WLAN_CIPHER_SUITE_TKIP: |
| 7549 | { |
| 7550 | u8 *pKey = &setKey.Key[0]; |
| 7551 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 7552 | |
| 7553 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 7554 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7555 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7556 | |
| 7557 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7558 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7559 | |--------------|----------|----------| |
| 7560 | <---16bytes---><--8bytes--><--8bytes--> |
| 7561 | |
| 7562 | */ |
| 7563 | /*Sme expects the 32 bytes key to be in the below order |
| 7564 | |
| 7565 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7566 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7567 | |--------------|----------|----------| |
| 7568 | <---16bytes---><--8bytes--><--8bytes--> |
| 7569 | */ |
| 7570 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7571 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7572 | |
| 7573 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7574 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7575 | |
| 7576 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7577 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7578 | |
| 7579 | |
| 7580 | break; |
| 7581 | } |
| 7582 | |
| 7583 | case WLAN_CIPHER_SUITE_CCMP: |
| 7584 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 7585 | break; |
| 7586 | |
| 7587 | #ifdef FEATURE_WLAN_WAPI |
| 7588 | case WLAN_CIPHER_SUITE_SMS4: |
| 7589 | { |
| 7590 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7591 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 7592 | params->key, params->key_len); |
| 7593 | return 0; |
| 7594 | } |
| 7595 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7596 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7597 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7598 | case WLAN_CIPHER_SUITE_KRK: |
| 7599 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 7600 | break; |
| 7601 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7602 | |
| 7603 | #ifdef WLAN_FEATURE_11W |
| 7604 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 7605 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 7606 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7607 | #endif |
| 7608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7609 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7610 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7611 | __func__, params->cipher); |
| 7612 | return -EOPNOTSUPP; |
| 7613 | } |
| 7614 | |
| 7615 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 7616 | __func__, setKey.encType); |
| 7617 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7618 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7619 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7620 | (!pairwise) |
| 7621 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7622 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7623 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7624 | ) |
| 7625 | { |
| 7626 | /* set group key*/ |
| 7627 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7628 | "%s- %d: setting Broadcast key", |
| 7629 | __func__, __LINE__); |
| 7630 | setKey.keyDirection = eSIR_RX_ONLY; |
| 7631 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 7632 | } |
| 7633 | else |
| 7634 | { |
| 7635 | /* set pairwise key*/ |
| 7636 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7637 | "%s- %d: setting pairwise key", |
| 7638 | __func__, __LINE__); |
| 7639 | setKey.keyDirection = eSIR_TX_RX; |
| 7640 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 7641 | } |
| 7642 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 7643 | { |
| 7644 | setKey.keyDirection = eSIR_TX_RX; |
| 7645 | /*Set the group key*/ |
| 7646 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7647 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7648 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7649 | if ( 0 != status ) |
| 7650 | { |
| 7651 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7652 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 7653 | return -EINVAL; |
| 7654 | } |
| 7655 | /*Save the keys here and call sme_RoamSetKey for setting |
| 7656 | the PTK after peer joins the IBSS network*/ |
| 7657 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 7658 | &setKey, sizeof(tCsrRoamSetKey)); |
| 7659 | return status; |
| 7660 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7661 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 7662 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7663 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7664 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7665 | if( pHostapdState->bssState == BSS_START ) |
| 7666 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 7667 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7668 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 7669 | |
| 7670 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 7671 | { |
| 7672 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7673 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 7674 | __LINE__, vos_status ); |
| 7675 | |
| 7676 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7677 | |
| 7678 | return -EINVAL; |
| 7679 | } |
| 7680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7681 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 7682 | |
| 7683 | if ( status != eHAL_STATUS_SUCCESS ) |
| 7684 | { |
| 7685 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7686 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 7687 | __LINE__, status ); |
| 7688 | } |
| 7689 | } |
| 7690 | |
| 7691 | /* Saving WEP keys */ |
| 7692 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 7693 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 7694 | { |
| 7695 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 7696 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 7697 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 7698 | } |
| 7699 | else |
| 7700 | { |
| 7701 | //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] | 7702 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7703 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 7704 | } |
| 7705 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7706 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 7707 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7708 | { |
| 7709 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7710 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7711 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7712 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7713 | if (!pairwise) |
| 7714 | #else |
| 7715 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 7716 | #endif |
| 7717 | { |
| 7718 | /* set group key*/ |
| 7719 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 7720 | { |
| 7721 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7722 | "%s- %d: Perform Set key Complete", |
| 7723 | __func__, __LINE__); |
| 7724 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 7725 | } |
| 7726 | } |
| 7727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7728 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 7729 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 7730 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 7731 | |
| 7732 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7733 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7734 | params->key, params->key_len); |
| 7735 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7737 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 7738 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7739 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7740 | "%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] | 7741 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 7742 | setKey.peerMac[2], setKey.peerMac[3], |
| 7743 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7744 | setKey.keyDirection); |
| 7745 | |
| 7746 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 7747 | |
| 7748 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 7749 | { |
| 7750 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7751 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 7752 | __LINE__, vos_status ); |
| 7753 | |
| 7754 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7755 | |
| 7756 | return -EINVAL; |
| 7757 | |
| 7758 | } |
| 7759 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7760 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7761 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 7762 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 7763 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7764 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7765 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7766 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7767 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 7768 | "%s: Update PreAuth Key success", __func__); |
| 7769 | return 0; |
| 7770 | } |
| 7771 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 7772 | { |
| 7773 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7774 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 7775 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7776 | } |
| 7777 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7778 | |
| 7779 | /* issue set key request to SME*/ |
| 7780 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7781 | pAdapter->sessionId, &setKey, &roamId ); |
| 7782 | |
| 7783 | if ( 0 != status ) |
| 7784 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7785 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7786 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 7787 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7788 | return -EINVAL; |
| 7789 | } |
| 7790 | |
| 7791 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7792 | /* in case of IBSS as there was no information available about WEP keys during |
| 7793 | * 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] | 7794 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7795 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 7796 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 7797 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7798 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 7799 | ) |
| 7800 | && |
| 7801 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 7802 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 7803 | ) |
| 7804 | ) |
| 7805 | { |
| 7806 | setKey.keyDirection = eSIR_RX_ONLY; |
| 7807 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 7808 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7809 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7810 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7811 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 7812 | setKey.peerMac[2], setKey.peerMac[3], |
| 7813 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7814 | setKey.keyDirection); |
| 7815 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7816 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7817 | pAdapter->sessionId, &setKey, &roamId ); |
| 7818 | |
| 7819 | if ( 0 != status ) |
| 7820 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7821 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7822 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7823 | __func__, status); |
| 7824 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7825 | return -EINVAL; |
| 7826 | } |
| 7827 | } |
| 7828 | } |
| 7829 | |
| 7830 | return 0; |
| 7831 | } |
| 7832 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7833 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7834 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 7835 | struct net_device *ndev, |
| 7836 | u8 key_index, bool pairwise, |
| 7837 | const u8 *mac_addr, |
| 7838 | struct key_params *params |
| 7839 | ) |
| 7840 | #else |
| 7841 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 7842 | struct net_device *ndev, |
| 7843 | u8 key_index, const u8 *mac_addr, |
| 7844 | struct key_params *params |
| 7845 | ) |
| 7846 | #endif |
| 7847 | { |
| 7848 | int ret; |
| 7849 | vos_ssr_protect(__func__); |
| 7850 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7851 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 7852 | mac_addr, params); |
| 7853 | #else |
| 7854 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 7855 | params); |
| 7856 | #endif |
| 7857 | vos_ssr_unprotect(__func__); |
| 7858 | |
| 7859 | return ret; |
| 7860 | } |
| 7861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7862 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7863 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7864 | * This function is used to get the key information |
| 7865 | */ |
| 7866 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7867 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7868 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7869 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7870 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7871 | const u8 *mac_addr, void *cookie, |
| 7872 | void (*callback)(void *cookie, struct key_params*) |
| 7873 | ) |
| 7874 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7875 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7876 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7877 | struct net_device *ndev, |
| 7878 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 7879 | void (*callback)(void *cookie, struct key_params*) |
| 7880 | ) |
| 7881 | #endif |
| 7882 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7883 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7884 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7885 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7886 | struct key_params params; |
| 7887 | |
| 7888 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7889 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7890 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7891 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7892 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7894 | memset(¶ms, 0, sizeof(params)); |
| 7895 | |
| 7896 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7897 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7898 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7899 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7901 | |
| 7902 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 7903 | { |
| 7904 | case eCSR_ENCRYPT_TYPE_NONE: |
| 7905 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 7906 | break; |
| 7907 | |
| 7908 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 7909 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 7910 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 7911 | break; |
| 7912 | |
| 7913 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 7914 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 7915 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 7916 | break; |
| 7917 | |
| 7918 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 7919 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 7920 | break; |
| 7921 | |
| 7922 | case eCSR_ENCRYPT_TYPE_AES: |
| 7923 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 7924 | break; |
| 7925 | |
| 7926 | default: |
| 7927 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 7928 | break; |
| 7929 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7930 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 7931 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7932 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 7933 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7934 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7935 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 7936 | params.seq_len = 0; |
| 7937 | params.seq = NULL; |
| 7938 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 7939 | callback(cookie, ¶ms); |
| 7940 | return 0; |
| 7941 | } |
| 7942 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7943 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7944 | static int wlan_hdd_cfg80211_get_key( |
| 7945 | struct wiphy *wiphy, |
| 7946 | struct net_device *ndev, |
| 7947 | u8 key_index, bool pairwise, |
| 7948 | const u8 *mac_addr, void *cookie, |
| 7949 | void (*callback)(void *cookie, struct key_params*) |
| 7950 | ) |
| 7951 | #else |
| 7952 | static int wlan_hdd_cfg80211_get_key( |
| 7953 | struct wiphy *wiphy, |
| 7954 | struct net_device *ndev, |
| 7955 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 7956 | void (*callback)(void *cookie, struct key_params*) |
| 7957 | ) |
| 7958 | #endif |
| 7959 | { |
| 7960 | int ret; |
| 7961 | |
| 7962 | vos_ssr_protect(__func__); |
| 7963 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7964 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 7965 | mac_addr, cookie, callback); |
| 7966 | #else |
| 7967 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 7968 | callback); |
| 7969 | #endif |
| 7970 | vos_ssr_unprotect(__func__); |
| 7971 | |
| 7972 | return ret; |
| 7973 | } |
| 7974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7975 | /* |
| 7976 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 7977 | * This function is used to delete the key information |
| 7978 | */ |
| 7979 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7980 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7981 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7982 | u8 key_index, |
| 7983 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7984 | const u8 *mac_addr |
| 7985 | ) |
| 7986 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7987 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7988 | struct net_device *ndev, |
| 7989 | u8 key_index, |
| 7990 | const u8 *mac_addr |
| 7991 | ) |
| 7992 | #endif |
| 7993 | { |
| 7994 | int status = 0; |
| 7995 | |
| 7996 | //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] | 7997 | //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] | 7998 | //it is observed that this is invalidating peer |
| 7999 | //key index whenever re-key is done. This is affecting data link. |
| 8000 | //It should be ok to ignore del_key. |
| 8001 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8002 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 8003 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8004 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 8005 | tCsrRoamSetKey setKey; |
| 8006 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8007 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8008 | ENTER(); |
| 8009 | |
| 8010 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 8011 | __func__,pAdapter->device_mode); |
| 8012 | |
| 8013 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8014 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8015 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8016 | key_index); |
| 8017 | |
| 8018 | return -EINVAL; |
| 8019 | } |
| 8020 | |
| 8021 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8022 | setKey.keyId = key_index; |
| 8023 | |
| 8024 | if (mac_addr) |
| 8025 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8026 | else |
| 8027 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 8028 | |
| 8029 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 8030 | |
| 8031 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8032 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8033 | ) |
| 8034 | { |
| 8035 | |
| 8036 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8037 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 8038 | if( pHostapdState->bssState == BSS_START) |
| 8039 | { |
| 8040 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8042 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8043 | { |
| 8044 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8045 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8046 | __LINE__, status ); |
| 8047 | } |
| 8048 | } |
| 8049 | } |
| 8050 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8051 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8052 | ) |
| 8053 | { |
| 8054 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8055 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8056 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8057 | |
| 8058 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8059 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8060 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8061 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8062 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8063 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 8064 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8065 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8066 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8067 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8069 | if ( 0 != status ) |
| 8070 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8071 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | "%s: sme_RoamSetKey failure, returned %d", |
| 8073 | __func__, status); |
| 8074 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8075 | return -EINVAL; |
| 8076 | } |
| 8077 | } |
| 8078 | } |
| 8079 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8080 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8081 | return status; |
| 8082 | } |
| 8083 | |
| 8084 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8085 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8086 | * This function is used to set the default tx key index |
| 8087 | */ |
| 8088 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8089 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8090 | struct net_device *ndev, |
| 8091 | u8 key_index, |
| 8092 | bool unicast, bool multicast) |
| 8093 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8094 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8095 | struct net_device *ndev, |
| 8096 | u8 key_index) |
| 8097 | #endif |
| 8098 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8099 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8100 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8101 | hdd_wext_state_t *pWextState; |
| 8102 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8103 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8104 | |
| 8105 | ENTER(); |
| 8106 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8107 | if ((NULL == pAdapter)) |
| 8108 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8109 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8110 | "invalid adapter"); |
| 8111 | return -EINVAL; |
| 8112 | } |
| 8113 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8114 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8115 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 8116 | pAdapter->sessionId, key_index)); |
| 8117 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8118 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8119 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8120 | |
| 8121 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 8122 | { |
| 8123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8124 | "invalid Wext state or HDD context"); |
| 8125 | return -EINVAL; |
| 8126 | } |
| 8127 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8128 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8129 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8131 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8132 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8133 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8134 | key_index); |
| 8135 | |
| 8136 | return -EINVAL; |
| 8137 | } |
| 8138 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8139 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8140 | status = wlan_hdd_validate_context(pHddCtx); |
| 8141 | |
| 8142 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8143 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8144 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8145 | "%s: HDD context is not valid", __func__); |
| 8146 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8147 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8148 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8149 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8150 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8151 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8152 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8153 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8154 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8155 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8156 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8157 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8158 | { |
| 8159 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8162 | tCsrRoamSetKey setKey; |
| 8163 | v_U32_t roamId= 0xFF; |
| 8164 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8165 | |
| 8166 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8167 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8168 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8169 | Keys->defaultIndex = (u8)key_index; |
| 8170 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8171 | setKey.keyId = key_index; |
| 8172 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8173 | |
| 8174 | vos_mem_copy(&setKey.Key[0], |
| 8175 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8176 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8177 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8178 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8179 | |
| 8180 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8181 | &pHddStaCtx->conn_info.bssId[0], |
| 8182 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8183 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8184 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 8185 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 8186 | eCSR_ENCRYPT_TYPE_WEP104) |
| 8187 | { |
| 8188 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 8189 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 8190 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 8191 | type(104) and switching encryption type to 40*/ |
| 8192 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 8193 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8194 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 8195 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8196 | } |
| 8197 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8198 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8199 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8201 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8202 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8203 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8205 | if ( 0 != status ) |
| 8206 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8208 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8209 | status); |
| 8210 | return -EINVAL; |
| 8211 | } |
| 8212 | } |
| 8213 | } |
| 8214 | |
| 8215 | /* In SoftAp mode setting key direction for default mode */ |
| 8216 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 8217 | { |
| 8218 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 8219 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 8220 | (eCSR_ENCRYPT_TYPE_AES != |
| 8221 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 8222 | ) |
| 8223 | { |
| 8224 | /* Saving key direction for default key index to TX default */ |
| 8225 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8226 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 8227 | } |
| 8228 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8230 | return status; |
| 8231 | } |
| 8232 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8233 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8234 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8235 | struct net_device *ndev, |
| 8236 | u8 key_index, |
| 8237 | bool unicast, bool multicast) |
| 8238 | #else |
| 8239 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8240 | struct net_device *ndev, |
| 8241 | u8 key_index) |
| 8242 | #endif |
| 8243 | { |
| 8244 | int ret; |
| 8245 | vos_ssr_protect(__func__); |
| 8246 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8247 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 8248 | multicast); |
| 8249 | #else |
| 8250 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 8251 | #endif |
| 8252 | vos_ssr_unprotect(__func__); |
| 8253 | |
| 8254 | return ret; |
| 8255 | } |
| 8256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8257 | /* |
| 8258 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 8259 | * This function is used to inform the BSS details to nl80211 interface. |
| 8260 | */ |
| 8261 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 8262 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 8263 | { |
| 8264 | struct net_device *dev = pAdapter->dev; |
| 8265 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 8266 | struct wiphy *wiphy = wdev->wiphy; |
| 8267 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 8268 | int chan_no; |
| 8269 | int ie_length; |
| 8270 | const char *ie; |
| 8271 | unsigned int freq; |
| 8272 | struct ieee80211_channel *chan; |
| 8273 | int rssi = 0; |
| 8274 | struct cfg80211_bss *bss = NULL; |
| 8275 | |
| 8276 | ENTER(); |
| 8277 | |
| 8278 | if( NULL == pBssDesc ) |
| 8279 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8280 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8281 | return bss; |
| 8282 | } |
| 8283 | |
| 8284 | chan_no = pBssDesc->channelId; |
| 8285 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 8286 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 8287 | |
| 8288 | if( NULL == ie ) |
| 8289 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8290 | 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] | 8291 | return bss; |
| 8292 | } |
| 8293 | |
| 8294 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 8295 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 8296 | { |
| 8297 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 8298 | } |
| 8299 | else |
| 8300 | { |
| 8301 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 8302 | } |
| 8303 | #else |
| 8304 | freq = ieee80211_channel_to_frequency(chan_no); |
| 8305 | #endif |
| 8306 | |
| 8307 | chan = __ieee80211_get_channel(wiphy, freq); |
| 8308 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 8309 | if (!chan) { |
| 8310 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 8311 | return NULL; |
| 8312 | } |
| 8313 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8314 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8315 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8316 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8317 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8318 | pBssDesc->capabilityInfo, |
| 8319 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8320 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8321 | } |
| 8322 | |
| 8323 | |
| 8324 | |
| 8325 | /* |
| 8326 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 8327 | * This function is used to inform the BSS details to nl80211 interface. |
| 8328 | */ |
| 8329 | struct cfg80211_bss* |
| 8330 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 8331 | tSirBssDescription *bss_desc |
| 8332 | ) |
| 8333 | { |
| 8334 | /* |
| 8335 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 8336 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 8337 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 8338 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 8339 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 8340 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 8341 | cfg80211_inform_bss_frame. |
| 8342 | */ |
| 8343 | struct net_device *dev = pAdapter->dev; |
| 8344 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 8345 | struct wiphy *wiphy = wdev->wiphy; |
| 8346 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 8347 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 8348 | qcom_ie_age *qie_age = NULL; |
| 8349 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 8350 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8351 | 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] | 8352 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8353 | const char *ie = |
| 8354 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 8355 | unsigned int freq; |
| 8356 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 8357 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8358 | struct cfg80211_bss *bss_status = NULL; |
| 8359 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 8360 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8361 | hdd_context_t *pHddCtx; |
| 8362 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8363 | #ifdef WLAN_OPEN_SOURCE |
| 8364 | struct timespec ts; |
| 8365 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8366 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8367 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8368 | status = wlan_hdd_validate_context(pHddCtx); |
| 8369 | |
| 8370 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8371 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8372 | { |
| 8373 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8374 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8375 | return NULL; |
| 8376 | } |
| 8377 | |
| 8378 | |
| 8379 | if (0 != status) |
| 8380 | { |
| 8381 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8382 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8383 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8384 | } |
| 8385 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 8386 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8387 | if (!mgmt) |
| 8388 | { |
| 8389 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8390 | "%s: memory allocation failed ", __func__); |
| 8391 | return NULL; |
| 8392 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8394 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8395 | |
| 8396 | #ifdef WLAN_OPEN_SOURCE |
| 8397 | /* Android does not want the timestamp from the frame. |
| 8398 | Instead it wants a monotonic increasing value */ |
| 8399 | get_monotonic_boottime(&ts); |
| 8400 | mgmt->u.probe_resp.timestamp = |
| 8401 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 8402 | #else |
| 8403 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8404 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 8405 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8406 | |
| 8407 | #endif |
| 8408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8409 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 8410 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 8411 | |
| 8412 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 8413 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 8414 | /* Assuming this is the last IE, copy at the end */ |
| 8415 | ie_length -=sizeof(qcom_ie_age); |
| 8416 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 8417 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 8418 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 8419 | qie_age->oui_1 = QCOM_OUI1; |
| 8420 | qie_age->oui_2 = QCOM_OUI2; |
| 8421 | qie_age->oui_3 = QCOM_OUI3; |
| 8422 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 8423 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 8424 | #endif |
| 8425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8426 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 8427 | if (bss_desc->fProbeRsp) |
| 8428 | { |
| 8429 | mgmt->frame_control |= |
| 8430 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 8431 | } |
| 8432 | else |
| 8433 | { |
| 8434 | mgmt->frame_control |= |
| 8435 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 8436 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8437 | |
| 8438 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8439 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8440 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 8441 | { |
| 8442 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 8443 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8444 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8445 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 8446 | |
| 8447 | { |
| 8448 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 8449 | } |
| 8450 | else |
| 8451 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8452 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 8453 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8454 | kfree(mgmt); |
| 8455 | return NULL; |
| 8456 | } |
| 8457 | #else |
| 8458 | freq = ieee80211_channel_to_frequency(chan_no); |
| 8459 | #endif |
| 8460 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8461 | /*when the band is changed on the fly using the GUI, three things are done |
| 8462 | * 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) |
| 8463 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 8464 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 8465 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 8466 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 8467 | * 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 |
| 8468 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 8469 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 8470 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 8471 | * So drop the bss and continue to next bss. |
| 8472 | */ |
| 8473 | if(chan == NULL) |
| 8474 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8475 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8476 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8477 | return NULL; |
| 8478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8479 | /*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] | 8480 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8481 | * */ |
| 8482 | if (( eConnectionState_Associated == |
| 8483 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 8484 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 8485 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 8486 | WNI_CFG_BSSID_LEN))) |
| 8487 | { |
| 8488 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 8489 | rssi = (pAdapter->rssi * 100); |
| 8490 | } |
| 8491 | else |
| 8492 | { |
| 8493 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 8494 | } |
| 8495 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8496 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 8497 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 8498 | chan->center_freq, (int)(rssi/100)); |
| 8499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8500 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 8501 | frame_len, rssi, GFP_KERNEL); |
| 8502 | kfree(mgmt); |
| 8503 | return bss_status; |
| 8504 | } |
| 8505 | |
| 8506 | /* |
| 8507 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 8508 | * This function is used to update the BSS data base of CFG8011 |
| 8509 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8510 | 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] | 8511 | tCsrRoamInfo *pRoamInfo |
| 8512 | ) |
| 8513 | { |
| 8514 | tCsrRoamConnectedProfile roamProfile; |
| 8515 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8516 | struct cfg80211_bss *bss = NULL; |
| 8517 | |
| 8518 | ENTER(); |
| 8519 | |
| 8520 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 8521 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 8522 | |
| 8523 | if (NULL != roamProfile.pBssDesc) |
| 8524 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 8525 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 8526 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8527 | |
| 8528 | if (NULL == bss) |
| 8529 | { |
| 8530 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 8531 | __func__); |
| 8532 | } |
| 8533 | |
| 8534 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 8535 | } |
| 8536 | else |
| 8537 | { |
| 8538 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 8539 | __func__); |
| 8540 | } |
| 8541 | return bss; |
| 8542 | } |
| 8543 | |
| 8544 | /* |
| 8545 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 8546 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8547 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 8548 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8549 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8550 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8551 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8552 | tCsrScanResultInfo *pScanResult; |
| 8553 | eHalStatus status = 0; |
| 8554 | tScanResultHandle pResult; |
| 8555 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8556 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8557 | |
| 8558 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8559 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8560 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8561 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 8562 | NO_SESSION, pAdapter->sessionId)); |
| 8563 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8564 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8565 | |
| 8566 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8567 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8568 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8569 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 8570 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | } |
| 8572 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8573 | |
| 8574 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8575 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8576 | { |
| 8577 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8578 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8579 | return VOS_STATUS_E_PERM; |
| 8580 | } |
| 8581 | |
| 8582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8583 | /* |
| 8584 | * start getting scan results and populate cgf80211 BSS database |
| 8585 | */ |
| 8586 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 8587 | |
| 8588 | /* no scan results */ |
| 8589 | if (NULL == pResult) |
| 8590 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8591 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 8592 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8593 | return status; |
| 8594 | } |
| 8595 | |
| 8596 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 8597 | |
| 8598 | while (pScanResult) |
| 8599 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8600 | /* |
| 8601 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 8602 | * entry already exists in bss data base of cfg80211 for that |
| 8603 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 8604 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 8605 | * mgmt packet as input. As of now there is no possibility to get |
| 8606 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8607 | * ieee80211_mgmt(probe response) and passing to c |
| 8608 | * fg80211_inform_bss_frame. |
| 8609 | * */ |
| 8610 | |
| 8611 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 8612 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8614 | |
| 8615 | if (NULL == bss_status) |
| 8616 | { |
| 8617 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8618 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8619 | } |
| 8620 | else |
| 8621 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8622 | cfg80211_put_bss( |
| 8623 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 8624 | wiphy, |
| 8625 | #endif |
| 8626 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8627 | } |
| 8628 | |
| 8629 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 8630 | } |
| 8631 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8632 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8633 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8634 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8635 | } |
| 8636 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8637 | void |
| 8638 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 8639 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8640 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 8641 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8642 | } /****** end hddPrintMacAddr() ******/ |
| 8643 | |
| 8644 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 8645 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8646 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8647 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8648 | "%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] | 8649 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 8650 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 8651 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8652 | } /****** end hddPrintPmkId() ******/ |
| 8653 | |
| 8654 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 8655 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 8656 | |
| 8657 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 8658 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 8659 | |
| 8660 | #define dump_bssid(bssid) \ |
| 8661 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8662 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 8663 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8664 | } |
| 8665 | |
| 8666 | #define dump_pmkid(pMac, pmkid) \ |
| 8667 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8668 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 8669 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8670 | } |
| 8671 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 8672 | #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] | 8673 | /* |
| 8674 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 8675 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 8676 | */ |
| 8677 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8678 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8679 | int index, bool preauth ) |
| 8680 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8681 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8682 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8683 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8684 | |
| 8685 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8686 | 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] | 8687 | |
| 8688 | if( NULL == pRoamInfo ) |
| 8689 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8690 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8691 | return -EINVAL; |
| 8692 | } |
| 8693 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8694 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 8695 | { |
| 8696 | dump_bssid(pRoamInfo->bssid); |
| 8697 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8698 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8699 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8700 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8701 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8702 | } |
| 8703 | #endif //FEATURE_WLAN_LFR |
| 8704 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 8705 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 8706 | /* |
| 8707 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 8708 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 8709 | * |
| 8710 | */ |
| 8711 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 8712 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 8713 | tCsrRoamInfo *pRoamInfo) |
| 8714 | { |
| 8715 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8716 | union iwreq_data wrqu; |
| 8717 | |
| 8718 | ENTER(); |
| 8719 | |
| 8720 | if (NULL == pAdapter) |
| 8721 | { |
| 8722 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8723 | return VOS_STATUS_E_FAILURE; |
| 8724 | } |
| 8725 | |
| 8726 | /* create the event */ |
| 8727 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8728 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8729 | |
| 8730 | wrqu.data.pointer = metrics_notification; |
| 8731 | wrqu.data.length = scnprintf(metrics_notification, |
| 8732 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 8733 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8734 | |
| 8735 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8736 | |
| 8737 | EXIT(); |
| 8738 | |
| 8739 | return VOS_STATUS_SUCCESS; |
| 8740 | } |
| 8741 | |
| 8742 | /* |
| 8743 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 8744 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 8745 | * or failure |
| 8746 | */ |
| 8747 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 8748 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 8749 | { |
| 8750 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8751 | union iwreq_data wrqu; |
| 8752 | |
| 8753 | ENTER(); |
| 8754 | |
| 8755 | if (NULL == pAdapter) |
| 8756 | { |
| 8757 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8758 | return VOS_STATUS_E_FAILURE; |
| 8759 | } |
| 8760 | |
| 8761 | /* create the event */ |
| 8762 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8763 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8764 | |
| 8765 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 8766 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 8767 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8768 | |
| 8769 | if (1 == preauth_status) |
| 8770 | strncat(metrics_notification, " TRUE", 5); |
| 8771 | else |
| 8772 | strncat(metrics_notification, " FALSE", 6); |
| 8773 | |
| 8774 | wrqu.data.pointer = metrics_notification; |
| 8775 | wrqu.data.length = strlen(metrics_notification); |
| 8776 | |
| 8777 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8778 | |
| 8779 | EXIT(); |
| 8780 | |
| 8781 | return VOS_STATUS_SUCCESS; |
| 8782 | } |
| 8783 | |
| 8784 | /* |
| 8785 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 8786 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 8787 | * |
| 8788 | */ |
| 8789 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 8790 | tCsrRoamInfo *pRoamInfo) |
| 8791 | { |
| 8792 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8793 | union iwreq_data wrqu; |
| 8794 | |
| 8795 | ENTER(); |
| 8796 | |
| 8797 | if (NULL == pAdapter) |
| 8798 | { |
| 8799 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 8800 | return VOS_STATUS_E_FAILURE; |
| 8801 | } |
| 8802 | |
| 8803 | /* create the event */ |
| 8804 | memset(&wrqu, 0, sizeof(wrqu)); |
| 8805 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 8806 | |
| 8807 | wrqu.data.pointer = metrics_notification; |
| 8808 | wrqu.data.length = scnprintf(metrics_notification, |
| 8809 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 8810 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 8811 | |
| 8812 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 8813 | |
| 8814 | EXIT(); |
| 8815 | |
| 8816 | return VOS_STATUS_SUCCESS; |
| 8817 | } |
| 8818 | #endif |
| 8819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8820 | /* |
| 8821 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 8822 | * scanning callback function, called after finishing scan |
| 8823 | * |
| 8824 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8825 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 8827 | { |
| 8828 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8829 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8830 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8831 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8832 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8833 | struct cfg80211_scan_request *req = NULL; |
| 8834 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8835 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8836 | long waitRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | |
| 8838 | ENTER(); |
| 8839 | |
| 8840 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8841 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8842 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8843 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 8844 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 8845 | pScanInfo->mScanPendingCounter = 0; |
| 8846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8847 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8848 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8849 | &pScanInfo->scan_req_completion_event, |
| 8850 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8851 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8852 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8853 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8854 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8855 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8856 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8857 | } |
| 8858 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 8859 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8860 | { |
| 8861 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8862 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8863 | } |
| 8864 | |
| 8865 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8866 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8867 | { |
| 8868 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8869 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8870 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8871 | (int) scanId); |
| 8872 | } |
| 8873 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8874 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8875 | pAdapter); |
| 8876 | |
| 8877 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8878 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8879 | |
| 8880 | |
| 8881 | /* If any client wait scan result through WEXT |
| 8882 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8883 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8884 | { |
| 8885 | /* The other scan request waiting for current scan finish |
| 8886 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8887 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8888 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8889 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8890 | } |
| 8891 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8892 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8893 | { |
| 8894 | struct net_device *dev = pAdapter->dev; |
| 8895 | union iwreq_data wrqu; |
| 8896 | int we_event; |
| 8897 | char *msg; |
| 8898 | |
| 8899 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 8900 | we_event = SIOCGIWSCAN; |
| 8901 | msg = NULL; |
| 8902 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 8903 | } |
| 8904 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 8905 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8906 | |
| 8907 | /* Get the Scan Req */ |
| 8908 | req = pAdapter->request; |
| 8909 | |
| 8910 | if (!req) |
| 8911 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8912 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 8913 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8914 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8915 | } |
| 8916 | |
| 8917 | /* |
| 8918 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8919 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8920 | req->n_ssids = 0; |
| 8921 | req->n_channels = 0; |
| 8922 | req->ie = 0; |
| 8923 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8924 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8925 | /* Scan is no longer pending */ |
| 8926 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8927 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 8928 | /* |
| 8929 | * cfg80211_scan_done informing NL80211 about completion |
| 8930 | * of scanning |
| 8931 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 8932 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 8933 | { |
| 8934 | aborted = true; |
| 8935 | } |
| 8936 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 8937 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8938 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8939 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 8940 | /* release the wake lock at the end of the scan*/ |
| 8941 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8942 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 8943 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 8944 | * immediatly after the driver gets connect request(i.e after scan) |
| 8945 | * from supplicant, this result in app's is suspending and not able |
| 8946 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 8947 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 8948 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8949 | #ifdef FEATURE_WLAN_TDLS |
c_hpothu | 3c8f8e8 | 2014-06-02 18:01:50 +0530 | [diff] [blame] | 8950 | if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) |
| 8951 | { |
| 8952 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 8953 | } |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 8954 | #endif |
| 8955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8956 | EXIT(); |
| 8957 | return 0; |
| 8958 | } |
| 8959 | |
| 8960 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8961 | * FUNCTION: hdd_isConnectionInProgress |
| 8962 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8963 | * |
| 8964 | */ |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 8965 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx, v_BOOL_t isRoC ) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8966 | { |
| 8967 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 8968 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 8969 | hdd_adapter_t *pAdapter = NULL; |
| 8970 | VOS_STATUS status = 0; |
| 8971 | v_U8_t staId = 0; |
| 8972 | v_U8_t *staMac = NULL; |
| 8973 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 8974 | if (TRUE == pHddCtx->btCoexModeSet) |
| 8975 | { |
| 8976 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8977 | FL("BTCoex Mode operation in progress")); |
| 8978 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 8979 | } |
| 8980 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 8981 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 8982 | |
| 8983 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 8984 | { |
| 8985 | pAdapter = pAdapterNode->pAdapter; |
| 8986 | |
| 8987 | if( pAdapter ) |
| 8988 | { |
| 8989 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8990 | "%s: Adapter with device mode %s (%d) exists", |
| 8991 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8992 | pAdapter->device_mode); |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 8993 | if ((((!isRoC) && (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 8994 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 8995 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 8996 | (eConnectionState_Connecting == |
| 8997 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 8998 | { |
| 8999 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9000 | "%s: %p(%d) Connection is in progress", __func__, |
| 9001 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 9002 | return VOS_TRUE; |
| 9003 | } |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9004 | if (((!isRoC) && (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9005 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9006 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9007 | { |
| 9008 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9009 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9010 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9011 | { |
| 9012 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 9013 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9014 | "%s: client " MAC_ADDRESS_STR |
| 9015 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 9016 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9017 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9018 | } |
| 9019 | } |
| 9020 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 9021 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 9022 | { |
| 9023 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 9024 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9025 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9026 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 9027 | { |
| 9028 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 9029 | |
| 9030 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9031 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 9032 | "middle of WPS/EAPOL exchange.", __func__, |
| 9033 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9034 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9035 | } |
| 9036 | } |
| 9037 | } |
| 9038 | } |
| 9039 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 9040 | pAdapterNode = pNext; |
| 9041 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9042 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9043 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9044 | |
| 9045 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9046 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9047 | * this scan respond to scan trigger and update cfg80211 scan database |
| 9048 | * later, scan dump command can be used to recieve scan results |
| 9049 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9050 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9051 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9052 | struct net_device *dev, |
| 9053 | #endif |
| 9054 | struct cfg80211_scan_request *request) |
| 9055 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9056 | hdd_adapter_t *pAdapter = NULL; |
| 9057 | hdd_context_t *pHddCtx = NULL; |
| 9058 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9059 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9060 | tCsrScanRequest scanRequest; |
| 9061 | tANI_U8 *channelList = NULL, i; |
| 9062 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9063 | int status; |
| 9064 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9065 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9066 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9067 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 9068 | struct net_device *dev = NULL; |
| 9069 | if (NULL == request) |
| 9070 | { |
| 9071 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9072 | "%s: scan req param null", __func__); |
| 9073 | return -EINVAL; |
| 9074 | } |
| 9075 | dev = request->wdev->netdev; |
| 9076 | #endif |
| 9077 | |
| 9078 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 9079 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 9080 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9081 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9082 | ENTER(); |
| 9083 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9084 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9085 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9086 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9087 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9088 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9089 | status = wlan_hdd_validate_context(pHddCtx); |
| 9090 | |
| 9091 | if (0 != status) |
| 9092 | { |
| 9093 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9094 | "%s: HDD context is not valid", __func__); |
| 9095 | return status; |
| 9096 | } |
| 9097 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9098 | if (NULL == pwextBuf) |
| 9099 | { |
| 9100 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 9101 | __func__); |
| 9102 | return -EIO; |
| 9103 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9104 | cfg_param = pHddCtx->cfg_ini; |
| 9105 | pScanInfo = &pHddCtx->scan_info; |
| 9106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9107 | #ifdef WLAN_BTAMP_FEATURE |
| 9108 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9109 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9111 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9112 | "%s: No scanning when AMP is on", __func__); |
| 9113 | return -EOPNOTSUPP; |
| 9114 | } |
| 9115 | #endif |
| 9116 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9117 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9118 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9119 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9120 | "%s: Not scanning on device_mode = %s (%d)", |
| 9121 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9122 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9123 | return -EOPNOTSUPP; |
| 9124 | } |
| 9125 | |
| 9126 | if (TRUE == pScanInfo->mScanPending) |
| 9127 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9128 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 9129 | { |
| 9130 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 9131 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9132 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9133 | } |
| 9134 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9135 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9136 | //Channel and action frame is pending |
| 9137 | //Otherwise Cancel Remain On Channel and allow Scan |
| 9138 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9139 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9140 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9141 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9142 | return -EBUSY; |
| 9143 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9144 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9145 | /* if tdls disagree scan right now, return immediately. |
| 9146 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 9147 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 9148 | */ |
| 9149 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 9150 | wiphy, |
| 9151 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9152 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 9153 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9154 | request); |
| 9155 | if(status <= 0) |
| 9156 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9157 | if(!status) |
| 9158 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 9159 | "scan rejected %d", __func__, status); |
| 9160 | else |
| 9161 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 9162 | __func__, status); |
| 9163 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9164 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9165 | } |
| 9166 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9168 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 9169 | { |
| 9170 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9171 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9172 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9174 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 9175 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9176 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | "%s: MAX TM Level Scan not allowed", __func__); |
| 9178 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9179 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9180 | } |
| 9181 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 9182 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9183 | /* Check if scan is allowed at this point of time. |
| 9184 | */ |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9185 | if (hdd_isConnectionInProgress(pHddCtx, VOS_FALSE)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9186 | { |
| 9187 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 9188 | return -EBUSY; |
| 9189 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9191 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 9192 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9193 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 9194 | (int)request->n_ssids); |
| 9195 | |
| 9196 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 9197 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 9198 | * is not aging out the scan results. |
| 9199 | */ |
| 9200 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9201 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9202 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9203 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9204 | |
| 9205 | if ((request->ssids) && (0 < request->n_ssids)) |
| 9206 | { |
| 9207 | tCsrSSIDInfo *SsidInfo; |
| 9208 | int j; |
| 9209 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 9210 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 9211 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 9212 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 9213 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 9214 | |
| 9215 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 9216 | { |
| 9217 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9218 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 9219 | return -ENOMEM; |
| 9220 | } |
| 9221 | |
| 9222 | /* copy all the ssid's and their length */ |
| 9223 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 9224 | { |
| 9225 | /* get the ssid length */ |
| 9226 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 9227 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 9228 | SsidInfo->SSID.length); |
| 9229 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 9230 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 9231 | j, SsidInfo->SSID.ssId); |
| 9232 | } |
| 9233 | /* set the scan type to active */ |
| 9234 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 9235 | } |
| 9236 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9237 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9238 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9239 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 9240 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9241 | /* set the scan type to active */ |
| 9242 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9244 | else |
| 9245 | { |
| 9246 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 9247 | scanRequest.scanType = pScanInfo->scan_mode; |
| 9248 | } |
| 9249 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 9250 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9251 | |
| 9252 | /* set BSSType to default type */ |
| 9253 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 9254 | |
| 9255 | /*TODO: scan the requested channels only*/ |
| 9256 | |
| 9257 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9258 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9259 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9260 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 9261 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 9262 | request->n_channels = MAX_CHANNEL; |
| 9263 | } |
| 9264 | |
| 9265 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9266 | "No of Scan Channels: %d", request->n_channels); |
| 9267 | |
| 9268 | |
| 9269 | if( request->n_channels ) |
| 9270 | { |
| 9271 | char chList [(request->n_channels*5)+1]; |
| 9272 | int len; |
| 9273 | channelList = vos_mem_malloc( request->n_channels ); |
| 9274 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9275 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9276 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9277 | "%s: memory alloc failed channelList", __func__); |
| 9278 | status = -ENOMEM; |
| 9279 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9280 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9281 | |
| 9282 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 9283 | { |
| 9284 | channelList[i] = request->channels[i]->hw_value; |
| 9285 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 9286 | } |
| 9287 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9288 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9289 | "Channel-List: %s ", chList); |
| 9290 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9291 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9292 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 9293 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 9294 | |
| 9295 | /* set requestType to full scan */ |
| 9296 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 9297 | |
| 9298 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 9299 | * search (Flush on both full scan and social scan but not on single |
| 9300 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 9301 | */ |
| 9302 | |
| 9303 | /* Supplicant does single channel scan after 8-way handshake |
| 9304 | * and in that case driver shoudnt flush scan results. If |
| 9305 | * driver flushes the scan results here and unfortunately if |
| 9306 | * the AP doesnt respond to our probe req then association |
| 9307 | * fails which is not desired |
| 9308 | */ |
| 9309 | |
| 9310 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 9311 | { |
| 9312 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 9313 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9314 | pAdapter->sessionId ); |
| 9315 | } |
| 9316 | |
| 9317 | if( request->ie_len ) |
| 9318 | { |
| 9319 | /* save this for future association (join requires this) */ |
| 9320 | /*TODO: Array needs to be converted to dynamic allocation, |
| 9321 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 9322 | * CR 597966 |
| 9323 | */ |
| 9324 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 9325 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 9326 | pScanInfo->scanAddIE.length = request->ie_len; |
| 9327 | |
| 9328 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9329 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9330 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9331 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9332 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9333 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9334 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 9335 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 9336 | request->ie, request->ie_len); |
| 9337 | } |
| 9338 | else |
| 9339 | { |
| 9340 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 9341 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9342 | } |
| 9343 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9344 | } |
| 9345 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 9346 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 9347 | |
| 9348 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 9349 | request->ie_len); |
| 9350 | if (pP2pIe != NULL) |
| 9351 | { |
| 9352 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9353 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 9354 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 9355 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9356 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9357 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 9358 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 9359 | "Go nego completed to Connection is started"); |
| 9360 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9361 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9362 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9363 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 9364 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9365 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9366 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 9367 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 9368 | "Disconnected state to Connection is started"); |
| 9369 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9370 | "for 4way Handshake"); |
| 9371 | } |
| 9372 | #endif |
| 9373 | |
| 9374 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 9375 | if(TRUE == request->no_cck) |
| 9376 | { |
| 9377 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9378 | "%s: This is a P2P Search", __func__); |
| 9379 | scanRequest.p2pSearch = 1; |
| 9380 | |
| 9381 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9382 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9383 | /* set requestType to P2P Discovery */ |
| 9384 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 9385 | } |
| 9386 | |
| 9387 | /* |
| 9388 | Skip Dfs Channel in case of P2P Search |
| 9389 | if it is set in ini file |
| 9390 | */ |
| 9391 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 9392 | { |
| 9393 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9394 | } |
| 9395 | else |
| 9396 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9397 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9399 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9401 | } |
| 9402 | } |
| 9403 | |
| 9404 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 9405 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9406 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 9407 | * address the following issues. |
| 9408 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 9409 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 9410 | * for long time, this result in apps running at full power for long time. |
| 9411 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 9412 | * be stuck in full power because of resume BMPS |
| 9413 | */ |
| 9414 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9415 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9416 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9417 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9418 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 9419 | scanRequest.requestType, scanRequest.scanType, |
| 9420 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9421 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 9422 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9423 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9424 | pAdapter->sessionId, &scanRequest, &scanId, |
| 9425 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9427 | if (eHAL_STATUS_SUCCESS != status) |
| 9428 | { |
| 9429 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9430 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 9431 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9432 | if(eHAL_STATUS_RESOURCES == status) |
| 9433 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9434 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 9435 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9436 | status = -EBUSY; |
| 9437 | } else { |
| 9438 | status = -EIO; |
| 9439 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9440 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9441 | goto free_mem; |
| 9442 | } |
| 9443 | |
| 9444 | pScanInfo->mScanPending = TRUE; |
| 9445 | pAdapter->request = request; |
| 9446 | pScanInfo->scanId = scanId; |
| 9447 | |
| 9448 | complete(&pScanInfo->scan_req_completion_event); |
| 9449 | |
| 9450 | free_mem: |
| 9451 | if( scanRequest.SSIDs.SSIDList ) |
| 9452 | { |
| 9453 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 9454 | } |
| 9455 | |
| 9456 | if( channelList ) |
| 9457 | vos_mem_free( channelList ); |
| 9458 | |
| 9459 | EXIT(); |
| 9460 | |
| 9461 | return status; |
| 9462 | } |
| 9463 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9464 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 9465 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9466 | struct net_device *dev, |
| 9467 | #endif |
| 9468 | struct cfg80211_scan_request *request) |
| 9469 | { |
| 9470 | int ret; |
| 9471 | |
| 9472 | vos_ssr_protect(__func__); |
| 9473 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 9474 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9475 | dev, |
| 9476 | #endif |
| 9477 | request); |
| 9478 | vos_ssr_unprotect(__func__); |
| 9479 | |
| 9480 | return ret; |
| 9481 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9482 | |
| 9483 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 9484 | { |
| 9485 | v_U8_t iniDot11Mode = |
| 9486 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 9487 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 9488 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9489 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 9490 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9491 | switch ( iniDot11Mode ) |
| 9492 | { |
| 9493 | case eHDD_DOT11_MODE_AUTO: |
| 9494 | case eHDD_DOT11_MODE_11ac: |
| 9495 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 9496 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 9497 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 9498 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 9499 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 9500 | else |
| 9501 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9502 | #else |
| 9503 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9504 | #endif |
| 9505 | break; |
| 9506 | case eHDD_DOT11_MODE_11n: |
| 9507 | case eHDD_DOT11_MODE_11n_ONLY: |
| 9508 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9509 | break; |
| 9510 | default: |
| 9511 | hddDot11Mode = iniDot11Mode; |
| 9512 | break; |
| 9513 | } |
| 9514 | /* This call decides required channel bonding mode */ |
| 9515 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 9516 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 9517 | operationChannel); |
| 9518 | } |
| 9519 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9520 | /* |
| 9521 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9522 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9523 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9524 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9525 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9526 | { |
| 9527 | int status = 0; |
| 9528 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9529 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9530 | v_U32_t roamId; |
| 9531 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | eCsrAuthType RSNAuthType; |
| 9533 | |
| 9534 | ENTER(); |
| 9535 | |
| 9536 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9537 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9538 | |
| 9539 | status = wlan_hdd_validate_context(pHddCtx); |
| 9540 | if (status) |
| 9541 | { |
| 9542 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9543 | "%s: HDD context is not valid!", __func__); |
| 9544 | return status; |
| 9545 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9547 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 9548 | { |
| 9549 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 9550 | return -EINVAL; |
| 9551 | } |
| 9552 | |
| 9553 | pRoamProfile = &pWextState->roamProfile; |
| 9554 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9555 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9556 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9557 | hdd_station_ctx_t *pHddStaCtx; |
| 9558 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9559 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9560 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9561 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 9562 | { |
| 9563 | /*QoS not enabled in cfg file*/ |
| 9564 | pRoamProfile->uapsd_mask = 0; |
| 9565 | } |
| 9566 | else |
| 9567 | { |
| 9568 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9569 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9570 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 9571 | } |
| 9572 | |
| 9573 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 9574 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 9575 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9576 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9577 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 9578 | ssid, ssid_len); |
| 9579 | |
| 9580 | if (bssid) |
| 9581 | { |
| 9582 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 9583 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 9584 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9585 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 9586 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9587 | case of join failure we should send valid BSSID to supplicant |
| 9588 | */ |
| 9589 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 9590 | WNI_CFG_BSSID_LEN); |
| 9591 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 9592 | else |
| 9593 | { |
| 9594 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 9595 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9596 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9597 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 9598 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9599 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 9600 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9601 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9602 | /*set gen ie*/ |
| 9603 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 9604 | /*set auth*/ |
| 9605 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 9606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | #ifdef FEATURE_WLAN_WAPI |
| 9608 | if (pAdapter->wapi_info.nWapiMode) |
| 9609 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9610 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9611 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 9612 | { |
| 9613 | case WAPI_AUTH_MODE_PSK: |
| 9614 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9615 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9616 | pAdapter->wapi_info.wapiAuthMode); |
| 9617 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 9618 | break; |
| 9619 | } |
| 9620 | case WAPI_AUTH_MODE_CERT: |
| 9621 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9622 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9623 | pAdapter->wapi_info.wapiAuthMode); |
| 9624 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 9625 | break; |
| 9626 | } |
| 9627 | } // End of switch |
| 9628 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 9629 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 9630 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9631 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9632 | pRoamProfile->AuthType.numEntries = 1; |
| 9633 | pRoamProfile->EncryptionType.numEntries = 1; |
| 9634 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9635 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 9636 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9637 | } |
| 9638 | } |
| 9639 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9640 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9641 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9642 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9643 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 9644 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9645 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 9646 | sizeof (tSirGtkOffloadParams)); |
| 9647 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9648 | } |
| 9649 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9650 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 9651 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9652 | if( operatingChannel ) |
| 9653 | { |
| 9654 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 9655 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9656 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9657 | else |
| 9658 | { |
| 9659 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9660 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9661 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9662 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 9663 | { |
| 9664 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 9665 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9666 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9667 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 9668 | * 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] | 9669 | * 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] | 9670 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9671 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 9672 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9673 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9674 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9675 | { |
| 9676 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9677 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 9678 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9679 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 9680 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9681 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9682 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9683 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 9684 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9685 | if ((eHAL_STATUS_SUCCESS != status) && |
| 9686 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9687 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9688 | |
| 9689 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9690 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 9691 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 9692 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9693 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9694 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9695 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9696 | |
| 9697 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9698 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9699 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9700 | } |
| 9701 | else |
| 9702 | { |
| 9703 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 9704 | return -EINVAL; |
| 9705 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9706 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9707 | return status; |
| 9708 | } |
| 9709 | |
| 9710 | /* |
| 9711 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 9712 | * This function is used to set the authentication type (OPEN/SHARED). |
| 9713 | * |
| 9714 | */ |
| 9715 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 9716 | enum nl80211_auth_type auth_type) |
| 9717 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9718 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9719 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9720 | |
| 9721 | ENTER(); |
| 9722 | |
| 9723 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9724 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9725 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9726 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9727 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9728 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 9729 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 9730 | break; |
| 9731 | |
| 9732 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9733 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9734 | case NL80211_AUTHTYPE_FT: |
| 9735 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9736 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9737 | "%s: set authentication type to OPEN", __func__); |
| 9738 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 9739 | break; |
| 9740 | |
| 9741 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9742 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9743 | "%s: set authentication type to SHARED", __func__); |
| 9744 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 9745 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9746 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9747 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9748 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9749 | "%s: set authentication type to CCKM WPA", __func__); |
| 9750 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 9751 | break; |
| 9752 | #endif |
| 9753 | |
| 9754 | |
| 9755 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9757 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9758 | auth_type); |
| 9759 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 9760 | return -EINVAL; |
| 9761 | } |
| 9762 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9763 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9764 | pHddStaCtx->conn_info.authType; |
| 9765 | return 0; |
| 9766 | } |
| 9767 | |
| 9768 | /* |
| 9769 | * FUNCTION: wlan_hdd_set_akm_suite |
| 9770 | * This function is used to set the key mgmt type(PSK/8021x). |
| 9771 | * |
| 9772 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9773 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9774 | u32 key_mgmt |
| 9775 | ) |
| 9776 | { |
| 9777 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9778 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9780 | /*set key mgmt type*/ |
| 9781 | switch(key_mgmt) |
| 9782 | { |
| 9783 | case WLAN_AKM_SUITE_PSK: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 9784 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9785 | case WLAN_AKM_SUITE_FT_PSK: |
| 9786 | #endif |
| 9787 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9788 | __func__); |
| 9789 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 9790 | break; |
| 9791 | |
| 9792 | case WLAN_AKM_SUITE_8021X: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 9793 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9794 | case WLAN_AKM_SUITE_FT_8021X: |
| 9795 | #endif |
| 9796 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9797 | __func__); |
| 9798 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 9799 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9800 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9801 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 9802 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 9803 | case WLAN_AKM_SUITE_CCKM: |
| 9804 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 9805 | __func__); |
| 9806 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 9807 | break; |
| 9808 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 9809 | #ifndef WLAN_AKM_SUITE_OSEN |
| 9810 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 9811 | case WLAN_AKM_SUITE_OSEN: |
| 9812 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 9813 | __func__); |
| 9814 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 9815 | break; |
| 9816 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9817 | |
| 9818 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9819 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9820 | __func__, key_mgmt); |
| 9821 | return -EINVAL; |
| 9822 | |
| 9823 | } |
| 9824 | return 0; |
| 9825 | } |
| 9826 | |
| 9827 | /* |
| 9828 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9829 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9830 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 9831 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9832 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 9833 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9834 | bool ucast |
| 9835 | ) |
| 9836 | { |
| 9837 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9838 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9839 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9840 | |
| 9841 | ENTER(); |
| 9842 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9843 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9844 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9845 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9846 | __func__, cipher); |
| 9847 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 9848 | } |
| 9849 | else |
| 9850 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9851 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9852 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9853 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9854 | { |
| 9855 | case IW_AUTH_CIPHER_NONE: |
| 9856 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 9857 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9859 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9860 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9863 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9864 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9865 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9867 | case WLAN_CIPHER_SUITE_TKIP: |
| 9868 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 9869 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9871 | case WLAN_CIPHER_SUITE_CCMP: |
| 9872 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 9873 | break; |
| 9874 | #ifdef FEATURE_WLAN_WAPI |
| 9875 | case WLAN_CIPHER_SUITE_SMS4: |
| 9876 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 9877 | break; |
| 9878 | #endif |
| 9879 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9880 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | case WLAN_CIPHER_SUITE_KRK: |
| 9882 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 9883 | break; |
| 9884 | #endif |
| 9885 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9886 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9887 | __func__, cipher); |
| 9888 | return -EOPNOTSUPP; |
| 9889 | } |
| 9890 | } |
| 9891 | |
| 9892 | if (ucast) |
| 9893 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9894 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9895 | __func__, encryptionType); |
| 9896 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 9897 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9898 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9899 | encryptionType; |
| 9900 | } |
| 9901 | else |
| 9902 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9903 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9904 | __func__, encryptionType); |
| 9905 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 9906 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 9907 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 9908 | } |
| 9909 | |
| 9910 | return 0; |
| 9911 | } |
| 9912 | |
| 9913 | |
| 9914 | /* |
| 9915 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 9916 | * This function is used to parse WPA/RSN IE's. |
| 9917 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9918 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 9919 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9920 | size_t ie_len |
| 9921 | ) |
| 9922 | { |
| 9923 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9924 | u8 *genie = ie; |
| 9925 | v_U16_t remLen = ie_len; |
| 9926 | #ifdef FEATURE_WLAN_WAPI |
| 9927 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 9928 | u16 *tmp; |
| 9929 | v_U16_t akmsuiteCount; |
| 9930 | int *akmlist; |
| 9931 | #endif |
| 9932 | ENTER(); |
| 9933 | |
| 9934 | /* clear previous assocAddIE */ |
| 9935 | pWextState->assocAddIE.length = 0; |
| 9936 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 9937 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9938 | |
| 9939 | while (remLen >= 2) |
| 9940 | { |
| 9941 | v_U16_t eLen = 0; |
| 9942 | v_U8_t elementId; |
| 9943 | elementId = *genie++; |
| 9944 | eLen = *genie++; |
| 9945 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9946 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9947 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9948 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9949 | |
| 9950 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9952 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 9953 | 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] | 9954 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9955 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | "%s: Invalid WPA IE", __func__); |
| 9957 | return -EINVAL; |
| 9958 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9959 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9960 | { |
| 9961 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9962 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9963 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9965 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9966 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9967 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 9968 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9969 | VOS_ASSERT(0); |
| 9970 | return -ENOMEM; |
| 9971 | } |
| 9972 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 9973 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 9974 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 9977 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 9978 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 9979 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9980 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 9981 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9982 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 9983 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 9984 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 9985 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 9986 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 9987 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9988 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 9989 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9990 | { |
| 9991 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9992 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9993 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9995 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 9996 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 9997 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 9998 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9999 | VOS_ASSERT(0); |
| 10000 | return -ENOMEM; |
| 10001 | } |
| 10002 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 10003 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10004 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10006 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10007 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10008 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10009 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10010 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 10011 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10012 | /*Consider WFD IE, only for P2P Client */ |
| 10013 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 10014 | { |
| 10015 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10016 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10017 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10019 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10020 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10021 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10022 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10023 | VOS_ASSERT(0); |
| 10024 | return -ENOMEM; |
| 10025 | } |
| 10026 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 10027 | // WPS IE + P2P IE + WFD IE |
| 10028 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10029 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10030 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10031 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10032 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10033 | } |
| 10034 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10035 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10036 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10037 | HS20_OUI_TYPE_SIZE)) ) |
| 10038 | { |
| 10039 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10040 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10041 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10042 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10043 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10044 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10045 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10046 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10047 | VOS_ASSERT(0); |
| 10048 | return -ENOMEM; |
| 10049 | } |
| 10050 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10051 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10052 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10053 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10054 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10055 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10056 | /* Appending OSEN Information Element in Assiciation Request */ |
| 10057 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 10058 | OSEN_OUI_TYPE_SIZE)) ) |
| 10059 | { |
| 10060 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 10061 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 10062 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10063 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10064 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10065 | { |
| 10066 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10067 | "Need bigger buffer space"); |
| 10068 | VOS_ASSERT(0); |
| 10069 | return -ENOMEM; |
| 10070 | } |
| 10071 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10072 | pWextState->assocAddIE.length += eLen + 2; |
| 10073 | |
| 10074 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 10075 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10076 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10077 | } |
| 10078 | |
| 10079 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 10080 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 10081 | |
| 10082 | /* populating as ADDIE in beacon frames */ |
| 10083 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10084 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 10085 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 10086 | { |
| 10087 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10088 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 10089 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10090 | { |
| 10091 | hddLog(LOGE, |
| 10092 | "Coldn't pass " |
| 10093 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 10094 | } |
| 10095 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 10096 | else |
| 10097 | hddLog(LOGE, |
| 10098 | "Could not pass on " |
| 10099 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 10100 | |
| 10101 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 10102 | beaconIE's need to be populated in probe response frames */ |
| 10103 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 10104 | { |
| 10105 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 10106 | u8 probe_rsp_ie_len[3] = {0}; |
| 10107 | u8 counter = 0; |
| 10108 | |
| 10109 | /* Check Probe Resp Length if it is greater then 255 then |
| 10110 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 10111 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 10112 | not able Store More then 255 bytes into One Variable */ |
| 10113 | |
| 10114 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 10115 | { |
| 10116 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 10117 | { |
| 10118 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 10119 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 10120 | } |
| 10121 | else |
| 10122 | { |
| 10123 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 10124 | rem_probe_resp_ie_len = 0; |
| 10125 | } |
| 10126 | } |
| 10127 | |
| 10128 | rem_probe_resp_ie_len = 0; |
| 10129 | |
| 10130 | if (probe_rsp_ie_len[0] > 0) |
| 10131 | { |
| 10132 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10133 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 10134 | (tANI_U8*)(genie - 2), |
| 10135 | probe_rsp_ie_len[0], NULL, |
| 10136 | eANI_BOOLEAN_FALSE) |
| 10137 | == eHAL_STATUS_FAILURE) |
| 10138 | { |
| 10139 | hddLog(LOGE, |
| 10140 | "Could not pass" |
| 10141 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 10142 | } |
| 10143 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 10144 | } |
| 10145 | |
| 10146 | if (probe_rsp_ie_len[1] > 0) |
| 10147 | { |
| 10148 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10149 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 10150 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10151 | probe_rsp_ie_len[1], NULL, |
| 10152 | eANI_BOOLEAN_FALSE) |
| 10153 | == eHAL_STATUS_FAILURE) |
| 10154 | { |
| 10155 | hddLog(LOGE, |
| 10156 | "Could not pass" |
| 10157 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 10158 | } |
| 10159 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 10160 | } |
| 10161 | |
| 10162 | if (probe_rsp_ie_len[2] > 0) |
| 10163 | { |
| 10164 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10165 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 10166 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10167 | probe_rsp_ie_len[2], NULL, |
| 10168 | eANI_BOOLEAN_FALSE) |
| 10169 | == eHAL_STATUS_FAILURE) |
| 10170 | { |
| 10171 | hddLog(LOGE, |
| 10172 | "Could not pass" |
| 10173 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 10174 | } |
| 10175 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 10176 | } |
| 10177 | |
| 10178 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10179 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 10180 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10181 | { |
| 10182 | hddLog(LOGE, |
| 10183 | "Could not pass" |
| 10184 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 10185 | } |
| 10186 | } |
| 10187 | else |
| 10188 | { |
| 10189 | // Reset WNI_CFG_PROBE_RSP Flags |
| 10190 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 10191 | |
| 10192 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10193 | "%s: No Probe Response IE received in set beacon", |
| 10194 | __func__); |
| 10195 | } |
| 10196 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10197 | break; |
| 10198 | case DOT11F_EID_RSN: |
| 10199 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 10200 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 10201 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 10202 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 10203 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 10204 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10205 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 10206 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10207 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10208 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10209 | 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] | 10210 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10211 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10212 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10213 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10214 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10215 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10216 | VOS_ASSERT(0); |
| 10217 | return -ENOMEM; |
| 10218 | } |
| 10219 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10220 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10221 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10222 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10223 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10224 | break; |
| 10225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10226 | #ifdef FEATURE_WLAN_WAPI |
| 10227 | case WLAN_EID_WAPI: |
| 10228 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 10229 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10230 | pAdapter->wapi_info.nWapiMode); |
| 10231 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10232 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 10234 | tmp = tmp + 1; |
| 10235 | akmlist = (int *)(tmp); |
| 10236 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 10237 | { |
| 10238 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 10239 | } |
| 10240 | else |
| 10241 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10242 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10243 | VOS_ASSERT(0); |
| 10244 | return -EINVAL; |
| 10245 | } |
| 10246 | |
| 10247 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 10248 | { |
| 10249 | 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] | 10250 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10251 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10253 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10254 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10255 | 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] | 10256 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10257 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 10258 | } |
| 10259 | break; |
| 10260 | #endif |
| 10261 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10262 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10264 | /* when Unknown IE is received we should break and continue |
| 10265 | * to the next IE in the buffer instead we were returning |
| 10266 | * so changing this to break */ |
| 10267 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | } |
| 10269 | genie += eLen; |
| 10270 | remLen -= eLen; |
| 10271 | } |
| 10272 | EXIT(); |
| 10273 | return 0; |
| 10274 | } |
| 10275 | |
| 10276 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 10277 | * FUNCTION: hdd_isWPAIEPresent |
| 10278 | * Parse the received IE to find the WPA IE |
| 10279 | * |
| 10280 | */ |
| 10281 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 10282 | { |
| 10283 | v_U8_t eLen = 0; |
| 10284 | v_U16_t remLen = ie_len; |
| 10285 | v_U8_t elementId = 0; |
| 10286 | |
| 10287 | while (remLen >= 2) |
| 10288 | { |
| 10289 | elementId = *ie++; |
| 10290 | eLen = *ie++; |
| 10291 | remLen -= 2; |
| 10292 | if (eLen > remLen) |
| 10293 | { |
| 10294 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10295 | "%s: IE length is wrong %d", __func__, eLen); |
| 10296 | return FALSE; |
| 10297 | } |
| 10298 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 10299 | { |
| 10300 | /* OUI - 0x00 0X50 0XF2 |
| 10301 | WPA Information Element - 0x01 |
| 10302 | WPA version - 0x01*/ |
| 10303 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 10304 | return TRUE; |
| 10305 | } |
| 10306 | ie += eLen; |
| 10307 | remLen -= eLen; |
| 10308 | } |
| 10309 | return FALSE; |
| 10310 | } |
| 10311 | |
| 10312 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10313 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10314 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10315 | * parameters during connect operation. |
| 10316 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10317 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10318 | struct cfg80211_connect_params *req |
| 10319 | ) |
| 10320 | { |
| 10321 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10322 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10323 | ENTER(); |
| 10324 | |
| 10325 | /*set wpa version*/ |
| 10326 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 10327 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10328 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10329 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 10330 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10331 | { |
| 10332 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 10333 | } |
| 10334 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 10335 | { |
| 10336 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 10337 | } |
| 10338 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10339 | |
| 10340 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10341 | pWextState->wpaVersion); |
| 10342 | |
| 10343 | /*set authentication type*/ |
| 10344 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 10345 | |
| 10346 | if (0 > status) |
| 10347 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10348 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10349 | "%s: failed to set authentication type ", __func__); |
| 10350 | return status; |
| 10351 | } |
| 10352 | |
| 10353 | /*set key mgmt type*/ |
| 10354 | if (req->crypto.n_akm_suites) |
| 10355 | { |
| 10356 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 10357 | if (0 > status) |
| 10358 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10359 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10360 | __func__); |
| 10361 | return status; |
| 10362 | } |
| 10363 | } |
| 10364 | |
| 10365 | /*set pairwise cipher type*/ |
| 10366 | if (req->crypto.n_ciphers_pairwise) |
| 10367 | { |
| 10368 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 10369 | req->crypto.ciphers_pairwise[0], true); |
| 10370 | if (0 > status) |
| 10371 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10372 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10373 | "%s: failed to set unicast cipher type", __func__); |
| 10374 | return status; |
| 10375 | } |
| 10376 | } |
| 10377 | else |
| 10378 | { |
| 10379 | /*Reset previous cipher suite to none*/ |
| 10380 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 10381 | if (0 > status) |
| 10382 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10383 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10384 | "%s: failed to set unicast cipher type", __func__); |
| 10385 | return status; |
| 10386 | } |
| 10387 | } |
| 10388 | |
| 10389 | /*set group cipher type*/ |
| 10390 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 10391 | false); |
| 10392 | |
| 10393 | if (0 > status) |
| 10394 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10395 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10396 | __func__); |
| 10397 | return status; |
| 10398 | } |
| 10399 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10400 | #ifdef WLAN_FEATURE_11W |
| 10401 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 10402 | #endif |
| 10403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10404 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 10405 | if (req->ie_len) |
| 10406 | { |
| 10407 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 10408 | if ( 0 > status) |
| 10409 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10410 | 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] | 10411 | __func__); |
| 10412 | return status; |
| 10413 | } |
| 10414 | } |
| 10415 | |
| 10416 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10417 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10418 | { |
| 10419 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 10420 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 10421 | ) |
| 10422 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10423 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10424 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 10425 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10426 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10427 | __func__); |
| 10428 | return -EOPNOTSUPP; |
| 10429 | } |
| 10430 | else |
| 10431 | { |
| 10432 | u8 key_len = req->key_len; |
| 10433 | u8 key_idx = req->key_idx; |
| 10434 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10435 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10436 | && (CSR_MAX_NUM_KEY > key_idx) |
| 10437 | ) |
| 10438 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10439 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10440 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10441 | __func__, key_idx, key_len); |
| 10442 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10443 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10444 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10445 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10446 | (u8)key_len; |
| 10447 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 10448 | } |
| 10449 | } |
| 10450 | } |
| 10451 | } |
| 10452 | |
| 10453 | return status; |
| 10454 | } |
| 10455 | |
| 10456 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10457 | * FUNCTION: wlan_hdd_try_disconnect |
| 10458 | * This function is used to disconnect from previous |
| 10459 | * connection |
| 10460 | */ |
| 10461 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 10462 | { |
| 10463 | long ret = 0; |
| 10464 | hdd_station_ctx_t *pHddStaCtx; |
| 10465 | eMib_dot11DesiredBssType connectedBssType; |
| 10466 | |
| 10467 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10468 | |
| 10469 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 10470 | |
| 10471 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 10472 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 10473 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 10474 | { |
| 10475 | /* Issue disconnect to CSR */ |
| 10476 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10477 | if( eHAL_STATUS_SUCCESS == |
| 10478 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10479 | pAdapter->sessionId, |
| 10480 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 10481 | { |
| 10482 | ret = wait_for_completion_interruptible_timeout( |
| 10483 | &pAdapter->disconnect_comp_var, |
| 10484 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10485 | if (0 >= ret) |
| 10486 | { |
| 10487 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10488 | return -EALREADY; |
| 10489 | } |
| 10490 | } |
| 10491 | } |
| 10492 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 10493 | { |
| 10494 | ret = wait_for_completion_interruptible_timeout( |
| 10495 | &pAdapter->disconnect_comp_var, |
| 10496 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10497 | if (0 >= ret) |
| 10498 | { |
| 10499 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10500 | return -EALREADY; |
| 10501 | } |
| 10502 | } |
| 10503 | |
| 10504 | return 0; |
| 10505 | } |
| 10506 | |
| 10507 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10508 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 10509 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10510 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10511 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10512 | struct net_device *ndev, |
| 10513 | struct cfg80211_connect_params *req |
| 10514 | ) |
| 10515 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10516 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10517 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10518 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 10519 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10520 | |
| 10521 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10522 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10523 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10524 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 10525 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10526 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10527 | "%s: device_mode = %s (%d)", __func__, |
| 10528 | hdd_device_modetoString(pAdapter->device_mode), |
| 10529 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10530 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10531 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10532 | if (!pHddCtx) |
| 10533 | { |
| 10534 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10535 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10536 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10537 | } |
| 10538 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10539 | status = wlan_hdd_validate_context(pHddCtx); |
| 10540 | |
| 10541 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10542 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10543 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10544 | "%s: HDD context is not valid", __func__); |
| 10545 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10546 | } |
| 10547 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10548 | if (vos_max_concurrent_connections_reached()) { |
| 10549 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10550 | return -ECONNREFUSED; |
| 10551 | } |
| 10552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10553 | #ifdef WLAN_BTAMP_FEATURE |
| 10554 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10555 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10556 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10557 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10558 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 10559 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | } |
| 10561 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10562 | |
| 10563 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 10564 | //P2P Mode will be taken care in Open/close adapter |
| 10565 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10566 | (vos_concurrent_open_sessions_running())) { |
| 10567 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 10568 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10569 | } |
| 10570 | |
| 10571 | /*Try disconnecting if already in connected state*/ |
| 10572 | status = wlan_hdd_try_disconnect(pAdapter); |
| 10573 | if ( 0 > status) |
| 10574 | { |
| 10575 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 10576 | " connection")); |
| 10577 | return -EALREADY; |
| 10578 | } |
| 10579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10580 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10581 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10582 | |
| 10583 | if ( 0 > status) |
| 10584 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10585 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10586 | __func__); |
| 10587 | return status; |
| 10588 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10589 | if ( req->channel ) |
| 10590 | { |
| 10591 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 10592 | req->ssid_len, req->bssid, |
| 10593 | req->channel->hw_value); |
| 10594 | } |
| 10595 | else |
| 10596 | { |
| 10597 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10598 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10600 | |
| 10601 | if (0 > status) |
| 10602 | { |
| 10603 | //ReEnable BMPS if disabled |
| 10604 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 10605 | (NULL != pHddCtx)) |
| 10606 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 10607 | if (pHddCtx->hdd_wlan_suspended) |
| 10608 | { |
| 10609 | hdd_set_pwrparams(pHddCtx); |
| 10610 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10611 | //ReEnable Bmps and Imps back |
| 10612 | hdd_enable_bmps_imps(pHddCtx); |
| 10613 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10614 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10615 | return status; |
| 10616 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10617 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10618 | EXIT(); |
| 10619 | return status; |
| 10620 | } |
| 10621 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10622 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 10623 | struct net_device *ndev, |
| 10624 | struct cfg80211_connect_params *req) |
| 10625 | { |
| 10626 | int ret; |
| 10627 | vos_ssr_protect(__func__); |
| 10628 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 10629 | vos_ssr_unprotect(__func__); |
| 10630 | |
| 10631 | return ret; |
| 10632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10633 | |
| 10634 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10635 | * FUNCTION: wlan_hdd_disconnect |
| 10636 | * This function is used to issue a disconnect request to SME |
| 10637 | */ |
| 10638 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 10639 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10640 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10641 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10642 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10643 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10644 | |
| 10645 | status = wlan_hdd_validate_context(pHddCtx); |
| 10646 | |
| 10647 | if (0 != status) |
| 10648 | { |
| 10649 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10650 | "%s: HDD context is not valid", __func__); |
| 10651 | return status; |
| 10652 | } |
| 10653 | |
| 10654 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10655 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10656 | /* Need to apply spin lock before decreasing active sessions |
| 10657 | * as there can be chance for double decrement if context switch |
| 10658 | * Calls hdd_DisConnectHandler. |
| 10659 | */ |
| 10660 | |
| 10661 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10662 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 10663 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10664 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 10665 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10666 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 10667 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10668 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10669 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10670 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 10671 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10672 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10673 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 10674 | /* |
| 10675 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 10676 | * tx has to be disabled because the firmware can get busy dropping |
| 10677 | * the tx frames after BSS/STA has been deleted and will not send |
| 10678 | * back a response resulting in WDI timeout |
| 10679 | */ |
| 10680 | netif_tx_disable(pAdapter->dev); |
| 10681 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10682 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 10683 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10684 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10685 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10686 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 10687 | { |
| 10688 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10689 | FL("status = %d, already disconnected"), |
| 10690 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10691 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10692 | } |
| 10693 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10694 | { |
| 10695 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10696 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10697 | __func__, (int)status ); |
| 10698 | return -EINVAL; |
| 10699 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10700 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10701 | &pAdapter->disconnect_comp_var, |
| 10702 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10703 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10704 | { |
| 10705 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10706 | "%s: Failed to disconnect, timed out", __func__); |
| 10707 | return -ETIMEDOUT; |
| 10708 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10709 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10710 | { |
| 10711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10712 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10713 | return ret; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10714 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10715 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10716 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 10717 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 10718 | |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10719 | return 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10720 | } |
| 10721 | |
| 10722 | |
| 10723 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10724 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10725 | * This function is used to issue a disconnect request to SME |
| 10726 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10727 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10728 | struct net_device *dev, |
| 10729 | u16 reason |
| 10730 | ) |
| 10731 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10732 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10733 | tCsrRoamProfile *pRoamProfile = |
| 10734 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10735 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10736 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10737 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10738 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10739 | tANI_U8 staIdx; |
| 10740 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10742 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10743 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10744 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10745 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 10746 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10747 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 10748 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10749 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10750 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10751 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 10752 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10753 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10754 | status = wlan_hdd_validate_context(pHddCtx); |
| 10755 | |
| 10756 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10757 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10759 | "%s: HDD context is not valid", __func__); |
| 10760 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10761 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10763 | if (NULL != pRoamProfile) |
| 10764 | { |
| 10765 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 10766 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 10767 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10769 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10770 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10771 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10772 | switch(reason) |
| 10773 | { |
| 10774 | case WLAN_REASON_MIC_FAILURE: |
| 10775 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 10776 | break; |
| 10777 | |
| 10778 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 10779 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 10780 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 10781 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 10782 | break; |
| 10783 | |
| 10784 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 10785 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 10786 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10787 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 10788 | break; |
| 10789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10790 | default: |
| 10791 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 10792 | break; |
| 10793 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10794 | pScanInfo = &pHddCtx->scan_info; |
| 10795 | if (pScanInfo->mScanPending) |
| 10796 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 10797 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10798 | "Aborting Scan"); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 10799 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 10800 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 10801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10802 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10803 | #ifdef FEATURE_WLAN_TDLS |
| 10804 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10805 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10806 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10807 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 10808 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10809 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10810 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10811 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 10812 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10813 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10814 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10815 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10816 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 10817 | pAdapter->sessionId, |
| 10818 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 10819 | } |
| 10820 | } |
| 10821 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10822 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10823 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 10824 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10825 | { |
| 10826 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10827 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10828 | __func__, (int)status ); |
| 10829 | return -EINVAL; |
| 10830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10831 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 10832 | else |
| 10833 | { |
| 10834 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 10835 | "called while in %d state", __func__, |
| 10836 | pHddStaCtx->conn_info.connState); |
| 10837 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10838 | } |
| 10839 | else |
| 10840 | { |
| 10841 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 10842 | } |
| 10843 | |
| 10844 | return status; |
| 10845 | } |
| 10846 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10847 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 10848 | struct net_device *dev, |
| 10849 | u16 reason |
| 10850 | ) |
| 10851 | { |
| 10852 | int ret; |
| 10853 | vos_ssr_protect(__func__); |
| 10854 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 10855 | vos_ssr_unprotect(__func__); |
| 10856 | |
| 10857 | return ret; |
| 10858 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10860 | /* |
| 10861 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10862 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10863 | * settings in IBSS mode. |
| 10864 | */ |
| 10865 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10866 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10867 | struct cfg80211_ibss_params *params |
| 10868 | ) |
| 10869 | { |
| 10870 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10871 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10872 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10873 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10875 | ENTER(); |
| 10876 | |
| 10877 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 10878 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10879 | |
| 10880 | if (params->ie_len && ( NULL != params->ie) ) |
| 10881 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10882 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 10883 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10884 | { |
| 10885 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 10886 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 10887 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10888 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10889 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10890 | tDot11fIEWPA dot11WPAIE; |
| 10891 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10892 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10893 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 10894 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10895 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 10896 | params->ie_len, DOT11F_EID_WPA); |
| 10897 | if ( NULL != ie ) |
| 10898 | { |
| 10899 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 10900 | // Unpack the WPA IE |
| 10901 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 10902 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 10903 | &ie[2+4], |
| 10904 | ie[1] - 4, |
| 10905 | &dot11WPAIE); |
| 10906 | /*Extract the multicast cipher, the encType for unicast |
| 10907 | cipher for wpa-none is none*/ |
| 10908 | encryptionType = |
| 10909 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 10910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10911 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 10912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10913 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 10914 | |
| 10915 | if (0 > status) |
| 10916 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10917 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10918 | __func__); |
| 10919 | return status; |
| 10920 | } |
| 10921 | } |
| 10922 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10923 | pWextState->roamProfile.AuthType.authType[0] = |
| 10924 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10925 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 10926 | |
| 10927 | if (params->privacy) |
| 10928 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10929 | /* Security enabled IBSS, At this time there is no information available |
| 10930 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10931 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10932 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10933 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10934 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10935 | *enable privacy bit in beacons */ |
| 10936 | |
| 10937 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 10938 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10939 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10940 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10941 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 10942 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 10943 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10944 | return status; |
| 10945 | } |
| 10946 | |
| 10947 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10948 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10949 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10950 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 10951 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10952 | struct net_device *dev, |
| 10953 | struct cfg80211_ibss_params *params |
| 10954 | ) |
| 10955 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10956 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10957 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10958 | tCsrRoamProfile *pRoamProfile; |
| 10959 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 10960 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10961 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10962 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10963 | |
| 10964 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10965 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10966 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10967 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 10968 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10969 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10970 | "%s: device_mode = %s (%d)", __func__, |
| 10971 | hdd_device_modetoString(pAdapter->device_mode), |
| 10972 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10973 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10974 | status = wlan_hdd_validate_context(pHddCtx); |
| 10975 | |
| 10976 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10977 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10978 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10979 | "%s: HDD context is not valid", __func__); |
| 10980 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10981 | } |
| 10982 | |
| 10983 | if (NULL == pWextState) |
| 10984 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10985 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10986 | __func__); |
| 10987 | return -EIO; |
| 10988 | } |
| 10989 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10990 | if (vos_max_concurrent_connections_reached()) { |
| 10991 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10992 | return -ECONNREFUSED; |
| 10993 | } |
| 10994 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10995 | /*Try disconnecting if already in connected state*/ |
| 10996 | status = wlan_hdd_try_disconnect(pAdapter); |
| 10997 | if ( 0 > status) |
| 10998 | { |
| 10999 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11000 | " IBSS connection")); |
| 11001 | return -EALREADY; |
| 11002 | } |
| 11003 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11004 | pRoamProfile = &pWextState->roamProfile; |
| 11005 | |
| 11006 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 11007 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11008 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11009 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11010 | return -EINVAL; |
| 11011 | } |
| 11012 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11013 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 11014 | if (NULL != params->bssid) { |
| 11015 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11016 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 11017 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11018 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11019 | return -EIO; |
| 11020 | } |
| 11021 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11022 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 11023 | { |
| 11024 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11025 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 11026 | { |
| 11027 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11028 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11029 | return -EIO; |
| 11030 | } |
| 11031 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 11032 | if (!params->bssid) |
| 11033 | { |
| 11034 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11035 | "%s:Failed memory allocation", __func__); |
| 11036 | return -EIO; |
| 11037 | } |
| 11038 | vos_mem_copy((v_U8_t *)params->bssid, |
| 11039 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 11040 | VOS_MAC_ADDR_SIZE); |
| 11041 | alloc_bssid = VOS_TRUE; |
| 11042 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11044 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11045 | if (NULL != |
| 11046 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11047 | params->chandef.chan) |
| 11048 | #else |
| 11049 | params->channel) |
| 11050 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11051 | { |
| 11052 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11053 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 11054 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 11055 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11056 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11057 | |
| 11058 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11059 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11060 | ieee80211_frequency_to_channel( |
| 11061 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11062 | params->chandef.chan->center_freq); |
| 11063 | #else |
| 11064 | params->channel->center_freq); |
| 11065 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11066 | |
| 11067 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 11068 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11069 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 11071 | __func__); |
| 11072 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11073 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11074 | |
| 11075 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11076 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11077 | if (channelNum == validChan[indx]) |
| 11078 | { |
| 11079 | break; |
| 11080 | } |
| 11081 | } |
| 11082 | if (indx >= numChans) |
| 11083 | { |
| 11084 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11085 | __func__, channelNum); |
| 11086 | return -EINVAL; |
| 11087 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11088 | /* Set the Operational Channel */ |
| 11089 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 11090 | channelNum); |
| 11091 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11092 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 11093 | pRoamProfile->ChannelInfo.ChannelList = |
| 11094 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11095 | } |
| 11096 | |
| 11097 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11098 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11099 | if (status < 0) |
| 11100 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11101 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11102 | __func__); |
| 11103 | return status; |
| 11104 | } |
| 11105 | |
| 11106 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11107 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11108 | params->ssid_len, params->bssid, |
| 11109 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11110 | |
| 11111 | if (0 > status) |
| 11112 | { |
| 11113 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 11114 | return status; |
| 11115 | } |
| 11116 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11117 | if (NULL != params->bssid && |
| 11118 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 11119 | alloc_bssid == VOS_TRUE) |
| 11120 | { |
| 11121 | vos_mem_free(params->bssid); |
| 11122 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11123 | return 0; |
| 11124 | } |
| 11125 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11126 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 11127 | struct net_device *dev, |
| 11128 | struct cfg80211_ibss_params *params |
| 11129 | ) |
| 11130 | { |
| 11131 | int ret = 0; |
| 11132 | |
| 11133 | vos_ssr_protect(__func__); |
| 11134 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 11135 | vos_ssr_unprotect(__func__); |
| 11136 | |
| 11137 | return ret; |
| 11138 | } |
| 11139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11140 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11141 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11142 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11143 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11144 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11145 | struct net_device *dev |
| 11146 | ) |
| 11147 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11148 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11149 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11150 | tCsrRoamProfile *pRoamProfile; |
| 11151 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11152 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11153 | |
| 11154 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11155 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11156 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11157 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 11158 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11159 | status = wlan_hdd_validate_context(pHddCtx); |
| 11160 | |
| 11161 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11162 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11163 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11164 | "%s: HDD context is not valid", __func__); |
| 11165 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11166 | } |
| 11167 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11168 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 11169 | hdd_device_modetoString(pAdapter->device_mode), |
| 11170 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11171 | if (NULL == pWextState) |
| 11172 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11173 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11174 | __func__); |
| 11175 | return -EIO; |
| 11176 | } |
| 11177 | |
| 11178 | pRoamProfile = &pWextState->roamProfile; |
| 11179 | |
| 11180 | /* Issue disconnect only if interface type is set to IBSS */ |
| 11181 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 11182 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11183 | 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] | 11184 | __func__); |
| 11185 | return -EINVAL; |
| 11186 | } |
| 11187 | |
| 11188 | /* Issue Disconnect request */ |
| 11189 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11190 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 11191 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 11192 | |
| 11193 | return 0; |
| 11194 | } |
| 11195 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11196 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 11197 | struct net_device *dev |
| 11198 | ) |
| 11199 | { |
| 11200 | int ret = 0; |
| 11201 | |
| 11202 | vos_ssr_protect(__func__); |
| 11203 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 11204 | vos_ssr_unprotect(__func__); |
| 11205 | |
| 11206 | return ret; |
| 11207 | } |
| 11208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11209 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11210 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11211 | * This function is used to set the phy parameters |
| 11212 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 11213 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11214 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11215 | u32 changed) |
| 11216 | { |
| 11217 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 11218 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11219 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | |
| 11221 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11222 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11223 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 11224 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11225 | status = wlan_hdd_validate_context(pHddCtx); |
| 11226 | |
| 11227 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11228 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11229 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11230 | "%s: HDD context is not valid", __func__); |
| 11231 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11232 | } |
| 11233 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11234 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 11235 | { |
| 11236 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 11237 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 11238 | wiphy->rts_threshold; |
| 11239 | |
| 11240 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11241 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11242 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11243 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11244 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11245 | __func__, rts_threshold); |
| 11246 | return -EINVAL; |
| 11247 | } |
| 11248 | |
| 11249 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 11250 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11251 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11252 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11253 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11254 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11255 | __func__, rts_threshold); |
| 11256 | return -EIO; |
| 11257 | } |
| 11258 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11259 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11260 | rts_threshold); |
| 11261 | } |
| 11262 | |
| 11263 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 11264 | { |
| 11265 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 11266 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 11267 | wiphy->frag_threshold; |
| 11268 | |
| 11269 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11270 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11271 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11272 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11273 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11274 | frag_threshold); |
| 11275 | return -EINVAL; |
| 11276 | } |
| 11277 | |
| 11278 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 11279 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11280 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11281 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11282 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11283 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11284 | __func__, frag_threshold); |
| 11285 | return -EIO; |
| 11286 | } |
| 11287 | |
| 11288 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 11289 | frag_threshold); |
| 11290 | } |
| 11291 | |
| 11292 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 11293 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 11294 | { |
| 11295 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 11296 | wiphy->retry_short : |
| 11297 | wiphy->retry_long; |
| 11298 | |
| 11299 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 11300 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 11301 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11302 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11303 | __func__, retry_value); |
| 11304 | return -EINVAL; |
| 11305 | } |
| 11306 | |
| 11307 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 11308 | { |
| 11309 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 11310 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11311 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11312 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11313 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11314 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11315 | __func__, retry_value); |
| 11316 | return -EIO; |
| 11317 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11318 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11319 | __func__, retry_value); |
| 11320 | } |
| 11321 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 11322 | { |
| 11323 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 11324 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11325 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11326 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11327 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11328 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11329 | __func__, retry_value); |
| 11330 | return -EIO; |
| 11331 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11332 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11333 | __func__, retry_value); |
| 11334 | } |
| 11335 | } |
| 11336 | |
| 11337 | return 0; |
| 11338 | } |
| 11339 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11340 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 11341 | u32 changed) |
| 11342 | { |
| 11343 | int ret; |
| 11344 | |
| 11345 | vos_ssr_protect(__func__); |
| 11346 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 11347 | vos_ssr_unprotect(__func__); |
| 11348 | |
| 11349 | return ret; |
| 11350 | } |
| 11351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11352 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11353 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11354 | * This function is used to set the txpower |
| 11355 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11356 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11357 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11358 | struct wireless_dev *wdev, |
| 11359 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11360 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11361 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11363 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11364 | #endif |
| 11365 | int dbm) |
| 11366 | { |
| 11367 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11368 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11369 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 11370 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11371 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11372 | |
| 11373 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11374 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11375 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 11376 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11377 | status = wlan_hdd_validate_context(pHddCtx); |
| 11378 | |
| 11379 | if (0 != status) |
| 11380 | { |
| 11381 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11382 | "%s: HDD context is not valid", __func__); |
| 11383 | return status; |
| 11384 | } |
| 11385 | |
| 11386 | hHal = pHddCtx->hHal; |
| 11387 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11388 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 11389 | dbm, ccmCfgSetCallback, |
| 11390 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11391 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11393 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 11394 | return -EIO; |
| 11395 | } |
| 11396 | |
| 11397 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 11398 | dbm); |
| 11399 | |
| 11400 | switch(type) |
| 11401 | { |
| 11402 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 11403 | /* Fall through */ |
| 11404 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 11405 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 11406 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11407 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 11408 | __func__); |
| 11409 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11410 | } |
| 11411 | break; |
| 11412 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11413 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11414 | __func__); |
| 11415 | return -EOPNOTSUPP; |
| 11416 | break; |
| 11417 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11418 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 11419 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11420 | return -EIO; |
| 11421 | } |
| 11422 | |
| 11423 | return 0; |
| 11424 | } |
| 11425 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11426 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 11427 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11428 | struct wireless_dev *wdev, |
| 11429 | #endif |
| 11430 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11431 | enum tx_power_setting type, |
| 11432 | #else |
| 11433 | enum nl80211_tx_power_setting type, |
| 11434 | #endif |
| 11435 | int dbm) |
| 11436 | { |
| 11437 | int ret; |
| 11438 | vos_ssr_protect(__func__); |
| 11439 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 11440 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11441 | wdev, |
| 11442 | #endif |
| 11443 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11444 | type, |
| 11445 | #else |
| 11446 | type, |
| 11447 | #endif |
| 11448 | dbm); |
| 11449 | vos_ssr_unprotect(__func__); |
| 11450 | |
| 11451 | return ret; |
| 11452 | } |
| 11453 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11454 | /* |
| 11455 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 11456 | * This function is used to read the txpower |
| 11457 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11458 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 11459 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11460 | struct wireless_dev *wdev, |
| 11461 | #endif |
| 11462 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11463 | { |
| 11464 | |
| 11465 | hdd_adapter_t *pAdapter; |
| 11466 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11467 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11468 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11469 | ENTER(); |
| 11470 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11471 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11473 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11474 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11475 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11476 | "%s: HDD context is not valid", __func__); |
| 11477 | *dbm = 0; |
| 11478 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11479 | } |
| 11480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11481 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 11482 | if (NULL == pAdapter) |
| 11483 | { |
| 11484 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 11485 | return -ENOENT; |
| 11486 | } |
| 11487 | |
| 11488 | wlan_hdd_get_classAstats(pAdapter); |
| 11489 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 11490 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11491 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11492 | return 0; |
| 11493 | } |
| 11494 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11495 | 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] | 11496 | u8* mac, struct station_info *sinfo) |
| 11497 | { |
| 11498 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 11499 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11500 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11501 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11502 | |
| 11503 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 11504 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11505 | |
| 11506 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 11507 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 11508 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 11509 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 11510 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 11511 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 11512 | tANI_U16 maxRate = 0; |
| 11513 | tANI_U16 myRate; |
| 11514 | tANI_U16 currentRate = 0; |
| 11515 | tANI_U8 maxSpeedMCS = 0; |
| 11516 | tANI_U8 maxMCSIdx = 0; |
| 11517 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11518 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 11519 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11520 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11521 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11522 | #ifdef WLAN_FEATURE_11AC |
| 11523 | tANI_U32 vht_mcs_map; |
| 11524 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 11525 | #endif /* WLAN_FEATURE_11AC */ |
| 11526 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11527 | ENTER(); |
| 11528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11529 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 11530 | (0 == ssidlen)) |
| 11531 | { |
| 11532 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 11533 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 11534 | /*To keep GUI happy*/ |
| 11535 | return 0; |
| 11536 | } |
| 11537 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 11538 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 11539 | { |
| 11540 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11541 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 11542 | return 0; |
| 11543 | } |
| 11544 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11545 | status = wlan_hdd_validate_context(pHddCtx); |
| 11546 | |
| 11547 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11548 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11550 | "%s: HDD context is not valid", __func__); |
| 11551 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11552 | } |
| 11553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11554 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 11555 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 11556 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 11557 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 11558 | wlan_hdd_get_station_stats(pAdapter); |
| 11559 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 11560 | |
| 11561 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11562 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 11563 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11564 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11565 | { |
| 11566 | rate_flags = pAdapter->maxRateFlags; |
| 11567 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11569 | //convert to the UI units of 100kbps |
| 11570 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 11571 | |
| 11572 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11573 | 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] | 11574 | sinfo->signal, |
| 11575 | pCfg->reportMaxLinkSpeed, |
| 11576 | myRate, |
| 11577 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11578 | (int) pCfg->linkSpeedRssiMid, |
| 11579 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11580 | (int) rate_flags, |
| 11581 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11582 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11583 | |
| 11584 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 11585 | { |
| 11586 | // we do not want to necessarily report the current speed |
| 11587 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 11588 | { |
| 11589 | // report the max possible speed |
| 11590 | rssidx = 0; |
| 11591 | } |
| 11592 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 11593 | { |
| 11594 | // report the max possible speed with RSSI scaling |
| 11595 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 11596 | { |
| 11597 | // report the max possible speed |
| 11598 | rssidx = 0; |
| 11599 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11600 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11601 | { |
| 11602 | // report middle speed |
| 11603 | rssidx = 1; |
| 11604 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11605 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 11606 | { |
| 11607 | // report middle speed |
| 11608 | rssidx = 2; |
| 11609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11610 | else |
| 11611 | { |
| 11612 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11613 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11614 | } |
| 11615 | } |
| 11616 | else |
| 11617 | { |
| 11618 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 11619 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11620 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 11621 | __func__, pCfg->reportMaxLinkSpeed); |
| 11622 | rssidx = 0; |
| 11623 | } |
| 11624 | |
| 11625 | maxRate = 0; |
| 11626 | |
| 11627 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11628 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 11629 | OperationalRates, &ORLeng)) |
| 11630 | { |
| 11631 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11632 | /*To keep GUI happy*/ |
| 11633 | return 0; |
| 11634 | } |
| 11635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11636 | for (i = 0; i < ORLeng; i++) |
| 11637 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11638 | 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] | 11639 | { |
| 11640 | /* Validate Rate Set */ |
| 11641 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 11642 | { |
| 11643 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11644 | break; |
| 11645 | } |
| 11646 | } |
| 11647 | /* Update MAX rate */ |
| 11648 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11649 | } |
| 11650 | |
| 11651 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11652 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 11653 | ExtendedRates, &ERLeng)) |
| 11654 | { |
| 11655 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11656 | /*To keep GUI happy*/ |
| 11657 | return 0; |
| 11658 | } |
| 11659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11660 | for (i = 0; i < ERLeng; i++) |
| 11661 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11662 | 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] | 11663 | { |
| 11664 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 11665 | { |
| 11666 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11667 | break; |
| 11668 | } |
| 11669 | } |
| 11670 | /* Update MAX rate */ |
| 11671 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11672 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11673 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11674 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 11675 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11676 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11677 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11678 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11679 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11680 | mode = 2; |
| 11681 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 11682 | mode = 1; |
| 11683 | else |
| 11684 | mode = 0; |
| 11685 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11686 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 11687 | MCSRates, &MCSLeng)) |
| 11688 | { |
| 11689 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11690 | /*To keep GUI happy*/ |
| 11691 | return 0; |
| 11692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11693 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11694 | #ifdef WLAN_FEATURE_11AC |
| 11695 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11696 | 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] | 11697 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11698 | 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] | 11699 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11700 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11701 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11702 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11703 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11704 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11705 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11706 | maxMCSIdx = 7; |
| 11707 | } |
| 11708 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 11709 | { |
| 11710 | maxMCSIdx = 8; |
| 11711 | } |
| 11712 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 11713 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11714 | //VHT20 is supporting 0~8 |
| 11715 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11716 | maxMCSIdx = 8; |
| 11717 | else |
| 11718 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11719 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11720 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11721 | if (0 != rssidx)/*check for scaled */ |
| 11722 | { |
| 11723 | //get middle rate MCS index if rssi=1/2 |
| 11724 | for (i=0; i <= maxMCSIdx; i++) |
| 11725 | { |
| 11726 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 11727 | { |
| 11728 | maxMCSIdx = i; |
| 11729 | break; |
| 11730 | } |
| 11731 | } |
| 11732 | } |
| 11733 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11734 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11735 | { |
| 11736 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 11737 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 11738 | } |
| 11739 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 11740 | { |
| 11741 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 11742 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 11743 | } |
| 11744 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11745 | { |
| 11746 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 11747 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 11748 | } |
| 11749 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11750 | maxSpeedMCS = 1; |
| 11751 | if (currentRate > maxRate) |
| 11752 | { |
| 11753 | maxRate = currentRate; |
| 11754 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11755 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11756 | } |
| 11757 | else |
| 11758 | #endif /* WLAN_FEATURE_11AC */ |
| 11759 | { |
| 11760 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11761 | { |
| 11762 | rateFlag |= 1; |
| 11763 | } |
| 11764 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11765 | { |
| 11766 | rateFlag |= 2; |
| 11767 | } |
| 11768 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 11769 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11770 | if (rssidx == 1 || rssidx == 2) |
| 11771 | { |
| 11772 | //get middle rate MCS index if rssi=1/2 |
| 11773 | for (i=0; i <= 7; i++) |
| 11774 | { |
| 11775 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 11776 | { |
| 11777 | temp = i+1; |
| 11778 | break; |
| 11779 | } |
| 11780 | } |
| 11781 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11782 | |
| 11783 | for (i = 0; i < MCSLeng; i++) |
| 11784 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11785 | for (j = 0; j < temp; j++) |
| 11786 | { |
| 11787 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 11788 | { |
| 11789 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 11790 | break; |
| 11791 | } |
| 11792 | } |
| 11793 | if ((j < temp) && (currentRate > maxRate)) |
| 11794 | { |
| 11795 | maxRate = currentRate; |
| 11796 | maxSpeedMCS = 1; |
| 11797 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 11798 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11799 | } |
| 11800 | } |
| 11801 | } |
| 11802 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11803 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 11804 | { |
| 11805 | maxRate = myRate; |
| 11806 | maxSpeedMCS = 1; |
| 11807 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 11808 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11809 | // 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] | 11810 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11811 | { |
| 11812 | maxRate = myRate; |
| 11813 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 11814 | { |
| 11815 | maxSpeedMCS = 0; |
| 11816 | } |
| 11817 | else |
| 11818 | { |
| 11819 | maxSpeedMCS = 1; |
| 11820 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 11821 | } |
| 11822 | } |
| 11823 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11824 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | { |
| 11826 | sinfo->txrate.legacy = maxRate; |
| 11827 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11828 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 11829 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11830 | } |
| 11831 | else |
| 11832 | { |
| 11833 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11834 | #ifdef WLAN_FEATURE_11AC |
| 11835 | sinfo->txrate.nss = 1; |
| 11836 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11837 | { |
| 11838 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11839 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11840 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11841 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11842 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11843 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11844 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11845 | } |
| 11846 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11847 | { |
| 11848 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11849 | } |
| 11850 | #endif /* WLAN_FEATURE_11AC */ |
| 11851 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 11852 | { |
| 11853 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 11854 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11855 | { |
| 11856 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11857 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11859 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11860 | { |
| 11861 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 11862 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11863 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11864 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11865 | pr_info("Reporting MCS rate %d flags %x\n", |
| 11866 | sinfo->txrate.mcs, |
| 11867 | sinfo->txrate.flags ); |
| 11868 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11869 | } |
| 11870 | } |
| 11871 | else |
| 11872 | { |
| 11873 | // report current rate instead of max rate |
| 11874 | |
| 11875 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 11876 | { |
| 11877 | //provide to the UI in units of 100kbps |
| 11878 | sinfo->txrate.legacy = myRate; |
| 11879 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11880 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 11881 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11882 | } |
| 11883 | else |
| 11884 | { |
| 11885 | //must be MCS |
| 11886 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11887 | #ifdef WLAN_FEATURE_11AC |
| 11888 | sinfo->txrate.nss = 1; |
| 11889 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11890 | { |
| 11891 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 11892 | } |
| 11893 | else |
| 11894 | #endif /* WLAN_FEATURE_11AC */ |
| 11895 | { |
| 11896 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 11897 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11898 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 11899 | { |
| 11900 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 11901 | } |
| 11902 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 11903 | { |
| 11904 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 11905 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11906 | #ifdef WLAN_FEATURE_11AC |
| 11907 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11908 | { |
| 11909 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 11910 | } |
| 11911 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11912 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 11913 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 11914 | sinfo->txrate.mcs, |
| 11915 | sinfo->txrate.flags ); |
| 11916 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11917 | } |
| 11918 | } |
| 11919 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 11920 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 11921 | sinfo->tx_packets = |
| 11922 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 11923 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 11924 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 11925 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 11926 | |
| 11927 | sinfo->tx_retries = |
| 11928 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 11929 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 11930 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 11931 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 11932 | |
| 11933 | sinfo->tx_failed = |
| 11934 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 11935 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 11936 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 11937 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 11938 | |
| 11939 | sinfo->filled |= |
| 11940 | STATION_INFO_TX_PACKETS | |
| 11941 | STATION_INFO_TX_RETRIES | |
| 11942 | STATION_INFO_TX_FAILED; |
| 11943 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11944 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11945 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 11946 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 11947 | EXIT(); |
| 11948 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11949 | } |
| 11950 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11951 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 11952 | u8* mac, struct station_info *sinfo) |
| 11953 | { |
| 11954 | int ret; |
| 11955 | |
| 11956 | vos_ssr_protect(__func__); |
| 11957 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 11958 | vos_ssr_unprotect(__func__); |
| 11959 | |
| 11960 | return ret; |
| 11961 | } |
| 11962 | |
| 11963 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 11964 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11965 | { |
| 11966 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11967 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11969 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11970 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11971 | ENTER(); |
| 11972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11973 | if (NULL == pAdapter) |
| 11974 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11975 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11976 | return -ENODEV; |
| 11977 | } |
| 11978 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11979 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11980 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 11981 | pAdapter->sessionId, timeout)); |
| 11982 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11983 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11984 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11985 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11986 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11987 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11988 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11989 | "%s: HDD context is not valid", __func__); |
| 11990 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11991 | } |
| 11992 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 11993 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 11994 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 11995 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 11996 | (eConnectionState_Associated == |
| 11997 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 11998 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 11999 | |
| 12000 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12001 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 12002 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12003 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12004 | { |
| 12005 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12006 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12007 | __func__, vos_status); |
| 12008 | } |
| 12009 | } |
| 12010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12011 | /**The get power cmd from the supplicant gets updated by the nl only |
| 12012 | *on successful execution of the function call |
| 12013 | *we are oppositely mapped w.r.t mode in the driver |
| 12014 | **/ |
| 12015 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 12016 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12017 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12018 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 12019 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12020 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12021 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12022 | return -EINVAL; |
| 12023 | } |
| 12024 | return 0; |
| 12025 | } |
| 12026 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12027 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 12028 | struct net_device *dev, bool mode, int timeout) |
| 12029 | { |
| 12030 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12031 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12032 | vos_ssr_protect(__func__); |
| 12033 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 12034 | vos_ssr_unprotect(__func__); |
| 12035 | |
| 12036 | return ret; |
| 12037 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12038 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12039 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 12040 | struct net_device *netdev, |
| 12041 | u8 key_index) |
| 12042 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12043 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12044 | return 0; |
| 12045 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12046 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12047 | |
| 12048 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 12049 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12050 | struct net_device *dev, |
| 12051 | struct ieee80211_txq_params *params) |
| 12052 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12053 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12054 | return 0; |
| 12055 | } |
| 12056 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12057 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12058 | struct ieee80211_txq_params *params) |
| 12059 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12060 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12061 | return 0; |
| 12062 | } |
| 12063 | #endif //LINUX_VERSION_CODE |
| 12064 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12065 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | struct net_device *dev, u8 *mac) |
| 12067 | { |
| 12068 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12069 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12070 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12071 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12072 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12073 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12074 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12075 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12076 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12077 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12078 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12079 | return -EINVAL; |
| 12080 | } |
| 12081 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12082 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12083 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 12084 | pAdapter->sessionId, pAdapter->device_mode)); |
| 12085 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12086 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12087 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12088 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12089 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12090 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12091 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12092 | "%s: HDD context is not valid", __func__); |
| 12093 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12094 | } |
| 12095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12096 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12097 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12098 | ) |
| 12099 | { |
| 12100 | if( NULL == mac ) |
| 12101 | { |
| 12102 | v_U16_t i; |
| 12103 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 12104 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 12105 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 12106 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12107 | { |
| 12108 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 12109 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12110 | "%s: Delete STA with MAC::" |
| 12111 | MAC_ADDRESS_STR, |
| 12112 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 12113 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 12114 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12115 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12116 | } |
| 12117 | } |
| 12118 | } |
| 12119 | else |
| 12120 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12121 | |
| 12122 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 12123 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12124 | { |
| 12125 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12126 | "%s: Skip this DEL STA as this is not used::" |
| 12127 | MAC_ADDRESS_STR, |
| 12128 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12129 | return -ENOENT; |
| 12130 | } |
| 12131 | |
| 12132 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 12133 | { |
| 12134 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12135 | "%s: Skip this DEL STA as deauth is in progress::" |
| 12136 | MAC_ADDRESS_STR, |
| 12137 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12138 | return -ENOENT; |
| 12139 | } |
| 12140 | |
| 12141 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 12142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12143 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12144 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12145 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12146 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12147 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12148 | |
| 12149 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 12150 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12151 | { |
| 12152 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 12153 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12154 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12155 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12156 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12157 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12158 | return -ENOENT; |
| 12159 | } |
| 12160 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12161 | } |
| 12162 | } |
| 12163 | |
| 12164 | EXIT(); |
| 12165 | |
| 12166 | return 0; |
| 12167 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12168 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 12169 | struct net_device *dev, u8 *mac) |
| 12170 | { |
| 12171 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12172 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12173 | vos_ssr_protect(__func__); |
| 12174 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, mac); |
| 12175 | vos_ssr_unprotect(__func__); |
| 12176 | |
| 12177 | return ret; |
| 12178 | } |
| 12179 | |
| 12180 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12181 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 12182 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12183 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12184 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12185 | #ifdef FEATURE_WLAN_TDLS |
| 12186 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12187 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12188 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12189 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12190 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 12191 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12192 | mask = params->sta_flags_mask; |
| 12193 | |
| 12194 | set = params->sta_flags_set; |
| 12195 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12196 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 12197 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12198 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 12199 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 12200 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12201 | |
| 12202 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 12203 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12204 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12205 | } |
| 12206 | } |
| 12207 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12208 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12209 | } |
| 12210 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12211 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 12212 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 12213 | { |
| 12214 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12215 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12216 | vos_ssr_protect(__func__); |
| 12217 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 12218 | vos_ssr_unprotect(__func__); |
| 12219 | |
| 12220 | return ret; |
| 12221 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12222 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12223 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12224 | 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] | 12225 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12226 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12227 | tANI_U32 j=0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12228 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12229 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12230 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12231 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12232 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12233 | tANI_U8 BSSIDMatched = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12234 | hdd_context_t *pHddCtx; |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12235 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 12236 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12237 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12238 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12239 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12240 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12241 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12242 | return -EINVAL; |
| 12243 | } |
| 12244 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12245 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12246 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12247 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12248 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12249 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12250 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12251 | "%s: HDD context is not valid", __func__); |
| 12252 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12253 | } |
| 12254 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12255 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12256 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12257 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12258 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12259 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12260 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12261 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12262 | pmksa->bssid, WNI_CFG_BSSID_LEN)) |
| 12263 | { |
| 12264 | /* BSSID matched previous entry. Overwrite it. */ |
| 12265 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12266 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12267 | pmksa->bssid, WNI_CFG_BSSID_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12268 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12269 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12270 | CSR_RSN_PMKID_SIZE); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12271 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12272 | __func__, j ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12273 | dump_bssid(pmksa->bssid); |
| 12274 | dump_pmkid(halHandle, pmksa->pmkid); |
| 12275 | break; |
| 12276 | } |
| 12277 | } |
| 12278 | |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 12279 | /* Check we compared all entries,if then take the first slot now */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12280 | if (j == MAX_PMKSAIDS_IN_CACHE) pHddStaCtx->PMKIDCacheIndex=0; |
Madan Mohan Koyyalamudi | c4b317d | 2012-10-18 19:43:08 -0700 | [diff] [blame] | 12281 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12282 | if (!BSSIDMatched) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12283 | { |
| 12284 | // 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] | 12285 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].BSSID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12286 | pmksa->bssid, ETHER_ADDR_LEN); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12287 | vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].PMKID, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12288 | pmksa->pmkid, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12289 | CSR_RSN_PMKID_SIZE); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12290 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Adding a new cache entry %d.", |
| 12291 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12292 | dump_bssid(pmksa->bssid); |
| 12293 | dump_pmkid(halHandle, pmksa->pmkid); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12294 | // Increment the HDD Local Cache index |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12295 | // 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] | 12296 | if (pHddStaCtx->PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) |
| 12297 | pHddStaCtx->PMKIDCacheIndex++; |
| 12298 | else |
| 12299 | pHddStaCtx->PMKIDCacheIndex = 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12300 | } |
| 12301 | |
| 12302 | |
| 12303 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12304 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", |
| 12305 | __func__, pHddStaCtx->PMKIDCacheIndex ); |
| 12306 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12307 | // Finally set the PMKSA ID Cache in CSR |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12308 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12309 | pHddStaCtx->PMKIDCache, |
| 12310 | pHddStaCtx->PMKIDCacheIndex); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12311 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12312 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 12313 | pAdapter->sessionId, result)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12314 | return 0; |
| 12315 | } |
| 12316 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12317 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 12318 | struct cfg80211_pmksa *pmksa) |
| 12319 | { |
| 12320 | int ret; |
| 12321 | |
| 12322 | vos_ssr_protect(__func__); |
| 12323 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 12324 | vos_ssr_unprotect(__func__); |
| 12325 | |
| 12326 | return ret; |
| 12327 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12328 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12329 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12330 | 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] | 12331 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12332 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12333 | tANI_U32 j=0; |
| 12334 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12335 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12336 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12337 | tANI_U8 BSSIDMatched = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12338 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12339 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12340 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12341 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 12342 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12343 | |
| 12344 | /* Validate pAdapter */ |
| 12345 | if (NULL == pAdapter) |
| 12346 | { |
| 12347 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 12348 | return -EINVAL; |
| 12349 | } |
| 12350 | |
| 12351 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12352 | status = wlan_hdd_validate_context(pHddCtx); |
| 12353 | |
| 12354 | if (0 != status) |
| 12355 | { |
| 12356 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12357 | "%s: HDD context is not valid", __func__); |
| 12358 | return status; |
| 12359 | } |
| 12360 | |
| 12361 | /*Retrieve halHandle*/ |
| 12362 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12363 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12364 | |
| 12365 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12366 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12367 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12368 | hddLog(VOS_TRACE_LEVEL_INFO, FL("No entries to flush")); |
| 12369 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12370 | } |
| 12371 | |
| 12372 | /*find the matching PMKSA entry from j=0 to (index-1), |
| 12373 | * and delete the matched one |
| 12374 | */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12375 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12376 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12377 | if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12378 | pmksa->bssid, |
| 12379 | WNI_CFG_BSSID_LEN)) |
| 12380 | { |
| 12381 | /* BSSID matched entry */ |
| 12382 | BSSIDMatched = 1; |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12383 | if (j < pHddStaCtx->PMKIDCacheIndex-1) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12384 | { |
| 12385 | /*replace the matching entry with the last entry in HDD local cache*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12386 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, |
| 12387 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 12388 | VOS_MAC_ADDR_SIZE); |
| 12389 | vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, |
| 12390 | pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 12391 | CSR_RSN_PMKID_SIZE); |
| 12392 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12393 | |
| 12394 | /*clear the last entry in HDD cache ---[index-1]*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12395 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, |
| 12396 | VOS_MAC_ADDR_SIZE); |
| 12397 | vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, |
| 12398 | CSR_RSN_PMKID_SIZE); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12399 | /*reduce the PMKID array index*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12400 | pHddStaCtx->PMKIDCacheIndex--; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12401 | /*delete the last PMKID cache in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12402 | if (eHAL_STATUS_SUCCESS != |
| 12403 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12404 | { |
| 12405 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12406 | __func__, pHddStaCtx->PMKIDCacheIndex); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12407 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12408 | } |
| 12409 | |
| 12410 | dump_bssid(pmksa->bssid); |
| 12411 | dump_pmkid(halHandle,pmksa->pmkid); |
| 12412 | |
| 12413 | break; |
| 12414 | } |
| 12415 | } |
| 12416 | |
| 12417 | /* we compare all entries,but cannot find matching entry */ |
| 12418 | if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched) |
| 12419 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12420 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 12421 | "%s: No such PMKSA entry existed " MAC_ADDRESS_STR, |
| 12422 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12423 | dump_bssid(pmksa->bssid); |
| 12424 | dump_pmkid(halHandle, pmksa->pmkid); |
| 12425 | return -EINVAL; |
| 12426 | } |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12427 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12428 | } |
| 12429 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12430 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12431 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 12432 | struct cfg80211_pmksa *pmksa) |
| 12433 | { |
| 12434 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12435 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12436 | vos_ssr_protect(__func__); |
| 12437 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 12438 | vos_ssr_unprotect(__func__); |
| 12439 | |
| 12440 | return ret; |
| 12441 | |
| 12442 | } |
| 12443 | |
| 12444 | 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] | 12445 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12446 | tANI_U32 j=0; |
| 12447 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12448 | hdd_station_ctx_t *pHddStaCtx; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12449 | tHalHandle halHandle; |
| 12450 | hdd_context_t *pHddCtx; |
| 12451 | tANI_U8 *pBSSId; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12452 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12453 | |
| 12454 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 12455 | |
| 12456 | /* Validate pAdapter */ |
| 12457 | if (NULL == pAdapter) |
| 12458 | { |
| 12459 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12460 | "%s: Invalid Adapter" ,__func__); |
| 12461 | return -EINVAL; |
| 12462 | } |
| 12463 | |
| 12464 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12465 | status = wlan_hdd_validate_context(pHddCtx); |
| 12466 | |
| 12467 | if (0 != status) |
| 12468 | { |
| 12469 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12470 | "%s: HDD context is not valid", __func__); |
| 12471 | return status; |
| 12472 | } |
| 12473 | |
| 12474 | /*Retrieve halHandle*/ |
| 12475 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12476 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12477 | |
| 12478 | /*in case index is 0,no entry to delete*/ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12479 | if (0 == pHddStaCtx->PMKIDCacheIndex) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12480 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12481 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("No entries to flush")); |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12482 | return 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12483 | } |
| 12484 | |
| 12485 | /*delete all the PMKSA one by one */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12486 | for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12487 | { |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12488 | pBSSId =(tANI_U8 *)(pHddStaCtx->PMKIDCache[j].BSSID); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12489 | /*delete the PMKID in CSR*/ |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12490 | if (eHAL_STATUS_SUCCESS != |
| 12491 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId)) |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12492 | { |
| 12493 | hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.", |
| 12494 | __func__,j); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12495 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12496 | } |
Kiet Lam | 8d21d5b | 2013-10-31 17:18:29 +0530 | [diff] [blame] | 12497 | /*clear the entry in HDD cache 0--index-1 */ |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12498 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].BSSID, VOS_MAC_ADDR_SIZE); |
| 12499 | vos_mem_zero(pHddStaCtx->PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); |
| 12500 | } |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12501 | |
Agarwal Ashish | 3da9524 | 2014-05-21 14:57:17 +0530 | [diff] [blame] | 12502 | pHddStaCtx->PMKIDCacheIndex = 0; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12503 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12504 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12505 | |
| 12506 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 12507 | { |
| 12508 | int ret; |
| 12509 | |
| 12510 | vos_ssr_protect(__func__); |
| 12511 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 12512 | vos_ssr_unprotect(__func__); |
| 12513 | |
| 12514 | return ret; |
| 12515 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12516 | #endif |
| 12517 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12518 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12519 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12520 | struct net_device *dev, |
| 12521 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12522 | { |
| 12523 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12524 | hdd_station_ctx_t *pHddStaCtx; |
| 12525 | |
| 12526 | if (NULL == pAdapter) |
| 12527 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12528 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12529 | return -ENODEV; |
| 12530 | } |
| 12531 | |
| 12532 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12533 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12534 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12535 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 12536 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12537 | // Added for debug on reception of Re-assoc Req. |
| 12538 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 12539 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12540 | 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] | 12541 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12542 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12543 | } |
| 12544 | |
| 12545 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12546 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12547 | ftie->ie_len); |
| 12548 | #endif |
| 12549 | |
| 12550 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 12551 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12552 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12553 | ftie->ie_len); |
| 12554 | return 0; |
| 12555 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12556 | |
| 12557 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12558 | struct net_device *dev, |
| 12559 | struct cfg80211_update_ft_ies_params *ftie) |
| 12560 | { |
| 12561 | int ret; |
| 12562 | |
| 12563 | vos_ssr_protect(__func__); |
| 12564 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 12565 | vos_ssr_unprotect(__func__); |
| 12566 | |
| 12567 | return ret; |
| 12568 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12569 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12570 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12571 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 12572 | |
| 12573 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 12574 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 12575 | { |
| 12576 | int ret; |
| 12577 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 12578 | hdd_context_t *pHddCtx; |
| 12579 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12580 | ENTER(); |
| 12581 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12582 | if (NULL == pAdapter) |
| 12583 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 12584 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12585 | "%s: HDD adapter is Null", __func__); |
| 12586 | return ; |
| 12587 | } |
| 12588 | |
| 12589 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12590 | if (NULL == pHddCtx) |
| 12591 | { |
| 12592 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12593 | "%s: HDD context is Null!!!", __func__); |
| 12594 | return ; |
| 12595 | } |
| 12596 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12597 | spin_lock(&pHddCtx->schedScan_lock); |
| 12598 | if (TRUE == pHddCtx->isWiphySuspended) |
| 12599 | { |
| 12600 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 12601 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12602 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12603 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 12604 | return ; |
| 12605 | } |
| 12606 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12607 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12608 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 12609 | |
| 12610 | if (0 > ret) |
| 12611 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 12612 | |
| 12613 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12615 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12616 | } |
| 12617 | |
| 12618 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12619 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12620 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12621 | */ |
| 12622 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 12623 | { |
| 12624 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 12625 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12626 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12627 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12628 | int status = 0; |
| 12629 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 12630 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12631 | /* The current firmware design does not allow PNO during any |
| 12632 | * active sessions. Hence, determine the active sessions |
| 12633 | * and return a failure. |
| 12634 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12635 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 12636 | { |
| 12637 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12638 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12639 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12640 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 12641 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 12642 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 12643 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 12644 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
| 12645 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12646 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12647 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12648 | } |
| 12649 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 12650 | pAdapterNode = pNext; |
| 12651 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12652 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12653 | } |
| 12654 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12655 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 12656 | { |
| 12657 | hdd_adapter_t *pAdapter = callbackContext; |
| 12658 | hdd_context_t *pHddCtx; |
| 12659 | |
| 12660 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 12661 | { |
| 12662 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12663 | FL("Invalid adapter or adapter has invalid magic")); |
| 12664 | return; |
| 12665 | } |
| 12666 | |
| 12667 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12668 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 12669 | { |
| 12670 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12671 | FL("HDD context is not valid")); |
| 12672 | return; |
| 12673 | } |
| 12674 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 12675 | if (VOS_STATUS_SUCCESS != status) |
| 12676 | { |
| 12677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12678 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 12679 | pHddCtx->isPnoEnable = FALSE; |
| 12680 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12681 | |
| 12682 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 12683 | complete(&pAdapter->pno_comp_var); |
| 12684 | } |
| 12685 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12686 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12687 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 12688 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12689 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12690 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12691 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 12692 | { |
| 12693 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12694 | tpSirPNOScanReq pPnoRequest = NULL; |
| 12695 | hdd_context_t *pHddCtx; |
| 12696 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 12697 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 12698 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 12699 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12700 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12701 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12702 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12703 | |
| 12704 | if (NULL == pAdapter) |
| 12705 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12706 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12707 | "%s: HDD adapter is Null", __func__); |
| 12708 | return -ENODEV; |
| 12709 | } |
| 12710 | |
| 12711 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12712 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12713 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12714 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12715 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 12716 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12717 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12718 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12719 | } |
| 12720 | |
| 12721 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12722 | if (NULL == hHal) |
| 12723 | { |
| 12724 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12725 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12726 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12727 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 12728 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12729 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 12730 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12731 | { |
| 12732 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12733 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 12734 | return -EBUSY; |
| 12735 | } |
| 12736 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12737 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12738 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12740 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12741 | return -EBUSY; |
| 12742 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12743 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12744 | if (TRUE == pHddCtx->isPnoEnable) |
| 12745 | { |
| 12746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 12747 | FL("already PNO is enabled")); |
| 12748 | return -EBUSY; |
| 12749 | } |
| 12750 | pHddCtx->isPnoEnable = TRUE; |
| 12751 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12752 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 12753 | if (NULL == pPnoRequest) |
| 12754 | { |
| 12755 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12756 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12757 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12758 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12759 | } |
| 12760 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 12761 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12762 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 12763 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 12764 | |
| 12765 | if (( !pPnoRequest->ucNetworksCount ) || |
| 12766 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 12767 | { |
| 12768 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 12769 | "%s: Network input is not correct %d Max Network supported is %d", |
| 12770 | __func__, pPnoRequest->ucNetworksCount, |
| 12771 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12772 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12773 | goto error; |
| 12774 | } |
| 12775 | |
| 12776 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 12777 | { |
| 12778 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12779 | "%s: Incorrect number of channels %d", |
| 12780 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12781 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12782 | goto error; |
| 12783 | } |
| 12784 | |
| 12785 | /* Framework provides one set of channels(all) |
| 12786 | * common for all saved profile */ |
| 12787 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12788 | channels_allowed, &num_channels_allowed)) |
| 12789 | { |
| 12790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12791 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12792 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12793 | goto error; |
| 12794 | } |
| 12795 | /* Checking each channel against allowed channel list */ |
| 12796 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12797 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12798 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12799 | char chList [(request->n_channels*5)+1]; |
| 12800 | int len; |
| 12801 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12802 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12803 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12804 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12805 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 12806 | { |
| 12807 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 12808 | len += snprintf(chList+len, 5, "%d ", |
| 12809 | request->channels[i]->hw_value); |
| 12810 | break ; |
| 12811 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12812 | } |
| 12813 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12814 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
| 12815 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12816 | |
| 12817 | /* Filling per profile params */ |
| 12818 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 12819 | { |
| 12820 | pPnoRequest->aNetworks[i].ssId.length = |
| 12821 | request->match_sets[i].ssid.ssid_len; |
| 12822 | |
| 12823 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 12824 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 12825 | { |
| 12826 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12827 | "%s: SSID Len %d is not correct for network %d", |
| 12828 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12829 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12830 | goto error; |
| 12831 | } |
| 12832 | |
| 12833 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 12834 | request->match_sets[i].ssid.ssid, |
| 12835 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 12836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12837 | "%s: SSID of network %d is %s ", __func__, |
| 12838 | i, pPnoRequest->aNetworks[i].ssId.ssId); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12839 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 12840 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 12841 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 12842 | |
| 12843 | /*Copying list of valid channel into request */ |
| 12844 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 12845 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 12846 | |
| 12847 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 12848 | } |
| 12849 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 12850 | for (i = 0; i < request->n_ssids; i++) |
| 12851 | { |
| 12852 | j = 0; |
| 12853 | while (j < pPnoRequest->ucNetworksCount) |
| 12854 | { |
| 12855 | if ((pPnoRequest->aNetworks[j].ssId.length == |
| 12856 | request->ssids[i].ssid_len) && |
| 12857 | (0 == memcmp(pPnoRequest->aNetworks[j].ssId.ssId, |
| 12858 | request->ssids[i].ssid, |
| 12859 | pPnoRequest->aNetworks[j].ssId.length))) |
| 12860 | { |
| 12861 | pPnoRequest->aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
| 12862 | break; |
| 12863 | } |
| 12864 | j++; |
| 12865 | } |
| 12866 | } |
| 12867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12868 | "Number of hidden networks being Configured = %d", |
| 12869 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 12870 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 12871 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 12872 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 12873 | { |
| 12874 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 12875 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 12876 | pPnoRequest->us24GProbeTemplateLen); |
| 12877 | |
| 12878 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 12879 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 12880 | pPnoRequest->us5GProbeTemplateLen); |
| 12881 | } |
| 12882 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 12883 | /* Driver gets only one time interval which is hardcoded in |
| 12884 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 12885 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 12886 | * 80,160,320 secs. And number of scan cycle for each timer |
| 12887 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 12888 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 12889 | * will be repeated after each interval specified by supplicant |
| 12890 | * till PNO is disabled. |
| 12891 | */ |
| 12892 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 12893 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 12894 | else |
| 12895 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 12896 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 12897 | |
| 12898 | tempInterval = (request->interval)/1000; |
| 12899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12900 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 12901 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 12902 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 12903 | { |
| 12904 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 12905 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 12906 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 12907 | tempInterval *= 2; |
| 12908 | } |
| 12909 | //Repeat last timer until pno disabled. |
| 12910 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 12911 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 12912 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12913 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12914 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 12915 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 12916 | pPnoRequest->callbackContext = pAdapter; |
| 12917 | pAdapter->pno_req_status = 0; |
| 12918 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12919 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12920 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 12921 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 12922 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 12923 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12924 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12925 | pPnoRequest, pAdapter->sessionId, |
| 12926 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 12927 | if (eHAL_STATUS_SUCCESS != status) |
| 12928 | { |
| 12929 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12930 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12931 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12932 | goto error; |
| 12933 | } |
| 12934 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12935 | ret = wait_for_completion_timeout( |
| 12936 | &pAdapter->pno_comp_var, |
| 12937 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 12938 | if (0 >= ret) |
| 12939 | { |
| 12940 | // Did not receive the response for PNO enable in time. |
| 12941 | // Assuming the PNO enable was success. |
| 12942 | // Returning error from here, because we timeout, results |
| 12943 | // in side effect of Wifi (Wifi Setting) not to work. |
| 12944 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12945 | FL("Timed out waiting for PNO to be Enabled")); |
| 12946 | ret = 0; |
| 12947 | goto error; |
| 12948 | } |
| 12949 | |
c_hpothu | 3c986b2 | 2014-07-09 14:45:09 +0530 | [diff] [blame] | 12950 | vos_mem_free(pPnoRequest); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12951 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12952 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12953 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12954 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12956 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12957 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12958 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12959 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12960 | } |
| 12961 | |
| 12962 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12963 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 12964 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12965 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12966 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 12967 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 12968 | { |
| 12969 | int ret; |
| 12970 | |
| 12971 | vos_ssr_protect(__func__); |
| 12972 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 12973 | vos_ssr_unprotect(__func__); |
| 12974 | |
| 12975 | return ret; |
| 12976 | } |
| 12977 | |
| 12978 | /* |
| 12979 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 12980 | * Function to disable PNO |
| 12981 | */ |
| 12982 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12983 | struct net_device *dev) |
| 12984 | { |
| 12985 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12986 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12987 | hdd_context_t *pHddCtx; |
| 12988 | tHalHandle hHal; |
| 12989 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12990 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12991 | |
| 12992 | ENTER(); |
| 12993 | |
| 12994 | if (NULL == pAdapter) |
| 12995 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12997 | "%s: HDD adapter is Null", __func__); |
| 12998 | return -ENODEV; |
| 12999 | } |
| 13000 | |
| 13001 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13002 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13003 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13004 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13005 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13006 | "%s: HDD context is Null", __func__); |
| 13007 | return -ENODEV; |
| 13008 | } |
| 13009 | |
| 13010 | /* The return 0 is intentional when isLogpInProgress and |
| 13011 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 13012 | * failure in sched_scan_stop , especially for a case where the unload |
| 13013 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 13014 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 13015 | * success. If it returns a failure , then its next invocation due to the |
| 13016 | * clean up of the second interface will have the dev pointer corresponding |
| 13017 | * to the first one leading to a crash. |
| 13018 | */ |
| 13019 | if (pHddCtx->isLogpInProgress) |
| 13020 | { |
| 13021 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13022 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13023 | return ret; |
| 13024 | } |
| 13025 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 13026 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13027 | { |
| 13028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13029 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 13030 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13031 | } |
| 13032 | |
| 13033 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13034 | if (NULL == hHal) |
| 13035 | { |
| 13036 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13037 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13038 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13039 | } |
| 13040 | |
| 13041 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 13042 | if (NULL == pPnoRequest) |
| 13043 | { |
| 13044 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13045 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13046 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13047 | } |
| 13048 | |
| 13049 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 13050 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 13051 | pPnoRequest->ucNetworksCount = 0; |
| 13052 | |
| 13053 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 13054 | pAdapter->sessionId, |
| 13055 | NULL, pAdapter); |
| 13056 | if (eHAL_STATUS_SUCCESS != status) |
| 13057 | { |
| 13058 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13059 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13060 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13061 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13062 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13063 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13064 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13065 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13066 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13067 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13068 | vos_mem_free(pPnoRequest); |
| 13069 | |
| 13070 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13071 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13072 | } |
| 13073 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13074 | /* |
| 13075 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 13076 | * NL interface to disable PNO |
| 13077 | */ |
| 13078 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 13079 | struct net_device *dev) |
| 13080 | { |
| 13081 | int ret; |
| 13082 | |
| 13083 | vos_ssr_protect(__func__); |
| 13084 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 13085 | vos_ssr_unprotect(__func__); |
| 13086 | |
| 13087 | return ret; |
| 13088 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13089 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 13090 | |
| 13091 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13092 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13093 | #if TDLS_MGMT_VERSION2 |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13094 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 13095 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13096 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 13097 | #else |
| 13098 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 13099 | u8 *peer, u8 action_code, u8 dialog_token, |
| 13100 | u16 status_code, const u8 *buf, size_t len) |
| 13101 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13102 | { |
| 13103 | |
| 13104 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13105 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13106 | u8 peerMac[6]; |
| 13107 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13108 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13109 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13110 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13111 | #if !(TDLS_MGMT_VERSION2) |
| 13112 | u32 peer_capability = 0; |
| 13113 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13114 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13115 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13116 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13117 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 13118 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13119 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13120 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13121 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13122 | "Invalid arguments"); |
| 13123 | return -EINVAL; |
| 13124 | } |
| 13125 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13126 | if (pHddCtx->isLogpInProgress) |
| 13127 | { |
| 13128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13129 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13130 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 13131 | peer, |
| 13132 | eTDLS_LINK_IDLE, |
| 13133 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13134 | return -EBUSY; |
| 13135 | } |
| 13136 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13137 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13138 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13139 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13140 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 13141 | MAC_ADDRESS_STR " action %d declined.", |
| 13142 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13143 | return -ENOTSUPP; |
| 13144 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13145 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13146 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 13147 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 13148 | { |
| 13149 | /* if tdls_mode is disabled to respond to peer's request */ |
| 13150 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 13151 | { |
| 13152 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13153 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13154 | " TDLS mode is disabled. action %d declined.", |
| 13155 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13156 | |
| 13157 | return -ENOTSUPP; |
| 13158 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 13159 | |
| 13160 | if (vos_max_concurrent_connections_reached()) |
| 13161 | { |
| 13162 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 13163 | return -EINVAL; |
| 13164 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13165 | } |
| 13166 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13167 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 13168 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13169 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13170 | { |
| 13171 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13172 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13173 | " TDLS setup is ongoing. action %d declined.", |
| 13174 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 13175 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13176 | } |
| 13177 | } |
| 13178 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13179 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 13180 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13181 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13182 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 13183 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13184 | { |
| 13185 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 13186 | we return error code at 'add_station()'. Hence we have this |
| 13187 | check again in addtion to add_station(). |
| 13188 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13189 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13190 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13191 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13192 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13193 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 13194 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 13195 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13196 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13197 | } |
| 13198 | else |
| 13199 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13200 | /* maximum reached. tweak to send error code to peer and return |
| 13201 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13202 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13203 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13204 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13205 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 13206 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 13207 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13208 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13209 | /* fall through to send setup resp with failure status |
| 13210 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13211 | } |
| 13212 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13213 | else |
| 13214 | { |
| 13215 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13216 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13217 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13218 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13219 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13220 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 13221 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13222 | return -EPERM; |
| 13223 | } |
| 13224 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13225 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13226 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13227 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13228 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 13229 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 13230 | "%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] | 13231 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 13232 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13233 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13234 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13235 | /*Except teardown responder will not be used so just make 0*/ |
| 13236 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13237 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13238 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13239 | |
| 13240 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13241 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13242 | |
| 13243 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 13244 | responder = pTdlsPeer->is_responder; |
| 13245 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13246 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13247 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 13248 | "%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] | 13249 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 13250 | dialog_token, status_code, len); |
| 13251 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13252 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13253 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13254 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13255 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 13256 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13257 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13258 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 13259 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13260 | { |
| 13261 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 13262 | { |
| 13263 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13264 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13265 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 13266 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13267 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 13268 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13269 | } |
| 13270 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13271 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 13272 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 13273 | { |
| 13274 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13275 | "%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] | 13276 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 13277 | return -EBUSY; |
| 13278 | } |
| 13279 | |
| 13280 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13281 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 13282 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13283 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 13284 | 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] | 13285 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13286 | if (VOS_STATUS_SUCCESS != status) |
| 13287 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13288 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13289 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13290 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13291 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13292 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13293 | } |
| 13294 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13295 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 13296 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 13297 | |
| 13298 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13299 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13300 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 13301 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13302 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13303 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 13304 | |
| 13305 | if (pHddCtx->isLogpInProgress) |
| 13306 | { |
| 13307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13308 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13309 | return -EAGAIN; |
| 13310 | } |
| 13311 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13312 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13313 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13314 | } |
| 13315 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13316 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13317 | { |
| 13318 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13319 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13320 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13321 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13322 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 13323 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 13324 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13325 | } |
| 13326 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 13327 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 13328 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13329 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13330 | |
| 13331 | return 0; |
| 13332 | } |
| 13333 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13334 | |
| 13335 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 13336 | u8 *peer, |
| 13337 | cfg80211_exttdls_callback callback) |
| 13338 | { |
| 13339 | |
| 13340 | hddTdlsPeer_t *pTdlsPeer; |
| 13341 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13343 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 13344 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13345 | |
| 13346 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13347 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13348 | |
| 13349 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13350 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13351 | __func__); |
| 13352 | return -ENOTSUPP; |
| 13353 | } |
| 13354 | |
| 13355 | /* To cater the requirement of establishing the TDLS link |
| 13356 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 13357 | */ |
| 13358 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 13359 | if (pTdlsPeer == NULL) { |
| 13360 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13361 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 13362 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13363 | return -EINVAL; |
| 13364 | } |
| 13365 | |
| 13366 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 13367 | |
| 13368 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13369 | " %s TDLS Add Force Peer Failed", |
| 13370 | __func__); |
| 13371 | return -EINVAL; |
| 13372 | } |
| 13373 | /*EXT TDLS*/ |
| 13374 | |
| 13375 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 13376 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13377 | " %s TDLS set callback Failed", |
| 13378 | __func__); |
| 13379 | return -EINVAL; |
| 13380 | } |
| 13381 | |
| 13382 | return(0); |
| 13383 | |
| 13384 | } |
| 13385 | |
| 13386 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 13387 | { |
| 13388 | |
| 13389 | hddTdlsPeer_t *pTdlsPeer; |
| 13390 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13391 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13392 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 13393 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13394 | |
| 13395 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13396 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13397 | |
| 13398 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13399 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13400 | __func__); |
| 13401 | return -ENOTSUPP; |
| 13402 | } |
| 13403 | |
| 13404 | |
| 13405 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13406 | |
| 13407 | if ( NULL == pTdlsPeer ) { |
| 13408 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 13409 | " peer not exsting", |
| 13410 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13411 | return -EINVAL; |
| 13412 | } |
| 13413 | else { |
| 13414 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 13415 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 13416 | } |
| 13417 | |
| 13418 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 13419 | return -EINVAL; |
| 13420 | |
| 13421 | /*EXT TDLS*/ |
| 13422 | |
| 13423 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 13424 | |
| 13425 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13426 | " %s TDLS set callback Failed", |
| 13427 | __func__); |
| 13428 | return -EINVAL; |
| 13429 | } |
| 13430 | return(0); |
| 13431 | |
| 13432 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13433 | 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] | 13434 | u8 *peer, enum nl80211_tdls_operation oper) |
| 13435 | { |
| 13436 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13437 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13438 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13439 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13440 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13441 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13442 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 13443 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13444 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13445 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13446 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 13447 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13448 | return -EINVAL; |
| 13449 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13450 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13451 | status = wlan_hdd_validate_context(pHddCtx); |
| 13452 | |
| 13453 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13454 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13455 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13456 | "%s: HDD context is not valid", __func__); |
| 13457 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13458 | } |
| 13459 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13460 | |
| 13461 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13462 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13463 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13464 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 13465 | "TDLS Disabled in INI OR not enabled in FW. " |
| 13466 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13467 | return -ENOTSUPP; |
| 13468 | } |
| 13469 | |
| 13470 | switch (oper) { |
| 13471 | case NL80211_TDLS_ENABLE_LINK: |
| 13472 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13473 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13474 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13475 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13476 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13477 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13478 | |
| 13479 | if ( NULL == pTdlsPeer ) { |
| 13480 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13481 | " (oper %d) not exsting. ignored", |
| 13482 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13483 | return -EINVAL; |
| 13484 | } |
| 13485 | |
| 13486 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13487 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13488 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13489 | "NL80211_TDLS_ENABLE_LINK"); |
| 13490 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 13491 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 13492 | { |
| 13493 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 13494 | MAC_ADDRESS_STR " failed", |
| 13495 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 13496 | return -EINVAL; |
| 13497 | } |
| 13498 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13499 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13500 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13501 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 13502 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13503 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 13504 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 13505 | return -EINVAL; |
| 13506 | } |
| 13507 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13508 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13509 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13510 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 13511 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 13512 | * register with the TL on after the response for this operation |
| 13513 | * is received . |
| 13514 | */ |
| 13515 | ret = wait_for_completion_interruptible_timeout( |
| 13516 | &pAdapter->tdls_link_establish_req_comp, |
| 13517 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 13518 | if (ret <= 0) |
| 13519 | { |
| 13520 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13521 | "%s: Link Establish Request Faled Status %ld", |
| 13522 | __func__, ret); |
| 13523 | return -EINVAL; |
| 13524 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13525 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13526 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13527 | eTDLS_LINK_CONNECTED, |
| 13528 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 13529 | /* Mark TDLS client Authenticated .*/ |
| 13530 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 13531 | pTdlsPeer->staId, |
| 13532 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13533 | if (VOS_STATUS_SUCCESS == status) |
| 13534 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13535 | if (pTdlsPeer->is_responder == 0) |
| 13536 | { |
| 13537 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 13538 | |
| 13539 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 13540 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 13541 | WAIT_TIME_TDLS_INITIATOR); |
| 13542 | /* suspend initiator TX until it receives direct packet from the |
| 13543 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 13544 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13545 | &staId, NULL); |
| 13546 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13547 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 13548 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13549 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13550 | |
| 13551 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13552 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 13553 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13554 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13555 | int ac; |
| 13556 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 13557 | WLANTL_AC_VI, |
| 13558 | WLANTL_AC_BK, |
| 13559 | WLANTL_AC_BE }; |
| 13560 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 13561 | for(ac=0; ac < 4; ac++) |
| 13562 | { |
| 13563 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13564 | pTdlsPeer->staId, ucAc[ac], |
| 13565 | tlTid[ac], tlTid[ac], 0, 0, |
| 13566 | WLANTL_BI_DIR ); |
| 13567 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13568 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13569 | } |
| 13570 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13571 | } |
| 13572 | break; |
| 13573 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13574 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13575 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13576 | |
| 13577 | if ( NULL == pTdlsPeer ) { |
| 13578 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13579 | " (oper %d) not exsting. ignored", |
| 13580 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13581 | return -EINVAL; |
| 13582 | } |
| 13583 | |
| 13584 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13585 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13586 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13587 | "NL80211_TDLS_DISABLE_LINK"); |
| 13588 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13589 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13590 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13591 | long status; |
| 13592 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 13593 | |
| 13594 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13595 | eTDLS_LINK_TEARING, |
| 13596 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 13597 | eTDLS_LINK_UNSPECIFIED: |
| 13598 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13599 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 13600 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13601 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13602 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13603 | |
| 13604 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 13605 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 13606 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13607 | eTDLS_LINK_IDLE, |
| 13608 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 13609 | eTDLS_LINK_UNSPECIFIED: |
| 13610 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13611 | if (status <= 0) |
| 13612 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13613 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13614 | "%s: Del station failed status %ld", |
| 13615 | __func__, status); |
| 13616 | return -EPERM; |
| 13617 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13618 | } |
| 13619 | else |
| 13620 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13621 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13622 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13623 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13624 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13625 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13626 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13627 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13628 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13629 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13630 | if (0 != status) |
| 13631 | { |
| 13632 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13633 | "%s: Error in TDLS Teardown", __func__); |
| 13634 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13635 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13636 | break; |
| 13637 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13638 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13639 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13640 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 13641 | peer, |
| 13642 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13643 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13644 | if (0 != status) |
| 13645 | { |
| 13646 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13647 | "%s: Error in TDLS Setup", __func__); |
| 13648 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 13649 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 13650 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13651 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13652 | case NL80211_TDLS_DISCOVERY_REQ: |
| 13653 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13654 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13655 | "%s: We don't support in-driver setup/teardown/discovery " |
| 13656 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13657 | return -ENOTSUPP; |
| 13658 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13659 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13660 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13661 | return -ENOTSUPP; |
| 13662 | } |
| 13663 | return 0; |
| 13664 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13665 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13666 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 13667 | u8 *peer, enum nl80211_tdls_operation oper) |
| 13668 | { |
| 13669 | int ret; |
| 13670 | |
| 13671 | vos_ssr_protect(__func__); |
| 13672 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 13673 | vos_ssr_unprotect(__func__); |
| 13674 | |
| 13675 | return ret; |
| 13676 | } |
| 13677 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13678 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 13679 | struct net_device *dev, u8 *peer) |
| 13680 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 13681 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13682 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 13683 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13684 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13685 | #if TDLS_MGMT_VERSION2 |
| 13686 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13687 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 13688 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13689 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13690 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13691 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13692 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13693 | #endif |
| 13694 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13695 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 13696 | /* |
| 13697 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 13698 | * Callback rountine called upon receiving response for |
| 13699 | * get offload info |
| 13700 | */ |
| 13701 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 13702 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 13703 | { |
| 13704 | |
| 13705 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13706 | tANI_U8 tempReplayCounter[8]; |
| 13707 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13708 | |
| 13709 | ENTER(); |
| 13710 | |
| 13711 | if (NULL == pAdapter) |
| 13712 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13713 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13714 | "%s: HDD adapter is Null", __func__); |
| 13715 | return ; |
| 13716 | } |
| 13717 | |
| 13718 | if (NULL == pGtkOffloadGetInfoRsp) |
| 13719 | { |
| 13720 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13721 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 13722 | return ; |
| 13723 | } |
| 13724 | |
| 13725 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 13726 | { |
| 13727 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13728 | "%s: wlan Failed to get replay counter value", |
| 13729 | __func__); |
| 13730 | return ; |
| 13731 | } |
| 13732 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13733 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13734 | /* Update replay counter */ |
| 13735 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 13736 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13737 | |
| 13738 | { |
| 13739 | /* changing from little to big endian since supplicant |
| 13740 | * works on big endian format |
| 13741 | */ |
| 13742 | int i; |
| 13743 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13744 | |
| 13745 | for (i = 0; i < 8; i++) |
| 13746 | { |
| 13747 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 13748 | } |
| 13749 | } |
| 13750 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13751 | /* Update replay counter to NL */ |
| 13752 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13753 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13754 | } |
| 13755 | |
| 13756 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13757 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13758 | * This function is used to offload GTK rekeying job to the firmware. |
| 13759 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13760 | 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] | 13761 | struct cfg80211_gtk_rekey_data *data) |
| 13762 | { |
| 13763 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13764 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13765 | hdd_station_ctx_t *pHddStaCtx; |
| 13766 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13767 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13768 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13769 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13770 | |
| 13771 | ENTER(); |
| 13772 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13773 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13774 | if (NULL == pAdapter) |
| 13775 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13776 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13777 | "%s: HDD adapter is Null", __func__); |
| 13778 | return -ENODEV; |
| 13779 | } |
| 13780 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13781 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13782 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 13783 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13784 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13785 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13786 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13787 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13788 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13789 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13790 | "%s: HDD context is not valid", __func__); |
| 13791 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13792 | } |
| 13793 | |
| 13794 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13795 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13796 | if (NULL == hHal) |
| 13797 | { |
| 13798 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13799 | "%s: HAL context is Null!!!", __func__); |
| 13800 | return -EAGAIN; |
| 13801 | } |
| 13802 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13803 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 13804 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 13805 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 13806 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13807 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13808 | { |
| 13809 | /* changing from big to little endian since driver |
| 13810 | * works on little endian format |
| 13811 | */ |
| 13812 | tANI_U8 *p = |
| 13813 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 13814 | int i; |
| 13815 | |
| 13816 | for (i = 0; i < 8; i++) |
| 13817 | { |
| 13818 | p[7-i] = data->replay_ctr[i]; |
| 13819 | } |
| 13820 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13821 | |
| 13822 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 13823 | { |
| 13824 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13825 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 13826 | sizeof (tSirGtkOffloadParams)); |
| 13827 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13828 | pAdapter->sessionId); |
| 13829 | |
| 13830 | if (eHAL_STATUS_SUCCESS != status) |
| 13831 | { |
| 13832 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13833 | "%s: sme_SetGTKOffload failed, returned %d", |
| 13834 | __func__, status); |
| 13835 | return status; |
| 13836 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13838 | "%s: sme_SetGTKOffload successfull", __func__); |
| 13839 | } |
| 13840 | else |
| 13841 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13842 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13843 | "%s: wlan not suspended GTKOffload request is stored", |
| 13844 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13845 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13846 | |
| 13847 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13848 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13849 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13850 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 13851 | struct cfg80211_gtk_rekey_data *data) |
| 13852 | { |
| 13853 | int ret; |
| 13854 | |
| 13855 | vos_ssr_protect(__func__); |
| 13856 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 13857 | vos_ssr_unprotect(__func__); |
| 13858 | |
| 13859 | return ret; |
| 13860 | } |
| 13861 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13862 | /* |
| 13863 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 13864 | * This function is used to set access control policy |
| 13865 | */ |
| 13866 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 13867 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 13868 | { |
| 13869 | int i; |
| 13870 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13871 | hdd_hostapd_state_t *pHostapdState; |
| 13872 | tsap_Config_t *pConfig; |
| 13873 | v_CONTEXT_t pVosContext = NULL; |
| 13874 | hdd_context_t *pHddCtx; |
| 13875 | int status; |
| 13876 | |
| 13877 | ENTER(); |
| 13878 | |
| 13879 | if (NULL == pAdapter) |
| 13880 | { |
| 13881 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13882 | "%s: HDD adapter is Null", __func__); |
| 13883 | return -ENODEV; |
| 13884 | } |
| 13885 | |
| 13886 | if (NULL == params) |
| 13887 | { |
| 13888 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13889 | "%s: params is Null", __func__); |
| 13890 | return -EINVAL; |
| 13891 | } |
| 13892 | |
| 13893 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13894 | status = wlan_hdd_validate_context(pHddCtx); |
| 13895 | |
| 13896 | if (0 != status) |
| 13897 | { |
| 13898 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13899 | "%s: HDD context is not valid", __func__); |
| 13900 | return status; |
| 13901 | } |
| 13902 | |
| 13903 | pVosContext = pHddCtx->pvosContext; |
| 13904 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 13905 | |
| 13906 | if (NULL == pHostapdState) |
| 13907 | { |
| 13908 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13909 | "%s: pHostapdState is Null", __func__); |
| 13910 | return -EINVAL; |
| 13911 | } |
| 13912 | |
| 13913 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 13914 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 13915 | |
| 13916 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 13917 | { |
| 13918 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 13919 | |
| 13920 | /* default value */ |
| 13921 | pConfig->num_accept_mac = 0; |
| 13922 | pConfig->num_deny_mac = 0; |
| 13923 | |
| 13924 | /** |
| 13925 | * access control policy |
| 13926 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 13927 | * listed in hostapd.deny file. |
| 13928 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 13929 | * listed in hostapd.accept file. |
| 13930 | */ |
| 13931 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 13932 | { |
| 13933 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 13934 | } |
| 13935 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 13936 | { |
| 13937 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 13938 | } |
| 13939 | else |
| 13940 | { |
| 13941 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13942 | "%s:Acl Policy : %d is not supported", |
| 13943 | __func__, params->acl_policy); |
| 13944 | return -ENOTSUPP; |
| 13945 | } |
| 13946 | |
| 13947 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 13948 | { |
| 13949 | pConfig->num_accept_mac = params->n_acl_entries; |
| 13950 | for (i = 0; i < params->n_acl_entries; i++) |
| 13951 | { |
| 13952 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13953 | "** Add ACL MAC entry %i in WhiletList :" |
| 13954 | MAC_ADDRESS_STR, i, |
| 13955 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 13956 | |
| 13957 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 13958 | sizeof(qcmacaddr)); |
| 13959 | } |
| 13960 | } |
| 13961 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 13962 | { |
| 13963 | pConfig->num_deny_mac = params->n_acl_entries; |
| 13964 | for (i = 0; i < params->n_acl_entries; i++) |
| 13965 | { |
| 13966 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13967 | "** Add ACL MAC entry %i in BlackList :" |
| 13968 | MAC_ADDRESS_STR, i, |
| 13969 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 13970 | |
| 13971 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 13972 | sizeof(qcmacaddr)); |
| 13973 | } |
| 13974 | } |
| 13975 | |
| 13976 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 13977 | { |
| 13978 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13979 | "%s: SAP Set Mac Acl fail", __func__); |
| 13980 | return -EINVAL; |
| 13981 | } |
| 13982 | } |
| 13983 | else |
| 13984 | { |
| 13985 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13986 | "%s: Invalid device_mode = %s (%d)", |
| 13987 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13988 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13989 | return -EINVAL; |
| 13990 | } |
| 13991 | |
| 13992 | return 0; |
| 13993 | } |
| 13994 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13995 | #ifdef WLAN_NL80211_TESTMODE |
| 13996 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 13997 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 13998 | ( |
| 13999 | void *pAdapter, |
| 14000 | void *indCont |
| 14001 | ) |
| 14002 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14003 | tSirLPHBInd *lphbInd; |
| 14004 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14005 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14006 | |
| 14007 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14008 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14009 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14010 | if (pAdapter == NULL) |
| 14011 | { |
| 14012 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14013 | "%s: pAdapter is NULL\n",__func__); |
| 14014 | return; |
| 14015 | } |
| 14016 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14017 | if (NULL == indCont) |
| 14018 | { |
| 14019 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14020 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14021 | return; |
| 14022 | } |
| 14023 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14024 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14025 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14026 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14027 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14028 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14029 | GFP_ATOMIC); |
| 14030 | if (!skb) |
| 14031 | { |
| 14032 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14033 | "LPHB timeout, NL buffer alloc fail"); |
| 14034 | return; |
| 14035 | } |
| 14036 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14037 | 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] | 14038 | { |
| 14039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14040 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 14041 | goto nla_put_failure; |
| 14042 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14043 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14044 | { |
| 14045 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14046 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 14047 | goto nla_put_failure; |
| 14048 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14049 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14050 | sizeof(tSirLPHBInd), lphbInd)) |
| 14051 | { |
| 14052 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14053 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 14054 | goto nla_put_failure; |
| 14055 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14056 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 14057 | return; |
| 14058 | |
| 14059 | nla_put_failure: |
| 14060 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14061 | "NLA Put fail"); |
| 14062 | kfree_skb(skb); |
| 14063 | |
| 14064 | return; |
| 14065 | } |
| 14066 | #endif /* FEATURE_WLAN_LPHB */ |
| 14067 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14068 | 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] | 14069 | { |
| 14070 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 14071 | int err = 0; |
| 14072 | #ifdef FEATURE_WLAN_LPHB |
| 14073 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14074 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14075 | #endif /* FEATURE_WLAN_LPHB */ |
| 14076 | |
| 14077 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 14078 | if (err) |
| 14079 | { |
| 14080 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14081 | "%s Testmode INV ATTR", __func__); |
| 14082 | return err; |
| 14083 | } |
| 14084 | |
| 14085 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 14086 | { |
| 14087 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14088 | "%s Testmode INV CMD", __func__); |
| 14089 | return -EINVAL; |
| 14090 | } |
| 14091 | |
| 14092 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 14093 | { |
| 14094 | #ifdef FEATURE_WLAN_LPHB |
| 14095 | /* Low Power Heartbeat configuration request */ |
| 14096 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 14097 | { |
| 14098 | int buf_len; |
| 14099 | void *buf; |
| 14100 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 14101 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14102 | |
| 14103 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 14104 | { |
| 14105 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14106 | "%s Testmode INV DATA", __func__); |
| 14107 | return -EINVAL; |
| 14108 | } |
| 14109 | |
| 14110 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 14111 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 14112 | |
| 14113 | hb_params_temp =(tSirLPHBReq *)buf; |
| 14114 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 14115 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 14116 | return -EINVAL; |
| 14117 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14118 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 14119 | if (NULL == hb_params) |
| 14120 | { |
| 14121 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14122 | "%s Request Buffer Alloc Fail", __func__); |
| 14123 | return -EINVAL; |
| 14124 | } |
| 14125 | |
| 14126 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14127 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 14128 | hb_params, |
| 14129 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 14130 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14131 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14132 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14133 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14134 | vos_mem_free(hb_params); |
| 14135 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14136 | return 0; |
| 14137 | } |
| 14138 | #endif /* FEATURE_WLAN_LPHB */ |
| 14139 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14141 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14142 | return -EOPNOTSUPP; |
| 14143 | } |
| 14144 | |
| 14145 | return err; |
| 14146 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14147 | |
| 14148 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 14149 | { |
| 14150 | int ret; |
| 14151 | |
| 14152 | vos_ssr_protect(__func__); |
| 14153 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 14154 | vos_ssr_unprotect(__func__); |
| 14155 | |
| 14156 | return ret; |
| 14157 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14158 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 14159 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14160 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14161 | struct net_device *dev, |
| 14162 | int idx, struct survey_info *survey) |
| 14163 | { |
| 14164 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14165 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14166 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14167 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14168 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14169 | v_S7_t snr,rssi; |
| 14170 | int status, i, j, filled = 0; |
| 14171 | |
| 14172 | ENTER(); |
| 14173 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14174 | if (NULL == pAdapter) |
| 14175 | { |
| 14176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14177 | "%s: HDD adapter is Null", __func__); |
| 14178 | return -ENODEV; |
| 14179 | } |
| 14180 | |
| 14181 | if (NULL == wiphy) |
| 14182 | { |
| 14183 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14184 | "%s: wiphy is Null", __func__); |
| 14185 | return -ENODEV; |
| 14186 | } |
| 14187 | |
| 14188 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14189 | status = wlan_hdd_validate_context(pHddCtx); |
| 14190 | |
| 14191 | if (0 != status) |
| 14192 | { |
| 14193 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14194 | "%s: HDD context is not valid", __func__); |
| 14195 | return status; |
| 14196 | } |
| 14197 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14198 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14199 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14200 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14201 | 0 != pAdapter->survey_idx || |
| 14202 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14203 | { |
| 14204 | /* The survey dump ops when implemented completely is expected to |
| 14205 | * return a survey of all channels and the ops is called by the |
| 14206 | * kernel with incremental values of the argument 'idx' till it |
| 14207 | * returns -ENONET. But we can only support the survey for the |
| 14208 | * operating channel for now. survey_idx is used to track |
| 14209 | * that the ops is called only once and then return -ENONET for |
| 14210 | * the next iteration |
| 14211 | */ |
| 14212 | pAdapter->survey_idx = 0; |
| 14213 | return -ENONET; |
| 14214 | } |
| 14215 | |
| 14216 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14217 | |
| 14218 | wlan_hdd_get_snr(pAdapter, &snr); |
| 14219 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 14220 | |
| 14221 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 14222 | hdd_wlan_get_freq(channel, &freq); |
| 14223 | |
| 14224 | |
| 14225 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 14226 | { |
| 14227 | if (NULL == wiphy->bands[i]) |
| 14228 | { |
| 14229 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 14230 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 14231 | continue; |
| 14232 | } |
| 14233 | |
| 14234 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 14235 | { |
| 14236 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 14237 | |
| 14238 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 14239 | { |
| 14240 | survey->channel = &band->channels[j]; |
| 14241 | /* The Rx BDs contain SNR values in dB for the received frames |
| 14242 | * while the supplicant expects noise. So we calculate and |
| 14243 | * return the value of noise (dBm) |
| 14244 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 14245 | */ |
| 14246 | survey->noise = rssi - snr; |
| 14247 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 14248 | filled = 1; |
| 14249 | } |
| 14250 | } |
| 14251 | } |
| 14252 | |
| 14253 | if (filled) |
| 14254 | pAdapter->survey_idx = 1; |
| 14255 | else |
| 14256 | { |
| 14257 | pAdapter->survey_idx = 0; |
| 14258 | return -ENONET; |
| 14259 | } |
| 14260 | |
| 14261 | return 0; |
| 14262 | } |
| 14263 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14264 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 14265 | struct net_device *dev, |
| 14266 | int idx, struct survey_info *survey) |
| 14267 | { |
| 14268 | int ret; |
| 14269 | |
| 14270 | vos_ssr_protect(__func__); |
| 14271 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 14272 | vos_ssr_unprotect(__func__); |
| 14273 | |
| 14274 | return ret; |
| 14275 | } |
| 14276 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14277 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14278 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14279 | * this is called when cfg80211 driver resume |
| 14280 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 14281 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14282 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14283 | { |
| 14284 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 14285 | hdd_adapter_t *pAdapter; |
| 14286 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 14287 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14288 | |
| 14289 | ENTER(); |
| 14290 | |
| 14291 | if ( NULL == pHddCtx ) |
| 14292 | { |
| 14293 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14294 | "%s: HddCtx validation failed", __func__); |
| 14295 | return 0; |
| 14296 | } |
| 14297 | |
| 14298 | if (pHddCtx->isLogpInProgress) |
| 14299 | { |
| 14300 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14301 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14302 | return 0; |
| 14303 | } |
| 14304 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14305 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14306 | { |
| 14307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14308 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14309 | return 0; |
| 14310 | } |
| 14311 | |
| 14312 | spin_lock(&pHddCtx->schedScan_lock); |
| 14313 | pHddCtx->isWiphySuspended = FALSE; |
| 14314 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 14315 | { |
| 14316 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14318 | "%s: Return resume is not due to PNO indication", __func__); |
| 14319 | return 0; |
| 14320 | } |
| 14321 | // Reset flag to avoid updatating cfg80211 data old results again |
| 14322 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 14323 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14324 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14325 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14326 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 14327 | |
| 14328 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 14329 | { |
| 14330 | pAdapter = pAdapterNode->pAdapter; |
| 14331 | if ( (NULL != pAdapter) && |
| 14332 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 14333 | { |
| 14334 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14335 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14336 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14337 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14338 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14339 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14340 | { |
| 14341 | /* Acquire wakelock to handle the case where APP's tries to |
| 14342 | * suspend immediately after updating the scan results. Whis |
| 14343 | * results in app's is in suspended state and not able to |
| 14344 | * process the connect request to AP |
| 14345 | */ |
| 14346 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14347 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14348 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14349 | |
| 14350 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14351 | "%s : cfg80211 scan result database updated", __func__); |
| 14352 | |
| 14353 | return 0; |
| 14354 | |
| 14355 | } |
| 14356 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14357 | pAdapterNode = pNext; |
| 14358 | } |
| 14359 | |
| 14360 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14361 | "%s: Failed to find Adapter", __func__); |
| 14362 | return 0; |
| 14363 | } |
| 14364 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14365 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 14366 | { |
| 14367 | int ret; |
| 14368 | |
| 14369 | vos_ssr_protect(__func__); |
| 14370 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 14371 | vos_ssr_unprotect(__func__); |
| 14372 | |
| 14373 | return ret; |
| 14374 | } |
| 14375 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14376 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14377 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14378 | * this is called when cfg80211 driver suspends |
| 14379 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14380 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14381 | struct cfg80211_wowlan *wow) |
| 14382 | { |
| 14383 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 14384 | |
| 14385 | ENTER(); |
| 14386 | if (NULL == pHddCtx) |
| 14387 | { |
| 14388 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14389 | "%s: HddCtx validation failed", __func__); |
| 14390 | return 0; |
| 14391 | } |
| 14392 | |
| 14393 | pHddCtx->isWiphySuspended = TRUE; |
| 14394 | |
| 14395 | EXIT(); |
| 14396 | |
| 14397 | return 0; |
| 14398 | } |
| 14399 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14400 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 14401 | struct cfg80211_wowlan *wow) |
| 14402 | { |
| 14403 | int ret; |
| 14404 | |
| 14405 | vos_ssr_protect(__func__); |
| 14406 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 14407 | vos_ssr_unprotect(__func__); |
| 14408 | |
| 14409 | return ret; |
| 14410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14411 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14412 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14413 | { |
| 14414 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 14415 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 14416 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 14417 | .change_station = wlan_hdd_change_station, |
| 14418 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 14419 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 14420 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 14421 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14422 | #else |
| 14423 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 14424 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 14425 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14426 | #endif |
| 14427 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 14428 | .add_key = wlan_hdd_cfg80211_add_key, |
| 14429 | .get_key = wlan_hdd_cfg80211_get_key, |
| 14430 | .del_key = wlan_hdd_cfg80211_del_key, |
| 14431 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 14432 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14433 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 14434 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14435 | .scan = wlan_hdd_cfg80211_scan, |
| 14436 | .connect = wlan_hdd_cfg80211_connect, |
| 14437 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 14438 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 14439 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 14440 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 14441 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 14442 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14443 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 14444 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 14445 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14446 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14447 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 14448 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 14449 | .set_txq_params = wlan_hdd_set_txq_params, |
| 14450 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14451 | .get_station = wlan_hdd_cfg80211_get_station, |
| 14452 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 14453 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14454 | .add_station = wlan_hdd_cfg80211_add_station, |
| 14455 | #ifdef FEATURE_WLAN_LFR |
| 14456 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 14457 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 14458 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 14459 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14460 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 14461 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 14462 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14463 | #ifdef FEATURE_WLAN_TDLS |
| 14464 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 14465 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 14466 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14467 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 14468 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 14469 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14470 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14471 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 14472 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 14473 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14474 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 14475 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14476 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14477 | #ifdef WLAN_NL80211_TESTMODE |
| 14478 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 14479 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14480 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14481 | }; |
| 14482 | |