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; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 569 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 570 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 571 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 572 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 573 | #ifdef WLAN_NL80211_TESTMODE |
| 574 | enum wlan_hdd_tm_attr |
| 575 | { |
| 576 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 577 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 578 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 579 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 580 | /* keep last */ |
| 581 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 582 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 583 | }; |
| 584 | |
| 585 | enum wlan_hdd_tm_cmd |
| 586 | { |
| 587 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 588 | }; |
| 589 | |
| 590 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 591 | |
| 592 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 593 | { |
| 594 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 595 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 596 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 597 | }; |
| 598 | #endif /* WLAN_NL80211_TESTMODE */ |
| 599 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 600 | #ifdef FEATURE_WLAN_CH_AVOID |
| 601 | /* |
| 602 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 603 | * This is called when wlan driver needs to send vendor specific |
| 604 | * avoid frequency range event to userspace |
| 605 | */ |
| 606 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 607 | tHddAvoidFreqList *pAvoidFreqList) |
| 608 | { |
| 609 | struct sk_buff *vendor_event; |
| 610 | |
| 611 | ENTER(); |
| 612 | |
| 613 | if (!pHddCtx) |
| 614 | { |
| 615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 616 | "%s: HDD context is null", __func__); |
| 617 | return -1; |
| 618 | } |
| 619 | |
| 620 | if (!pAvoidFreqList) |
| 621 | { |
| 622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 623 | "%s: pAvoidFreqList is null", __func__); |
| 624 | return -1; |
| 625 | } |
| 626 | |
| 627 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 628 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 629 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 630 | GFP_KERNEL); |
| 631 | if (!vendor_event) |
| 632 | { |
| 633 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 634 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 635 | return -1; |
| 636 | } |
| 637 | |
| 638 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 639 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 640 | |
| 641 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 642 | |
| 643 | EXIT(); |
| 644 | return 0; |
| 645 | } |
| 646 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 647 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 648 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 649 | |
| 650 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 651 | struct sk_buff *vendor_event) |
| 652 | { |
| 653 | if (nla_put_u8(vendor_event, |
| 654 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 655 | stats->rate.preamble) || |
| 656 | nla_put_u8(vendor_event, |
| 657 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 658 | stats->rate.nss) || |
| 659 | nla_put_u8(vendor_event, |
| 660 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 661 | stats->rate.bw) || |
| 662 | nla_put_u8(vendor_event, |
| 663 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 664 | stats->rate.rateMcsIdx) || |
| 665 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 666 | stats->rate.bitrate ) || |
| 667 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 668 | stats->txMpdu ) || |
| 669 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 670 | stats->rxMpdu ) || |
| 671 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 672 | stats->mpduLost ) || |
| 673 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 674 | stats->retries) || |
| 675 | nla_put_u32(vendor_event, |
| 676 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 677 | stats->retriesShort ) || |
| 678 | nla_put_u32(vendor_event, |
| 679 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 680 | stats->retriesLong)) |
| 681 | { |
| 682 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 683 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 684 | return FALSE; |
| 685 | } |
| 686 | return TRUE; |
| 687 | } |
| 688 | |
| 689 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 690 | struct sk_buff *vendor_event) |
| 691 | { |
| 692 | u32 i = 0; |
| 693 | struct nlattr *rateInfo; |
| 694 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 695 | stats->type) || |
| 696 | nla_put(vendor_event, |
| 697 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 698 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 699 | nla_put_u32(vendor_event, |
| 700 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 701 | stats->capabilities) || |
| 702 | nla_put_u32(vendor_event, |
| 703 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 704 | stats->numRate)) |
| 705 | { |
| 706 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 707 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 708 | goto error; |
| 709 | } |
| 710 | |
| 711 | rateInfo = nla_nest_start(vendor_event, |
| 712 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
| 713 | for (i = 0; i < stats->numRate; i++) |
| 714 | { |
| 715 | struct nlattr *rates; |
| 716 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 717 | stats->rateStats + |
| 718 | (i * sizeof(tSirWifiRateStat))); |
| 719 | rates = nla_nest_start(vendor_event, i); |
| 720 | |
| 721 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 722 | { |
| 723 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 724 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 725 | return FALSE; |
| 726 | } |
| 727 | nla_nest_end(vendor_event, rates); |
| 728 | } |
| 729 | nla_nest_end(vendor_event, rateInfo); |
| 730 | |
| 731 | return TRUE; |
| 732 | error: |
| 733 | return FALSE; |
| 734 | } |
| 735 | |
| 736 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 737 | struct sk_buff *vendor_event) |
| 738 | { |
| 739 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 740 | stats->ac ) || |
| 741 | nla_put_u32(vendor_event, |
| 742 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 743 | stats->txMpdu ) || |
| 744 | nla_put_u32(vendor_event, |
| 745 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 746 | stats->rxMpdu ) || |
| 747 | nla_put_u32(vendor_event, |
| 748 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 749 | stats->txMcast ) || |
| 750 | nla_put_u32(vendor_event, |
| 751 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 752 | stats->rxMcast ) || |
| 753 | nla_put_u32(vendor_event, |
| 754 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 755 | stats->rxAmpdu ) || |
| 756 | nla_put_u32(vendor_event, |
| 757 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 758 | stats->txAmpdu ) || |
| 759 | nla_put_u32(vendor_event, |
| 760 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 761 | stats->mpduLost )|| |
| 762 | nla_put_u32(vendor_event, |
| 763 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 764 | stats->retries ) || |
| 765 | nla_put_u32(vendor_event, |
| 766 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 767 | stats->retriesShort ) || |
| 768 | nla_put_u32(vendor_event, |
| 769 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 770 | stats->retriesLong ) || |
| 771 | nla_put_u32(vendor_event, |
| 772 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 773 | stats->contentionTimeMin ) || |
| 774 | nla_put_u32(vendor_event, |
| 775 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 776 | stats->contentionTimeMax ) || |
| 777 | nla_put_u32(vendor_event, |
| 778 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 779 | stats->contentionTimeAvg ) || |
| 780 | nla_put_u32(vendor_event, |
| 781 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 782 | stats->contentionNumSamples )) |
| 783 | { |
| 784 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 785 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 786 | return FALSE; |
| 787 | } |
| 788 | return TRUE; |
| 789 | } |
| 790 | |
| 791 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 792 | struct sk_buff *vendor_event) |
| 793 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 794 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 795 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 796 | nla_put(vendor_event, |
| 797 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 798 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 799 | nla_put_u32(vendor_event, |
| 800 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 801 | stats->state ) || |
| 802 | nla_put_u32(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 804 | stats->roaming ) || |
| 805 | nla_put_u32(vendor_event, |
| 806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 807 | stats->capabilities ) || |
| 808 | nla_put(vendor_event, |
| 809 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 810 | strlen(stats->ssid), stats->ssid) || |
| 811 | nla_put(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 813 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 814 | nla_put(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 816 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 817 | nla_put(vendor_event, |
| 818 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 819 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 820 | ) |
| 821 | { |
| 822 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 823 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 824 | return FALSE; |
| 825 | } |
| 826 | return TRUE; |
| 827 | } |
| 828 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 829 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 830 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 831 | struct sk_buff *vendor_event) |
| 832 | { |
| 833 | int i = 0; |
| 834 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 835 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 836 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
| 837 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 838 | if (FALSE == put_wifi_interface_info( |
| 839 | &pWifiIfaceStat->info, |
| 840 | vendor_event)) |
| 841 | { |
| 842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 843 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 844 | return FALSE; |
| 845 | |
| 846 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 847 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 848 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 849 | if (NULL == pWifiIfaceStatTL) |
| 850 | { |
| 851 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 852 | return FALSE; |
| 853 | } |
| 854 | |
| 855 | |
| 856 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 857 | { |
| 858 | if (VOS_STATUS_SUCCESS == |
| 859 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 860 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 861 | { |
| 862 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 863 | * obtained from TL structure |
| 864 | */ |
| 865 | |
| 866 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 867 | pWifiIfaceStatTL->mgmtRx; |
| 868 | pWifiIfaceStat->mgmtActionRx = pWifiIfaceStatTL->mgmtActionRx; |
| 869 | pWifiIfaceStat->mgmtActionTx = pWifiIfaceStatTL->mgmtActionTx; |
| 870 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 871 | |
| 872 | vos_mem_copy( |
| 873 | (void *) &pWifiIfaceStat->AccessclassStats[WIFI_AC_VO], |
| 874 | (void *) &pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO], |
| 875 | sizeof(WLANTL_AccessCategoryStatsType)); |
| 876 | |
| 877 | vos_mem_copy( |
| 878 | (void *) &pWifiIfaceStat->AccessclassStats[WIFI_AC_VI], |
| 879 | (void *) &pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI], |
| 880 | sizeof(WLANTL_AccessCategoryStatsType)); |
| 881 | |
| 882 | vos_mem_copy( |
| 883 | (void *) &pWifiIfaceStat->AccessclassStats[WIFI_AC_BE], |
| 884 | (void *) &pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE], |
| 885 | sizeof(WLANTL_AccessCategoryStatsType)); |
| 886 | |
| 887 | vos_mem_copy( |
| 888 | (void *) &pWifiIfaceStat->AccessclassStats[WIFI_AC_BK], |
| 889 | (void *) &pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK], |
| 890 | sizeof(WLANTL_AccessCategoryStatsType)); |
| 891 | } |
| 892 | else |
| 893 | { |
| 894 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 895 | } |
| 896 | |
| 897 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMpdu = |
| 898 | pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[WLANTL_AC_VO]; |
| 899 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMpdu = |
| 900 | pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[WLANTL_AC_VI]; |
| 901 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMpdu = |
| 902 | pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[WLANTL_AC_BE]; |
| 903 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMpdu = |
| 904 | pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[WLANTL_AC_BK]; |
| 905 | |
| 906 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 907 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 908 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 909 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 910 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 911 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 912 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 913 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 914 | } |
| 915 | else |
| 916 | { |
| 917 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 918 | } |
| 919 | |
| 920 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 921 | |
| 922 | if (nla_put_u32(vendor_event, |
| 923 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 924 | pWifiIfaceStat->beaconRx) || |
| 925 | nla_put_u32(vendor_event, |
| 926 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 927 | pWifiIfaceStat->mgmtRx) || |
| 928 | nla_put_u32(vendor_event, |
| 929 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 930 | pWifiIfaceStat->mgmtActionRx) || |
| 931 | nla_put_u32(vendor_event, |
| 932 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 933 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 934 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 935 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 936 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 937 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 938 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 939 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 940 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 941 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 942 | pWifiIfaceStat->rssiAck)) |
| 943 | { |
| 944 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 945 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 946 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 947 | return FALSE; |
| 948 | } |
| 949 | |
| 950 | wmmInfo = nla_nest_start(vendor_event, |
| 951 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
| 952 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 953 | { |
| 954 | struct nlattr *wmmStats; |
| 955 | wmmStats = nla_nest_start(vendor_event, i); |
| 956 | if (FALSE == put_wifi_wmm_ac_stat( |
| 957 | &pWifiIfaceStat->AccessclassStats[i], |
| 958 | vendor_event)) |
| 959 | { |
| 960 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 961 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 962 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 963 | return FALSE; |
| 964 | } |
| 965 | |
| 966 | nla_nest_end(vendor_event, wmmStats); |
| 967 | } |
| 968 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 969 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 970 | return TRUE; |
| 971 | } |
| 972 | |
| 973 | static tSirWifiInterfaceMode |
| 974 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 975 | { |
| 976 | switch (deviceMode) |
| 977 | { |
| 978 | case WLAN_HDD_INFRA_STATION: |
| 979 | return WIFI_INTERFACE_STA; |
| 980 | case WLAN_HDD_SOFTAP: |
| 981 | return WIFI_INTERFACE_SOFTAP; |
| 982 | case WLAN_HDD_P2P_CLIENT: |
| 983 | return WIFI_INTERFACE_P2P_CLIENT; |
| 984 | case WLAN_HDD_P2P_GO: |
| 985 | return WIFI_INTERFACE_P2P_GO; |
| 986 | case WLAN_HDD_IBSS: |
| 987 | return WIFI_INTERFACE_IBSS; |
| 988 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 989 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 990 | } |
| 991 | } |
| 992 | |
| 993 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 994 | tpSirWifiInterfaceInfo pInfo) |
| 995 | { |
| 996 | v_U8_t *staMac = NULL; |
| 997 | hdd_station_ctx_t *pHddStaCtx; |
| 998 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 999 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1000 | |
| 1001 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1002 | |
| 1003 | vos_mem_copy(pInfo->macAddr, |
| 1004 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1005 | |
| 1006 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1007 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1008 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1009 | { |
| 1010 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1011 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1012 | { |
| 1013 | pInfo->state = WIFI_DISCONNECTED; |
| 1014 | } |
| 1015 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1016 | { |
| 1017 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1018 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1019 | pAdapter->sessionId); |
| 1020 | pInfo->state = WIFI_ASSOCIATING; |
| 1021 | } |
| 1022 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1023 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1024 | { |
| 1025 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1026 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1027 | "%s: client " MAC_ADDRESS_STR |
| 1028 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1029 | MAC_ADDR_ARRAY(staMac)); |
| 1030 | pInfo->state = WIFI_AUTHENTICATING; |
| 1031 | } |
| 1032 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1033 | { |
| 1034 | pInfo->state = WIFI_ASSOCIATED; |
| 1035 | vos_mem_copy(pInfo->bssid, |
| 1036 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1037 | vos_mem_copy(pInfo->ssid, |
| 1038 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1039 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1040 | //NULL Terminate the string. |
| 1041 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1042 | } |
| 1043 | } |
| 1044 | vos_mem_copy(pInfo->countryStr, |
| 1045 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1046 | |
| 1047 | vos_mem_copy(pInfo->apCountryStr, |
| 1048 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1049 | |
| 1050 | return TRUE; |
| 1051 | } |
| 1052 | |
| 1053 | /* |
| 1054 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1055 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1056 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1057 | * layers. |
| 1058 | */ |
| 1059 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1060 | v_VOID_t *pData) |
| 1061 | { |
| 1062 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1063 | tpSirWifiRateStat pWifiRateStat; |
| 1064 | tpSirWifiPeerStat pWifiPeerStat; |
| 1065 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1066 | struct nlattr *peerInfo; |
| 1067 | struct sk_buff *vendor_event; |
| 1068 | int status, i; |
| 1069 | |
| 1070 | status = wlan_hdd_validate_context(pHddCtx); |
| 1071 | if (0 != status) |
| 1072 | { |
| 1073 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1074 | FL("HDD context is not valid") ); |
| 1075 | return; |
| 1076 | } |
| 1077 | |
| 1078 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1079 | |
| 1080 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1081 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1082 | pWifiPeerStat->numPeers); |
| 1083 | { |
| 1084 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1085 | { |
| 1086 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1087 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1088 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1089 | |
| 1090 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1091 | " %d) LL_STATS Channel Stats " |
| 1092 | " Peer Type %u " |
| 1093 | " peerMacAddress %pM " |
| 1094 | " capabilities 0x%x " |
| 1095 | " numRate %u ", |
| 1096 | i, |
| 1097 | pWifiPeerInfo->type, |
| 1098 | pWifiPeerInfo->peerMacAddress, |
| 1099 | pWifiPeerInfo->capabilities, |
| 1100 | pWifiPeerInfo->numRate); |
| 1101 | { |
| 1102 | int j; |
| 1103 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1104 | { |
| 1105 | pWifiRateStat = (tpSirWifiRateStat) |
| 1106 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1107 | ( j * sizeof(tSirWifiRateStat))); |
| 1108 | |
| 1109 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1110 | " peer Rate Stats " |
| 1111 | " preamble %u " |
| 1112 | " nss %u " |
| 1113 | " bw %u " |
| 1114 | " rateMcsIdx %u " |
| 1115 | " reserved %u " |
| 1116 | " bitrate %u " |
| 1117 | " txMpdu %u " |
| 1118 | " rxMpdu %u " |
| 1119 | " mpduLost %u " |
| 1120 | " retries %u " |
| 1121 | " retriesShort %u " |
| 1122 | " retriesLong %u", |
| 1123 | pWifiRateStat->rate.preamble, |
| 1124 | pWifiRateStat->rate.nss, |
| 1125 | pWifiRateStat->rate.bw, |
| 1126 | pWifiRateStat->rate.rateMcsIdx, |
| 1127 | pWifiRateStat->rate.reserved, |
| 1128 | pWifiRateStat->rate.bitrate, |
| 1129 | pWifiRateStat->txMpdu, |
| 1130 | pWifiRateStat->rxMpdu, |
| 1131 | pWifiRateStat->mpduLost, |
| 1132 | pWifiRateStat->retries, |
| 1133 | pWifiRateStat->retriesShort, |
| 1134 | pWifiRateStat->retriesLong); |
| 1135 | } |
| 1136 | } |
| 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | /* |
| 1141 | * Allocate a size of 4096 for the peer stats comprising |
| 1142 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1143 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1144 | * NL attribute.The size of 4096 is considered assuming |
| 1145 | * that number of rates shall not exceed beyond 50 with |
| 1146 | * the sizeof (tSirWifiRateStat) being 32. |
| 1147 | */ |
| 1148 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1149 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1150 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1151 | GFP_KERNEL); |
| 1152 | if (!vendor_event) |
| 1153 | { |
| 1154 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1155 | "%s: cfg80211_vendor_event_alloc failed", |
| 1156 | __func__); |
| 1157 | return; |
| 1158 | } |
| 1159 | if (nla_put_u32(vendor_event, |
| 1160 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1161 | pWifiPeerStat->numPeers)) |
| 1162 | { |
| 1163 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1164 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1165 | kfree_skb(vendor_event); |
| 1166 | return; |
| 1167 | } |
| 1168 | |
| 1169 | peerInfo = nla_nest_start(vendor_event, |
| 1170 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
| 1171 | |
| 1172 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1173 | pWifiPeerStat->peerInfo); |
| 1174 | |
| 1175 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1176 | { |
| 1177 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
| 1178 | int numRate = pWifiPeerInfo->numRate; |
| 1179 | |
| 1180 | if (FALSE == put_wifi_peer_info( |
| 1181 | pWifiPeerInfo, vendor_event)) |
| 1182 | { |
| 1183 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1184 | "%s: put_wifi_peer_info put fail", __func__); |
| 1185 | kfree_skb(vendor_event); |
| 1186 | return; |
| 1187 | } |
| 1188 | |
| 1189 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1190 | pWifiPeerStat->peerInfo + |
| 1191 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1192 | (numRate * sizeof (tSirWifiRateStat))); |
| 1193 | nla_nest_end(vendor_event, peers); |
| 1194 | } |
| 1195 | nla_nest_end(vendor_event, peerInfo); |
| 1196 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1197 | } |
| 1198 | |
| 1199 | /* |
| 1200 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1201 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1202 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1203 | * layers. |
| 1204 | */ |
| 1205 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1206 | v_VOID_t *pData) |
| 1207 | { |
| 1208 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1209 | struct sk_buff *vendor_event; |
| 1210 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1211 | int status; |
| 1212 | |
| 1213 | status = wlan_hdd_validate_context(pHddCtx); |
| 1214 | if (0 != status) |
| 1215 | { |
| 1216 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1217 | FL("HDD context is not valid") ); |
| 1218 | return; |
| 1219 | } |
| 1220 | /* |
| 1221 | * Allocate a size of 4096 for the interface stats comprising |
| 1222 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1223 | * assuming that all these fit with in the limit.Please take |
| 1224 | * a call on the limit based on the data requirements on |
| 1225 | * interface statistics. |
| 1226 | */ |
| 1227 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1228 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1229 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1230 | GFP_KERNEL); |
| 1231 | if (!vendor_event) |
| 1232 | { |
| 1233 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1234 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1235 | return; |
| 1236 | } |
| 1237 | |
| 1238 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1239 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1240 | |
| 1241 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1242 | &pWifiIfaceStat->info)) |
| 1243 | { |
| 1244 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1245 | FL("hdd_get_interface_info get fail") ); |
| 1246 | kfree_skb(vendor_event); |
| 1247 | return; |
| 1248 | } |
| 1249 | |
| 1250 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1251 | vendor_event)) |
| 1252 | { |
| 1253 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1254 | FL("put_wifi_iface_stats fail") ); |
| 1255 | kfree_skb(vendor_event); |
| 1256 | return; |
| 1257 | } |
| 1258 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1259 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1260 | "WMI_LINK_STATS_IFACE Data"); |
| 1261 | |
| 1262 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1263 | "LL_STATS_IFACE: " |
| 1264 | " Mode %u " |
| 1265 | " MAC %pM " |
| 1266 | " State %u " |
| 1267 | " Roaming %u " |
| 1268 | " capabilities 0x%x " |
| 1269 | " SSID %s " |
| 1270 | " BSSID %pM", |
| 1271 | pWifiIfaceStat->info.mode, |
| 1272 | pWifiIfaceStat->info.macAddr, |
| 1273 | pWifiIfaceStat->info.state, |
| 1274 | pWifiIfaceStat->info.roaming, |
| 1275 | pWifiIfaceStat->info.capabilities, |
| 1276 | pWifiIfaceStat->info.ssid, |
| 1277 | pWifiIfaceStat->info.bssid); |
| 1278 | |
| 1279 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1280 | " AP country str: %c%c%c", |
| 1281 | pWifiIfaceStat->info.apCountryStr[0], |
| 1282 | pWifiIfaceStat->info.apCountryStr[1], |
| 1283 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1284 | |
| 1285 | |
| 1286 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1287 | " Country Str Association: %c%c%c", |
| 1288 | pWifiIfaceStat->info.countryStr[0], |
| 1289 | pWifiIfaceStat->info.countryStr[1], |
| 1290 | pWifiIfaceStat->info.countryStr[2]); |
| 1291 | |
| 1292 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1293 | " beaconRx %u " |
| 1294 | " mgmtRx %u " |
| 1295 | " mgmtActionRx %u " |
| 1296 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1297 | " rssiMgmt %d " |
| 1298 | " rssiData %d " |
| 1299 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1300 | pWifiIfaceStat->beaconRx, |
| 1301 | pWifiIfaceStat->mgmtRx, |
| 1302 | pWifiIfaceStat->mgmtActionRx, |
| 1303 | pWifiIfaceStat->mgmtActionTx, |
| 1304 | pWifiIfaceStat->rssiMgmt, |
| 1305 | pWifiIfaceStat->rssiData, |
| 1306 | pWifiIfaceStat->rssiAck ); |
| 1307 | |
| 1308 | |
| 1309 | { |
| 1310 | int i; |
| 1311 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1312 | { |
| 1313 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1314 | |
| 1315 | " %d) LL_STATS IFACE: " |
| 1316 | " ac: %u txMpdu: %u " |
| 1317 | " rxMpdu: %u txMcast: %u " |
| 1318 | " rxMcast: %u rxAmpdu: %u " |
| 1319 | " txAmpdu: %u mpduLost: %u " |
| 1320 | " retries: %u retriesShort: %u " |
| 1321 | " retriesLong: %u contentionTimeMin: %u " |
| 1322 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1323 | " contentionNumSamples: %u", |
| 1324 | i, |
| 1325 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1326 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1327 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1328 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1329 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1330 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1331 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1332 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1333 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1334 | pWifiIfaceStat-> |
| 1335 | AccessclassStats[i].retriesShort, |
| 1336 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1337 | pWifiIfaceStat-> |
| 1338 | AccessclassStats[i].contentionTimeMin, |
| 1339 | pWifiIfaceStat-> |
| 1340 | AccessclassStats[i].contentionTimeMax, |
| 1341 | pWifiIfaceStat-> |
| 1342 | AccessclassStats[i].contentionTimeAvg, |
| 1343 | pWifiIfaceStat-> |
| 1344 | AccessclassStats[i].contentionNumSamples); |
| 1345 | |
| 1346 | } |
| 1347 | } |
| 1348 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1349 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1350 | } |
| 1351 | |
| 1352 | /* |
| 1353 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1354 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1355 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1356 | * layers. |
| 1357 | */ |
| 1358 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1359 | v_VOID_t *pData) |
| 1360 | { |
| 1361 | int status, i; |
| 1362 | tpSirWifiRadioStat pWifiRadioStat; |
| 1363 | tpSirWifiChannelStats pWifiChannelStats; |
| 1364 | struct sk_buff *vendor_event; |
| 1365 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1366 | struct nlattr *chList; |
| 1367 | |
| 1368 | status = wlan_hdd_validate_context(pHddCtx); |
| 1369 | if (0 != status) |
| 1370 | { |
| 1371 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1372 | FL("HDD context is not valid") ); |
| 1373 | return; |
| 1374 | } |
| 1375 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1376 | |
| 1377 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1378 | "LL_STATS_RADIO" |
| 1379 | " radio is %d onTime is %u " |
| 1380 | " txTime is %u rxTime is %u " |
| 1381 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1382 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1383 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1384 | " numChannels is %u", |
| 1385 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1386 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1387 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1388 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1389 | pWifiRadioStat->onTimeRoamScan, |
| 1390 | pWifiRadioStat->onTimePnoScan, |
| 1391 | pWifiRadioStat->onTimeHs20, |
| 1392 | pWifiRadioStat->numChannels); |
| 1393 | /* |
| 1394 | * Allocate a size of 4096 for the Radio stats comprising |
| 1395 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1396 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1397 | * NL attribute.The size of 4096 is considered assuming that |
| 1398 | * number of channels shall not exceed beyond 60 with the |
| 1399 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1400 | */ |
| 1401 | |
| 1402 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1403 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1404 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1405 | GFP_KERNEL); |
| 1406 | |
| 1407 | if (!vendor_event) |
| 1408 | { |
| 1409 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1410 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1411 | return; |
| 1412 | } |
| 1413 | |
| 1414 | if (nla_put_u32(vendor_event, |
| 1415 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1416 | pWifiRadioStat->radio) || |
| 1417 | nla_put_u32(vendor_event, |
| 1418 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1419 | pWifiRadioStat->onTime) || |
| 1420 | nla_put_u32(vendor_event, |
| 1421 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1422 | pWifiRadioStat->txTime) || |
| 1423 | nla_put_u32(vendor_event, |
| 1424 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1425 | pWifiRadioStat->rxTime) || |
| 1426 | nla_put_u32(vendor_event, |
| 1427 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1428 | pWifiRadioStat->onTimeScan) || |
| 1429 | nla_put_u32(vendor_event, |
| 1430 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1431 | pWifiRadioStat->onTimeNbd) || |
| 1432 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1433 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1434 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1435 | nla_put_u32(vendor_event, |
| 1436 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1437 | pWifiRadioStat->onTimeRoamScan) || |
| 1438 | nla_put_u32(vendor_event, |
| 1439 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1440 | pWifiRadioStat->onTimePnoScan) || |
| 1441 | nla_put_u32(vendor_event, |
| 1442 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1443 | pWifiRadioStat->onTimeHs20) || |
| 1444 | nla_put_u32(vendor_event, |
| 1445 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1446 | pWifiRadioStat->numChannels)) |
| 1447 | { |
| 1448 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1449 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1450 | kfree_skb(vendor_event); |
| 1451 | return ; |
| 1452 | } |
| 1453 | |
| 1454 | chList = nla_nest_start(vendor_event, |
| 1455 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
| 1456 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1457 | { |
| 1458 | struct nlattr *chInfo; |
| 1459 | |
| 1460 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1461 | pWifiRadioStat->channels + |
| 1462 | (i * sizeof(tSirWifiChannelStats))); |
| 1463 | |
| 1464 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1465 | " %d) Channel Info" |
| 1466 | " width is %u " |
| 1467 | " CenterFreq %u " |
| 1468 | " CenterFreq0 %u " |
| 1469 | " CenterFreq1 %u " |
| 1470 | " onTime %u " |
| 1471 | " ccaBusyTime %u", |
| 1472 | i, |
| 1473 | pWifiChannelStats->channel.width, |
| 1474 | pWifiChannelStats->channel.centerFreq, |
| 1475 | pWifiChannelStats->channel.centerFreq0, |
| 1476 | pWifiChannelStats->channel.centerFreq1, |
| 1477 | pWifiChannelStats->onTime, |
| 1478 | pWifiChannelStats->ccaBusyTime); |
| 1479 | |
| 1480 | |
| 1481 | chInfo = nla_nest_start(vendor_event, i); |
| 1482 | |
| 1483 | if (nla_put_u32(vendor_event, |
| 1484 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1485 | pWifiChannelStats->channel.width) || |
| 1486 | nla_put_u32(vendor_event, |
| 1487 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1488 | pWifiChannelStats->channel.centerFreq) || |
| 1489 | nla_put_u32(vendor_event, |
| 1490 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1491 | pWifiChannelStats->channel.centerFreq0) || |
| 1492 | nla_put_u32(vendor_event, |
| 1493 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1494 | pWifiChannelStats->channel.centerFreq1) || |
| 1495 | nla_put_u32(vendor_event, |
| 1496 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1497 | pWifiChannelStats->onTime) || |
| 1498 | nla_put_u32(vendor_event, |
| 1499 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1500 | pWifiChannelStats->ccaBusyTime)) |
| 1501 | { |
| 1502 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1503 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1504 | kfree_skb(vendor_event); |
| 1505 | return ; |
| 1506 | } |
| 1507 | nla_nest_end(vendor_event, chInfo); |
| 1508 | } |
| 1509 | nla_nest_end(vendor_event, chList); |
| 1510 | |
| 1511 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1512 | return; |
| 1513 | } |
| 1514 | |
| 1515 | /* |
| 1516 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1517 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1518 | * data to the NL data and send the same to the kernel/upper layers. |
| 1519 | */ |
| 1520 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1521 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1522 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1523 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1524 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1525 | hdd_adapter_t *pAdapter = NULL; |
| 1526 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1527 | int status; |
| 1528 | |
| 1529 | status = wlan_hdd_validate_context(pHddCtx); |
| 1530 | |
| 1531 | if (0 != status) |
| 1532 | { |
| 1533 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1534 | FL("HDD context is not valid")); |
| 1535 | return; |
| 1536 | } |
| 1537 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1538 | |
| 1539 | |
| 1540 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1541 | if (NULL == pAdapter) |
| 1542 | { |
| 1543 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1544 | FL(" MAC address %pM does not exist with host"), |
| 1545 | macAddr); |
| 1546 | return; |
| 1547 | } |
| 1548 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1549 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1550 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1551 | pAdapter->dev->name, indType); |
| 1552 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1553 | switch (indType) |
| 1554 | { |
| 1555 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1556 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1557 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1558 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1559 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1560 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1561 | linkLayerStatsResults->paramId); |
| 1562 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1563 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1564 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1565 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1566 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1567 | linkLayerStatsResults->respId); |
| 1568 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1569 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1570 | linkLayerStatsResults->moreResultToFollow); |
| 1571 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1572 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1573 | linkLayerStatsResults->result); |
| 1574 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1575 | { |
| 1576 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1577 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1578 | } |
| 1579 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1580 | { |
| 1581 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1582 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1583 | } |
| 1584 | else if ( linkLayerStatsResults->paramId & |
| 1585 | WMI_LINK_STATS_ALL_PEER ) |
| 1586 | { |
| 1587 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1588 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1589 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1590 | else |
| 1591 | { |
| 1592 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1593 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1594 | } |
| 1595 | |
| 1596 | break; |
| 1597 | } |
| 1598 | default: |
| 1599 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1600 | break; |
| 1601 | } |
| 1602 | return; |
| 1603 | } |
| 1604 | |
| 1605 | const struct |
| 1606 | nla_policy |
| 1607 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1608 | { |
| 1609 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1610 | { .type = NLA_U32 }, |
| 1611 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1612 | { .type = NLA_U32 }, |
| 1613 | }; |
| 1614 | |
| 1615 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1616 | struct wireless_dev *wdev, |
| 1617 | void *data, |
| 1618 | int data_len) |
| 1619 | { |
| 1620 | int status; |
| 1621 | 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] | 1622 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1623 | struct net_device *dev = wdev->netdev; |
| 1624 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1625 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1626 | |
| 1627 | status = wlan_hdd_validate_context(pHddCtx); |
| 1628 | if (0 != status) |
| 1629 | { |
| 1630 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1631 | FL("HDD context is not valid")); |
| 1632 | return -EINVAL; |
| 1633 | } |
| 1634 | |
| 1635 | if (NULL == pAdapter) |
| 1636 | { |
| 1637 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1638 | FL("HDD adapter is Null")); |
| 1639 | return -ENODEV; |
| 1640 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1641 | /* check the LLStats Capability */ |
| 1642 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1643 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1644 | { |
| 1645 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1646 | FL("Link Layer Statistics not supported by Firmware")); |
| 1647 | return -EINVAL; |
| 1648 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1649 | |
| 1650 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1651 | (struct nlattr *)data, |
| 1652 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1653 | { |
| 1654 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1655 | return -EINVAL; |
| 1656 | } |
| 1657 | if (!tb_vendor |
| 1658 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1659 | { |
| 1660 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1661 | return -EINVAL; |
| 1662 | } |
| 1663 | if (!tb_vendor[ |
| 1664 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1665 | { |
| 1666 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1667 | return -EINVAL; |
| 1668 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1669 | // 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] | 1670 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1671 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1672 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1673 | nla_get_u32( |
| 1674 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1675 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1676 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1677 | nla_get_u32( |
| 1678 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1679 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1680 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1681 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1682 | |
| 1683 | |
| 1684 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1685 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1686 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1687 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1688 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1689 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1690 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1691 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1692 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1693 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1694 | |
| 1695 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1696 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1697 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1698 | { |
| 1699 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1700 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1701 | return -EINVAL; |
| 1702 | |
| 1703 | } |
| 1704 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1705 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1706 | { |
| 1707 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1708 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1709 | return -EINVAL; |
| 1710 | } |
| 1711 | |
| 1712 | pAdapter->isLinkLayerStatsSet = 1; |
| 1713 | |
| 1714 | return 0; |
| 1715 | } |
| 1716 | |
| 1717 | const struct |
| 1718 | nla_policy |
| 1719 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1720 | { |
| 1721 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1722 | * command. When reporting |
| 1723 | * the stats results, the driver uses the same value to indicate |
| 1724 | * which GET request the results |
| 1725 | * correspond to. |
| 1726 | */ |
| 1727 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1728 | |
| 1729 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1730 | requested for retrieval */ |
| 1731 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1732 | }; |
| 1733 | |
| 1734 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1735 | struct wireless_dev *wdev, |
| 1736 | void *data, |
| 1737 | int data_len) |
| 1738 | { |
| 1739 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1740 | 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] | 1741 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1742 | struct net_device *dev = wdev->netdev; |
| 1743 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1744 | int status; |
| 1745 | |
| 1746 | status = wlan_hdd_validate_context(pHddCtx); |
| 1747 | if (0 != status) |
| 1748 | { |
| 1749 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1750 | FL("HDD context is not valid")); |
| 1751 | return -EINVAL ; |
| 1752 | } |
| 1753 | |
| 1754 | if (NULL == pAdapter) |
| 1755 | { |
| 1756 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1757 | "%s: HDD adapter is Null", __func__); |
| 1758 | return -ENODEV; |
| 1759 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1760 | /* check the LLStats Capability */ |
| 1761 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1762 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1763 | { |
| 1764 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1765 | FL("Link Layer Statistics not supported by Firmware")); |
| 1766 | return -EINVAL; |
| 1767 | } |
| 1768 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1769 | |
| 1770 | if (!pAdapter->isLinkLayerStatsSet) |
| 1771 | { |
| 1772 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1773 | "%s: isLinkLayerStatsSet : %d", |
| 1774 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1775 | return -EINVAL; |
| 1776 | } |
| 1777 | |
| 1778 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1779 | (struct nlattr *)data, |
| 1780 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1781 | { |
| 1782 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1783 | return -EINVAL; |
| 1784 | } |
| 1785 | |
| 1786 | if (!tb_vendor |
| 1787 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1788 | { |
| 1789 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1790 | return -EINVAL; |
| 1791 | } |
| 1792 | |
| 1793 | if (!tb_vendor |
| 1794 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1795 | { |
| 1796 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1797 | return -EINVAL; |
| 1798 | } |
| 1799 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1800 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1801 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1802 | nla_get_u32( tb_vendor[ |
| 1803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1804 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1805 | nla_get_u32( tb_vendor[ |
| 1806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1807 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1808 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1809 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1810 | |
| 1811 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1812 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1813 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1814 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1815 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1816 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1817 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1818 | |
| 1819 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1820 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1821 | { |
| 1822 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1823 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1824 | return -EINVAL; |
| 1825 | } |
| 1826 | return 0; |
| 1827 | } |
| 1828 | |
| 1829 | const struct |
| 1830 | nla_policy |
| 1831 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1832 | { |
| 1833 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1834 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1835 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1836 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1837 | }; |
| 1838 | |
| 1839 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1840 | struct wireless_dev *wdev, |
| 1841 | void *data, |
| 1842 | int data_len) |
| 1843 | { |
| 1844 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1845 | 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] | 1846 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1847 | struct net_device *dev = wdev->netdev; |
| 1848 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1849 | u32 statsClearReqMask; |
| 1850 | u8 stopReq; |
| 1851 | int status; |
| 1852 | |
| 1853 | status = wlan_hdd_validate_context(pHddCtx); |
| 1854 | if (0 != status) |
| 1855 | { |
| 1856 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1857 | FL("HDD context is not valid")); |
| 1858 | return -EINVAL; |
| 1859 | } |
| 1860 | |
| 1861 | if (NULL == pAdapter) |
| 1862 | { |
| 1863 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1864 | "%s: HDD adapter is Null", __func__); |
| 1865 | return -ENODEV; |
| 1866 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1867 | /* check the LLStats Capability */ |
| 1868 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1869 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1870 | { |
| 1871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1872 | FL("Enable LLStats Capability")); |
| 1873 | return -EINVAL; |
| 1874 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1875 | |
| 1876 | if (!pAdapter->isLinkLayerStatsSet) |
| 1877 | { |
| 1878 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1879 | "%s: isLinkLayerStatsSet : %d", |
| 1880 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1881 | return -EINVAL; |
| 1882 | } |
| 1883 | |
| 1884 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1885 | (struct nlattr *)data, |
| 1886 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1887 | { |
| 1888 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1889 | return -EINVAL; |
| 1890 | } |
| 1891 | |
| 1892 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1893 | |
| 1894 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 1895 | { |
| 1896 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 1897 | return -EINVAL; |
| 1898 | |
| 1899 | } |
| 1900 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1901 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1902 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1903 | nla_get_u32( |
| 1904 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 1905 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1906 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1907 | nla_get_u8( |
| 1908 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 1909 | |
| 1910 | // 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] | 1911 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1913 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 1914 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1915 | |
| 1916 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1917 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1918 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1919 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1920 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1921 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1922 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1923 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1924 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1925 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1926 | |
| 1927 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1928 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1929 | { |
| 1930 | struct sk_buff *temp_skbuff; |
| 1931 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 1932 | 2 * sizeof(u32) + |
| 1933 | NLMSG_HDRLEN); |
| 1934 | |
| 1935 | if (temp_skbuff != NULL) |
| 1936 | { |
| 1937 | |
| 1938 | if (nla_put_u32(temp_skbuff, |
| 1939 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 1940 | statsClearReqMask) || |
| 1941 | nla_put_u32(temp_skbuff, |
| 1942 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 1943 | stopReq)) |
| 1944 | { |
| 1945 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 1946 | kfree_skb(temp_skbuff); |
| 1947 | return -EINVAL; |
| 1948 | } |
| 1949 | /* If the ask is to stop the stats collection as part of clear |
| 1950 | * (stopReq = 1) , ensure that no further requests of get |
| 1951 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 1952 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1953 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1954 | * case the firmware is just asked to clear the statistics. |
| 1955 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1956 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1957 | pAdapter->isLinkLayerStatsSet = 0; |
| 1958 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 1959 | } |
| 1960 | return -ENOMEM; |
| 1961 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1962 | return -EINVAL; |
| 1963 | } |
| 1964 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 1965 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1966 | #ifdef WLAN_FEATURE_EXTSCAN |
| 1967 | static const struct nla_policy |
| 1968 | wlan_hdd_extscan_config_policy |
| 1969 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 1970 | { |
| 1971 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 1972 | { .type = NLA_U32 }, |
| 1973 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 1974 | { .type = NLA_U32 }, |
| 1975 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 1976 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 1977 | { .type = NLA_U32 }, |
| 1978 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 1979 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 1980 | |
| 1981 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 1982 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 1983 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 1984 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 1985 | { .type = NLA_U8 }, |
| 1986 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 1987 | { .type = NLA_U32 }, |
| 1988 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 1989 | { .type = NLA_U32 }, |
| 1990 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 1991 | { .type = NLA_U32 }, |
| 1992 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 1993 | { .type = NLA_U8 }, |
| 1994 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 1995 | { .type = NLA_U8 }, |
| 1996 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 1997 | { .type = NLA_U8 }, |
| 1998 | |
| 1999 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2000 | { .type = NLA_U32 }, |
| 2001 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2002 | { .type = NLA_UNSPEC }, |
| 2003 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2004 | { .type = NLA_S32 }, |
| 2005 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2006 | { .type = NLA_S32 }, |
| 2007 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2008 | { .type = NLA_U32 }, |
| 2009 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2010 | { .type = NLA_U32 }, |
| 2011 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2012 | { .type = NLA_U32 }, |
| 2013 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2014 | = { .type = NLA_U32 }, |
| 2015 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2016 | { .type = NLA_U32 }, |
| 2017 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2018 | NLA_U32 }, |
| 2019 | }; |
| 2020 | |
| 2021 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2022 | { |
| 2023 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2024 | struct sk_buff *skb = NULL; |
| 2025 | tpSirEXTScanCapabilitiesEvent pData = |
| 2026 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2027 | |
| 2028 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2029 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2030 | "or pData(%p) is null"), pData); |
| 2031 | return; |
| 2032 | } |
| 2033 | |
| 2034 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2035 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2036 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2037 | GFP_KERNEL); |
| 2038 | |
| 2039 | if (!skb) { |
| 2040 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2041 | FL("cfg80211_vendor_event_alloc failed")); |
| 2042 | return; |
| 2043 | } |
| 2044 | |
| 2045 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2046 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2047 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2048 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2049 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2050 | pData->maxRssiSampleSize); |
| 2051 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2052 | pData->maxScanReportingThreshold); |
| 2053 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2054 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2055 | pData->maxSignificantWifiChangeAPs); |
| 2056 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2057 | pData->maxBsidHistoryEntries); |
| 2058 | |
| 2059 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2060 | pData->requestId) || |
| 2061 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2062 | nla_put_u32(skb, |
| 2063 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2064 | pData->scanCacheSize) || |
| 2065 | nla_put_u32(skb, |
| 2066 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2067 | pData->scanBuckets) || |
| 2068 | nla_put_u32(skb, |
| 2069 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2070 | pData->maxApPerScan) || |
| 2071 | nla_put_u32(skb, |
| 2072 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2073 | pData->maxRssiSampleSize) || |
| 2074 | nla_put_u32(skb, |
| 2075 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2076 | pData->maxScanReportingThreshold) || |
| 2077 | nla_put_u32(skb, |
| 2078 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2079 | pData->maxHotlistAPs) || |
| 2080 | nla_put_u32(skb, |
| 2081 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2082 | pData->maxSignificantWifiChangeAPs) || |
| 2083 | nla_put_u32(skb, |
| 2084 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2085 | pData->maxBsidHistoryEntries)) { |
| 2086 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2087 | goto nla_put_failure; |
| 2088 | } |
| 2089 | |
| 2090 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2091 | return; |
| 2092 | |
| 2093 | nla_put_failure: |
| 2094 | kfree_skb(skb); |
| 2095 | return; |
| 2096 | } |
| 2097 | |
| 2098 | |
| 2099 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2100 | { |
| 2101 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2102 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2103 | struct sk_buff *skb = NULL; |
| 2104 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2105 | |
| 2106 | |
| 2107 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2108 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2109 | "or pData(%p) is null"), pData); |
| 2110 | return; |
| 2111 | } |
| 2112 | |
| 2113 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2114 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2115 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2116 | GFP_KERNEL); |
| 2117 | |
| 2118 | if (!skb) { |
| 2119 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2120 | FL("cfg80211_vendor_event_alloc failed")); |
| 2121 | return; |
| 2122 | } |
| 2123 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2124 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2125 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2126 | |
| 2127 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2128 | pData->requestId) || |
| 2129 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2130 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2131 | goto nla_put_failure; |
| 2132 | } |
| 2133 | |
| 2134 | /* |
| 2135 | * Store the Request ID for comparing with the requestID obtained |
| 2136 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2137 | * request is issued with a different requestId as that of the |
| 2138 | * extscan_start request. Also, This requestId shall be used while |
| 2139 | * indicating the full scan results to the upper layers. |
| 2140 | * The requestId is stored with the assumption that the firmware |
| 2141 | * shall return the ext scan start request's requestId in ext scan |
| 2142 | * start response. |
| 2143 | */ |
| 2144 | if (pData->status == 0) |
| 2145 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2146 | |
| 2147 | |
| 2148 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2149 | return; |
| 2150 | |
| 2151 | nla_put_failure: |
| 2152 | kfree_skb(skb); |
| 2153 | return; |
| 2154 | } |
| 2155 | |
| 2156 | |
| 2157 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2158 | { |
| 2159 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2160 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2161 | struct sk_buff *skb = NULL; |
| 2162 | |
| 2163 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2164 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2165 | "or pData(%p) is null"), pData); |
| 2166 | return; |
| 2167 | } |
| 2168 | |
| 2169 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2170 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2171 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2172 | GFP_KERNEL); |
| 2173 | |
| 2174 | if (!skb) { |
| 2175 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2176 | FL("cfg80211_vendor_event_alloc failed")); |
| 2177 | return; |
| 2178 | } |
| 2179 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2180 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2181 | |
| 2182 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2183 | pData->requestId) || |
| 2184 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2185 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2186 | goto nla_put_failure; |
| 2187 | } |
| 2188 | |
| 2189 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2190 | return; |
| 2191 | |
| 2192 | nla_put_failure: |
| 2193 | kfree_skb(skb); |
| 2194 | return; |
| 2195 | } |
| 2196 | |
| 2197 | |
| 2198 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2199 | void *pMsg) |
| 2200 | { |
| 2201 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2202 | struct sk_buff *skb = NULL; |
| 2203 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2204 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2205 | |
| 2206 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2207 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2208 | "or pData(%p) is null"), pData); |
| 2209 | return; |
| 2210 | } |
| 2211 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2212 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2213 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_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 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2241 | void *pMsg) |
| 2242 | { |
| 2243 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2244 | struct sk_buff *skb = NULL; |
| 2245 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2246 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2247 | |
| 2248 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2249 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2250 | "or pData(%p) is null"), pData); |
| 2251 | return; |
| 2252 | } |
| 2253 | |
| 2254 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2255 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2256 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2257 | GFP_KERNEL); |
| 2258 | |
| 2259 | if (!skb) { |
| 2260 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2261 | FL("cfg80211_vendor_event_alloc failed")); |
| 2262 | return; |
| 2263 | } |
| 2264 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2265 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2266 | |
| 2267 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2268 | pData->requestId) || |
| 2269 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2270 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2271 | goto nla_put_failure; |
| 2272 | } |
| 2273 | |
| 2274 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2275 | return; |
| 2276 | |
| 2277 | nla_put_failure: |
| 2278 | kfree_skb(skb); |
| 2279 | return; |
| 2280 | } |
| 2281 | |
| 2282 | |
| 2283 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2284 | void *pMsg) |
| 2285 | { |
| 2286 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2287 | struct sk_buff *skb = NULL; |
| 2288 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2289 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2290 | |
| 2291 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2292 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2293 | "or pData(%p) is null"), pData); |
| 2294 | return; |
| 2295 | } |
| 2296 | |
| 2297 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2298 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2299 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2300 | GFP_KERNEL); |
| 2301 | |
| 2302 | if (!skb) { |
| 2303 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2304 | FL("cfg80211_vendor_event_alloc failed")); |
| 2305 | return; |
| 2306 | } |
| 2307 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2308 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2309 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2310 | |
| 2311 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2312 | pData->requestId) || |
| 2313 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2314 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2315 | goto nla_put_failure; |
| 2316 | } |
| 2317 | |
| 2318 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2319 | return; |
| 2320 | |
| 2321 | nla_put_failure: |
| 2322 | kfree_skb(skb); |
| 2323 | return; |
| 2324 | } |
| 2325 | |
| 2326 | |
| 2327 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2328 | void *pMsg) |
| 2329 | { |
| 2330 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2331 | struct sk_buff *skb = NULL; |
| 2332 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2333 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2334 | |
| 2335 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2336 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2337 | "or pData(%p) is null"), pData); |
| 2338 | return; |
| 2339 | } |
| 2340 | |
| 2341 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2342 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2343 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2344 | GFP_KERNEL); |
| 2345 | |
| 2346 | if (!skb) { |
| 2347 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2348 | FL("cfg80211_vendor_event_alloc failed")); |
| 2349 | return; |
| 2350 | } |
| 2351 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2352 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2353 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2354 | |
| 2355 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2356 | pData->requestId) || |
| 2357 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2358 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2359 | goto nla_put_failure; |
| 2360 | } |
| 2361 | |
| 2362 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2363 | return; |
| 2364 | |
| 2365 | nla_put_failure: |
| 2366 | kfree_skb(skb); |
| 2367 | return; |
| 2368 | } |
| 2369 | |
| 2370 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2371 | void *pMsg) |
| 2372 | { |
| 2373 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2374 | struct sk_buff *skb = NULL; |
| 2375 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2376 | tANI_S32 totalResults; |
| 2377 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2378 | tpSirWifiScanResult pSirWifiScanResult; |
| 2379 | |
| 2380 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2381 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2382 | "or pData(%p) is null"), pData); |
| 2383 | return; |
| 2384 | } |
| 2385 | totalResults = pData->numOfAps; |
| 2386 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2387 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2388 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2389 | |
| 2390 | do{ |
| 2391 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2392 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2393 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2394 | |
| 2395 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2396 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2397 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2398 | GFP_KERNEL); |
| 2399 | |
| 2400 | if (!skb) { |
| 2401 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2402 | FL("cfg80211_vendor_event_alloc failed")); |
| 2403 | return; |
| 2404 | } |
| 2405 | |
| 2406 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2407 | |
| 2408 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2409 | pData->requestId) || |
| 2410 | nla_put_u32(skb, |
| 2411 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2412 | resultsPerEvent)) { |
| 2413 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2414 | goto fail; |
| 2415 | } |
| 2416 | if (nla_put_u8(skb, |
| 2417 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2418 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2419 | { |
| 2420 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2421 | goto fail; |
| 2422 | } |
| 2423 | |
| 2424 | if (resultsPerEvent) { |
| 2425 | struct nlattr *aps; |
| 2426 | |
| 2427 | aps = nla_nest_start(skb, |
| 2428 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2429 | if (!aps) |
| 2430 | { |
| 2431 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2432 | goto fail; |
| 2433 | } |
| 2434 | |
| 2435 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2436 | struct nlattr *ap; |
| 2437 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2438 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2439 | |
| 2440 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2441 | "Ssid (%s)" |
| 2442 | "Bssid: %pM " |
| 2443 | "Channel (%u)" |
| 2444 | "Rssi (%d)" |
| 2445 | "RTT (%u)" |
| 2446 | "RTT_SD (%u)", |
| 2447 | i, |
| 2448 | pSirWifiScanResult->ts, |
| 2449 | pSirWifiScanResult->ssid, |
| 2450 | pSirWifiScanResult->bssid, |
| 2451 | pSirWifiScanResult->channel, |
| 2452 | pSirWifiScanResult->rssi, |
| 2453 | pSirWifiScanResult->rtt, |
| 2454 | pSirWifiScanResult->rtt_sd); |
| 2455 | |
| 2456 | ap = nla_nest_start(skb, j + 1); |
| 2457 | if (!ap) |
| 2458 | { |
| 2459 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2460 | goto fail; |
| 2461 | } |
| 2462 | |
| 2463 | if (nla_put_u64(skb, |
| 2464 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2465 | pSirWifiScanResult->ts) ) |
| 2466 | { |
| 2467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2468 | goto fail; |
| 2469 | } |
| 2470 | if (nla_put(skb, |
| 2471 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2472 | sizeof(pSirWifiScanResult->ssid), |
| 2473 | pSirWifiScanResult->ssid) ) |
| 2474 | { |
| 2475 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2476 | goto fail; |
| 2477 | } |
| 2478 | if (nla_put(skb, |
| 2479 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2480 | sizeof(pSirWifiScanResult->bssid), |
| 2481 | pSirWifiScanResult->bssid) ) |
| 2482 | { |
| 2483 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2484 | goto fail; |
| 2485 | } |
| 2486 | if (nla_put_u32(skb, |
| 2487 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2488 | pSirWifiScanResult->channel) ) |
| 2489 | { |
| 2490 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2491 | goto fail; |
| 2492 | } |
| 2493 | if (nla_put_u32(skb, |
| 2494 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2495 | pSirWifiScanResult->rssi) ) |
| 2496 | { |
| 2497 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2498 | goto fail; |
| 2499 | } |
| 2500 | if (nla_put_u32(skb, |
| 2501 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2502 | pSirWifiScanResult->rtt) ) |
| 2503 | { |
| 2504 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2505 | goto fail; |
| 2506 | } |
| 2507 | if (nla_put_u32(skb, |
| 2508 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2509 | pSirWifiScanResult->rtt_sd)) |
| 2510 | { |
| 2511 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2512 | goto fail; |
| 2513 | } |
| 2514 | |
| 2515 | nla_nest_end(skb, ap); |
| 2516 | } |
| 2517 | nla_nest_end(skb, aps); |
| 2518 | |
| 2519 | } |
| 2520 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2521 | } while (totalResults > 0); |
| 2522 | |
| 2523 | return; |
| 2524 | fail: |
| 2525 | kfree_skb(skb); |
| 2526 | return; |
| 2527 | } |
| 2528 | |
| 2529 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2530 | void *pMsg) |
| 2531 | { |
| 2532 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2533 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2534 | struct sk_buff *skb = NULL; |
| 2535 | tANI_U32 i; |
| 2536 | |
| 2537 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2538 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2539 | "or pData(%p) is null"), pData); |
| 2540 | return; |
| 2541 | } |
| 2542 | |
| 2543 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2544 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2545 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2546 | GFP_KERNEL); |
| 2547 | |
| 2548 | if (!skb) { |
| 2549 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2550 | FL("cfg80211_vendor_event_alloc failed")); |
| 2551 | return; |
| 2552 | } |
| 2553 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2554 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2555 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2556 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2557 | |
| 2558 | for (i = 0; i < pData->numOfAps; i++) { |
| 2559 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2560 | "Ssid (%s) " |
| 2561 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2562 | "Channel (%u) " |
| 2563 | "Rssi (%d) " |
| 2564 | "RTT (%u) " |
| 2565 | "RTT_SD (%u) ", |
| 2566 | i, |
| 2567 | pData->ap[i].ts, |
| 2568 | pData->ap[i].ssid, |
| 2569 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2570 | pData->ap[i].channel, |
| 2571 | pData->ap[i].rssi, |
| 2572 | pData->ap[i].rtt, |
| 2573 | pData->ap[i].rtt_sd); |
| 2574 | } |
| 2575 | |
| 2576 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2577 | pData->requestId) || |
| 2578 | nla_put_u32(skb, |
| 2579 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2580 | pData->numOfAps)) { |
| 2581 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2582 | goto fail; |
| 2583 | } |
| 2584 | if (pData->numOfAps) { |
| 2585 | struct nlattr *aps; |
| 2586 | |
| 2587 | aps = nla_nest_start(skb, |
| 2588 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2589 | if (!aps) |
| 2590 | goto fail; |
| 2591 | |
| 2592 | for (i = 0; i < pData->numOfAps; i++) { |
| 2593 | struct nlattr *ap; |
| 2594 | |
| 2595 | ap = nla_nest_start(skb, i + 1); |
| 2596 | if (!ap) |
| 2597 | goto fail; |
| 2598 | |
| 2599 | if (nla_put_u64(skb, |
| 2600 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2601 | pData->ap[i].ts) || |
| 2602 | nla_put(skb, |
| 2603 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2604 | sizeof(pData->ap[i].ssid), |
| 2605 | pData->ap[i].ssid) || |
| 2606 | nla_put(skb, |
| 2607 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2608 | sizeof(pData->ap[i].bssid), |
| 2609 | pData->ap[i].bssid) || |
| 2610 | nla_put_u32(skb, |
| 2611 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2612 | pData->ap[i].channel) || |
| 2613 | nla_put_s32(skb, |
| 2614 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2615 | pData->ap[i].rssi) || |
| 2616 | nla_put_u32(skb, |
| 2617 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2618 | pData->ap[i].rtt) || |
| 2619 | nla_put_u32(skb, |
| 2620 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2621 | pData->ap[i].rtt_sd)) |
| 2622 | goto fail; |
| 2623 | |
| 2624 | nla_nest_end(skb, ap); |
| 2625 | } |
| 2626 | nla_nest_end(skb, aps); |
| 2627 | |
| 2628 | if (nla_put_u8(skb, |
| 2629 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2630 | pData->moreData)) |
| 2631 | goto fail; |
| 2632 | } |
| 2633 | |
| 2634 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2635 | return; |
| 2636 | |
| 2637 | fail: |
| 2638 | kfree_skb(skb); |
| 2639 | return; |
| 2640 | |
| 2641 | } |
| 2642 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2643 | void *pMsg) |
| 2644 | { |
| 2645 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2646 | struct sk_buff *skb = NULL; |
| 2647 | tANI_U32 i, j; |
| 2648 | tpSirWifiSignificantChangeEvent pData = |
| 2649 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2650 | |
| 2651 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2653 | "or pData(%p) is null"), pData); |
| 2654 | return; |
| 2655 | } |
| 2656 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2657 | EXTSCAN_EVENT_BUF_SIZE, |
| 2658 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2659 | GFP_KERNEL); |
| 2660 | |
| 2661 | if (!skb) { |
| 2662 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2663 | FL("cfg80211_vendor_event_alloc failed")); |
| 2664 | return; |
| 2665 | } |
| 2666 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2667 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2668 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2669 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2670 | pData->numSigRssiBss); |
| 2671 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2672 | |
| 2673 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2674 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2675 | " num RSSI %u ", |
| 2676 | i, pData->sigRssiResult[i].bssid, |
| 2677 | pData->sigRssiResult[i].channel, |
| 2678 | pData->sigRssiResult[i].numRssi); |
| 2679 | |
| 2680 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2681 | |
| 2682 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2683 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2684 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2685 | |
| 2686 | } |
| 2687 | } |
| 2688 | |
| 2689 | |
| 2690 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2691 | pData->requestId) || |
| 2692 | nla_put_u32(skb, |
| 2693 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2694 | pData->numSigRssiBss)) { |
| 2695 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2696 | goto fail; |
| 2697 | } |
| 2698 | |
| 2699 | if (pData->numSigRssiBss) { |
| 2700 | struct nlattr *aps; |
| 2701 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2702 | if (!aps) |
| 2703 | goto fail; |
| 2704 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2705 | struct nlattr *ap; |
| 2706 | |
| 2707 | ap = nla_nest_start(skb, i); |
| 2708 | if (!ap) |
| 2709 | goto fail; |
| 2710 | if (nla_put(skb, |
| 2711 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2712 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2713 | nla_put_u32(skb, |
| 2714 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2715 | pData->sigRssiResult[i].channel) || |
| 2716 | nla_put_u32(skb, |
| 2717 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2718 | pData->sigRssiResult[i].numRssi) || |
| 2719 | nla_put(skb, |
| 2720 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2721 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2722 | pData->sigRssiResult[i].rssi)) |
| 2723 | goto fail; |
| 2724 | nla_nest_end(skb, ap); |
| 2725 | } |
| 2726 | nla_nest_end(skb, aps); |
| 2727 | if (nla_put_u8(skb, |
| 2728 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2729 | pData->moreData)) |
| 2730 | goto fail; |
| 2731 | } |
| 2732 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2733 | return; |
| 2734 | fail: |
| 2735 | kfree_skb(skb); |
| 2736 | return; |
| 2737 | } |
| 2738 | |
| 2739 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2740 | void *pMsg) |
| 2741 | { |
| 2742 | struct sk_buff *skb; |
| 2743 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2744 | tpSirWifiFullScanResultEvent pData = |
| 2745 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2746 | |
| 2747 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2748 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2749 | "or pData(%p) is null"), pData); |
| 2750 | return; |
| 2751 | } |
| 2752 | |
| 2753 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2754 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2755 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2756 | GFP_KERNEL); |
| 2757 | |
| 2758 | if (!skb) { |
| 2759 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2760 | FL("cfg80211_vendor_event_alloc failed")); |
| 2761 | return; |
| 2762 | } |
| 2763 | |
| 2764 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2765 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2766 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2767 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2768 | "Ssid (%s)" |
| 2769 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2770 | "Channel (%u)" |
| 2771 | "Rssi (%d)" |
| 2772 | "RTT (%u)" |
| 2773 | "RTT_SD (%u)"), |
| 2774 | pData->ap.ts, |
| 2775 | pData->ap.ssid, |
| 2776 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2777 | pData->ap.channel, |
| 2778 | pData->ap.rssi, |
| 2779 | pData->ap.rtt, |
| 2780 | pData->ap.rtt_sd); |
| 2781 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2782 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2783 | pData->requestId) || |
| 2784 | nla_put_u64(skb, |
| 2785 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2786 | pData->ap.ts) || |
| 2787 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2788 | sizeof(pData->ap.ssid), |
| 2789 | pData->ap.ssid) || |
| 2790 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2791 | WNI_CFG_BSSID_LEN, |
| 2792 | pData->ap.bssid) || |
| 2793 | nla_put_u32(skb, |
| 2794 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2795 | pData->ap.channel) || |
| 2796 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2797 | pData->ap.rssi) || |
| 2798 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2799 | pData->ap.rtt) || |
| 2800 | nla_put_u32(skb, |
| 2801 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2802 | pData->ap.rtt_sd) || |
| 2803 | nla_put_u16(skb, |
| 2804 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2805 | pData->ap.beaconPeriod) || |
| 2806 | nla_put_u16(skb, |
| 2807 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2808 | pData->ap.capability) || |
| 2809 | nla_put_u32(skb, |
| 2810 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2811 | pData->ieLength)) |
| 2812 | { |
| 2813 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2814 | goto nla_put_failure; |
| 2815 | } |
| 2816 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2817 | pData->ieLength, |
| 2818 | pData->ie)) |
| 2819 | { |
| 2820 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2821 | goto nla_put_failure; |
| 2822 | } |
| 2823 | |
| 2824 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2825 | return; |
| 2826 | |
| 2827 | nla_put_failure: |
| 2828 | kfree_skb(skb); |
| 2829 | return; |
| 2830 | } |
| 2831 | |
| 2832 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 2833 | void *pMsg) |
| 2834 | { |
| 2835 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2836 | struct sk_buff *skb = NULL; |
| 2837 | tpSirEXTScanResultsAvailableIndParams pData = |
| 2838 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 2839 | |
| 2840 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2841 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2842 | "or pData(%p) is null"), pData); |
| 2843 | return; |
| 2844 | } |
| 2845 | |
| 2846 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2847 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2848 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 2849 | GFP_KERNEL); |
| 2850 | |
| 2851 | if (!skb) { |
| 2852 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2853 | FL("cfg80211_vendor_event_alloc failed")); |
| 2854 | return; |
| 2855 | } |
| 2856 | |
| 2857 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2858 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2859 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 2860 | pData->numResultsAvailable); |
| 2861 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2862 | pData->requestId) || |
| 2863 | nla_put_u32(skb, |
| 2864 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2865 | pData->numResultsAvailable)) { |
| 2866 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2867 | goto nla_put_failure; |
| 2868 | } |
| 2869 | |
| 2870 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2871 | return; |
| 2872 | |
| 2873 | nla_put_failure: |
| 2874 | kfree_skb(skb); |
| 2875 | return; |
| 2876 | } |
| 2877 | |
| 2878 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 2879 | { |
| 2880 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2881 | struct sk_buff *skb = NULL; |
| 2882 | tpSirEXTScanProgressIndParams pData = |
| 2883 | (tpSirEXTScanProgressIndParams) pMsg; |
| 2884 | |
| 2885 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2886 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2887 | "or pData(%p) is null"), pData); |
| 2888 | return; |
| 2889 | } |
| 2890 | |
| 2891 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2892 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2893 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 2894 | GFP_KERNEL); |
| 2895 | |
| 2896 | if (!skb) { |
| 2897 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2898 | FL("cfg80211_vendor_event_alloc failed")); |
| 2899 | return; |
| 2900 | } |
| 2901 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2902 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 2903 | pData->extScanEventType); |
| 2904 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 2905 | pData->status); |
| 2906 | |
| 2907 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 2908 | pData->extScanEventType) || |
| 2909 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 2910 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2911 | pData->requestId) || |
| 2912 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2913 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 2914 | pData->status)) { |
| 2915 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2916 | goto nla_put_failure; |
| 2917 | } |
| 2918 | |
| 2919 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2920 | return; |
| 2921 | |
| 2922 | nla_put_failure: |
| 2923 | kfree_skb(skb); |
| 2924 | return; |
| 2925 | } |
| 2926 | |
| 2927 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 2928 | void *pMsg) |
| 2929 | { |
| 2930 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2931 | |
| 2932 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dasari Srinivas | b46ed1d | 2014-10-08 13:03:08 +0530 | [diff] [blame^] | 2933 | hddLog(VOS_TRACE_LEVEL_INFO, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2934 | return; |
| 2935 | } |
| 2936 | |
| 2937 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 2938 | |
| 2939 | |
| 2940 | switch(evType) { |
| 2941 | case SIR_HAL_EXTSCAN_START_RSP: |
| 2942 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 2943 | break; |
| 2944 | |
| 2945 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 2946 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 2947 | break; |
| 2948 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 2949 | /* There is no need to send this response to upper layer |
| 2950 | Just log the message */ |
| 2951 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2952 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 2953 | break; |
| 2954 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 2955 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 2956 | break; |
| 2957 | |
| 2958 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 2959 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 2960 | break; |
| 2961 | |
| 2962 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 2963 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 2964 | break; |
| 2965 | |
| 2966 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 2967 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 2968 | break; |
| 2969 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 2970 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 2971 | break; |
| 2972 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 2973 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 2974 | break; |
| 2975 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 2976 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 2977 | break; |
| 2978 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 2979 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 2980 | break; |
| 2981 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 2982 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 2983 | break; |
| 2984 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 2985 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 2986 | break; |
| 2987 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 2988 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 2989 | break; |
| 2990 | default: |
| 2991 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 2992 | break; |
| 2993 | } |
| 2994 | } |
| 2995 | |
| 2996 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 2997 | struct wireless_dev *wdev, |
| 2998 | void *data, int dataLen) |
| 2999 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3000 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3001 | struct net_device *dev = wdev->netdev; |
| 3002 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3003 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3004 | struct nlattr |
| 3005 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3006 | eHalStatus status; |
| 3007 | |
| 3008 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3009 | status = wlan_hdd_validate_context(pHddCtx); |
| 3010 | if (0 != status) |
| 3011 | { |
| 3012 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3013 | FL("HDD context is not valid")); |
| 3014 | return -EINVAL; |
| 3015 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3016 | /* check the EXTScan Capability */ |
| 3017 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3018 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3019 | { |
| 3020 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3021 | FL("EXTScan not enabled/supported by Firmware")); |
| 3022 | return -EINVAL; |
| 3023 | } |
| 3024 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3025 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3026 | data, dataLen, |
| 3027 | wlan_hdd_extscan_config_policy)) { |
| 3028 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3029 | return -EINVAL; |
| 3030 | } |
| 3031 | |
| 3032 | /* Parse and fetch request Id */ |
| 3033 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3034 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3035 | return -EINVAL; |
| 3036 | } |
| 3037 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3038 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3039 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3040 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3041 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3042 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3043 | reqMsg.sessionId = pAdapter->sessionId; |
| 3044 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3045 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3046 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3047 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3048 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3049 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3050 | return -EINVAL; |
| 3051 | } |
| 3052 | |
| 3053 | return 0; |
| 3054 | } |
| 3055 | |
| 3056 | |
| 3057 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3058 | struct wireless_dev *wdev, |
| 3059 | void *data, int dataLen) |
| 3060 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3061 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3062 | struct net_device *dev = wdev->netdev; |
| 3063 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3064 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3065 | struct nlattr |
| 3066 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3067 | eHalStatus status; |
| 3068 | |
| 3069 | status = wlan_hdd_validate_context(pHddCtx); |
| 3070 | if (0 != status) |
| 3071 | { |
| 3072 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3073 | FL("HDD context is not valid")); |
| 3074 | return -EINVAL; |
| 3075 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3076 | /* check the EXTScan Capability */ |
| 3077 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3078 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3079 | { |
| 3080 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3081 | FL("EXTScan not enabled/supported by Firmware")); |
| 3082 | return -EINVAL; |
| 3083 | } |
| 3084 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3085 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3086 | data, dataLen, |
| 3087 | wlan_hdd_extscan_config_policy)) { |
| 3088 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3089 | return -EINVAL; |
| 3090 | } |
| 3091 | /* Parse and fetch request Id */ |
| 3092 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3093 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3094 | return -EINVAL; |
| 3095 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3096 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3097 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3098 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3099 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3100 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3101 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3102 | reqMsg.sessionId = pAdapter->sessionId; |
| 3103 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3104 | |
| 3105 | /* Parse and fetch flush parameter */ |
| 3106 | if (!tb |
| 3107 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3108 | { |
| 3109 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3110 | goto failed; |
| 3111 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3112 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3113 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3114 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3115 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3116 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3117 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3118 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3119 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3120 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3121 | return -EINVAL; |
| 3122 | } |
| 3123 | return 0; |
| 3124 | |
| 3125 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3126 | return -EINVAL; |
| 3127 | } |
| 3128 | |
| 3129 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3130 | struct wireless_dev *wdev, |
| 3131 | void *data, int dataLen) |
| 3132 | { |
| 3133 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3134 | struct net_device *dev = wdev->netdev; |
| 3135 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3136 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3137 | struct nlattr |
| 3138 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3139 | struct nlattr |
| 3140 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3141 | struct nlattr *apTh; |
| 3142 | eHalStatus status; |
| 3143 | tANI_U8 i = 0; |
| 3144 | int rem; |
| 3145 | |
| 3146 | status = wlan_hdd_validate_context(pHddCtx); |
| 3147 | if (0 != status) |
| 3148 | { |
| 3149 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3150 | FL("HDD context is not valid")); |
| 3151 | return -EINVAL; |
| 3152 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3153 | /* check the EXTScan Capability */ |
| 3154 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3155 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3156 | { |
| 3157 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3158 | FL("EXTScan not enabled/supported by Firmware")); |
| 3159 | return -EINVAL; |
| 3160 | } |
| 3161 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3162 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3163 | data, dataLen, |
| 3164 | wlan_hdd_extscan_config_policy)) { |
| 3165 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3166 | return -EINVAL; |
| 3167 | } |
| 3168 | |
| 3169 | /* Parse and fetch request Id */ |
| 3170 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3171 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3172 | return -EINVAL; |
| 3173 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3174 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3175 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3176 | if (!pReqMsg) { |
| 3177 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3178 | return -ENOMEM; |
| 3179 | } |
| 3180 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3181 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3182 | pReqMsg->requestId = nla_get_u32( |
| 3183 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3184 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3185 | |
| 3186 | /* Parse and fetch number of APs */ |
| 3187 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3188 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3189 | goto fail; |
| 3190 | } |
| 3191 | |
| 3192 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3193 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3194 | |
| 3195 | pReqMsg->numAp = nla_get_u32( |
| 3196 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3197 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3198 | |
| 3199 | nla_for_each_nested(apTh, |
| 3200 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3201 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3202 | nla_data(apTh), nla_len(apTh), |
| 3203 | NULL)) { |
| 3204 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3205 | goto fail; |
| 3206 | } |
| 3207 | |
| 3208 | /* Parse and fetch MAC address */ |
| 3209 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3210 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3211 | goto fail; |
| 3212 | } |
| 3213 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3214 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3215 | sizeof(tSirMacAddr)); |
| 3216 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3217 | |
| 3218 | /* Parse and fetch low RSSI */ |
| 3219 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3220 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3221 | goto fail; |
| 3222 | } |
| 3223 | pReqMsg->ap[i].low = nla_get_s32( |
| 3224 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3225 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3226 | |
| 3227 | /* Parse and fetch high RSSI */ |
| 3228 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3229 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3230 | goto fail; |
| 3231 | } |
| 3232 | pReqMsg->ap[i].high = nla_get_s32( |
| 3233 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3234 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3235 | pReqMsg->ap[i].high); |
| 3236 | |
| 3237 | /* Parse and fetch channel */ |
| 3238 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3240 | goto fail; |
| 3241 | } |
| 3242 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3243 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3244 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3245 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3246 | i++; |
| 3247 | } |
| 3248 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3249 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3250 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3251 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3252 | vos_mem_free(pReqMsg); |
| 3253 | return -EINVAL; |
| 3254 | } |
| 3255 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3256 | vos_mem_free(pReqMsg); |
| 3257 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3258 | return 0; |
| 3259 | |
| 3260 | fail: |
| 3261 | vos_mem_free(pReqMsg); |
| 3262 | return -EINVAL; |
| 3263 | } |
| 3264 | |
| 3265 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3266 | struct wireless_dev *wdev, |
| 3267 | void *data, int dataLen) |
| 3268 | { |
| 3269 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3270 | struct net_device *dev = wdev->netdev; |
| 3271 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3272 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3273 | struct nlattr |
| 3274 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3275 | struct nlattr |
| 3276 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3277 | struct nlattr *apTh; |
| 3278 | eHalStatus status; |
| 3279 | int i = 0; |
| 3280 | int rem; |
| 3281 | |
| 3282 | status = wlan_hdd_validate_context(pHddCtx); |
| 3283 | if (0 != status) |
| 3284 | { |
| 3285 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3286 | FL("HDD context is not valid")); |
| 3287 | return -EINVAL; |
| 3288 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3289 | /* check the EXTScan Capability */ |
| 3290 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3291 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3292 | { |
| 3293 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3294 | FL("EXTScan not enabled/supported by Firmware")); |
| 3295 | return -EINVAL; |
| 3296 | } |
| 3297 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3298 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3299 | data, dataLen, |
| 3300 | wlan_hdd_extscan_config_policy)) { |
| 3301 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3302 | return -EINVAL; |
| 3303 | } |
| 3304 | |
| 3305 | /* Parse and fetch request Id */ |
| 3306 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3307 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3308 | return -EINVAL; |
| 3309 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3310 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3311 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3312 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3313 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3314 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3315 | } |
| 3316 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3317 | |
| 3318 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3319 | pReqMsg->requestId = nla_get_u32( |
| 3320 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3321 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3322 | |
| 3323 | /* Parse and fetch RSSI sample size */ |
| 3324 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3325 | { |
| 3326 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3327 | goto fail; |
| 3328 | } |
| 3329 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3330 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3331 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3332 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3333 | |
| 3334 | /* Parse and fetch lost AP sample size */ |
| 3335 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3336 | { |
| 3337 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3338 | goto fail; |
| 3339 | } |
| 3340 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3341 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3342 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3343 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3344 | /* Parse and fetch minimum Breaching */ |
| 3345 | if (!tb |
| 3346 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3347 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3348 | goto fail; |
| 3349 | } |
| 3350 | pReqMsg->minBreaching = nla_get_u32( |
| 3351 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3352 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3353 | |
| 3354 | /* Parse and fetch number of APs */ |
| 3355 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3356 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3357 | goto fail; |
| 3358 | } |
| 3359 | pReqMsg->numAp = nla_get_u32( |
| 3360 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3361 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3362 | |
| 3363 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3364 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3365 | |
| 3366 | nla_for_each_nested(apTh, |
| 3367 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3368 | if(nla_parse(tb2, |
| 3369 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3370 | nla_data(apTh), nla_len(apTh), |
| 3371 | NULL)) { |
| 3372 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3373 | goto fail; |
| 3374 | } |
| 3375 | |
| 3376 | /* Parse and fetch MAC address */ |
| 3377 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3378 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3379 | goto fail; |
| 3380 | } |
| 3381 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3382 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3383 | sizeof(tSirMacAddr)); |
| 3384 | |
| 3385 | /* Parse and fetch low RSSI */ |
| 3386 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3388 | goto fail; |
| 3389 | } |
| 3390 | pReqMsg->ap[i].low = nla_get_s32( |
| 3391 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3392 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3393 | |
| 3394 | /* Parse and fetch high RSSI */ |
| 3395 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3396 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3397 | goto fail; |
| 3398 | } |
| 3399 | pReqMsg->ap[i].high = nla_get_s32( |
| 3400 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3401 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3402 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3403 | |
| 3404 | /* Parse and fetch channel */ |
| 3405 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3406 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3407 | goto fail; |
| 3408 | } |
| 3409 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3410 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3411 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3412 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3413 | i++; |
| 3414 | } |
| 3415 | |
| 3416 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3417 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3418 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3419 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3420 | vos_mem_free(pReqMsg); |
| 3421 | return -EINVAL; |
| 3422 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3423 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3424 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3425 | return 0; |
| 3426 | |
| 3427 | fail: |
| 3428 | vos_mem_free(pReqMsg); |
| 3429 | return -EINVAL; |
| 3430 | } |
| 3431 | |
| 3432 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3433 | struct wireless_dev *wdev, |
| 3434 | void *data, int dataLen) |
| 3435 | { |
| 3436 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3437 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3438 | tANI_U8 numChannels = 0; |
| 3439 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3440 | tANI_U32 requestId; |
| 3441 | tWifiBand wifiBand; |
| 3442 | eHalStatus status; |
| 3443 | struct sk_buff *replySkb; |
| 3444 | tANI_U8 i; |
| 3445 | |
| 3446 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3447 | status = wlan_hdd_validate_context(pHddCtx); |
| 3448 | if (0 != status) |
| 3449 | { |
| 3450 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3451 | FL("HDD context is not valid")); |
| 3452 | return -EINVAL; |
| 3453 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3454 | /* check the EXTScan Capability */ |
| 3455 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3456 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3457 | { |
| 3458 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3459 | FL("EXTScan not enabled/supported by Firmware")); |
| 3460 | return -EINVAL; |
| 3461 | } |
| 3462 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3463 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3464 | data, dataLen, |
| 3465 | wlan_hdd_extscan_config_policy)) { |
| 3466 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3467 | return -EINVAL; |
| 3468 | } |
| 3469 | |
| 3470 | /* Parse and fetch request Id */ |
| 3471 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3472 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3473 | return -EINVAL; |
| 3474 | } |
| 3475 | requestId = nla_get_u32( |
| 3476 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3477 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3478 | |
| 3479 | /* Parse and fetch wifi band */ |
| 3480 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3481 | { |
| 3482 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3483 | return -EINVAL; |
| 3484 | } |
| 3485 | wifiBand = nla_get_u32( |
| 3486 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3487 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3488 | |
| 3489 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3490 | wifiBand, ChannelList, |
| 3491 | &numChannels); |
| 3492 | if (eHAL_STATUS_SUCCESS != status) { |
| 3493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3494 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3495 | return -EINVAL; |
| 3496 | } |
| 3497 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3498 | for (i = 0; i < numChannels; i++) |
| 3499 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3500 | |
| 3501 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3502 | sizeof(u32) * numChannels + |
| 3503 | NLMSG_HDRLEN); |
| 3504 | |
| 3505 | if (!replySkb) { |
| 3506 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3507 | FL("valid channels: buffer alloc fail")); |
| 3508 | return -EINVAL; |
| 3509 | } |
| 3510 | if (nla_put_u32(replySkb, |
| 3511 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3512 | numChannels) || |
| 3513 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3514 | sizeof(u32) * numChannels, ChannelList)) { |
| 3515 | |
| 3516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3517 | kfree_skb(replySkb); |
| 3518 | return -EINVAL; |
| 3519 | } |
| 3520 | |
| 3521 | return cfg80211_vendor_cmd_reply(replySkb); |
| 3522 | } |
| 3523 | |
| 3524 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 3525 | struct wireless_dev *wdev, |
| 3526 | void *data, int dataLen) |
| 3527 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3528 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3529 | struct net_device *dev = wdev->netdev; |
| 3530 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3531 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3532 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3533 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3534 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3535 | struct nlattr *buckets; |
| 3536 | struct nlattr *channels; |
| 3537 | int rem1; |
| 3538 | int rem2; |
| 3539 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3540 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3541 | |
| 3542 | status = wlan_hdd_validate_context(pHddCtx); |
| 3543 | if (0 != status) |
| 3544 | { |
| 3545 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3546 | FL("HDD context is not valid")); |
| 3547 | return -EINVAL; |
| 3548 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3549 | /* check the EXTScan Capability */ |
| 3550 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3551 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3552 | { |
| 3553 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3554 | FL("EXTScan not enabled/supported by Firmware")); |
| 3555 | return -EINVAL; |
| 3556 | } |
| 3557 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3558 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3559 | data, dataLen, |
| 3560 | wlan_hdd_extscan_config_policy)) { |
| 3561 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3562 | return -EINVAL; |
| 3563 | } |
| 3564 | |
| 3565 | /* Parse and fetch request Id */ |
| 3566 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3567 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3568 | return -EINVAL; |
| 3569 | } |
| 3570 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3571 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3572 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3573 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3574 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3575 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3576 | } |
| 3577 | |
| 3578 | pReqMsg->requestId = nla_get_u32( |
| 3579 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3580 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3581 | |
| 3582 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3583 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3584 | |
| 3585 | /* Parse and fetch base period */ |
| 3586 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3587 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3588 | goto fail; |
| 3589 | } |
| 3590 | pReqMsg->basePeriod = nla_get_u32( |
| 3591 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3592 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3593 | pReqMsg->basePeriod); |
| 3594 | |
| 3595 | /* Parse and fetch max AP per scan */ |
| 3596 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3597 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3598 | goto fail; |
| 3599 | } |
| 3600 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3601 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3602 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3603 | pReqMsg->maxAPperScan); |
| 3604 | |
| 3605 | /* Parse and fetch report threshold */ |
| 3606 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3607 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3608 | goto fail; |
| 3609 | } |
| 3610 | pReqMsg->reportThreshold = nla_get_u8( |
| 3611 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3612 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3613 | pReqMsg->reportThreshold); |
| 3614 | |
| 3615 | /* Parse and fetch number of buckets */ |
| 3616 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3617 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3618 | goto fail; |
| 3619 | } |
| 3620 | pReqMsg->numBuckets = nla_get_u8( |
| 3621 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3622 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3623 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3624 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3625 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3626 | } |
| 3627 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3628 | pReqMsg->numBuckets); |
| 3629 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3630 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3631 | goto fail; |
| 3632 | } |
| 3633 | |
| 3634 | nla_for_each_nested(buckets, |
| 3635 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3636 | if(nla_parse(bucket, |
| 3637 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3638 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3639 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3640 | goto fail; |
| 3641 | } |
| 3642 | |
| 3643 | /* Parse and fetch bucket spec */ |
| 3644 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3645 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3646 | goto fail; |
| 3647 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3648 | |
| 3649 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 3650 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3651 | |
| 3652 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 3653 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3654 | |
| 3655 | /* Parse and fetch wifi band */ |
| 3656 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3657 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3658 | goto fail; |
| 3659 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3660 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3661 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3662 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3663 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3664 | |
| 3665 | /* Parse and fetch period */ |
| 3666 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3668 | goto fail; |
| 3669 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3670 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3671 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3672 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3673 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3674 | |
| 3675 | /* Parse and fetch report events */ |
| 3676 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3678 | goto fail; |
| 3679 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3680 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3681 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3682 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3683 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3684 | |
| 3685 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3686 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 3687 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3688 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3689 | goto fail; |
| 3690 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3691 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3692 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3693 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3694 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3695 | |
| 3696 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3697 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3698 | goto fail; |
| 3699 | } |
| 3700 | |
| 3701 | j = 0; |
| 3702 | nla_for_each_nested(channels, |
| 3703 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3704 | if(nla_parse(channel, |
| 3705 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3706 | nla_data(channels), nla_len(channels), |
| 3707 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 3708 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3709 | goto fail; |
| 3710 | } |
| 3711 | |
| 3712 | /* Parse and fetch channel */ |
| 3713 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 3714 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3715 | goto fail; |
| 3716 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3717 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3718 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 3719 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3720 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3721 | |
| 3722 | /* Parse and fetch dwell time */ |
| 3723 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 3724 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 3725 | goto fail; |
| 3726 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3727 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3728 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 3729 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3730 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3731 | |
| 3732 | /* Parse and fetch channel spec passive */ |
| 3733 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 3734 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3735 | FL("attr channel spec passive failed")); |
| 3736 | goto fail; |
| 3737 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3738 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3739 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 3740 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3741 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3742 | j++; |
| 3743 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3744 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3745 | } |
| 3746 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 3747 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3748 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3749 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 3750 | vos_mem_free(pReqMsg); |
| 3751 | return -EINVAL; |
| 3752 | } |
| 3753 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3754 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3755 | return 0; |
| 3756 | |
| 3757 | fail: |
| 3758 | vos_mem_free(pReqMsg); |
| 3759 | return -EINVAL; |
| 3760 | } |
| 3761 | |
| 3762 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 3763 | struct wireless_dev *wdev, |
| 3764 | void *data, int dataLen) |
| 3765 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3766 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3767 | struct net_device *dev = wdev->netdev; |
| 3768 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3769 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3770 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3771 | eHalStatus status; |
| 3772 | |
| 3773 | status = wlan_hdd_validate_context(pHddCtx); |
| 3774 | if (0 != status) |
| 3775 | { |
| 3776 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3777 | FL("HDD context is not valid")); |
| 3778 | return -EINVAL; |
| 3779 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3780 | /* check the EXTScan Capability */ |
| 3781 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3782 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3783 | { |
| 3784 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3785 | FL("EXTScan not enabled/supported by Firmware")); |
| 3786 | return -EINVAL; |
| 3787 | } |
| 3788 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3789 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3790 | data, dataLen, |
| 3791 | wlan_hdd_extscan_config_policy)) { |
| 3792 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3793 | return -EINVAL; |
| 3794 | } |
| 3795 | |
| 3796 | /* Parse and fetch request Id */ |
| 3797 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3798 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3799 | return -EINVAL; |
| 3800 | } |
| 3801 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3802 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3803 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3804 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3805 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3806 | reqMsg.sessionId = pAdapter->sessionId; |
| 3807 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3808 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3809 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3810 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3812 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3813 | return -EINVAL; |
| 3814 | } |
| 3815 | |
| 3816 | return 0; |
| 3817 | } |
| 3818 | |
| 3819 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 3820 | struct wireless_dev *wdev, |
| 3821 | void *data, int dataLen) |
| 3822 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3823 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3824 | struct net_device *dev = wdev->netdev; |
| 3825 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3826 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3827 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3828 | eHalStatus status; |
| 3829 | |
| 3830 | status = wlan_hdd_validate_context(pHddCtx); |
| 3831 | if (0 != status) |
| 3832 | { |
| 3833 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3834 | FL("HDD context is not valid")); |
| 3835 | return -EINVAL; |
| 3836 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3837 | /* check the EXTScan Capability */ |
| 3838 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3839 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3840 | { |
| 3841 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3842 | FL("EXTScan not enabled/supported by Firmware")); |
| 3843 | return -EINVAL; |
| 3844 | } |
| 3845 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3846 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3847 | data, dataLen, |
| 3848 | wlan_hdd_extscan_config_policy)) { |
| 3849 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3850 | return -EINVAL; |
| 3851 | } |
| 3852 | |
| 3853 | /* Parse and fetch request Id */ |
| 3854 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3855 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3856 | return -EINVAL; |
| 3857 | } |
| 3858 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3859 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3860 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3861 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3862 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3863 | reqMsg.sessionId = pAdapter->sessionId; |
| 3864 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3865 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3866 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3867 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3868 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3869 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3870 | return -EINVAL; |
| 3871 | } |
| 3872 | |
| 3873 | return 0; |
| 3874 | } |
| 3875 | |
| 3876 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 3877 | struct wiphy *wiphy, |
| 3878 | struct wireless_dev *wdev, |
| 3879 | void *data, int dataLen) |
| 3880 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3881 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3882 | struct net_device *dev = wdev->netdev; |
| 3883 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3884 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3885 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3886 | eHalStatus status; |
| 3887 | |
| 3888 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering")); |
| 3889 | status = wlan_hdd_validate_context(pHddCtx); |
| 3890 | if (0 != status) |
| 3891 | { |
| 3892 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3893 | FL("HDD context is not valid")); |
| 3894 | return -EINVAL; |
| 3895 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3896 | /* check the EXTScan Capability */ |
| 3897 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3898 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3899 | { |
| 3900 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3901 | FL("EXTScan not enabled/supported by Firmware")); |
| 3902 | return -EINVAL; |
| 3903 | } |
| 3904 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3905 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3906 | data, dataLen, |
| 3907 | wlan_hdd_extscan_config_policy)) { |
| 3908 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3909 | return -EINVAL; |
| 3910 | } |
| 3911 | |
| 3912 | /* Parse and fetch request Id */ |
| 3913 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3914 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3915 | return -EINVAL; |
| 3916 | } |
| 3917 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3918 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3919 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3920 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3921 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3922 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3923 | reqMsg.sessionId = pAdapter->sessionId; |
| 3924 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3925 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3926 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3927 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3929 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3930 | return -EINVAL; |
| 3931 | } |
| 3932 | |
| 3933 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3934 | return 0; |
| 3935 | } |
| 3936 | |
| 3937 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 3938 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3939 | /*EXT TDLS*/ |
| 3940 | static const struct nla_policy |
| 3941 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 3942 | { |
| 3943 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3944 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 3945 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 3946 | {.type = NLA_S32 }, |
| 3947 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 3948 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 3949 | |
| 3950 | }; |
| 3951 | |
| 3952 | static const struct nla_policy |
| 3953 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 3954 | { |
| 3955 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3956 | |
| 3957 | }; |
| 3958 | |
| 3959 | static const struct nla_policy |
| 3960 | wlan_hdd_tdls_config_state_change_policy[ |
| 3961 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 3962 | { |
| 3963 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3964 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 3965 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
| 3966 | |
| 3967 | }; |
| 3968 | |
| 3969 | static const struct nla_policy |
| 3970 | wlan_hdd_tdls_config_get_status_policy[ |
| 3971 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 3972 | { |
| 3973 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3974 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 3975 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
| 3976 | |
| 3977 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 3978 | |
| 3979 | static const struct nla_policy |
| 3980 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 3981 | { |
| 3982 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 3983 | }; |
| 3984 | |
| 3985 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 3986 | struct wireless_dev *wdev, |
| 3987 | void *data, |
| 3988 | int data_len) |
| 3989 | { |
| 3990 | |
| 3991 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3992 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 3993 | |
| 3994 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
| 3995 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("hdd Ctx invalid while spoof macAddr")); |
| 3996 | return -EINVAL; |
| 3997 | } |
| 3998 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 3999 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4000 | return -ENOTSUPP; |
| 4001 | } |
| 4002 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4003 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4004 | return -ENOTSUPP; |
| 4005 | } |
| 4006 | |
| 4007 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4008 | data, data_len, wlan_hdd_mac_config)) { |
| 4009 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4010 | return -EINVAL; |
| 4011 | } |
| 4012 | |
| 4013 | /* Parse and fetch mac address */ |
| 4014 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4015 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4016 | return -EINVAL; |
| 4017 | } |
| 4018 | |
| 4019 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4020 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4021 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4022 | |
| 4023 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,nla_data( |
| 4024 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4025 | VOS_MAC_ADDR_FIRST_3_BYTES); |
| 4026 | |
| 4027 | if (VOS_STATUS_SUCCESS != vos_randomize_n_bytes( |
| 4028 | (void *)(&pHddCtx->spoofMacAddr.randomMacAddr.bytes[3]), |
| 4029 | VOS_MAC_ADDR_LAST_3_BYTES)) { |
| 4030 | hddLog(LOGE, FL("Failed to generate random Mac Addr")); |
| 4031 | } |
| 4032 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4033 | pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4034 | VOS_MAC_ADDR_SIZE); |
| 4035 | |
| 4036 | if (eHAL_STATUS_SUCCESS != sme_SpoofMacAddrReq(pHddCtx->hHal, |
| 4037 | &pHddCtx->spoofMacAddr.randomMacAddr)) { |
| 4038 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4039 | } |
| 4040 | |
| 4041 | return 0; |
| 4042 | } |
| 4043 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4044 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4045 | struct wireless_dev *wdev, |
| 4046 | void *data, |
| 4047 | int data_len) |
| 4048 | { |
| 4049 | u8 peer[6] = {0}; |
| 4050 | struct net_device *dev = wdev->netdev; |
| 4051 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4052 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4053 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4054 | eHalStatus ret; |
| 4055 | tANI_S32 state; |
| 4056 | tANI_S32 reason; |
| 4057 | struct sk_buff *skb = NULL; |
| 4058 | |
| 4059 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4060 | if (0 != ret) { |
| 4061 | |
| 4062 | return -EINVAL; |
| 4063 | } |
| 4064 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4065 | |
| 4066 | return -ENOTSUPP; |
| 4067 | } |
| 4068 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4069 | data, data_len, |
| 4070 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4071 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4072 | return -EINVAL; |
| 4073 | } |
| 4074 | |
| 4075 | /* Parse and fetch mac address */ |
| 4076 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4077 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4078 | return -EINVAL; |
| 4079 | } |
| 4080 | |
| 4081 | memcpy(peer, nla_data( |
| 4082 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4083 | sizeof(peer)); |
| 4084 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4085 | |
| 4086 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4087 | |
| 4088 | if (0 != ret) { |
| 4089 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4090 | FL("get status Failed")); |
| 4091 | return -EINVAL; |
| 4092 | } |
| 4093 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 4094 | 2 * sizeof(s32) + |
| 4095 | NLMSG_HDRLEN); |
| 4096 | |
| 4097 | if (!skb) { |
| 4098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4099 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4100 | return -EINVAL; |
| 4101 | } |
| 4102 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reason (%d) Status (%d) tdls peer" MAC_ADDRESS_STR), |
| 4103 | reason, |
| 4104 | state, |
| 4105 | MAC_ADDR_ARRAY(peer)); |
| 4106 | |
| 4107 | if (nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, state) || |
| 4108 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, reason)) { |
| 4109 | |
| 4110 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4111 | goto nla_put_failure; |
| 4112 | } |
| 4113 | |
| 4114 | return cfg80211_vendor_cmd_reply(skb); |
| 4115 | |
| 4116 | nla_put_failure: |
| 4117 | kfree_skb(skb); |
| 4118 | return -EINVAL; |
| 4119 | } |
| 4120 | |
| 4121 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4122 | tANI_S32 state, |
| 4123 | tANI_S32 reason, |
| 4124 | void *ctx) |
| 4125 | { |
| 4126 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
| 4127 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4128 | struct sk_buff *skb = NULL; |
| 4129 | |
| 4130 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 4131 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid ")); |
| 4132 | return -EINVAL; |
| 4133 | } |
| 4134 | |
| 4135 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4136 | |
| 4137 | return -ENOTSUPP; |
| 4138 | } |
| 4139 | skb = cfg80211_vendor_event_alloc( |
| 4140 | pHddCtx->wiphy, |
| 4141 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4142 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4143 | GFP_KERNEL); |
| 4144 | |
| 4145 | if (!skb) { |
| 4146 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4147 | FL("cfg80211_vendor_event_alloc failed")); |
| 4148 | return -EINVAL; |
| 4149 | } |
| 4150 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 4151 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason (%d) Status (%d)", reason, state); |
| 4152 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4153 | MAC_ADDR_ARRAY(mac)); |
| 4154 | |
| 4155 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4156 | VOS_MAC_ADDR_SIZE, mac) || |
| 4157 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, state) || |
| 4158 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, reason) |
| 4159 | ) { |
| 4160 | |
| 4161 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4162 | goto nla_put_failure; |
| 4163 | } |
| 4164 | |
| 4165 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 4166 | return (0); |
| 4167 | |
| 4168 | nla_put_failure: |
| 4169 | kfree_skb(skb); |
| 4170 | return -EINVAL; |
| 4171 | } |
| 4172 | |
| 4173 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4174 | struct wireless_dev *wdev, |
| 4175 | void *data, |
| 4176 | int data_len) |
| 4177 | { |
| 4178 | u8 peer[6] = {0}; |
| 4179 | struct net_device *dev = wdev->netdev; |
| 4180 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4181 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4182 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4183 | eHalStatus status; |
| 4184 | tdls_req_params_t pReqMsg = {0}; |
| 4185 | |
| 4186 | status = wlan_hdd_validate_context(pHddCtx); |
| 4187 | if (0 != status) { |
| 4188 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4189 | FL("HDD context is not valid")); |
| 4190 | return -EINVAL; |
| 4191 | } |
| 4192 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4193 | |
| 4194 | return -ENOTSUPP; |
| 4195 | } |
| 4196 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4197 | data, data_len, |
| 4198 | wlan_hdd_tdls_config_enable_policy)) { |
| 4199 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4200 | return -EINVAL; |
| 4201 | } |
| 4202 | |
| 4203 | /* Parse and fetch mac address */ |
| 4204 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4205 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4206 | return -EINVAL; |
| 4207 | } |
| 4208 | |
| 4209 | memcpy(peer, nla_data( |
| 4210 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4211 | sizeof(peer)); |
| 4212 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4213 | |
| 4214 | /* Parse and fetch channel */ |
| 4215 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4216 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4217 | return -EINVAL; |
| 4218 | } |
| 4219 | pReqMsg.channel = nla_get_s32( |
| 4220 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4221 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4222 | |
| 4223 | /* Parse and fetch global operating class */ |
| 4224 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4225 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4226 | return -EINVAL; |
| 4227 | } |
| 4228 | pReqMsg.global_operating_class = nla_get_s32( |
| 4229 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4230 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4231 | pReqMsg.global_operating_class); |
| 4232 | |
| 4233 | /* Parse and fetch latency ms */ |
| 4234 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4235 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4236 | return -EINVAL; |
| 4237 | } |
| 4238 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4239 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4240 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4241 | pReqMsg.max_latency_ms); |
| 4242 | |
| 4243 | /* Parse and fetch required bandwidth kbps */ |
| 4244 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4245 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4246 | return -EINVAL; |
| 4247 | } |
| 4248 | |
| 4249 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4250 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4251 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4252 | pReqMsg.min_bandwidth_kbps); |
| 4253 | |
| 4254 | return (wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 4255 | peer, |
| 4256 | wlan_hdd_cfg80211_exttdls_callback)); |
| 4257 | } |
| 4258 | |
| 4259 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4260 | struct wireless_dev *wdev, |
| 4261 | void *data, |
| 4262 | int data_len) |
| 4263 | { |
| 4264 | u8 peer[6] = {0}; |
| 4265 | struct net_device *dev = wdev->netdev; |
| 4266 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4267 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4268 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4269 | eHalStatus status; |
| 4270 | |
| 4271 | status = wlan_hdd_validate_context(pHddCtx); |
| 4272 | if (0 != status) { |
| 4273 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4274 | FL("HDD context is not valid")); |
| 4275 | return -EINVAL; |
| 4276 | } |
| 4277 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4278 | |
| 4279 | return -ENOTSUPP; |
| 4280 | } |
| 4281 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4282 | data, data_len, |
| 4283 | wlan_hdd_tdls_config_disable_policy)) { |
| 4284 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4285 | return -EINVAL; |
| 4286 | } |
| 4287 | /* Parse and fetch mac address */ |
| 4288 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4289 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4290 | return -EINVAL; |
| 4291 | } |
| 4292 | |
| 4293 | memcpy(peer, nla_data( |
| 4294 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4295 | sizeof(peer)); |
| 4296 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4297 | |
| 4298 | return (wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer)); |
| 4299 | } |
| 4300 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4301 | static int |
| 4302 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 4303 | struct wireless_dev *wdev, |
| 4304 | void *data, int data_len) |
| 4305 | { |
| 4306 | struct net_device *dev = wdev->netdev; |
| 4307 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4308 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4309 | struct sk_buff *skb = NULL; |
| 4310 | tANI_U32 fset = 0; |
| 4311 | |
| 4312 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4313 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4314 | fset |= WIFI_FEATURE_INFRA; |
| 4315 | } |
| 4316 | |
| 4317 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4318 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4319 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4320 | } |
| 4321 | |
| 4322 | #ifdef WLAN_FEATURE_P2P |
| 4323 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4324 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4325 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4326 | fset |= WIFI_FEATURE_P2P; |
| 4327 | } |
| 4328 | #endif |
| 4329 | |
| 4330 | /* Soft-AP is supported currently by default */ |
| 4331 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4332 | |
| 4333 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4334 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4335 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4336 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4337 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4338 | } |
| 4339 | #endif |
| 4340 | |
| 4341 | #ifdef WLAN_FEATURE_NAN |
| 4342 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4343 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4344 | fset |= WIFI_FEATURE_NAN; |
| 4345 | } |
| 4346 | #endif |
| 4347 | |
| 4348 | /* D2D RTT is not supported currently by default */ |
| 4349 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4350 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4351 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 4352 | } |
| 4353 | |
| 4354 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 4355 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 4356 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 4357 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 4358 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 4359 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 4360 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 4361 | } |
| 4362 | #endif |
| 4363 | |
| 4364 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4365 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 4366 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 4367 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 4368 | fset |= WIFI_FEATURE_PNO; |
| 4369 | } |
| 4370 | #endif |
| 4371 | |
| 4372 | /* STA+STA is supported currently by default */ |
| 4373 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 4374 | |
| 4375 | #ifdef FEATURE_WLAN_TDLS |
| 4376 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 4377 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 4378 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 4379 | fset |= WIFI_FEATURE_TDLS; |
| 4380 | } |
| 4381 | |
| 4382 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 4383 | #endif |
| 4384 | |
| 4385 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 4386 | /* AP+STA concurrency is supported currently by default */ |
| 4387 | fset |= WIFI_FEATURE_AP_STA; |
| 4388 | #endif |
| 4389 | |
| 4390 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 4391 | NLMSG_HDRLEN); |
| 4392 | |
| 4393 | if (!skb) { |
| 4394 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4395 | return -EINVAL; |
| 4396 | } |
| 4397 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 4398 | |
| 4399 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 4400 | hddLog(LOGE, FL("nla put fail")); |
| 4401 | goto nla_put_failure; |
| 4402 | } |
| 4403 | |
| 4404 | return cfg80211_vendor_cmd_reply(skb); |
| 4405 | |
| 4406 | nla_put_failure: |
| 4407 | kfree_skb(skb); |
| 4408 | return -EINVAL; |
| 4409 | } |
| 4410 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4411 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4412 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 4413 | { |
| 4414 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4415 | { |
| 4416 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4417 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 4418 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4419 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4420 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4421 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
| 4422 | }, |
| 4423 | |
| 4424 | { |
| 4425 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4426 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 4427 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4428 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4429 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4430 | .doit = wlan_hdd_cfg80211_ll_stats_set |
| 4431 | }, |
| 4432 | |
| 4433 | { |
| 4434 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4435 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 4436 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4437 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4438 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4439 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4440 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4441 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4442 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4443 | { |
| 4444 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4445 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 4446 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4447 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4448 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4449 | .doit = wlan_hdd_cfg80211_extscan_start |
| 4450 | }, |
| 4451 | { |
| 4452 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4453 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 4454 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4455 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4456 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4457 | .doit = wlan_hdd_cfg80211_extscan_stop |
| 4458 | }, |
| 4459 | { |
| 4460 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4461 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 4462 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4463 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4464 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
| 4465 | }, |
| 4466 | { |
| 4467 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4468 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 4469 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4470 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4471 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4472 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
| 4473 | }, |
| 4474 | { |
| 4475 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4476 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 4477 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4478 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4479 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4480 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
| 4481 | }, |
| 4482 | { |
| 4483 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4484 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 4485 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4486 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4487 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4488 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
| 4489 | }, |
| 4490 | { |
| 4491 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4492 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 4493 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4494 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4495 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4496 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
| 4497 | }, |
| 4498 | { |
| 4499 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4500 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 4501 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4502 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4503 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4504 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
| 4505 | }, |
| 4506 | { |
| 4507 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4508 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 4509 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4510 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4511 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4512 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
| 4513 | }, |
| 4514 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4515 | /*EXT TDLS*/ |
| 4516 | { |
| 4517 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4518 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 4519 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4520 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4521 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4522 | .doit = wlan_hdd_cfg80211_exttdls_enable |
| 4523 | }, |
| 4524 | { |
| 4525 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4526 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 4527 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4528 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4529 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 4530 | .doit = wlan_hdd_cfg80211_exttdls_disable |
| 4531 | }, |
| 4532 | { |
| 4533 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4534 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 4535 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4536 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4537 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
| 4538 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4539 | { |
| 4540 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4541 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 4542 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4543 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4544 | .doit = wlan_hdd_cfg80211_get_supported_features |
| 4545 | }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4546 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4547 | { |
| 4548 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4549 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 4550 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4551 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 4552 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
| 4553 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4554 | }; |
| 4555 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4556 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4557 | static const |
| 4558 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4559 | { |
| 4560 | #ifdef FEATURE_WLAN_CH_AVOID |
| 4561 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4562 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4563 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4564 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4565 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 4566 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4567 | { |
| 4568 | /* Index = 1*/ |
| 4569 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4570 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 4571 | }, |
| 4572 | { |
| 4573 | /* Index = 2*/ |
| 4574 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4575 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 4576 | }, |
| 4577 | { |
| 4578 | /* Index = 3*/ |
| 4579 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4580 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 4581 | }, |
| 4582 | { |
| 4583 | /* Index = 4*/ |
| 4584 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4585 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 4586 | }, |
| 4587 | { |
| 4588 | /* Index = 5*/ |
| 4589 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4590 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 4591 | }, |
| 4592 | { |
| 4593 | /* Index = 6*/ |
| 4594 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4595 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 4596 | }, |
| 4597 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4598 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4599 | { |
| 4600 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4601 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 4602 | }, |
| 4603 | { |
| 4604 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4605 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 4606 | }, |
| 4607 | { |
| 4608 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4609 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 4610 | }, |
| 4611 | { |
| 4612 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4613 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 4614 | }, |
| 4615 | { |
| 4616 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4617 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 4618 | }, |
| 4619 | { |
| 4620 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4621 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 4622 | }, |
| 4623 | { |
| 4624 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4625 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 4626 | }, |
| 4627 | { |
| 4628 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4629 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 4630 | }, |
| 4631 | { |
| 4632 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4633 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 4634 | }, |
| 4635 | { |
| 4636 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4637 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 4638 | }, |
| 4639 | { |
| 4640 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4641 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 4642 | }, |
| 4643 | { |
| 4644 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4645 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 4646 | }, |
| 4647 | { |
| 4648 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4649 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 4650 | }, |
| 4651 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4652 | /*EXT TDLS*/ |
| 4653 | { |
| 4654 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4655 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 4656 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4657 | }; |
| 4658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4659 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4660 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4661 | * This function is called by hdd_wlan_startup() |
| 4662 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4663 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4664 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4665 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4666 | { |
| 4667 | struct wiphy *wiphy; |
| 4668 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4669 | /* |
| 4670 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4671 | */ |
| 4672 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 4673 | |
| 4674 | if (!wiphy) |
| 4675 | { |
| 4676 | /* Print error and jump into err label and free the memory */ |
| 4677 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 4678 | return NULL; |
| 4679 | } |
| 4680 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4681 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4682 | return wiphy; |
| 4683 | } |
| 4684 | |
| 4685 | /* |
| 4686 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4687 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4688 | * private ioctl to change the band value |
| 4689 | */ |
| 4690 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 4691 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4692 | int i, j; |
| 4693 | eNVChannelEnabledType channelEnabledState; |
| 4694 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4695 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4696 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4697 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4698 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4699 | |
| 4700 | if (NULL == wiphy->bands[i]) |
| 4701 | { |
| 4702 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4703 | __func__, i); |
| 4704 | continue; |
| 4705 | } |
| 4706 | |
| 4707 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4708 | { |
| 4709 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4710 | |
| 4711 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 4712 | band->channels[j].hw_value); |
| 4713 | |
| 4714 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 4715 | { |
| 4716 | // Enable Social channels for P2P |
| 4717 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq) && |
| 4718 | NV_CHANNEL_ENABLE == channelEnabledState) |
| 4719 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4720 | else |
| 4721 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4722 | continue; |
| 4723 | } |
| 4724 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 4725 | { |
| 4726 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4727 | continue; |
| 4728 | } |
| 4729 | |
| 4730 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 4731 | NV_CHANNEL_INVALID == channelEnabledState) |
| 4732 | { |
| 4733 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4734 | } |
| 4735 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 4736 | { |
| 4737 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4738 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 4739 | } |
| 4740 | else |
| 4741 | { |
| 4742 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 4743 | |IEEE80211_CHAN_RADAR); |
| 4744 | } |
| 4745 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4746 | } |
| 4747 | return 0; |
| 4748 | } |
| 4749 | /* |
| 4750 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4751 | * This function is called by hdd_wlan_startup() |
| 4752 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | * This function is used to initialize and register wiphy structure. |
| 4754 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4755 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4756 | struct wiphy *wiphy, |
| 4757 | hdd_config_t *pCfg |
| 4758 | ) |
| 4759 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4760 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4761 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4762 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4763 | ENTER(); |
| 4764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4765 | /* Now bind the underlying wlan device with wiphy */ |
| 4766 | set_wiphy_dev(wiphy, dev); |
| 4767 | |
| 4768 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4769 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4770 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4771 | /* the flag for the other case would be initialzed in |
| 4772 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 4773 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4774 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4775 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4776 | /* This will disable updating of NL channels from passive to |
| 4777 | * active if a beacon is received on passive channel. */ |
| 4778 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 4779 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4780 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4781 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4782 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4783 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 4784 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 4785 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4786 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 4787 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4788 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4789 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4790 | #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] | 4791 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4792 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4793 | || pCfg->isFastRoamIniFeatureEnabled |
| 4794 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4795 | #ifdef FEATURE_WLAN_ESE |
| 4796 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 4797 | #endif |
| 4798 | ) |
| 4799 | { |
| 4800 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 4801 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 4802 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4803 | #ifdef FEATURE_WLAN_TDLS |
| 4804 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 4805 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 4806 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4807 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 4808 | if (pCfg->configPNOScanSupport) |
| 4809 | { |
| 4810 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 4811 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4812 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 4813 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 4814 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 4815 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4816 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4817 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4818 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 4819 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4820 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 4821 | driver need to determine what to do with both |
| 4822 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4823 | |
| 4824 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 4825 | #else |
| 4826 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 4827 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4828 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4829 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 4830 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 4831 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4832 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 4833 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 4834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4835 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4836 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4837 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 4839 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4840 | | BIT(NL80211_IFTYPE_AP); |
| 4841 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4842 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4843 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4844 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 4845 | if( pCfg->enableMCC ) |
| 4846 | { |
| 4847 | /* Currently, supports up to two channels */ |
| 4848 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4849 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4850 | if( !pCfg->allowMCCGODiffBI ) |
| 4851 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4852 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4853 | } |
| 4854 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 4855 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4856 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 4857 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 4858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | /* Before registering we need to update the ht capabilitied based |
| 4860 | * on ini values*/ |
| 4861 | if( !pCfg->ShortGI20MhzEnable ) |
| 4862 | { |
| 4863 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4864 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4865 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 4866 | } |
| 4867 | |
| 4868 | if( !pCfg->ShortGI40MhzEnable ) |
| 4869 | { |
| 4870 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 4871 | } |
| 4872 | |
| 4873 | if( !pCfg->nChannelBondingMode5GHz ) |
| 4874 | { |
| 4875 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 4876 | } |
| 4877 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4878 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 4879 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 4880 | { |
| 4881 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 4882 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4883 | |
| 4884 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 4885 | { |
| 4886 | |
| 4887 | if (NULL == wiphy->bands[i]) |
| 4888 | { |
| 4889 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 4890 | __func__, i); |
| 4891 | continue; |
| 4892 | } |
| 4893 | |
| 4894 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 4895 | { |
| 4896 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 4897 | |
| 4898 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 4899 | { |
| 4900 | // Enable social channels for P2P |
| 4901 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 4902 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 4903 | else |
| 4904 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4905 | continue; |
| 4906 | } |
| 4907 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 4908 | { |
| 4909 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 4910 | continue; |
| 4911 | } |
| 4912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4913 | } |
| 4914 | /*Initialise the supported cipher suite details*/ |
| 4915 | wiphy->cipher_suites = hdd_cipher_suites; |
| 4916 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 4917 | |
| 4918 | /*signal strength in mBm (100*dBm) */ |
| 4919 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 4920 | |
| 4921 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 4922 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4924 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4925 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 4926 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4927 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 4928 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 4929 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4930 | EXIT(); |
| 4931 | return 0; |
| 4932 | } |
| 4933 | |
| 4934 | /* In this function we are registering wiphy. */ |
| 4935 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 4936 | { |
| 4937 | ENTER(); |
| 4938 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4939 | if (0 > wiphy_register(wiphy)) |
| 4940 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4941 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4942 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 4943 | return -EIO; |
| 4944 | } |
| 4945 | |
| 4946 | EXIT(); |
| 4947 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4948 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4949 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4950 | /* In this function we are updating channel list when, |
| 4951 | regulatory domain is FCC and country code is US. |
| 4952 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 4953 | As per FCC smart phone is not a indoor device. |
| 4954 | GO should not opeate on indoor channels */ |
| 4955 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 4956 | { |
| 4957 | int j; |
| 4958 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4959 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 4960 | //Default counrtycode from NV at the time of wiphy initialization. |
| 4961 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 4962 | &defaultCountryCode[0])) |
| 4963 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4964 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4965 | } |
| 4966 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 4967 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4968 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 4969 | { |
| 4970 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 4971 | return; |
| 4972 | } |
| 4973 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 4974 | { |
| 4975 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 4976 | // Mark UNII -1 band channel as passive |
| 4977 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 4978 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 4979 | } |
| 4980 | } |
| 4981 | } |
| 4982 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 4983 | /* This function registers for all frame which supplicant is interested in */ |
| 4984 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4985 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4987 | /* Register for all P2P action, public action etc frames */ |
| 4988 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 4989 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4990 | ENTER(); |
| 4991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | /* Right now we are registering these frame when driver is getting |
| 4993 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 4994 | frame register ops, we will move this code as a part of that */ |
| 4995 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4996 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 4998 | |
| 4999 | /* GAS Initial Response */ |
| 5000 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5001 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5003 | /* GAS Comeback Request */ |
| 5004 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5005 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5006 | |
| 5007 | /* GAS Comeback Response */ |
| 5008 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5009 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5010 | |
| 5011 | /* P2P Public Action */ |
| 5012 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5013 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5015 | |
| 5016 | /* P2P Action */ |
| 5017 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5018 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5019 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5020 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5021 | /* WNM BSS Transition Request frame */ |
| 5022 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5023 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5024 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5025 | |
| 5026 | /* WNM-Notification */ |
| 5027 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5028 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5029 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5030 | } |
| 5031 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5032 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5034 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5035 | /* Register for all P2P action, public action etc frames */ |
| 5036 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5037 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5038 | ENTER(); |
| 5039 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5040 | /* Right now we are registering these frame when driver is getting |
| 5041 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5042 | frame register ops, we will move this code as a part of that */ |
| 5043 | /* GAS Initial Request */ |
| 5044 | |
| 5045 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5046 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5047 | |
| 5048 | /* GAS Initial Response */ |
| 5049 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5050 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5052 | /* GAS Comeback Request */ |
| 5053 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5054 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5055 | |
| 5056 | /* GAS Comeback Response */ |
| 5057 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5058 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5059 | |
| 5060 | /* P2P Public Action */ |
| 5061 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5062 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5063 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5064 | |
| 5065 | /* P2P Action */ |
| 5066 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5067 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5068 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5069 | /* WNM-Notification */ |
| 5070 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5071 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5072 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5073 | } |
| 5074 | |
| 5075 | #ifdef FEATURE_WLAN_WAPI |
| 5076 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 5077 | const u8 *mac_addr, u8 *key , int key_Len) |
| 5078 | { |
| 5079 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5080 | tCsrRoamSetKey setKey; |
| 5081 | v_BOOL_t isConnected = TRUE; |
| 5082 | int status = 0; |
| 5083 | v_U32_t roamId= 0xFF; |
| 5084 | tANI_U8 *pKeyPtr = NULL; |
| 5085 | int n = 0; |
| 5086 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5087 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 5088 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5089 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5090 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 5091 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5092 | setKey.keyId = key_index; // Store Key ID |
| 5093 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 5094 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 5095 | setKey.paeRole = 0 ; // the PAE role |
| 5096 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 5097 | { |
| 5098 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 5099 | } |
| 5100 | else |
| 5101 | { |
| 5102 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 5103 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 5104 | } |
| 5105 | setKey.keyLength = key_Len; |
| 5106 | pKeyPtr = setKey.Key; |
| 5107 | memcpy( pKeyPtr, key, key_Len); |
| 5108 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5109 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | __func__, key_Len); |
| 5111 | for (n = 0 ; n < key_Len; n++) |
| 5112 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 5113 | __func__,n,setKey.Key[n]); |
| 5114 | |
| 5115 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5116 | if ( isConnected ) |
| 5117 | { |
| 5118 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5119 | pAdapter->sessionId, &setKey, &roamId ); |
| 5120 | } |
| 5121 | if ( status != 0 ) |
| 5122 | { |
| 5123 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5124 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 5125 | __LINE__, status ); |
| 5126 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5127 | } |
| 5128 | } |
| 5129 | #endif /* FEATURE_WLAN_WAPI*/ |
| 5130 | |
| 5131 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5132 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5133 | beacon_data_t **ppBeacon, |
| 5134 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5135 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5136 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5137 | beacon_data_t **ppBeacon, |
| 5138 | struct cfg80211_beacon_data *params, |
| 5139 | int dtim_period) |
| 5140 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5141 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5142 | int size; |
| 5143 | beacon_data_t *beacon = NULL; |
| 5144 | beacon_data_t *old = NULL; |
| 5145 | int head_len,tail_len; |
| 5146 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5147 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5148 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5149 | { |
| 5150 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5151 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5152 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5154 | |
| 5155 | old = pAdapter->sessionCtx.ap.beacon; |
| 5156 | |
| 5157 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5158 | { |
| 5159 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5160 | FL("session(%d) old and new heads points to NULL"), |
| 5161 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5162 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5163 | } |
| 5164 | |
| 5165 | if (params->tail && !params->tail_len) |
| 5166 | { |
| 5167 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5168 | FL("tail_len is zero but tail is not NULL")); |
| 5169 | return -EINVAL; |
| 5170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5172 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 5173 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 5174 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5175 | { |
| 5176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5177 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5178 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5180 | #endif |
| 5181 | |
| 5182 | if(params->head) |
| 5183 | head_len = params->head_len; |
| 5184 | else |
| 5185 | head_len = old->head_len; |
| 5186 | |
| 5187 | if(params->tail || !old) |
| 5188 | tail_len = params->tail_len; |
| 5189 | else |
| 5190 | tail_len = old->tail_len; |
| 5191 | |
| 5192 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 5193 | |
| 5194 | beacon = kzalloc(size, GFP_KERNEL); |
| 5195 | |
| 5196 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5197 | { |
| 5198 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5199 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5200 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5201 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5202 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5203 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5204 | if(params->dtim_period || !old ) |
| 5205 | beacon->dtim_period = params->dtim_period; |
| 5206 | else |
| 5207 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5208 | #else |
| 5209 | if(dtim_period || !old ) |
| 5210 | beacon->dtim_period = dtim_period; |
| 5211 | else |
| 5212 | beacon->dtim_period = old->dtim_period; |
| 5213 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5215 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 5216 | beacon->tail = beacon->head + head_len; |
| 5217 | beacon->head_len = head_len; |
| 5218 | beacon->tail_len = tail_len; |
| 5219 | |
| 5220 | if(params->head) { |
| 5221 | memcpy (beacon->head,params->head,beacon->head_len); |
| 5222 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5223 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5224 | if(old) |
| 5225 | memcpy (beacon->head,old->head,beacon->head_len); |
| 5226 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | if(params->tail) { |
| 5229 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 5230 | } |
| 5231 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5232 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5233 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 5234 | } |
| 5235 | |
| 5236 | *ppBeacon = beacon; |
| 5237 | |
| 5238 | kfree(old); |
| 5239 | |
| 5240 | return 0; |
| 5241 | |
| 5242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | |
| 5244 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 5245 | { |
| 5246 | int left = length; |
| 5247 | v_U8_t *ptr = pIes; |
| 5248 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5250 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5251 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5252 | elem_id = ptr[0]; |
| 5253 | elem_len = ptr[1]; |
| 5254 | left -= 2; |
| 5255 | if(elem_len > left) |
| 5256 | { |
| 5257 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 5258 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5259 | eid,elem_len,left); |
| 5260 | return NULL; |
| 5261 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5262 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5263 | { |
| 5264 | return ptr; |
| 5265 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5266 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5267 | left -= elem_len; |
| 5268 | ptr += (elem_len + 2); |
| 5269 | } |
| 5270 | return NULL; |
| 5271 | } |
| 5272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5273 | /* Check if rate is 11g rate or not */ |
| 5274 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 5275 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 5276 | 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] | 5277 | u8 i; |
| 5278 | for (i = 0; i < 8; i++) |
| 5279 | { |
| 5280 | if(rate == gRateArray[i]) |
| 5281 | return TRUE; |
| 5282 | } |
| 5283 | return FALSE; |
| 5284 | } |
| 5285 | |
| 5286 | /* Check for 11g rate and set proper 11g only mode */ |
| 5287 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 5288 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 5289 | { |
| 5290 | u8 i, num_rates = pIe[0]; |
| 5291 | |
| 5292 | pIe += 1; |
| 5293 | for ( i = 0; i < num_rates; i++) |
| 5294 | { |
| 5295 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 5296 | { |
| 5297 | /* If rate set have 11g rate than change the mode to 11G */ |
| 5298 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 5299 | if (pIe[i] & BASIC_RATE_MASK) |
| 5300 | { |
| 5301 | /* If we have 11g rate as basic rate, it means mode |
| 5302 | is 11g only mode. |
| 5303 | */ |
| 5304 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 5305 | *pCheckRatesfor11g = FALSE; |
| 5306 | } |
| 5307 | } |
| 5308 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 5309 | { |
| 5310 | *require_ht = TRUE; |
| 5311 | } |
| 5312 | } |
| 5313 | return; |
| 5314 | } |
| 5315 | |
| 5316 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 5317 | { |
| 5318 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5319 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5320 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5321 | u8 checkRatesfor11g = TRUE; |
| 5322 | u8 require_ht = FALSE; |
| 5323 | u8 *pIe=NULL; |
| 5324 | |
| 5325 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 5326 | |
| 5327 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 5328 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 5329 | if (pIe != NULL) |
| 5330 | { |
| 5331 | pIe += 1; |
| 5332 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5333 | &pConfig->SapHw_mode); |
| 5334 | } |
| 5335 | |
| 5336 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5337 | WLAN_EID_EXT_SUPP_RATES); |
| 5338 | if (pIe != NULL) |
| 5339 | { |
| 5340 | |
| 5341 | pIe += 1; |
| 5342 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5343 | &pConfig->SapHw_mode); |
| 5344 | } |
| 5345 | |
| 5346 | if( pConfig->channel > 14 ) |
| 5347 | { |
| 5348 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 5349 | } |
| 5350 | |
| 5351 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5352 | WLAN_EID_HT_CAPABILITY); |
| 5353 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5354 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5355 | { |
| 5356 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 5357 | if(require_ht) |
| 5358 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 5359 | } |
| 5360 | } |
| 5361 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5362 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 5363 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 5364 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5365 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5366 | v_U8_t *pIe = NULL; |
| 5367 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5368 | |
| 5369 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 5370 | pBeacon->tail, pBeacon->tail_len); |
| 5371 | |
| 5372 | if (pIe) |
| 5373 | { |
| 5374 | ielen = pIe[1] + 2; |
| 5375 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5376 | { |
| 5377 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 5378 | } |
| 5379 | else |
| 5380 | { |
| 5381 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 5382 | return -EINVAL; |
| 5383 | } |
| 5384 | *total_ielen += ielen; |
| 5385 | } |
| 5386 | return 0; |
| 5387 | } |
| 5388 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5389 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 5390 | v_U8_t *genie, v_U8_t *total_ielen) |
| 5391 | { |
| 5392 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5393 | int left = pBeacon->tail_len; |
| 5394 | v_U8_t *ptr = pBeacon->tail; |
| 5395 | v_U8_t elem_id, elem_len; |
| 5396 | v_U16_t ielen = 0; |
| 5397 | |
| 5398 | if ( NULL == ptr || 0 == left ) |
| 5399 | return; |
| 5400 | |
| 5401 | while (left >= 2) |
| 5402 | { |
| 5403 | elem_id = ptr[0]; |
| 5404 | elem_len = ptr[1]; |
| 5405 | left -= 2; |
| 5406 | if (elem_len > left) |
| 5407 | { |
| 5408 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5409 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 5410 | elem_id, elem_len, left); |
| 5411 | return; |
| 5412 | } |
| 5413 | if (IE_EID_VENDOR == elem_id) |
| 5414 | { |
| 5415 | /* skipping the VSIE's which we don't want to include or |
| 5416 | * it will be included by existing code |
| 5417 | */ |
| 5418 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 5419 | #ifdef WLAN_FEATURE_WFD |
| 5420 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 5421 | #endif |
| 5422 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5423 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5424 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 5425 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5426 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 5427 | { |
| 5428 | ielen = ptr[1] + 2; |
| 5429 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5430 | { |
| 5431 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 5432 | *total_ielen += ielen; |
| 5433 | } |
| 5434 | else |
| 5435 | { |
| 5436 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5437 | "IE Length is too big " |
| 5438 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 5439 | elem_id, elem_len, *total_ielen); |
| 5440 | } |
| 5441 | } |
| 5442 | } |
| 5443 | |
| 5444 | left -= elem_len; |
| 5445 | ptr += (elem_len + 2); |
| 5446 | } |
| 5447 | return; |
| 5448 | } |
| 5449 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5450 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5451 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5452 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5453 | #else |
| 5454 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5455 | struct cfg80211_beacon_data *params) |
| 5456 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5457 | { |
| 5458 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5459 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5461 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5462 | |
| 5463 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 5464 | |
| 5465 | if(genie == NULL) { |
| 5466 | |
| 5467 | return -ENOMEM; |
| 5468 | } |
| 5469 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5470 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5471 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5472 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5473 | hddLog(LOGE, |
| 5474 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5475 | ret = -EINVAL; |
| 5476 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5477 | } |
| 5478 | |
| 5479 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5480 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5481 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 5482 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5483 | hddLog(LOGE, |
| 5484 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5485 | ret = -EINVAL; |
| 5486 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | } |
| 5488 | #endif |
| 5489 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5490 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5491 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5492 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5493 | hddLog(LOGE, |
| 5494 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5495 | ret = -EINVAL; |
| 5496 | goto done; |
| 5497 | } |
| 5498 | |
| 5499 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 5500 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5501 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | |
| 5504 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5505 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 5506 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 5507 | { |
| 5508 | hddLog(LOGE, |
| 5509 | "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] | 5510 | ret = -EINVAL; |
| 5511 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5512 | } |
| 5513 | |
| 5514 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5515 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 5516 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5517 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5518 | ==eHAL_STATUS_FAILURE) |
| 5519 | { |
| 5520 | hddLog(LOGE, |
| 5521 | "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] | 5522 | ret = -EINVAL; |
| 5523 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5524 | } |
| 5525 | |
| 5526 | // Added for ProResp IE |
| 5527 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 5528 | { |
| 5529 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 5530 | u8 probe_rsp_ie_len[3] = {0}; |
| 5531 | u8 counter = 0; |
| 5532 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 5533 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 5534 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 5535 | Store More then 255 bytes into One Variable. |
| 5536 | */ |
| 5537 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 5538 | { |
| 5539 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 5540 | { |
| 5541 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 5542 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 5543 | } |
| 5544 | else |
| 5545 | { |
| 5546 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 5547 | rem_probe_resp_ie_len = 0; |
| 5548 | } |
| 5549 | } |
| 5550 | |
| 5551 | rem_probe_resp_ie_len = 0; |
| 5552 | |
| 5553 | if (probe_rsp_ie_len[0] > 0) |
| 5554 | { |
| 5555 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5556 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 5557 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5558 | probe_rsp_ie_len[0], NULL, |
| 5559 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5560 | { |
| 5561 | hddLog(LOGE, |
| 5562 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5563 | ret = -EINVAL; |
| 5564 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5565 | } |
| 5566 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 5567 | } |
| 5568 | |
| 5569 | if (probe_rsp_ie_len[1] > 0) |
| 5570 | { |
| 5571 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5572 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 5573 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5574 | probe_rsp_ie_len[1], NULL, |
| 5575 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5576 | { |
| 5577 | hddLog(LOGE, |
| 5578 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5579 | ret = -EINVAL; |
| 5580 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5581 | } |
| 5582 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 5583 | } |
| 5584 | |
| 5585 | if (probe_rsp_ie_len[2] > 0) |
| 5586 | { |
| 5587 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5588 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 5589 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5590 | probe_rsp_ie_len[2], NULL, |
| 5591 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5592 | { |
| 5593 | hddLog(LOGE, |
| 5594 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5595 | ret = -EINVAL; |
| 5596 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5597 | } |
| 5598 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 5599 | } |
| 5600 | |
| 5601 | if (probe_rsp_ie_len[1] == 0 ) |
| 5602 | { |
| 5603 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5604 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 5605 | eANI_BOOLEAN_FALSE) ) |
| 5606 | { |
| 5607 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5608 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | } |
| 5610 | } |
| 5611 | |
| 5612 | if (probe_rsp_ie_len[2] == 0 ) |
| 5613 | { |
| 5614 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5615 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 5616 | eANI_BOOLEAN_FALSE) ) |
| 5617 | { |
| 5618 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5619 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | } |
| 5621 | } |
| 5622 | |
| 5623 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5624 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 5625 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5626 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5627 | == eHAL_STATUS_FAILURE) |
| 5628 | { |
| 5629 | hddLog(LOGE, |
| 5630 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5631 | ret = -EINVAL; |
| 5632 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | } |
| 5634 | } |
| 5635 | else |
| 5636 | { |
| 5637 | // Reset WNI_CFG_PROBE_RSP Flags |
| 5638 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 5639 | |
| 5640 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5641 | "%s: No Probe Response IE received in set beacon", |
| 5642 | __func__); |
| 5643 | } |
| 5644 | |
| 5645 | // Added for AssocResp IE |
| 5646 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 5647 | { |
| 5648 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5649 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 5650 | params->assocresp_ies_len, NULL, |
| 5651 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5652 | { |
| 5653 | hddLog(LOGE, |
| 5654 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5655 | ret = -EINVAL; |
| 5656 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | } |
| 5658 | |
| 5659 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5660 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 5661 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5662 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5663 | == eHAL_STATUS_FAILURE) |
| 5664 | { |
| 5665 | hddLog(LOGE, |
| 5666 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5667 | ret = -EINVAL; |
| 5668 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | } |
| 5670 | } |
| 5671 | else |
| 5672 | { |
| 5673 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5674 | "%s: No Assoc Response IE received in set beacon", |
| 5675 | __func__); |
| 5676 | |
| 5677 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5678 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 5679 | eANI_BOOLEAN_FALSE) ) |
| 5680 | { |
| 5681 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5682 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5683 | } |
| 5684 | } |
| 5685 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5686 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5688 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5691 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5692 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 5693 | * called by wlan_hdd_cfg80211_start_bss() and |
| 5694 | * wlan_hdd_cfg80211_set_channel() |
| 5695 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5696 | * channel list. |
| 5697 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 5698 | 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] | 5699 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5700 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5701 | v_U32_t num_ch = 0; |
| 5702 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 5703 | u32 indx = 0; |
| 5704 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5705 | v_U8_t fValidChannel = FALSE, count = 0; |
| 5706 | 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] | 5707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5708 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5709 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5710 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5711 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5712 | /* Validate the channel */ |
| 5713 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5715 | if ( channel == rfChannels[count].channelNum ) |
| 5716 | { |
| 5717 | fValidChannel = TRUE; |
| 5718 | break; |
| 5719 | } |
| 5720 | } |
| 5721 | if (fValidChannel != TRUE) |
| 5722 | { |
| 5723 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5724 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5725 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5726 | } |
| 5727 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5728 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5729 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 5730 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 5731 | valid_ch, &num_ch)) |
| 5732 | { |
| 5733 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5734 | "%s: failed to get valid channel list", __func__); |
| 5735 | return VOS_STATUS_E_FAILURE; |
| 5736 | } |
| 5737 | for (indx = 0; indx < num_ch; indx++) |
| 5738 | { |
| 5739 | if (channel == valid_ch[indx]) |
| 5740 | { |
| 5741 | break; |
| 5742 | } |
| 5743 | } |
| 5744 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5745 | if (indx >= num_ch) |
| 5746 | { |
| 5747 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5748 | { |
| 5749 | eCsrBand band; |
| 5750 | unsigned int freq; |
| 5751 | |
| 5752 | sme_GetFreqBand(hHal, &band); |
| 5753 | |
| 5754 | if (eCSR_BAND_5G == band) |
| 5755 | { |
| 5756 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 5757 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 5758 | { |
| 5759 | freq = ieee80211_channel_to_frequency(channel, |
| 5760 | IEEE80211_BAND_2GHZ); |
| 5761 | } |
| 5762 | else |
| 5763 | { |
| 5764 | freq = ieee80211_channel_to_frequency(channel, |
| 5765 | IEEE80211_BAND_5GHZ); |
| 5766 | } |
| 5767 | #else |
| 5768 | freq = ieee80211_channel_to_frequency(channel); |
| 5769 | #endif |
| 5770 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 5771 | return VOS_STATUS_SUCCESS; |
| 5772 | } |
| 5773 | } |
| 5774 | |
| 5775 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5776 | "%s: Invalid Channel [%d]", __func__, channel); |
| 5777 | return VOS_STATUS_E_FAILURE; |
| 5778 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5779 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 5780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5781 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5782 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | } |
| 5784 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5785 | /** |
| 5786 | * FUNCTION: wlan_hdd_cfg80211_set_channel |
| 5787 | * This function is used to set the channel number |
| 5788 | */ |
| 5789 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
| 5790 | struct ieee80211_channel *chan, |
| 5791 | enum nl80211_channel_type channel_type |
| 5792 | ) |
| 5793 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5794 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5795 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5796 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5797 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5798 | hdd_context_t *pHddCtx; |
| 5799 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5800 | |
| 5801 | ENTER(); |
| 5802 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5803 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5804 | if( NULL == dev ) |
| 5805 | { |
| 5806 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5807 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5808 | return -ENODEV; |
| 5809 | } |
| 5810 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 5811 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5812 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 5813 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 5814 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5815 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5816 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 5817 | hdd_device_modetoString(pAdapter->device_mode), |
| 5818 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5819 | |
| 5820 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5821 | status = wlan_hdd_validate_context(pHddCtx); |
| 5822 | |
| 5823 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5824 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5825 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5826 | "%s: HDD context is not valid", __func__); |
| 5827 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5828 | } |
| 5829 | |
| 5830 | /* |
| 5831 | * Do freq to chan conversion |
| 5832 | * TODO: for 11a |
| 5833 | */ |
| 5834 | |
| 5835 | channel = ieee80211_frequency_to_channel(freq); |
| 5836 | |
| 5837 | /* Check freq range */ |
| 5838 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 5839 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 5840 | { |
| 5841 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5842 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5843 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 5844 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 5845 | return -EINVAL; |
| 5846 | } |
| 5847 | |
| 5848 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 5849 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 5850 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 5851 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5852 | { |
| 5853 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5854 | { |
| 5855 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5856 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5857 | return -EINVAL; |
| 5858 | } |
| 5859 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5860 | "%s: set channel to [%d] for device mode =%d", |
| 5861 | __func__, channel,pAdapter->device_mode); |
| 5862 | } |
| 5863 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5864 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5865 | ) |
| 5866 | { |
| 5867 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5868 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 5869 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5870 | |
| 5871 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 5872 | { |
| 5873 | /* Link is up then return cant set channel*/ |
| 5874 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5875 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5876 | return -EINVAL; |
| 5877 | } |
| 5878 | |
| 5879 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 5880 | pHddStaCtx->conn_info.operationChannel = channel; |
| 5881 | pRoamProfile->ChannelInfo.ChannelList = |
| 5882 | &pHddStaCtx->conn_info.operationChannel; |
| 5883 | } |
| 5884 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5885 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5886 | ) |
| 5887 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5888 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 5889 | { |
| 5890 | if(VOS_STATUS_SUCCESS != |
| 5891 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5892 | { |
| 5893 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5894 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5895 | return -EINVAL; |
| 5896 | } |
| 5897 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5898 | } |
| 5899 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5900 | { |
| 5901 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 5902 | |
| 5903 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 5904 | channel set by supplicant |
| 5905 | */ |
| 5906 | if ( cfg_param->apAutoChannelSelection ) |
| 5907 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5908 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 5909 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5910 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5911 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 5912 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5913 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5914 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5915 | else |
| 5916 | { |
| 5917 | if(VOS_STATUS_SUCCESS != |
| 5918 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 5919 | { |
| 5920 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5921 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 5922 | return -EINVAL; |
| 5923 | } |
| 5924 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 5925 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5926 | } |
| 5927 | } |
| 5928 | else |
| 5929 | { |
| 5930 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5931 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 5932 | return -EINVAL; |
| 5933 | } |
| 5934 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 5935 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 5936 | } |
| 5937 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5938 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 5939 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5940 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5941 | #else |
| 5942 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 5943 | struct cfg80211_beacon_data *params, |
| 5944 | const u8 *ssid, size_t ssid_len, |
| 5945 | enum nl80211_hidden_ssid hidden_ssid) |
| 5946 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5947 | { |
| 5948 | tsap_Config_t *pConfig; |
| 5949 | beacon_data_t *pBeacon = NULL; |
| 5950 | struct ieee80211_mgmt *pMgmt_frame; |
| 5951 | v_U8_t *pIe=NULL; |
| 5952 | v_U16_t capab_info; |
| 5953 | eCsrAuthType RSNAuthType; |
| 5954 | eCsrEncryptionType RSNEncryptType; |
| 5955 | eCsrEncryptionType mcRSNEncryptType; |
| 5956 | int status = VOS_STATUS_SUCCESS; |
| 5957 | tpWLAN_SAPEventCB pSapEventCallback; |
| 5958 | hdd_hostapd_state_t *pHostapdState; |
| 5959 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 5960 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 5961 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5962 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5963 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5964 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 5965 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 5966 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 5967 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 5968 | v_BOOL_t MFPRequired = VOS_FALSE; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 5969 | eHddDot11Mode sapDot11Mode = |
| 5970 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5971 | |
| 5972 | ENTER(); |
| 5973 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 5974 | iniConfig = pHddCtx->cfg_ini; |
| 5975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 5977 | |
| 5978 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5979 | |
| 5980 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5981 | |
| 5982 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5983 | |
| 5984 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 5985 | |
| 5986 | //channel is already set in the set_channel Call back |
| 5987 | //pConfig->channel = pCommitConfig->channel; |
| 5988 | |
| 5989 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5990 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5991 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 5992 | |
| 5993 | pConfig->dtim_period = pBeacon->dtim_period; |
| 5994 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5995 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5996 | pConfig->dtim_period); |
| 5997 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 5998 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5999 | { |
| 6000 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6001 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6002 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6003 | { |
| 6004 | tANI_BOOLEAN restartNeeded; |
| 6005 | pConfig->ieee80211d = 1; |
| 6006 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6007 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6008 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6009 | } |
| 6010 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6011 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6012 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6013 | pConfig->ieee80211d = 1; |
| 6014 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6015 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6016 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6017 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6018 | else |
| 6019 | { |
| 6020 | pConfig->ieee80211d = 0; |
| 6021 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6022 | /* |
| 6023 | * If auto channel is configured i.e. channel is 0, |
| 6024 | * so skip channel validation. |
| 6025 | */ |
| 6026 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6027 | { |
| 6028 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6029 | { |
| 6030 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6031 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6032 | return -EINVAL; |
| 6033 | } |
| 6034 | } |
| 6035 | else |
| 6036 | { |
| 6037 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 6038 | { |
| 6039 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 6040 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 6041 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 6042 | } |
| 6043 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 6044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6045 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6046 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6047 | { |
| 6048 | pConfig->ieee80211d = 0; |
| 6049 | } |
| 6050 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 6051 | |
| 6052 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6053 | |
| 6054 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6055 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 6056 | |
| 6057 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 6058 | |
| 6059 | /*Set wps station to configured*/ |
| 6060 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 6061 | |
| 6062 | if(pIe) |
| 6063 | { |
| 6064 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 6065 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6066 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6067 | return -EINVAL; |
| 6068 | } |
| 6069 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 6070 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6071 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6072 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 6073 | * WPS state |
| 6074 | */ |
| 6075 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 6076 | { |
| 6077 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 6078 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 6079 | { |
| 6080 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 6081 | } |
| 6082 | } |
| 6083 | } |
| 6084 | else |
| 6085 | { |
| 6086 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 6087 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6088 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6089 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 6090 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6091 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6092 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 6093 | eCSR_ENCRYPT_TYPE_NONE; |
| 6094 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | pConfig->RSNWPAReqIELength = 0; |
| 6096 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6097 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | WLAN_EID_RSN); |
| 6099 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6100 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6101 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6102 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6103 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6104 | /* The actual processing may eventually be more extensive than |
| 6105 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | * by the app. |
| 6107 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6108 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6109 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6110 | &RSNEncryptType, |
| 6111 | &mcRSNEncryptType, |
| 6112 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6113 | &MFPCapable, |
| 6114 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6115 | pConfig->pRSNWPAReqIE[1]+2, |
| 6116 | pConfig->pRSNWPAReqIE ); |
| 6117 | |
| 6118 | if( VOS_STATUS_SUCCESS == status ) |
| 6119 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6120 | /* Now copy over all the security attributes you have |
| 6121 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | * */ |
| 6123 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6124 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6125 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6126 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6127 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6128 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6130 | } |
| 6131 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6132 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6133 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6134 | pBeacon->tail, pBeacon->tail_len); |
| 6135 | |
| 6136 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 6137 | { |
| 6138 | if (pConfig->pRSNWPAReqIE) |
| 6139 | { |
| 6140 | /*Mixed mode WPA/WPA2*/ |
| 6141 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 6142 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 6143 | } |
| 6144 | else |
| 6145 | { |
| 6146 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6147 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6148 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6149 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6150 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6151 | &RSNEncryptType, |
| 6152 | &mcRSNEncryptType, |
| 6153 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6154 | &MFPCapable, |
| 6155 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6156 | pConfig->pRSNWPAReqIE[1]+2, |
| 6157 | pConfig->pRSNWPAReqIE ); |
| 6158 | |
| 6159 | if( VOS_STATUS_SUCCESS == status ) |
| 6160 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6161 | /* Now copy over all the security attributes you have |
| 6162 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6163 | * */ |
| 6164 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6165 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6166 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6167 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6168 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6169 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6170 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6171 | } |
| 6172 | } |
| 6173 | } |
| 6174 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6175 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 6176 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 6177 | return -EINVAL; |
| 6178 | } |
| 6179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 6181 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6182 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6183 | if (params->ssid != NULL) |
| 6184 | { |
| 6185 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 6186 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 6187 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6188 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6189 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6190 | #else |
| 6191 | if (ssid != NULL) |
| 6192 | { |
| 6193 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 6194 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 6195 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6196 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6197 | } |
| 6198 | #endif |
| 6199 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6200 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6203 | /* default value */ |
| 6204 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 6205 | pConfig->num_accept_mac = 0; |
| 6206 | pConfig->num_deny_mac = 0; |
| 6207 | |
| 6208 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6209 | pBeacon->tail, pBeacon->tail_len); |
| 6210 | |
| 6211 | /* pIe for black list is following form: |
| 6212 | type : 1 byte |
| 6213 | length : 1 byte |
| 6214 | OUI : 4 bytes |
| 6215 | acl type : 1 byte |
| 6216 | no of mac addr in black list: 1 byte |
| 6217 | 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] | 6218 | */ |
| 6219 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | { |
| 6221 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6222 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6223 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6224 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6225 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 6226 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6227 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6228 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 6229 | { |
| 6230 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6231 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6233 | } |
| 6234 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6235 | pBeacon->tail, pBeacon->tail_len); |
| 6236 | |
| 6237 | /* pIe for white list is following form: |
| 6238 | type : 1 byte |
| 6239 | length : 1 byte |
| 6240 | OUI : 4 bytes |
| 6241 | acl type : 1 byte |
| 6242 | no of mac addr in white list: 1 byte |
| 6243 | 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] | 6244 | */ |
| 6245 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6246 | { |
| 6247 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6248 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6249 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6250 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6251 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 6252 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6253 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6254 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 6255 | { |
| 6256 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6257 | acl_entry++; |
| 6258 | } |
| 6259 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6261 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 6262 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6263 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6264 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 6265 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 6266 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 6267 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 6268 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6269 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 6270 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 6271 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 6272 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 6273 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 6274 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 6275 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6276 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6277 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6278 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6279 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6280 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6281 | /* If ACS disable and selected channel <= 14 |
| 6282 | * OR |
| 6283 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 6284 | * AND |
| 6285 | * VHT in 2.4G Disabled |
| 6286 | * THEN |
| 6287 | * Fallback to 11N mode |
| 6288 | */ |
| 6289 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 6290 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6291 | operatingBand == RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6292 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6293 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6294 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 6295 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6296 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 6297 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6298 | } |
| 6299 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6300 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 6301 | if ( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6302 | { |
| 6303 | sme_SelectCBMode(hHal, |
| 6304 | sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode), |
| 6305 | pConfig->channel); |
| 6306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6307 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 6308 | pConfig->ht_capab = |
| 6309 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 6310 | |
| 6311 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 6312 | { |
| 6313 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 6314 | return -EINVAL; |
| 6315 | } |
| 6316 | |
| 6317 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6318 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6319 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 6320 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6321 | pConfig->obssProtEnabled = |
| 6322 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6323 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6324 | #ifdef WLAN_FEATURE_11W |
| 6325 | pConfig->mfpCapable = MFPCapable; |
| 6326 | pConfig->mfpRequired = MFPRequired; |
| 6327 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 6328 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 6329 | #endif |
| 6330 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6331 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6333 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 6334 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 6335 | (int)pConfig->channel); |
| 6336 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 6337 | pConfig->SapHw_mode, pConfig->privacy, |
| 6338 | pConfig->authType); |
| 6339 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 6340 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 6341 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 6342 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6344 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6345 | { |
| 6346 | //Bss already started. just return. |
| 6347 | //TODO Probably it should update some beacon params. |
| 6348 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 6349 | EXIT(); |
| 6350 | return 0; |
| 6351 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6352 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6353 | if (vos_max_concurrent_connections_reached()) { |
| 6354 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6355 | return -EINVAL; |
| 6356 | } |
| 6357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | pConfig->persona = pHostapdAdapter->device_mode; |
| 6359 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6360 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 6361 | if ( NULL != psmeConfig) |
| 6362 | { |
| 6363 | sme_GetConfigParam(hHal, psmeConfig); |
| 6364 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
| 6365 | vos_mem_free(psmeConfig); |
| 6366 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 6367 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 6370 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 6371 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 6372 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6373 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | return -EINVAL; |
| 6375 | } |
| 6376 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6377 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6378 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 6379 | |
| 6380 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6383 | { |
| 6384 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6385 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 6386 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6387 | VOS_ASSERT(0); |
| 6388 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6390 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6391 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6392 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6393 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6394 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 6395 | { |
| 6396 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 6397 | { |
| 6398 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6399 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6400 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6401 | } |
| 6402 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 6403 | { |
| 6404 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6405 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6406 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6407 | } |
| 6408 | } |
| 6409 | #endif |
| 6410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6411 | pHostapdState->bCommit = TRUE; |
| 6412 | EXIT(); |
| 6413 | |
| 6414 | return 0; |
| 6415 | } |
| 6416 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6417 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6418 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 6419 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6420 | struct beacon_parameters *params) |
| 6421 | { |
| 6422 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6423 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6424 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | |
| 6426 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6427 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6428 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6429 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 6430 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6431 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 6432 | hdd_device_modetoString(pAdapter->device_mode), |
| 6433 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6434 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6435 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6436 | status = wlan_hdd_validate_context(pHddCtx); |
| 6437 | |
| 6438 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6439 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6440 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6441 | "%s: HDD context is not valid", __func__); |
| 6442 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6443 | } |
| 6444 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6445 | if (vos_max_concurrent_connections_reached()) { |
| 6446 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6447 | return -EINVAL; |
| 6448 | } |
| 6449 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6450 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6451 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6452 | ) |
| 6453 | { |
| 6454 | beacon_data_t *old,*new; |
| 6455 | |
| 6456 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6457 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6458 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6459 | { |
| 6460 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 6461 | FL("already beacon info added to session(%d)"), |
| 6462 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6463 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6464 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6465 | |
| 6466 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6467 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6468 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6469 | { |
| 6470 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6471 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | return -EINVAL; |
| 6473 | } |
| 6474 | |
| 6475 | pAdapter->sessionCtx.ap.beacon = new; |
| 6476 | |
| 6477 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6478 | } |
| 6479 | |
| 6480 | EXIT(); |
| 6481 | return status; |
| 6482 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6483 | |
| 6484 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6485 | struct net_device *dev, |
| 6486 | struct beacon_parameters *params) |
| 6487 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6488 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6489 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6490 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6491 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6492 | |
| 6493 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6494 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6495 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 6496 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 6497 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6498 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6499 | pAdapter->device_mode); |
| 6500 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6501 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6502 | status = wlan_hdd_validate_context(pHddCtx); |
| 6503 | |
| 6504 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6505 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6506 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6507 | "%s: HDD context is not valid", __func__); |
| 6508 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6509 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6510 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6511 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6512 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6513 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | { |
| 6515 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6517 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6519 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6520 | { |
| 6521 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6522 | FL("session(%d) old and new heads points to NULL"), |
| 6523 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6524 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6526 | |
| 6527 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6528 | |
| 6529 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6530 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6531 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6532 | return -EINVAL; |
| 6533 | } |
| 6534 | |
| 6535 | pAdapter->sessionCtx.ap.beacon = new; |
| 6536 | |
| 6537 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6538 | } |
| 6539 | |
| 6540 | EXIT(); |
| 6541 | return status; |
| 6542 | } |
| 6543 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6544 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6545 | |
| 6546 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6547 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 6548 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6549 | #else |
| 6550 | static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
| 6551 | struct net_device *dev) |
| 6552 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6553 | { |
| 6554 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6555 | hdd_context_t *pHddCtx = NULL; |
| 6556 | hdd_scaninfo_t *pScanInfo = NULL; |
| 6557 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6558 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6559 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | |
| 6561 | ENTER(); |
| 6562 | |
| 6563 | if (NULL == pAdapter) |
| 6564 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6565 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6566 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6567 | return -ENODEV; |
| 6568 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6569 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6570 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6571 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 6572 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6573 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6574 | status = wlan_hdd_validate_context(pHddCtx); |
| 6575 | |
| 6576 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6577 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6578 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6579 | "%s: HDD context is not valid", __func__); |
| 6580 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6581 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6582 | |
| 6583 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6584 | if (NULL == staAdapter) |
| 6585 | { |
| 6586 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 6587 | if (NULL == staAdapter) |
| 6588 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 6589 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6590 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 6591 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6592 | } |
| 6593 | } |
| 6594 | |
| 6595 | pScanInfo = &pHddCtx->scan_info; |
| 6596 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6597 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6598 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6599 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6600 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6601 | ret = wlan_hdd_scan_abort(pAdapter); |
| 6602 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 6603 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6604 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6605 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6606 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6607 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6608 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6609 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6611 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 6612 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6613 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6614 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6615 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6616 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6617 | } |
| 6618 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 6619 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 6620 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 6621 | hdd_hostapd_stop(dev); |
| 6622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6623 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6624 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6625 | ) |
| 6626 | { |
| 6627 | beacon_data_t *old; |
| 6628 | |
| 6629 | old = pAdapter->sessionCtx.ap.beacon; |
| 6630 | |
| 6631 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6632 | { |
| 6633 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6634 | FL("session(%d) beacon data points to NULL"), |
| 6635 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6638 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6639 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6640 | |
| 6641 | mutex_lock(&pHddCtx->sap_lock); |
| 6642 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 6643 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6644 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6645 | { |
| 6646 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 6647 | |
| 6648 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 6649 | |
| 6650 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 6651 | { |
| 6652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6653 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6655 | } |
| 6656 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6657 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6658 | /* BSS stopped, clear the active sessions for this device mode */ |
| 6659 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | } |
| 6661 | mutex_unlock(&pHddCtx->sap_lock); |
| 6662 | |
| 6663 | if(status != VOS_STATUS_SUCCESS) |
| 6664 | { |
| 6665 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6666 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | return -EINVAL; |
| 6668 | } |
| 6669 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6670 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 6672 | ==eHAL_STATUS_FAILURE) |
| 6673 | { |
| 6674 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6675 | "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] | 6676 | } |
| 6677 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6678 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6679 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6680 | eANI_BOOLEAN_FALSE) ) |
| 6681 | { |
| 6682 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6683 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6684 | } |
| 6685 | |
| 6686 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6687 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 6688 | |
| 6689 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 6690 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6691 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6692 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 6693 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 6694 | { |
| 6695 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 6696 | "GO got removed"); |
| 6697 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 6698 | } |
| 6699 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6700 | } |
| 6701 | EXIT(); |
| 6702 | return status; |
| 6703 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6704 | |
| 6705 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6706 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6707 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 6708 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6709 | struct cfg80211_ap_settings *params) |
| 6710 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6711 | hdd_adapter_t *pAdapter; |
| 6712 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6713 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6714 | |
| 6715 | ENTER(); |
| 6716 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6717 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6718 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6719 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6720 | "%s: Device is Null", __func__); |
| 6721 | return -ENODEV; |
| 6722 | } |
| 6723 | |
| 6724 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6725 | if (NULL == pAdapter) |
| 6726 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6727 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6728 | "%s: HDD adapter is Null", __func__); |
| 6729 | return -ENODEV; |
| 6730 | } |
| 6731 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6732 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6733 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 6734 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6735 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 6736 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6737 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6738 | "%s: HDD adapter magic is invalid", __func__); |
| 6739 | return -ENODEV; |
| 6740 | } |
| 6741 | |
| 6742 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6743 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6744 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6745 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6746 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6747 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6748 | "%s: HDD context is not valid", __func__); |
| 6749 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6750 | } |
| 6751 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6752 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 6753 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6754 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6755 | |
| 6756 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6757 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6758 | ) |
| 6759 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6760 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6761 | |
| 6762 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6763 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6764 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6765 | { |
| 6766 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 6767 | FL("already beacon info added to session(%d)"), |
| 6768 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6769 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6770 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6771 | |
| 6772 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 6773 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6774 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6775 | { |
| 6776 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 6777 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6778 | return -EINVAL; |
| 6779 | } |
| 6780 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6781 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 6782 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 6783 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 6784 | params->channel, params->channel_type); |
| 6785 | #else |
| 6786 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 6787 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6788 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6789 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 6790 | params->ssid_len, params->hidden_ssid); |
| 6791 | } |
| 6792 | |
| 6793 | EXIT(); |
| 6794 | return status; |
| 6795 | } |
| 6796 | |
| 6797 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6798 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6799 | struct net_device *dev, |
| 6800 | struct cfg80211_beacon_data *params) |
| 6801 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6802 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6803 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6804 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6805 | |
| 6806 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6807 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6808 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6809 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 6810 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6811 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6812 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6813 | |
| 6814 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6815 | status = wlan_hdd_validate_context(pHddCtx); |
| 6816 | |
| 6817 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6818 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6819 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6820 | "%s: HDD context is not valid", __func__); |
| 6821 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 6822 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6823 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6824 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6825 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6826 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6827 | { |
| 6828 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6829 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6830 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6831 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6832 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6833 | { |
| 6834 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6835 | FL("session(%d) beacon data points to NULL"), |
| 6836 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6837 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6838 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6839 | |
| 6840 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 6841 | |
| 6842 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6843 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6844 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6845 | return -EINVAL; |
| 6846 | } |
| 6847 | |
| 6848 | pAdapter->sessionCtx.ap.beacon = new; |
| 6849 | |
| 6850 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 6851 | } |
| 6852 | |
| 6853 | EXIT(); |
| 6854 | return status; |
| 6855 | } |
| 6856 | |
| 6857 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 6858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6859 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6860 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6861 | struct net_device *dev, |
| 6862 | struct bss_parameters *params) |
| 6863 | { |
| 6864 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6865 | |
| 6866 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6867 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6868 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6869 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 6870 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6871 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6872 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6873 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6874 | |
| 6875 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6876 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6877 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | { |
| 6879 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 6880 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6881 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6882 | { |
| 6883 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6884 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6885 | } |
| 6886 | |
| 6887 | EXIT(); |
| 6888 | return 0; |
| 6889 | } |
| 6890 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 6891 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 6892 | struct net_device *dev, |
| 6893 | struct bss_parameters *params) |
| 6894 | { |
| 6895 | int ret; |
| 6896 | |
| 6897 | vos_ssr_protect(__func__); |
| 6898 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 6899 | vos_ssr_unprotect(__func__); |
| 6900 | |
| 6901 | return ret; |
| 6902 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 6903 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 6904 | * to wait for contry code completion |
| 6905 | */ |
| 6906 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 6907 | { |
| 6908 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 6909 | complete(&call_back_pAdapter->change_country_code); |
| 6910 | return NULL; |
| 6911 | } |
| 6912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6913 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6914 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6915 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 6916 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 6917 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6918 | struct net_device *ndev, |
| 6919 | enum nl80211_iftype type, |
| 6920 | u32 *flags, |
| 6921 | struct vif_params *params |
| 6922 | ) |
| 6923 | { |
| 6924 | struct wireless_dev *wdev; |
| 6925 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6926 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 6927 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6928 | tCsrRoamProfile *pRoamProfile = NULL; |
| 6929 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6930 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6931 | eMib_dot11DesiredBssType connectedBssType; |
| 6932 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6933 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6934 | |
| 6935 | ENTER(); |
| 6936 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6937 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 6938 | { |
| 6939 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6940 | "%s: Adapter context is null", __func__); |
| 6941 | return VOS_STATUS_E_FAILURE; |
| 6942 | } |
| 6943 | |
| 6944 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6945 | if (!pHddCtx) |
| 6946 | { |
| 6947 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6948 | "%s: HDD context is null", __func__); |
| 6949 | return VOS_STATUS_E_FAILURE; |
| 6950 | } |
| 6951 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6952 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6953 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 6954 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6955 | status = wlan_hdd_validate_context(pHddCtx); |
| 6956 | |
| 6957 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6958 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6959 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6960 | "%s: HDD context is not valid", __func__); |
| 6961 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6962 | } |
| 6963 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6964 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6965 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6966 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6967 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6968 | if (vos_max_concurrent_connections_reached()) { |
| 6969 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6970 | return -EINVAL; |
| 6971 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6972 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6973 | wdev = ndev->ieee80211_ptr; |
| 6974 | |
| 6975 | #ifdef WLAN_BTAMP_FEATURE |
| 6976 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 6977 | (NL80211_IFTYPE_ADHOC == type)|| |
| 6978 | (NL80211_IFTYPE_AP == type)|| |
| 6979 | (NL80211_IFTYPE_P2P_GO == type)) |
| 6980 | { |
| 6981 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 6982 | // stop AMP traffic |
| 6983 | status = WLANBAP_StopAmp(); |
| 6984 | if(VOS_STATUS_SUCCESS != status ) |
| 6985 | { |
| 6986 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 6987 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6988 | "%s: Failed to stop AMP", __func__); |
| 6989 | return -EINVAL; |
| 6990 | } |
| 6991 | } |
| 6992 | #endif //WLAN_BTAMP_FEATURE |
| 6993 | /* Reset the current device mode bit mask*/ |
| 6994 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 6995 | |
| 6996 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6998 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6999 | ) |
| 7000 | { |
| 7001 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7002 | if (!pWextState) |
| 7003 | { |
| 7004 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7005 | "%s: pWextState is null", __func__); |
| 7006 | return VOS_STATUS_E_FAILURE; |
| 7007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | pRoamProfile = &pWextState->roamProfile; |
| 7009 | LastBSSType = pRoamProfile->BSSType; |
| 7010 | |
| 7011 | switch (type) |
| 7012 | { |
| 7013 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7014 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7015 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7016 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 7017 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7018 | #ifdef WLAN_FEATURE_11AC |
| 7019 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 7020 | { |
| 7021 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 7022 | } |
| 7023 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7024 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7025 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7026 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7027 | //Check for sub-string p2p to confirm its a p2p interface |
| 7028 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7029 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7030 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7031 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7032 | } |
| 7033 | else |
| 7034 | { |
| 7035 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7036 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7037 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 7038 | #ifdef FEATURE_WLAN_TDLS |
| 7039 | /* The open adapter for the p2p shall skip initializations in |
| 7040 | * tdls_init if the device mode is WLAN_HDD_P2P_DEVICE, for |
| 7041 | * TDLS is supported only on WLAN_HDD_P2P_CLIENT. Hence invoke |
| 7042 | * tdls_init when the change_iface sets the device mode to |
| 7043 | * WLAN_HDD_P2P_CLIENT. |
| 7044 | */ |
| 7045 | |
| 7046 | if ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 7047 | { |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 7048 | if (0 != wlan_hdd_sta_tdls_init (pAdapter)) |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 7049 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7050 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7051 | "%s: tdls initialization failed", __func__); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 7052 | return -EINVAL; |
| 7053 | } |
| 7054 | } |
| 7055 | #endif |
| 7056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7057 | break; |
| 7058 | case NL80211_IFTYPE_ADHOC: |
| 7059 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7060 | "%s: setting interface Type to ADHOC", __func__); |
| 7061 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 7062 | pRoamProfile->phyMode = |
| 7063 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 7064 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7065 | wdev->iftype = type; |
| 7066 | break; |
| 7067 | |
| 7068 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7069 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7070 | { |
| 7071 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 7072 | "%s: setting interface Type to %s", __func__, |
| 7073 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 7074 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7075 | //Cancel any remain on channel for GO mode |
| 7076 | if (NL80211_IFTYPE_P2P_GO == type) |
| 7077 | { |
| 7078 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 7079 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7080 | if (NL80211_IFTYPE_AP == type) |
| 7081 | { |
| 7082 | /* As Loading WLAN Driver one interface being created for p2p device |
| 7083 | * address. This will take one HW STA and the max number of clients |
| 7084 | * that can connect to softAP will be reduced by one. so while changing |
| 7085 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 7086 | * interface as it is not required in SoftAP mode. |
| 7087 | */ |
| 7088 | |
| 7089 | // Get P2P Adapter |
| 7090 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 7091 | |
| 7092 | if (pP2pAdapter) |
| 7093 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 7094 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7095 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 7096 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 7097 | } |
| 7098 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 7099 | //Disable IMPS & BMPS for SAP/GO |
| 7100 | if(VOS_STATUS_E_FAILURE == |
| 7101 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 7102 | { |
| 7103 | //Fail to Exit BMPS |
| 7104 | VOS_ASSERT(0); |
| 7105 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7106 | |
| 7107 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 7108 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7109 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7110 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7111 | /* A Mutex Lock is introduced while changing the mode to |
| 7112 | * protect the concurrent access for the Adapters by TDLS |
| 7113 | * module. |
| 7114 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7115 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7116 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7117 | //De-init the adapter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7118 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 7119 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7120 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7121 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7122 | #ifdef FEATURE_WLAN_TDLS |
| 7123 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7124 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7125 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 7126 | (pConfig->apRandomBssidEnabled)) |
| 7127 | { |
| 7128 | /* To meet Android requirements create a randomized |
| 7129 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 7130 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 7131 | ndev->dev_addr[0] = 0x02; |
| 7132 | ndev->dev_addr[1] = 0x1A; |
| 7133 | ndev->dev_addr[2] = 0x11; |
| 7134 | ndev->dev_addr[3] |= 0xF0; |
| 7135 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 7136 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7137 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 7138 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7139 | } |
| 7140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | hdd_set_ap_ops( pAdapter->dev ); |
| 7142 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7143 | /* This is for only SAP mode where users can |
| 7144 | * control country through ini. |
| 7145 | * P2P GO follows station country code |
| 7146 | * acquired during the STA scanning. */ |
| 7147 | if((NL80211_IFTYPE_AP == type) && |
| 7148 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 7149 | { |
| 7150 | int status = 0; |
| 7151 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 7152 | "%s: setting country code from INI ", __func__); |
| 7153 | init_completion(&pAdapter->change_country_code); |
| 7154 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 7155 | (void *)(tSmeChangeCountryCallback) |
| 7156 | wlan_hdd_change_country_code_cb, |
| 7157 | pConfig->apCntryCode, pAdapter, |
| 7158 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 7159 | eSIR_FALSE, |
| 7160 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7161 | if (eHAL_STATUS_SUCCESS == status) |
| 7162 | { |
| 7163 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7164 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7165 | &pAdapter->change_country_code, |
| 7166 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7167 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7168 | { |
| 7169 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7170 | FL("SME Timed out while setting country code %ld"), |
| 7171 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7172 | |
| 7173 | if (pHddCtx->isLogpInProgress) |
| 7174 | { |
| 7175 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7176 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 7177 | return -EAGAIN; |
| 7178 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7179 | } |
| 7180 | } |
| 7181 | else |
| 7182 | { |
| 7183 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7184 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7185 | return -EINVAL; |
| 7186 | } |
| 7187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7188 | status = hdd_init_ap_mode(pAdapter); |
| 7189 | if(status != VOS_STATUS_SUCCESS) |
| 7190 | { |
| 7191 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7192 | "%s: Error initializing the ap mode", __func__); |
| 7193 | return -EINVAL; |
| 7194 | } |
| 7195 | hdd_set_conparam(1); |
| 7196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7197 | /*interface type changed update in wiphy structure*/ |
| 7198 | if(wdev) |
| 7199 | { |
| 7200 | wdev->iftype = type; |
| 7201 | pHddCtx->change_iface = type; |
| 7202 | } |
| 7203 | else |
| 7204 | { |
| 7205 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7206 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 7207 | return -EINVAL; |
| 7208 | } |
| 7209 | goto done; |
| 7210 | } |
| 7211 | |
| 7212 | default: |
| 7213 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7214 | __func__); |
| 7215 | return -EOPNOTSUPP; |
| 7216 | } |
| 7217 | } |
| 7218 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7219 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7220 | ) |
| 7221 | { |
| 7222 | switch(type) |
| 7223 | { |
| 7224 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7225 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7227 | |
| 7228 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7229 | #ifdef FEATURE_WLAN_TDLS |
| 7230 | |
| 7231 | /* A Mutex Lock is introduced while changing the mode to |
| 7232 | * protect the concurrent access for the Adapters by TDLS |
| 7233 | * module. |
| 7234 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7235 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7236 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7237 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7238 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7239 | //Check for sub-string p2p to confirm its a p2p interface |
| 7240 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7241 | { |
| 7242 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7243 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7244 | } |
| 7245 | else |
| 7246 | { |
| 7247 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7248 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7250 | hdd_set_conparam(0); |
| 7251 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7252 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 7253 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7254 | #ifdef FEATURE_WLAN_TDLS |
| 7255 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7256 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 7257 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7258 | if( VOS_STATUS_SUCCESS != status ) |
| 7259 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7260 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 7261 | * This is the right place to enable back bmps_imps() |
| 7262 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 7263 | if (pHddCtx->hdd_wlan_suspended) |
| 7264 | { |
| 7265 | hdd_set_pwrparams(pHddCtx); |
| 7266 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7267 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7268 | goto done; |
| 7269 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7270 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7271 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7272 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7273 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7274 | goto done; |
| 7275 | default: |
| 7276 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7277 | __func__); |
| 7278 | return -EOPNOTSUPP; |
| 7279 | |
| 7280 | } |
| 7281 | |
| 7282 | } |
| 7283 | else |
| 7284 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7285 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 7286 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7287 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7288 | return -EOPNOTSUPP; |
| 7289 | } |
| 7290 | |
| 7291 | |
| 7292 | if(pRoamProfile) |
| 7293 | { |
| 7294 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 7295 | { |
| 7296 | /*interface type changed update in wiphy structure*/ |
| 7297 | wdev->iftype = type; |
| 7298 | |
| 7299 | /*the BSS mode changed, We need to issue disconnect |
| 7300 | if connected or in IBSS disconnect state*/ |
| 7301 | if ( hdd_connGetConnectedBssType( |
| 7302 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 7303 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 7304 | { |
| 7305 | /*need to issue a disconnect to CSR.*/ |
| 7306 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7307 | if( eHAL_STATUS_SUCCESS == |
| 7308 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7309 | pAdapter->sessionId, |
| 7310 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 7311 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7312 | ret = wait_for_completion_interruptible_timeout( |
| 7313 | &pAdapter->disconnect_comp_var, |
| 7314 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 7315 | if (ret <= 0) |
| 7316 | { |
| 7317 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7318 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 7319 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7320 | } |
| 7321 | } |
| 7322 | } |
| 7323 | } |
| 7324 | |
| 7325 | done: |
| 7326 | /*set bitmask based on updated value*/ |
| 7327 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 7328 | |
| 7329 | /* Only STA mode support TM now |
| 7330 | * all other mode, TM feature should be disabled */ |
| 7331 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 7332 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 7333 | { |
| 7334 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 7335 | } |
| 7336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7337 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7338 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7339 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | { |
| 7341 | //we are ok to do AMP |
| 7342 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7343 | } |
| 7344 | #endif //WLAN_BTAMP_FEATURE |
| 7345 | EXIT(); |
| 7346 | return 0; |
| 7347 | } |
| 7348 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7349 | /* |
| 7350 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 7351 | * wrapper function to protect the actual implementation from SSR. |
| 7352 | */ |
| 7353 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 7354 | struct net_device *ndev, |
| 7355 | enum nl80211_iftype type, |
| 7356 | u32 *flags, |
| 7357 | struct vif_params *params |
| 7358 | ) |
| 7359 | { |
| 7360 | int ret; |
| 7361 | |
| 7362 | vos_ssr_protect(__func__); |
| 7363 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 7364 | vos_ssr_unprotect(__func__); |
| 7365 | |
| 7366 | return ret; |
| 7367 | } |
| 7368 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7369 | #ifdef FEATURE_WLAN_TDLS |
| 7370 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 7371 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 7372 | { |
| 7373 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7374 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7375 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7376 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7377 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7378 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7379 | |
| 7380 | ENTER(); |
| 7381 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7382 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7383 | { |
| 7384 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7385 | "Invalid arguments"); |
| 7386 | return -EINVAL; |
| 7387 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7388 | |
| 7389 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 7390 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 7391 | { |
| 7392 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7393 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 7394 | MAC_ADDRESS_STR " Request declined.", |
| 7395 | __func__, MAC_ADDR_ARRAY(mac)); |
| 7396 | return -ENOTSUPP; |
| 7397 | } |
| 7398 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7399 | if (pHddCtx->isLogpInProgress) |
| 7400 | { |
| 7401 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7402 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7403 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7404 | mac, |
| 7405 | eTDLS_LINK_IDLE, |
| 7406 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7407 | return -EBUSY; |
| 7408 | } |
| 7409 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 7410 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7411 | |
| 7412 | if ( NULL == pTdlsPeer ) { |
| 7413 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7414 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 7415 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 7416 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7417 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7418 | |
| 7419 | /* in add station, we accept existing valid staId if there is */ |
| 7420 | if ((0 == update) && |
| 7421 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 7422 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7423 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7424 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7425 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7426 | " link_status %d. staId %d. add station ignored.", |
| 7427 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 7428 | return 0; |
| 7429 | } |
| 7430 | /* in change station, we accept only when staId is valid */ |
| 7431 | if ((1 == update) && |
| 7432 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 7433 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 7434 | { |
| 7435 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7436 | "%s: " MAC_ADDRESS_STR |
| 7437 | " link status %d. staId %d. change station %s.", |
| 7438 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 7439 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 7440 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7441 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7442 | |
| 7443 | /* 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] | 7444 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7445 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7446 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7447 | "%s: " MAC_ADDRESS_STR |
| 7448 | " TDLS setup is ongoing. Request declined.", |
| 7449 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7450 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7451 | } |
| 7452 | |
| 7453 | /* first to check if we reached to maximum supported TDLS peer. |
| 7454 | TODO: for now, return -EPERM looks working fine, |
| 7455 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7456 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 7457 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7458 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7459 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7460 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7461 | " TDLS Max peer already connected. Request declined." |
| 7462 | " Num of peers (%d), Max allowed (%d).", |
| 7463 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 7464 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7465 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7466 | } |
| 7467 | else |
| 7468 | { |
| 7469 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7470 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7471 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7472 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7473 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7474 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 7475 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7476 | return -EPERM; |
| 7477 | } |
| 7478 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7479 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7480 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7481 | mac, |
| 7482 | eTDLS_LINK_CONNECTING, |
| 7483 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7484 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7485 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7486 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7487 | { |
| 7488 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7489 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7490 | if(StaParams->htcap_present) |
| 7491 | { |
| 7492 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7493 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 7494 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7495 | "ht_capa->extended_capabilities: %0x", |
| 7496 | StaParams->HTCap.extendedHtCapInfo); |
| 7497 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7498 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7499 | "params->capability: %0x",StaParams->capability); |
| 7500 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7501 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7502 | if(StaParams->vhtcap_present) |
| 7503 | { |
| 7504 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7505 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 7506 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 7507 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 7508 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7509 | { |
| 7510 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7511 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7512 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 7513 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7514 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 7515 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7516 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7517 | else if ((1 == update) && (NULL == StaParams)) |
| 7518 | { |
| 7519 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7520 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 7521 | return -EPERM; |
| 7522 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7523 | |
| 7524 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 7525 | |
| 7526 | if (!update) |
| 7527 | { |
| 7528 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7529 | pAdapter->sessionId, mac); |
| 7530 | } |
| 7531 | else |
| 7532 | { |
| 7533 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7534 | pAdapter->sessionId, mac, StaParams); |
| 7535 | } |
| 7536 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7537 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7538 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 7539 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7540 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7541 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7542 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7543 | "%s: timeout waiting for tdls add station indication %ld", |
| 7544 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7545 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7546 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7547 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7548 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 7549 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7551 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7552 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7553 | } |
| 7554 | |
| 7555 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7556 | |
| 7557 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7558 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7559 | mac, |
| 7560 | eTDLS_LINK_IDLE, |
| 7561 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7562 | return -EPERM; |
| 7563 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7564 | } |
| 7565 | #endif |
| 7566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7567 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 7568 | struct net_device *dev, |
| 7569 | u8 *mac, |
| 7570 | struct station_parameters *params) |
| 7571 | { |
| 7572 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 7573 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7574 | hdd_context_t *pHddCtx; |
| 7575 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7576 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7577 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7578 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7579 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7580 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7581 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7582 | ENTER(); |
| 7583 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7584 | if ((NULL == pAdapter)) |
| 7585 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7586 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7587 | "invalid adapter "); |
| 7588 | return -EINVAL; |
| 7589 | } |
| 7590 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7591 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7592 | TRACE_CODE_HDD_CHANGE_STATION, |
| 7593 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7594 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7595 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7596 | |
| 7597 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 7598 | { |
| 7599 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7600 | "invalid HDD state or HDD station context"); |
| 7601 | return -EINVAL; |
| 7602 | } |
| 7603 | |
| 7604 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7605 | { |
| 7606 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7607 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 7608 | return -EAGAIN; |
| 7609 | } |
| 7610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7611 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 7612 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7613 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7614 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7615 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7616 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7617 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7618 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7619 | WLANTL_STA_AUTHENTICATED); |
| 7620 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7621 | if (status != VOS_STATUS_SUCCESS) |
| 7622 | { |
| 7623 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7624 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 7625 | return -EINVAL; |
| 7626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7627 | } |
| 7628 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 7629 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 7630 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7631 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7632 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 7633 | StaParams.capability = params->capability; |
| 7634 | StaParams.uapsd_queues = params->uapsd_queues; |
| 7635 | StaParams.max_sp = params->max_sp; |
| 7636 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7637 | /* Convert (first channel , number of channels) tuple to |
| 7638 | * the total list of channels. This goes with the assumption |
| 7639 | * that if the first channel is < 14, then the next channels |
| 7640 | * are an incremental of 1 else an incremental of 4 till the number |
| 7641 | * of channels. |
| 7642 | */ |
| 7643 | if (0 != params->supported_channels_len) { |
| 7644 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 7645 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 7646 | { |
| 7647 | int wifi_chan_index; |
| 7648 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 7649 | wifi_chan_index = |
| 7650 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 7651 | no_of_channels = params->supported_channels[i+1]; |
| 7652 | for(k=1; k <= no_of_channels; k++) |
| 7653 | { |
| 7654 | StaParams.supported_channels[j+1] = |
| 7655 | StaParams.supported_channels[j] + wifi_chan_index; |
| 7656 | j+=1; |
| 7657 | } |
| 7658 | } |
| 7659 | StaParams.supported_channels_len = j; |
| 7660 | } |
| 7661 | vos_mem_copy(StaParams.supported_oper_classes, |
| 7662 | params->supported_oper_classes, |
| 7663 | params->supported_oper_classes_len); |
| 7664 | StaParams.supported_oper_classes_len = |
| 7665 | params->supported_oper_classes_len; |
| 7666 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7667 | if (0 != params->ext_capab_len) |
| 7668 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 7669 | sizeof(StaParams.extn_capability)); |
| 7670 | |
| 7671 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7672 | { |
| 7673 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7674 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7675 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7676 | |
| 7677 | StaParams.supported_rates_len = params->supported_rates_len; |
| 7678 | |
| 7679 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 7680 | * The supported_rates array , for all the structures propogating till Add Sta |
| 7681 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 7682 | * modified to send more rates. |
| 7683 | */ |
| 7684 | |
| 7685 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 7686 | */ |
| 7687 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 7688 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 7689 | |
| 7690 | if (0 != StaParams.supported_rates_len) { |
| 7691 | int i = 0; |
| 7692 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 7693 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7694 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7695 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 7696 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7697 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7698 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 7699 | } |
| 7700 | |
| 7701 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7702 | { |
| 7703 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7704 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7705 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7706 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7707 | if (0 != params->ext_capab_len ) { |
| 7708 | /*Define A Macro : TODO Sunil*/ |
| 7709 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 7710 | isBufSta = 1; |
| 7711 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7712 | /* TDLS Channel Switching Support */ |
| 7713 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 7714 | isOffChannelSupported = 1; |
| 7715 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7716 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7717 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 7718 | &StaParams, isBufSta, |
| 7719 | isOffChannelSupported); |
| 7720 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 7721 | if (VOS_STATUS_SUCCESS != status) { |
| 7722 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7723 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 7724 | return -EINVAL; |
| 7725 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7726 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 7727 | |
| 7728 | if (VOS_STATUS_SUCCESS != status) { |
| 7729 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7730 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 7731 | return -EINVAL; |
| 7732 | } |
| 7733 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7734 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 7735 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7736 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7737 | return status; |
| 7738 | } |
| 7739 | |
| 7740 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7741 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7742 | * This function is used to initialize the key information |
| 7743 | */ |
| 7744 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7745 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7746 | struct net_device *ndev, |
| 7747 | u8 key_index, bool pairwise, |
| 7748 | const u8 *mac_addr, |
| 7749 | struct key_params *params |
| 7750 | ) |
| 7751 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 7752 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7753 | struct net_device *ndev, |
| 7754 | u8 key_index, const u8 *mac_addr, |
| 7755 | struct key_params *params |
| 7756 | ) |
| 7757 | #endif |
| 7758 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7759 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7760 | tCsrRoamSetKey setKey; |
| 7761 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7762 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7763 | v_U32_t roamId= 0xFF; |
| 7764 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7765 | hdd_hostapd_state_t *pHostapdState; |
| 7766 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 7767 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7768 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7769 | |
| 7770 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7771 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7772 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7773 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 7774 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7775 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7776 | status = wlan_hdd_validate_context(pHddCtx); |
| 7777 | |
| 7778 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7779 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7780 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7781 | "%s: HDD context is not valid", __func__); |
| 7782 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7783 | } |
| 7784 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7785 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7786 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7787 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7788 | |
| 7789 | if (CSR_MAX_NUM_KEY <= key_index) |
| 7790 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7791 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7792 | key_index); |
| 7793 | |
| 7794 | return -EINVAL; |
| 7795 | } |
| 7796 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7797 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 7798 | { |
| 7799 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 7800 | params->key_len); |
| 7801 | |
| 7802 | return -EINVAL; |
| 7803 | } |
| 7804 | |
| 7805 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7806 | "%s: called with key index = %d & key length %d", |
| 7807 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7808 | |
| 7809 | /*extract key idx, key len and key*/ |
| 7810 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7811 | setKey.keyId = key_index; |
| 7812 | setKey.keyLength = params->key_len; |
| 7813 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 7814 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7815 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7816 | { |
| 7817 | case WLAN_CIPHER_SUITE_WEP40: |
| 7818 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 7819 | break; |
| 7820 | |
| 7821 | case WLAN_CIPHER_SUITE_WEP104: |
| 7822 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 7823 | break; |
| 7824 | |
| 7825 | case WLAN_CIPHER_SUITE_TKIP: |
| 7826 | { |
| 7827 | u8 *pKey = &setKey.Key[0]; |
| 7828 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 7829 | |
| 7830 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 7831 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7832 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7833 | |
| 7834 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7835 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7836 | |--------------|----------|----------| |
| 7837 | <---16bytes---><--8bytes--><--8bytes--> |
| 7838 | |
| 7839 | */ |
| 7840 | /*Sme expects the 32 bytes key to be in the below order |
| 7841 | |
| 7842 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7843 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7844 | |--------------|----------|----------| |
| 7845 | <---16bytes---><--8bytes--><--8bytes--> |
| 7846 | */ |
| 7847 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7848 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7849 | |
| 7850 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7851 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7852 | |
| 7853 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7854 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7855 | |
| 7856 | |
| 7857 | break; |
| 7858 | } |
| 7859 | |
| 7860 | case WLAN_CIPHER_SUITE_CCMP: |
| 7861 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 7862 | break; |
| 7863 | |
| 7864 | #ifdef FEATURE_WLAN_WAPI |
| 7865 | case WLAN_CIPHER_SUITE_SMS4: |
| 7866 | { |
| 7867 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 7868 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 7869 | params->key, params->key_len); |
| 7870 | return 0; |
| 7871 | } |
| 7872 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7873 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7874 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7875 | case WLAN_CIPHER_SUITE_KRK: |
| 7876 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 7877 | break; |
| 7878 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7879 | |
| 7880 | #ifdef WLAN_FEATURE_11W |
| 7881 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 7882 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 7883 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7884 | #endif |
| 7885 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7886 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7887 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7888 | __func__, params->cipher); |
| 7889 | return -EOPNOTSUPP; |
| 7890 | } |
| 7891 | |
| 7892 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 7893 | __func__, setKey.encType); |
| 7894 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7895 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7896 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7897 | (!pairwise) |
| 7898 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7899 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7900 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7901 | ) |
| 7902 | { |
| 7903 | /* set group key*/ |
| 7904 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7905 | "%s- %d: setting Broadcast key", |
| 7906 | __func__, __LINE__); |
| 7907 | setKey.keyDirection = eSIR_RX_ONLY; |
| 7908 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 7909 | } |
| 7910 | else |
| 7911 | { |
| 7912 | /* set pairwise key*/ |
| 7913 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7914 | "%s- %d: setting pairwise key", |
| 7915 | __func__, __LINE__); |
| 7916 | setKey.keyDirection = eSIR_TX_RX; |
| 7917 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 7918 | } |
| 7919 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 7920 | { |
| 7921 | setKey.keyDirection = eSIR_TX_RX; |
| 7922 | /*Set the group key*/ |
| 7923 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7924 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7925 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 7926 | if ( 0 != status ) |
| 7927 | { |
| 7928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7929 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 7930 | return -EINVAL; |
| 7931 | } |
| 7932 | /*Save the keys here and call sme_RoamSetKey for setting |
| 7933 | the PTK after peer joins the IBSS network*/ |
| 7934 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 7935 | &setKey, sizeof(tCsrRoamSetKey)); |
| 7936 | return status; |
| 7937 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7938 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 7939 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7940 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7941 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7942 | if( pHostapdState->bssState == BSS_START ) |
| 7943 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 7944 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7945 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 7946 | |
| 7947 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 7948 | { |
| 7949 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7950 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 7951 | __LINE__, vos_status ); |
| 7952 | |
| 7953 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 7954 | |
| 7955 | return -EINVAL; |
| 7956 | } |
| 7957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7958 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 7959 | |
| 7960 | if ( status != eHAL_STATUS_SUCCESS ) |
| 7961 | { |
| 7962 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7963 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 7964 | __LINE__, status ); |
| 7965 | } |
| 7966 | } |
| 7967 | |
| 7968 | /* Saving WEP keys */ |
| 7969 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 7970 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 7971 | { |
| 7972 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 7973 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 7974 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 7975 | } |
| 7976 | else |
| 7977 | { |
| 7978 | //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] | 7979 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7980 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 7981 | } |
| 7982 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 7983 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 7984 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7985 | { |
| 7986 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7987 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7988 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 7989 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 7990 | if (!pairwise) |
| 7991 | #else |
| 7992 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 7993 | #endif |
| 7994 | { |
| 7995 | /* set group key*/ |
| 7996 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 7997 | { |
| 7998 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7999 | "%s- %d: Perform Set key Complete", |
| 8000 | __func__, __LINE__); |
| 8001 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 8002 | } |
| 8003 | } |
| 8004 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8005 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 8006 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 8007 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 8008 | |
| 8009 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8010 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8011 | params->key, params->key_len); |
| 8012 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8013 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8014 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8015 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8016 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8017 | "%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] | 8018 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8019 | setKey.peerMac[2], setKey.peerMac[3], |
| 8020 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8021 | setKey.keyDirection); |
| 8022 | |
| 8023 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 8024 | |
| 8025 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 8026 | { |
| 8027 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8028 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 8029 | __LINE__, vos_status ); |
| 8030 | |
| 8031 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8032 | |
| 8033 | return -EINVAL; |
| 8034 | |
| 8035 | } |
| 8036 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8037 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8038 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 8039 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 8040 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8041 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8042 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8043 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8044 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 8045 | "%s: Update PreAuth Key success", __func__); |
| 8046 | return 0; |
| 8047 | } |
| 8048 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 8049 | { |
| 8050 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8051 | "%s: Update PreAuth Key failed", __func__); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 8052 | return -EINVAL; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8053 | } |
| 8054 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8055 | |
| 8056 | /* issue set key request to SME*/ |
| 8057 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8058 | pAdapter->sessionId, &setKey, &roamId ); |
| 8059 | |
| 8060 | if ( 0 != status ) |
| 8061 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8062 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8063 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 8064 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8065 | return -EINVAL; |
| 8066 | } |
| 8067 | |
| 8068 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8069 | /* in case of IBSS as there was no information available about WEP keys during |
| 8070 | * 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] | 8071 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8072 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 8073 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 8074 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8075 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 8076 | ) |
| 8077 | && |
| 8078 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 8079 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 8080 | ) |
| 8081 | ) |
| 8082 | { |
| 8083 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8084 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8085 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8086 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8087 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8088 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8089 | setKey.peerMac[2], setKey.peerMac[3], |
| 8090 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8091 | setKey.keyDirection); |
| 8092 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8093 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8094 | pAdapter->sessionId, &setKey, &roamId ); |
| 8095 | |
| 8096 | if ( 0 != status ) |
| 8097 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8099 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8100 | __func__, status); |
| 8101 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8102 | return -EINVAL; |
| 8103 | } |
| 8104 | } |
| 8105 | } |
| 8106 | |
| 8107 | return 0; |
| 8108 | } |
| 8109 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8110 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8111 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8112 | struct net_device *ndev, |
| 8113 | u8 key_index, bool pairwise, |
| 8114 | const u8 *mac_addr, |
| 8115 | struct key_params *params |
| 8116 | ) |
| 8117 | #else |
| 8118 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8119 | struct net_device *ndev, |
| 8120 | u8 key_index, const u8 *mac_addr, |
| 8121 | struct key_params *params |
| 8122 | ) |
| 8123 | #endif |
| 8124 | { |
| 8125 | int ret; |
| 8126 | vos_ssr_protect(__func__); |
| 8127 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8128 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 8129 | mac_addr, params); |
| 8130 | #else |
| 8131 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 8132 | params); |
| 8133 | #endif |
| 8134 | vos_ssr_unprotect(__func__); |
| 8135 | |
| 8136 | return ret; |
| 8137 | } |
| 8138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8139 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8140 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8141 | * This function is used to get the key information |
| 8142 | */ |
| 8143 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8144 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8145 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8146 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8147 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8148 | const u8 *mac_addr, void *cookie, |
| 8149 | void (*callback)(void *cookie, struct key_params*) |
| 8150 | ) |
| 8151 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8152 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8153 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8154 | struct net_device *ndev, |
| 8155 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 8156 | void (*callback)(void *cookie, struct key_params*) |
| 8157 | ) |
| 8158 | #endif |
| 8159 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8160 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8161 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8162 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8163 | struct key_params params; |
| 8164 | |
| 8165 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8166 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8167 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8168 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8169 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8171 | memset(¶ms, 0, sizeof(params)); |
| 8172 | |
| 8173 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8174 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8175 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8176 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8177 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8178 | |
| 8179 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 8180 | { |
| 8181 | case eCSR_ENCRYPT_TYPE_NONE: |
| 8182 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8183 | break; |
| 8184 | |
| 8185 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 8186 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 8187 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 8188 | break; |
| 8189 | |
| 8190 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 8191 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 8192 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 8193 | break; |
| 8194 | |
| 8195 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 8196 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 8197 | break; |
| 8198 | |
| 8199 | case eCSR_ENCRYPT_TYPE_AES: |
| 8200 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 8201 | break; |
| 8202 | |
| 8203 | default: |
| 8204 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8205 | break; |
| 8206 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8207 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 8208 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8209 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 8210 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 8213 | params.seq_len = 0; |
| 8214 | params.seq = NULL; |
| 8215 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 8216 | callback(cookie, ¶ms); |
| 8217 | return 0; |
| 8218 | } |
| 8219 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8220 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8221 | static int wlan_hdd_cfg80211_get_key( |
| 8222 | struct wiphy *wiphy, |
| 8223 | struct net_device *ndev, |
| 8224 | u8 key_index, bool pairwise, |
| 8225 | const u8 *mac_addr, void *cookie, |
| 8226 | void (*callback)(void *cookie, struct key_params*) |
| 8227 | ) |
| 8228 | #else |
| 8229 | static int wlan_hdd_cfg80211_get_key( |
| 8230 | struct wiphy *wiphy, |
| 8231 | struct net_device *ndev, |
| 8232 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 8233 | void (*callback)(void *cookie, struct key_params*) |
| 8234 | ) |
| 8235 | #endif |
| 8236 | { |
| 8237 | int ret; |
| 8238 | |
| 8239 | vos_ssr_protect(__func__); |
| 8240 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8241 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 8242 | mac_addr, cookie, callback); |
| 8243 | #else |
| 8244 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 8245 | callback); |
| 8246 | #endif |
| 8247 | vos_ssr_unprotect(__func__); |
| 8248 | |
| 8249 | return ret; |
| 8250 | } |
| 8251 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8252 | /* |
| 8253 | * FUNCTION: wlan_hdd_cfg80211_del_key |
| 8254 | * This function is used to delete the key information |
| 8255 | */ |
| 8256 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8257 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8258 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8259 | u8 key_index, |
| 8260 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8261 | const u8 *mac_addr |
| 8262 | ) |
| 8263 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8264 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8265 | struct net_device *ndev, |
| 8266 | u8 key_index, |
| 8267 | const u8 *mac_addr |
| 8268 | ) |
| 8269 | #endif |
| 8270 | { |
| 8271 | int status = 0; |
| 8272 | |
| 8273 | //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] | 8274 | //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] | 8275 | //it is observed that this is invalidating peer |
| 8276 | //key index whenever re-key is done. This is affecting data link. |
| 8277 | //It should be ok to ignore del_key. |
| 8278 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8279 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 8280 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8281 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 8282 | tCsrRoamSetKey setKey; |
| 8283 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8285 | ENTER(); |
| 8286 | |
| 8287 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 8288 | __func__,pAdapter->device_mode); |
| 8289 | |
| 8290 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8291 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8292 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | key_index); |
| 8294 | |
| 8295 | return -EINVAL; |
| 8296 | } |
| 8297 | |
| 8298 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8299 | setKey.keyId = key_index; |
| 8300 | |
| 8301 | if (mac_addr) |
| 8302 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8303 | else |
| 8304 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 8305 | |
| 8306 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 8307 | |
| 8308 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8310 | ) |
| 8311 | { |
| 8312 | |
| 8313 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8314 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 8315 | if( pHostapdState->bssState == BSS_START) |
| 8316 | { |
| 8317 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8319 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8320 | { |
| 8321 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8322 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8323 | __LINE__, status ); |
| 8324 | } |
| 8325 | } |
| 8326 | } |
| 8327 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8328 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8329 | ) |
| 8330 | { |
| 8331 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8332 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8333 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8334 | |
| 8335 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8336 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8337 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8338 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8339 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8340 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 8341 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8342 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8343 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8346 | if ( 0 != status ) |
| 8347 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8348 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8349 | "%s: sme_RoamSetKey failure, returned %d", |
| 8350 | __func__, status); |
| 8351 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8352 | return -EINVAL; |
| 8353 | } |
| 8354 | } |
| 8355 | } |
| 8356 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8357 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8358 | return status; |
| 8359 | } |
| 8360 | |
| 8361 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8362 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8363 | * This function is used to set the default tx key index |
| 8364 | */ |
| 8365 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8366 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8367 | struct net_device *ndev, |
| 8368 | u8 key_index, |
| 8369 | bool unicast, bool multicast) |
| 8370 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8371 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8372 | struct net_device *ndev, |
| 8373 | u8 key_index) |
| 8374 | #endif |
| 8375 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8376 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8377 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8378 | hdd_wext_state_t *pWextState; |
| 8379 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8380 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8381 | |
| 8382 | ENTER(); |
| 8383 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8384 | if ((NULL == pAdapter)) |
| 8385 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8386 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8387 | "invalid adapter"); |
| 8388 | return -EINVAL; |
| 8389 | } |
| 8390 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8391 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8392 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 8393 | pAdapter->sessionId, key_index)); |
| 8394 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8395 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8396 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8397 | |
| 8398 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 8399 | { |
| 8400 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8401 | "invalid Wext state or HDD context"); |
| 8402 | return -EINVAL; |
| 8403 | } |
| 8404 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8405 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8406 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8408 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8409 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8410 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8411 | key_index); |
| 8412 | |
| 8413 | return -EINVAL; |
| 8414 | } |
| 8415 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8416 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8417 | status = wlan_hdd_validate_context(pHddCtx); |
| 8418 | |
| 8419 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8420 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8421 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8422 | "%s: HDD context is not valid", __func__); |
| 8423 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8424 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8426 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8427 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8428 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8429 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8430 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8431 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8432 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8433 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8434 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8435 | { |
| 8436 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8437 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8439 | tCsrRoamSetKey setKey; |
| 8440 | v_U32_t roamId= 0xFF; |
| 8441 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8442 | |
| 8443 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8444 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8446 | Keys->defaultIndex = (u8)key_index; |
| 8447 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8448 | setKey.keyId = key_index; |
| 8449 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8450 | |
| 8451 | vos_mem_copy(&setKey.Key[0], |
| 8452 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8453 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8454 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8455 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8456 | |
| 8457 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8458 | &pHddStaCtx->conn_info.bssId[0], |
| 8459 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8460 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8461 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 8462 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 8463 | eCSR_ENCRYPT_TYPE_WEP104) |
| 8464 | { |
| 8465 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 8466 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 8467 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 8468 | type(104) and switching encryption type to 40*/ |
| 8469 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 8470 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8471 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 8472 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8473 | } |
| 8474 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8475 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8476 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8478 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8479 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8480 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8482 | if ( 0 != status ) |
| 8483 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8484 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8485 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8486 | status); |
| 8487 | return -EINVAL; |
| 8488 | } |
| 8489 | } |
| 8490 | } |
| 8491 | |
| 8492 | /* In SoftAp mode setting key direction for default mode */ |
| 8493 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 8494 | { |
| 8495 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 8496 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 8497 | (eCSR_ENCRYPT_TYPE_AES != |
| 8498 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 8499 | ) |
| 8500 | { |
| 8501 | /* Saving key direction for default key index to TX default */ |
| 8502 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8503 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 8504 | } |
| 8505 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | return status; |
| 8508 | } |
| 8509 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8510 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8511 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8512 | struct net_device *ndev, |
| 8513 | u8 key_index, |
| 8514 | bool unicast, bool multicast) |
| 8515 | #else |
| 8516 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8517 | struct net_device *ndev, |
| 8518 | u8 key_index) |
| 8519 | #endif |
| 8520 | { |
| 8521 | int ret; |
| 8522 | vos_ssr_protect(__func__); |
| 8523 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8524 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 8525 | multicast); |
| 8526 | #else |
| 8527 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 8528 | #endif |
| 8529 | vos_ssr_unprotect(__func__); |
| 8530 | |
| 8531 | return ret; |
| 8532 | } |
| 8533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8534 | /* |
| 8535 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 8536 | * This function is used to inform the BSS details to nl80211 interface. |
| 8537 | */ |
| 8538 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 8539 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 8540 | { |
| 8541 | struct net_device *dev = pAdapter->dev; |
| 8542 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 8543 | struct wiphy *wiphy = wdev->wiphy; |
| 8544 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 8545 | int chan_no; |
| 8546 | int ie_length; |
| 8547 | const char *ie; |
| 8548 | unsigned int freq; |
| 8549 | struct ieee80211_channel *chan; |
| 8550 | int rssi = 0; |
| 8551 | struct cfg80211_bss *bss = NULL; |
| 8552 | |
| 8553 | ENTER(); |
| 8554 | |
| 8555 | if( NULL == pBssDesc ) |
| 8556 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8557 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8558 | return bss; |
| 8559 | } |
| 8560 | |
| 8561 | chan_no = pBssDesc->channelId; |
| 8562 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 8563 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 8564 | |
| 8565 | if( NULL == ie ) |
| 8566 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8567 | 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] | 8568 | return bss; |
| 8569 | } |
| 8570 | |
| 8571 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 8572 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 8573 | { |
| 8574 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 8575 | } |
| 8576 | else |
| 8577 | { |
| 8578 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 8579 | } |
| 8580 | #else |
| 8581 | freq = ieee80211_channel_to_frequency(chan_no); |
| 8582 | #endif |
| 8583 | |
| 8584 | chan = __ieee80211_get_channel(wiphy, freq); |
| 8585 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 8586 | if (!chan) { |
| 8587 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 8588 | return NULL; |
| 8589 | } |
| 8590 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8591 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8592 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8593 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8594 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8595 | pBssDesc->capabilityInfo, |
| 8596 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 8597 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8598 | } |
| 8599 | |
| 8600 | |
| 8601 | |
| 8602 | /* |
| 8603 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 8604 | * This function is used to inform the BSS details to nl80211 interface. |
| 8605 | */ |
| 8606 | struct cfg80211_bss* |
| 8607 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 8608 | tSirBssDescription *bss_desc |
| 8609 | ) |
| 8610 | { |
| 8611 | /* |
| 8612 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 8613 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 8614 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 8615 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 8616 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 8617 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 8618 | cfg80211_inform_bss_frame. |
| 8619 | */ |
| 8620 | struct net_device *dev = pAdapter->dev; |
| 8621 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 8622 | struct wiphy *wiphy = wdev->wiphy; |
| 8623 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 8624 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 8625 | qcom_ie_age *qie_age = NULL; |
| 8626 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 8627 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8628 | 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] | 8629 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8630 | const char *ie = |
| 8631 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 8632 | unsigned int freq; |
| 8633 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 8634 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8635 | struct cfg80211_bss *bss_status = NULL; |
| 8636 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 8637 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8638 | hdd_context_t *pHddCtx; |
| 8639 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8640 | #ifdef WLAN_OPEN_SOURCE |
| 8641 | struct timespec ts; |
| 8642 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8643 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8644 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8645 | status = wlan_hdd_validate_context(pHddCtx); |
| 8646 | |
| 8647 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8648 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8649 | { |
| 8650 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8651 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8652 | return NULL; |
| 8653 | } |
| 8654 | |
| 8655 | |
| 8656 | if (0 != status) |
| 8657 | { |
| 8658 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8659 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8660 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8661 | } |
| 8662 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 8663 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8664 | if (!mgmt) |
| 8665 | { |
| 8666 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8667 | "%s: memory allocation failed ", __func__); |
| 8668 | return NULL; |
| 8669 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 8670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8671 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8672 | |
| 8673 | #ifdef WLAN_OPEN_SOURCE |
| 8674 | /* Android does not want the timestamp from the frame. |
| 8675 | Instead it wants a monotonic increasing value */ |
| 8676 | get_monotonic_boottime(&ts); |
| 8677 | mgmt->u.probe_resp.timestamp = |
| 8678 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 8679 | #else |
| 8680 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8681 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 8682 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8683 | |
| 8684 | #endif |
| 8685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8686 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 8687 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 8688 | |
| 8689 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 8690 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 8691 | /* Assuming this is the last IE, copy at the end */ |
| 8692 | ie_length -=sizeof(qcom_ie_age); |
| 8693 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 8694 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 8695 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 8696 | qie_age->oui_1 = QCOM_OUI1; |
| 8697 | qie_age->oui_2 = QCOM_OUI2; |
| 8698 | qie_age->oui_3 = QCOM_OUI3; |
| 8699 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 8700 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 8701 | #endif |
| 8702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8703 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 8704 | if (bss_desc->fProbeRsp) |
| 8705 | { |
| 8706 | mgmt->frame_control |= |
| 8707 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 8708 | } |
| 8709 | else |
| 8710 | { |
| 8711 | mgmt->frame_control |= |
| 8712 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 8713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8714 | |
| 8715 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8716 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8717 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 8718 | { |
| 8719 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 8720 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8721 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8722 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 8723 | |
| 8724 | { |
| 8725 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 8726 | } |
| 8727 | else |
| 8728 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8729 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 8730 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8731 | kfree(mgmt); |
| 8732 | return NULL; |
| 8733 | } |
| 8734 | #else |
| 8735 | freq = ieee80211_channel_to_frequency(chan_no); |
| 8736 | #endif |
| 8737 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8738 | /*when the band is changed on the fly using the GUI, three things are done |
| 8739 | * 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) |
| 8740 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 8741 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 8742 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 8743 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 8744 | * 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 |
| 8745 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 8746 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 8747 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 8748 | * So drop the bss and continue to next bss. |
| 8749 | */ |
| 8750 | if(chan == NULL) |
| 8751 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8752 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8753 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 8754 | return NULL; |
| 8755 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8756 | /*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] | 8757 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8758 | * */ |
| 8759 | if (( eConnectionState_Associated == |
| 8760 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 8761 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 8762 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 8763 | WNI_CFG_BSSID_LEN))) |
| 8764 | { |
| 8765 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 8766 | rssi = (pAdapter->rssi * 100); |
| 8767 | } |
| 8768 | else |
| 8769 | { |
| 8770 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 8771 | } |
| 8772 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8773 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 8774 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 8775 | chan->center_freq, (int)(rssi/100)); |
| 8776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8777 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 8778 | frame_len, rssi, GFP_KERNEL); |
| 8779 | kfree(mgmt); |
| 8780 | return bss_status; |
| 8781 | } |
| 8782 | |
| 8783 | /* |
| 8784 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 8785 | * This function is used to update the BSS data base of CFG8011 |
| 8786 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8787 | 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] | 8788 | tCsrRoamInfo *pRoamInfo |
| 8789 | ) |
| 8790 | { |
| 8791 | tCsrRoamConnectedProfile roamProfile; |
| 8792 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8793 | struct cfg80211_bss *bss = NULL; |
| 8794 | |
| 8795 | ENTER(); |
| 8796 | |
| 8797 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 8798 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 8799 | |
| 8800 | if (NULL != roamProfile.pBssDesc) |
| 8801 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 8802 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 8803 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8804 | |
| 8805 | if (NULL == bss) |
| 8806 | { |
| 8807 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 8808 | __func__); |
| 8809 | } |
| 8810 | |
| 8811 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 8812 | } |
| 8813 | else |
| 8814 | { |
| 8815 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 8816 | __func__); |
| 8817 | } |
| 8818 | return bss; |
| 8819 | } |
| 8820 | |
| 8821 | /* |
| 8822 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 8823 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8824 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 8825 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8827 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8828 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8829 | tCsrScanResultInfo *pScanResult; |
| 8830 | eHalStatus status = 0; |
| 8831 | tScanResultHandle pResult; |
| 8832 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8833 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8834 | |
| 8835 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8836 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8837 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8838 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 8839 | NO_SESSION, pAdapter->sessionId)); |
| 8840 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8841 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8842 | |
| 8843 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8844 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8845 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8846 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 8847 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8848 | } |
| 8849 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8850 | |
| 8851 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 8852 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 8853 | { |
| 8854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8855 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 8856 | return VOS_STATUS_E_PERM; |
| 8857 | } |
| 8858 | |
| 8859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8860 | /* |
| 8861 | * start getting scan results and populate cgf80211 BSS database |
| 8862 | */ |
| 8863 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 8864 | |
| 8865 | /* no scan results */ |
| 8866 | if (NULL == pResult) |
| 8867 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 8868 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 8869 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8870 | return status; |
| 8871 | } |
| 8872 | |
| 8873 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 8874 | |
| 8875 | while (pScanResult) |
| 8876 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8877 | /* |
| 8878 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 8879 | * entry already exists in bss data base of cfg80211 for that |
| 8880 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 8881 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 8882 | * mgmt packet as input. As of now there is no possibility to get |
| 8883 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8884 | * ieee80211_mgmt(probe response) and passing to c |
| 8885 | * fg80211_inform_bss_frame. |
| 8886 | * */ |
| 8887 | |
| 8888 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 8889 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8890 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8891 | |
| 8892 | if (NULL == bss_status) |
| 8893 | { |
| 8894 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8895 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8896 | } |
| 8897 | else |
| 8898 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 8899 | cfg80211_put_bss( |
| 8900 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 8901 | wiphy, |
| 8902 | #endif |
| 8903 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8904 | } |
| 8905 | |
| 8906 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 8907 | } |
| 8908 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8909 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8910 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8911 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8912 | } |
| 8913 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8914 | void |
| 8915 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 8916 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8917 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 8918 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8919 | } /****** end hddPrintMacAddr() ******/ |
| 8920 | |
| 8921 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 8922 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8923 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8924 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8925 | "%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] | 8926 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 8927 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 8928 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8929 | } /****** end hddPrintPmkId() ******/ |
| 8930 | |
| 8931 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 8932 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 8933 | |
| 8934 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 8935 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 8936 | |
| 8937 | #define dump_bssid(bssid) \ |
| 8938 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8939 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 8940 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8941 | } |
| 8942 | |
| 8943 | #define dump_pmkid(pMac, pmkid) \ |
| 8944 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8945 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 8946 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8947 | } |
| 8948 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 8949 | #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] | 8950 | /* |
| 8951 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 8952 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 8953 | */ |
| 8954 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8955 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8956 | int index, bool preauth ) |
| 8957 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8958 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8959 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8960 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8961 | |
| 8962 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8963 | 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] | 8964 | |
| 8965 | if( NULL == pRoamInfo ) |
| 8966 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8967 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8968 | return -EINVAL; |
| 8969 | } |
| 8970 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8971 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 8972 | { |
| 8973 | dump_bssid(pRoamInfo->bssid); |
| 8974 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8975 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8976 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8977 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8978 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8979 | } |
| 8980 | #endif //FEATURE_WLAN_LFR |
| 8981 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 8982 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 8983 | /* |
| 8984 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 8985 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 8986 | * |
| 8987 | */ |
| 8988 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 8989 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 8990 | tCsrRoamInfo *pRoamInfo) |
| 8991 | { |
| 8992 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 8993 | union iwreq_data wrqu; |
| 8994 | |
| 8995 | ENTER(); |
| 8996 | |
| 8997 | if (NULL == pAdapter) |
| 8998 | { |
| 8999 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9000 | return VOS_STATUS_E_FAILURE; |
| 9001 | } |
| 9002 | |
| 9003 | /* create the event */ |
| 9004 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9005 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9006 | |
| 9007 | wrqu.data.pointer = metrics_notification; |
| 9008 | wrqu.data.length = scnprintf(metrics_notification, |
| 9009 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 9010 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9011 | |
| 9012 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9013 | |
| 9014 | EXIT(); |
| 9015 | |
| 9016 | return VOS_STATUS_SUCCESS; |
| 9017 | } |
| 9018 | |
| 9019 | /* |
| 9020 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 9021 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 9022 | * or failure |
| 9023 | */ |
| 9024 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 9025 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 9026 | { |
| 9027 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9028 | union iwreq_data wrqu; |
| 9029 | |
| 9030 | ENTER(); |
| 9031 | |
| 9032 | if (NULL == pAdapter) |
| 9033 | { |
| 9034 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9035 | return VOS_STATUS_E_FAILURE; |
| 9036 | } |
| 9037 | |
| 9038 | /* create the event */ |
| 9039 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9040 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9041 | |
| 9042 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 9043 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 9044 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9045 | |
| 9046 | if (1 == preauth_status) |
| 9047 | strncat(metrics_notification, " TRUE", 5); |
| 9048 | else |
| 9049 | strncat(metrics_notification, " FALSE", 6); |
| 9050 | |
| 9051 | wrqu.data.pointer = metrics_notification; |
| 9052 | wrqu.data.length = strlen(metrics_notification); |
| 9053 | |
| 9054 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9055 | |
| 9056 | EXIT(); |
| 9057 | |
| 9058 | return VOS_STATUS_SUCCESS; |
| 9059 | } |
| 9060 | |
| 9061 | /* |
| 9062 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 9063 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 9064 | * |
| 9065 | */ |
| 9066 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 9067 | tCsrRoamInfo *pRoamInfo) |
| 9068 | { |
| 9069 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9070 | union iwreq_data wrqu; |
| 9071 | |
| 9072 | ENTER(); |
| 9073 | |
| 9074 | if (NULL == pAdapter) |
| 9075 | { |
| 9076 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9077 | return VOS_STATUS_E_FAILURE; |
| 9078 | } |
| 9079 | |
| 9080 | /* create the event */ |
| 9081 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9082 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9083 | |
| 9084 | wrqu.data.pointer = metrics_notification; |
| 9085 | wrqu.data.length = scnprintf(metrics_notification, |
| 9086 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 9087 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9088 | |
| 9089 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9090 | |
| 9091 | EXIT(); |
| 9092 | |
| 9093 | return VOS_STATUS_SUCCESS; |
| 9094 | } |
| 9095 | #endif |
| 9096 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9097 | /* |
| 9098 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 9099 | * scanning callback function, called after finishing scan |
| 9100 | * |
| 9101 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9102 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9103 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 9104 | { |
| 9105 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9106 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9107 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9108 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9109 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | struct cfg80211_scan_request *req = NULL; |
| 9111 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 9112 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9113 | long waitRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9114 | |
| 9115 | ENTER(); |
| 9116 | |
| 9117 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9118 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9119 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9120 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 9121 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9122 | pScanInfo->mScanPendingCounter = 0; |
| 9123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9124 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9125 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9126 | &pScanInfo->scan_req_completion_event, |
| 9127 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9128 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9129 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9130 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9131 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9132 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9133 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9134 | } |
| 9135 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9136 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9137 | { |
| 9138 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9139 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9140 | } |
| 9141 | |
| 9142 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9143 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9144 | { |
| 9145 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9146 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9147 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9148 | (int) scanId); |
| 9149 | } |
| 9150 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9151 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9152 | pAdapter); |
| 9153 | |
| 9154 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9155 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9156 | |
| 9157 | |
| 9158 | /* If any client wait scan result through WEXT |
| 9159 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9160 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | { |
| 9162 | /* The other scan request waiting for current scan finish |
| 9163 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9164 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9165 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9166 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9167 | } |
| 9168 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9169 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9170 | { |
| 9171 | struct net_device *dev = pAdapter->dev; |
| 9172 | union iwreq_data wrqu; |
| 9173 | int we_event; |
| 9174 | char *msg; |
| 9175 | |
| 9176 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 9177 | we_event = SIOCGIWSCAN; |
| 9178 | msg = NULL; |
| 9179 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 9180 | } |
| 9181 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9182 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9183 | |
| 9184 | /* Get the Scan Req */ |
| 9185 | req = pAdapter->request; |
| 9186 | |
| 9187 | if (!req) |
| 9188 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9189 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9190 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9191 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9192 | } |
| 9193 | |
| 9194 | /* |
| 9195 | * setting up 0, just in case. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9196 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9197 | req->n_ssids = 0; |
| 9198 | req->n_channels = 0; |
| 9199 | req->ie = 0; |
| 9200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9201 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9202 | /* Scan is no longer pending */ |
| 9203 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9204 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 9205 | /* |
| 9206 | * cfg80211_scan_done informing NL80211 about completion |
| 9207 | * of scanning |
| 9208 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 9209 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 9210 | { |
| 9211 | aborted = true; |
| 9212 | } |
| 9213 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 9214 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9215 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9216 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9217 | /* release the wake lock at the end of the scan*/ |
| 9218 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9219 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 9220 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 9221 | * immediatly after the driver gets connect request(i.e after scan) |
| 9222 | * from supplicant, this result in app's is suspending and not able |
| 9223 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9224 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 9225 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9226 | #ifdef FEATURE_WLAN_TDLS |
c_hpothu | 3c8f8e8 | 2014-06-02 18:01:50 +0530 | [diff] [blame] | 9227 | if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) |
| 9228 | { |
| 9229 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 9230 | } |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9231 | #endif |
| 9232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9233 | EXIT(); |
| 9234 | return 0; |
| 9235 | } |
| 9236 | |
| 9237 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9238 | * FUNCTION: hdd_isConnectionInProgress |
| 9239 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9240 | * |
| 9241 | */ |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9242 | 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] | 9243 | { |
| 9244 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 9245 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 9246 | hdd_adapter_t *pAdapter = NULL; |
| 9247 | VOS_STATUS status = 0; |
| 9248 | v_U8_t staId = 0; |
| 9249 | v_U8_t *staMac = NULL; |
| 9250 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 9251 | if (TRUE == pHddCtx->btCoexModeSet) |
| 9252 | { |
| 9253 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9254 | FL("BTCoex Mode operation in progress")); |
| 9255 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 9256 | } |
| 9257 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9258 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 9259 | |
| 9260 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 9261 | { |
| 9262 | pAdapter = pAdapterNode->pAdapter; |
| 9263 | |
| 9264 | if( pAdapter ) |
| 9265 | { |
| 9266 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9267 | "%s: Adapter with device mode %s (%d) exists", |
| 9268 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9269 | pAdapter->device_mode); |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9270 | if ((((!isRoC) && (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9271 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9272 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 9273 | (eConnectionState_Connecting == |
| 9274 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 9275 | { |
| 9276 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9277 | "%s: %p(%d) Connection is in progress", __func__, |
| 9278 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 9279 | return VOS_TRUE; |
| 9280 | } |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9281 | if (((!isRoC) && (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9282 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9283 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9284 | { |
| 9285 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9286 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9287 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9288 | { |
| 9289 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 9290 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9291 | "%s: client " MAC_ADDRESS_STR |
| 9292 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 9293 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9294 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9295 | } |
| 9296 | } |
| 9297 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 9298 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 9299 | { |
| 9300 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 9301 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9302 | if ((pAdapter->aStaInfo[staId].isUsed) && |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9303 | (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState)) |
| 9304 | { |
| 9305 | staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]); |
| 9306 | |
| 9307 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9308 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 9309 | "middle of WPS/EAPOL exchange.", __func__, |
| 9310 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9311 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9312 | } |
| 9313 | } |
| 9314 | } |
| 9315 | } |
| 9316 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 9317 | pAdapterNode = pNext; |
| 9318 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9319 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9320 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9321 | |
| 9322 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9323 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9324 | * this scan respond to scan trigger and update cfg80211 scan database |
| 9325 | * later, scan dump command can be used to recieve scan results |
| 9326 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9327 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9328 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9329 | struct net_device *dev, |
| 9330 | #endif |
| 9331 | struct cfg80211_scan_request *request) |
| 9332 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9333 | hdd_adapter_t *pAdapter = NULL; |
| 9334 | hdd_context_t *pHddCtx = NULL; |
| 9335 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9336 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9337 | tCsrScanRequest scanRequest; |
| 9338 | tANI_U8 *channelList = NULL, i; |
| 9339 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9340 | int status; |
| 9341 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9342 | v_U8_t* pP2pIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9343 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9344 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 9345 | struct net_device *dev = NULL; |
| 9346 | if (NULL == request) |
| 9347 | { |
| 9348 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9349 | "%s: scan req param null", __func__); |
| 9350 | return -EINVAL; |
| 9351 | } |
| 9352 | dev = request->wdev->netdev; |
| 9353 | #endif |
| 9354 | |
| 9355 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 9356 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 9357 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9359 | ENTER(); |
| 9360 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9361 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9362 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9363 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9364 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9365 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9366 | status = wlan_hdd_validate_context(pHddCtx); |
| 9367 | |
| 9368 | if (0 != status) |
| 9369 | { |
| 9370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9371 | "%s: HDD context is not valid", __func__); |
| 9372 | return status; |
| 9373 | } |
| 9374 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9375 | if (NULL == pwextBuf) |
| 9376 | { |
| 9377 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 9378 | __func__); |
| 9379 | return -EIO; |
| 9380 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9381 | cfg_param = pHddCtx->cfg_ini; |
| 9382 | pScanInfo = &pHddCtx->scan_info; |
| 9383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9384 | #ifdef WLAN_BTAMP_FEATURE |
| 9385 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9386 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9387 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9388 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9389 | "%s: No scanning when AMP is on", __func__); |
| 9390 | return -EOPNOTSUPP; |
| 9391 | } |
| 9392 | #endif |
| 9393 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9394 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9395 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9397 | "%s: Not scanning on device_mode = %s (%d)", |
| 9398 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9399 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9400 | return -EOPNOTSUPP; |
| 9401 | } |
| 9402 | |
| 9403 | if (TRUE == pScanInfo->mScanPending) |
| 9404 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9405 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 9406 | { |
| 9407 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 9408 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9409 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9410 | } |
| 9411 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9412 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9413 | //Channel and action frame is pending |
| 9414 | //Otherwise Cancel Remain On Channel and allow Scan |
| 9415 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9416 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9417 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9418 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9419 | return -EBUSY; |
| 9420 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9421 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9422 | /* if tdls disagree scan right now, return immediately. |
| 9423 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 9424 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 9425 | */ |
| 9426 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 9427 | wiphy, |
| 9428 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9429 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 9430 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9431 | request); |
| 9432 | if(status <= 0) |
| 9433 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9434 | if(!status) |
| 9435 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 9436 | "scan rejected %d", __func__, status); |
| 9437 | else |
| 9438 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 9439 | __func__, status); |
| 9440 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9441 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9442 | } |
| 9443 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9444 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9445 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 9446 | { |
| 9447 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9448 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9449 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9450 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9451 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 9452 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9453 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9454 | "%s: MAX TM Level Scan not allowed", __func__); |
| 9455 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9456 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9457 | } |
| 9458 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 9459 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9460 | /* Check if scan is allowed at this point of time. |
| 9461 | */ |
Ganesh Kondabattini | aeb7b77 | 2014-08-11 20:00:36 +0530 | [diff] [blame] | 9462 | if (hdd_isConnectionInProgress(pHddCtx, VOS_FALSE)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9463 | { |
| 9464 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 9465 | return -EBUSY; |
| 9466 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9468 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 9469 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9470 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 9471 | (int)request->n_ssids); |
| 9472 | |
| 9473 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 9474 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 9475 | * is not aging out the scan results. |
| 9476 | */ |
| 9477 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9478 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9479 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9480 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9481 | |
| 9482 | if ((request->ssids) && (0 < request->n_ssids)) |
| 9483 | { |
| 9484 | tCsrSSIDInfo *SsidInfo; |
| 9485 | int j; |
| 9486 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 9487 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 9488 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 9489 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 9490 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 9491 | |
| 9492 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 9493 | { |
| 9494 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9495 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 9496 | return -ENOMEM; |
| 9497 | } |
| 9498 | |
| 9499 | /* copy all the ssid's and their length */ |
| 9500 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 9501 | { |
| 9502 | /* get the ssid length */ |
| 9503 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 9504 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 9505 | SsidInfo->SSID.length); |
| 9506 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 9507 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 9508 | j, SsidInfo->SSID.ssId); |
| 9509 | } |
| 9510 | /* set the scan type to active */ |
| 9511 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 9512 | } |
| 9513 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9514 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9515 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9516 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 9517 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9518 | /* set the scan type to active */ |
| 9519 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9520 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9521 | else |
| 9522 | { |
| 9523 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 9524 | scanRequest.scanType = pScanInfo->scan_mode; |
| 9525 | } |
| 9526 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 9527 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9528 | |
| 9529 | /* set BSSType to default type */ |
| 9530 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 9531 | |
| 9532 | /*TODO: scan the requested channels only*/ |
| 9533 | |
| 9534 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9535 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9536 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9537 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 9538 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 9539 | request->n_channels = MAX_CHANNEL; |
| 9540 | } |
| 9541 | |
| 9542 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9543 | "No of Scan Channels: %d", request->n_channels); |
| 9544 | |
| 9545 | |
| 9546 | if( request->n_channels ) |
| 9547 | { |
| 9548 | char chList [(request->n_channels*5)+1]; |
| 9549 | int len; |
| 9550 | channelList = vos_mem_malloc( request->n_channels ); |
| 9551 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9552 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9553 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9554 | "%s: memory alloc failed channelList", __func__); |
| 9555 | status = -ENOMEM; |
| 9556 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9557 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9558 | |
| 9559 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 9560 | { |
| 9561 | channelList[i] = request->channels[i]->hw_value; |
| 9562 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 9563 | } |
| 9564 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9565 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9566 | "Channel-List: %s ", chList); |
| 9567 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 9568 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9569 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 9570 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 9571 | |
| 9572 | /* set requestType to full scan */ |
| 9573 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 9574 | |
| 9575 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 9576 | * search (Flush on both full scan and social scan but not on single |
| 9577 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 9578 | */ |
| 9579 | |
| 9580 | /* Supplicant does single channel scan after 8-way handshake |
| 9581 | * and in that case driver shoudnt flush scan results. If |
| 9582 | * driver flushes the scan results here and unfortunately if |
| 9583 | * the AP doesnt respond to our probe req then association |
| 9584 | * fails which is not desired |
| 9585 | */ |
| 9586 | |
| 9587 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 9588 | { |
| 9589 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 9590 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9591 | pAdapter->sessionId ); |
| 9592 | } |
| 9593 | |
| 9594 | if( request->ie_len ) |
| 9595 | { |
| 9596 | /* save this for future association (join requires this) */ |
| 9597 | /*TODO: Array needs to be converted to dynamic allocation, |
| 9598 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 9599 | * CR 597966 |
| 9600 | */ |
| 9601 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 9602 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 9603 | pScanInfo->scanAddIE.length = request->ie_len; |
| 9604 | |
| 9605 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9606 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9607 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9608 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9609 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9610 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9611 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 9612 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 9613 | request->ie, request->ie_len); |
| 9614 | } |
| 9615 | else |
| 9616 | { |
| 9617 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 9618 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9619 | } |
| 9620 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9621 | } |
| 9622 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 9623 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 9624 | |
| 9625 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 9626 | request->ie_len); |
| 9627 | if (pP2pIe != NULL) |
| 9628 | { |
| 9629 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9630 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 9631 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 9632 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9633 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9634 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 9635 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 9636 | "Go nego completed to Connection is started"); |
| 9637 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9638 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9639 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9640 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 9641 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9642 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9643 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 9644 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 9645 | "Disconnected state to Connection is started"); |
| 9646 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 9647 | "for 4way Handshake"); |
| 9648 | } |
| 9649 | #endif |
| 9650 | |
| 9651 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 9652 | if(TRUE == request->no_cck) |
| 9653 | { |
| 9654 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9655 | "%s: This is a P2P Search", __func__); |
| 9656 | scanRequest.p2pSearch = 1; |
| 9657 | |
| 9658 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9659 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9660 | /* set requestType to P2P Discovery */ |
| 9661 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 9662 | } |
| 9663 | |
| 9664 | /* |
| 9665 | Skip Dfs Channel in case of P2P Search |
| 9666 | if it is set in ini file |
| 9667 | */ |
| 9668 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 9669 | { |
| 9670 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9671 | } |
| 9672 | else |
| 9673 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9674 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9676 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9677 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9678 | } |
| 9679 | } |
| 9680 | |
| 9681 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 9682 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9683 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 9684 | * address the following issues. |
| 9685 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 9686 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 9687 | * for long time, this result in apps running at full power for long time. |
| 9688 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 9689 | * be stuck in full power because of resume BMPS |
| 9690 | */ |
| 9691 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9692 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9693 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9694 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9695 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 9696 | scanRequest.requestType, scanRequest.scanType, |
| 9697 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9698 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 9699 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9700 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9701 | pAdapter->sessionId, &scanRequest, &scanId, |
| 9702 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9704 | if (eHAL_STATUS_SUCCESS != status) |
| 9705 | { |
| 9706 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9707 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 9708 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9709 | if(eHAL_STATUS_RESOURCES == status) |
| 9710 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9711 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 9712 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 9713 | status = -EBUSY; |
| 9714 | } else { |
| 9715 | status = -EIO; |
| 9716 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9717 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9718 | goto free_mem; |
| 9719 | } |
| 9720 | |
| 9721 | pScanInfo->mScanPending = TRUE; |
| 9722 | pAdapter->request = request; |
| 9723 | pScanInfo->scanId = scanId; |
| 9724 | |
| 9725 | complete(&pScanInfo->scan_req_completion_event); |
| 9726 | |
| 9727 | free_mem: |
| 9728 | if( scanRequest.SSIDs.SSIDList ) |
| 9729 | { |
| 9730 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 9731 | } |
| 9732 | |
| 9733 | if( channelList ) |
| 9734 | vos_mem_free( channelList ); |
| 9735 | |
| 9736 | EXIT(); |
| 9737 | |
| 9738 | return status; |
| 9739 | } |
| 9740 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9741 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 9742 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9743 | struct net_device *dev, |
| 9744 | #endif |
| 9745 | struct cfg80211_scan_request *request) |
| 9746 | { |
| 9747 | int ret; |
| 9748 | |
| 9749 | vos_ssr_protect(__func__); |
| 9750 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 9751 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9752 | dev, |
| 9753 | #endif |
| 9754 | request); |
| 9755 | vos_ssr_unprotect(__func__); |
| 9756 | |
| 9757 | return ret; |
| 9758 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9759 | |
| 9760 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 9761 | { |
| 9762 | v_U8_t iniDot11Mode = |
| 9763 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 9764 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 9765 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9766 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 9767 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9768 | switch ( iniDot11Mode ) |
| 9769 | { |
| 9770 | case eHDD_DOT11_MODE_AUTO: |
| 9771 | case eHDD_DOT11_MODE_11ac: |
| 9772 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 9773 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 9774 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 9775 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 9776 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 9777 | else |
| 9778 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9779 | #else |
| 9780 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9781 | #endif |
| 9782 | break; |
| 9783 | case eHDD_DOT11_MODE_11n: |
| 9784 | case eHDD_DOT11_MODE_11n_ONLY: |
| 9785 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 9786 | break; |
| 9787 | default: |
| 9788 | hddDot11Mode = iniDot11Mode; |
| 9789 | break; |
| 9790 | } |
| 9791 | /* This call decides required channel bonding mode */ |
| 9792 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
| 9793 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 9794 | operationChannel); |
| 9795 | } |
| 9796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9797 | /* |
| 9798 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9799 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9800 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9801 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9802 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9803 | { |
| 9804 | int status = 0; |
| 9805 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9806 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9807 | v_U32_t roamId; |
| 9808 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9809 | eCsrAuthType RSNAuthType; |
| 9810 | |
| 9811 | ENTER(); |
| 9812 | |
| 9813 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 9814 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9815 | |
| 9816 | status = wlan_hdd_validate_context(pHddCtx); |
| 9817 | if (status) |
| 9818 | { |
| 9819 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9820 | "%s: HDD context is not valid!", __func__); |
| 9821 | return status; |
| 9822 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9824 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 9825 | { |
| 9826 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 9827 | return -EINVAL; |
| 9828 | } |
| 9829 | |
| 9830 | pRoamProfile = &pWextState->roamProfile; |
| 9831 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9832 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9834 | hdd_station_ctx_t *pHddStaCtx; |
| 9835 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9836 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9837 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 9839 | { |
| 9840 | /*QoS not enabled in cfg file*/ |
| 9841 | pRoamProfile->uapsd_mask = 0; |
| 9842 | } |
| 9843 | else |
| 9844 | { |
| 9845 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9846 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9847 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 9848 | } |
| 9849 | |
| 9850 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 9851 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 9852 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9853 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9854 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 9855 | ssid, ssid_len); |
| 9856 | |
| 9857 | if (bssid) |
| 9858 | { |
| 9859 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 9860 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 9861 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9862 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 9863 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9864 | case of join failure we should send valid BSSID to supplicant |
| 9865 | */ |
| 9866 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 9867 | WNI_CFG_BSSID_LEN); |
| 9868 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 9869 | else |
| 9870 | { |
| 9871 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 9872 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9873 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9874 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 9875 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9876 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 9877 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9878 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9879 | /*set gen ie*/ |
| 9880 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 9881 | /*set auth*/ |
| 9882 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 9883 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9884 | #ifdef FEATURE_WLAN_WAPI |
| 9885 | if (pAdapter->wapi_info.nWapiMode) |
| 9886 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9887 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9888 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 9889 | { |
| 9890 | case WAPI_AUTH_MODE_PSK: |
| 9891 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9892 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9893 | pAdapter->wapi_info.wapiAuthMode); |
| 9894 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 9895 | break; |
| 9896 | } |
| 9897 | case WAPI_AUTH_MODE_CERT: |
| 9898 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9899 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9900 | pAdapter->wapi_info.wapiAuthMode); |
| 9901 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 9902 | break; |
| 9903 | } |
| 9904 | } // End of switch |
| 9905 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 9906 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 9907 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9908 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9909 | pRoamProfile->AuthType.numEntries = 1; |
| 9910 | pRoamProfile->EncryptionType.numEntries = 1; |
| 9911 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9912 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 9913 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 9914 | } |
| 9915 | } |
| 9916 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9917 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9918 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9919 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9920 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 9921 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 9922 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 9923 | sizeof (tSirGtkOffloadParams)); |
| 9924 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 9925 | } |
| 9926 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9927 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 9928 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9929 | if( operatingChannel ) |
| 9930 | { |
| 9931 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 9932 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9933 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9934 | else |
| 9935 | { |
| 9936 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9937 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9938 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 9939 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 9940 | { |
| 9941 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 9942 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 9943 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9944 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 9945 | * 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] | 9946 | * 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] | 9947 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9948 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 9949 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9950 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9951 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9952 | { |
| 9953 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9954 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 9955 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9956 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 9957 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9958 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9959 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9960 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 9961 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 9962 | if ((eHAL_STATUS_SUCCESS != status) && |
| 9963 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 9964 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9965 | |
| 9966 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9967 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 9968 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 9969 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9970 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 9971 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 9972 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 9973 | |
| 9974 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 9975 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 9976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9977 | } |
| 9978 | else |
| 9979 | { |
| 9980 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 9981 | return -EINVAL; |
| 9982 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9983 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9984 | return status; |
| 9985 | } |
| 9986 | |
| 9987 | /* |
| 9988 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 9989 | * This function is used to set the authentication type (OPEN/SHARED). |
| 9990 | * |
| 9991 | */ |
| 9992 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 9993 | enum nl80211_auth_type auth_type) |
| 9994 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9995 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9996 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9997 | |
| 9998 | ENTER(); |
| 9999 | |
| 10000 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10001 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10002 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10003 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10004 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10005 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 10006 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 10007 | break; |
| 10008 | |
| 10009 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 10010 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10011 | case NL80211_AUTHTYPE_FT: |
| 10012 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10013 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10014 | "%s: set authentication type to OPEN", __func__); |
| 10015 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 10016 | break; |
| 10017 | |
| 10018 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10019 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10020 | "%s: set authentication type to SHARED", __func__); |
| 10021 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 10022 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10023 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10024 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10025 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10026 | "%s: set authentication type to CCKM WPA", __func__); |
| 10027 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 10028 | break; |
| 10029 | #endif |
| 10030 | |
| 10031 | |
| 10032 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10033 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10034 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10035 | auth_type); |
| 10036 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 10037 | return -EINVAL; |
| 10038 | } |
| 10039 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10040 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10041 | pHddStaCtx->conn_info.authType; |
| 10042 | return 0; |
| 10043 | } |
| 10044 | |
| 10045 | /* |
| 10046 | * FUNCTION: wlan_hdd_set_akm_suite |
| 10047 | * This function is used to set the key mgmt type(PSK/8021x). |
| 10048 | * |
| 10049 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10050 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10051 | u32 key_mgmt |
| 10052 | ) |
| 10053 | { |
| 10054 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10055 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10056 | /* Should be in ieee802_11_defs.h */ |
| 10057 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 10058 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10059 | /*set key mgmt type*/ |
| 10060 | switch(key_mgmt) |
| 10061 | { |
| 10062 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10063 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10064 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10065 | case WLAN_AKM_SUITE_FT_PSK: |
| 10066 | #endif |
| 10067 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10068 | __func__); |
| 10069 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 10070 | break; |
| 10071 | |
| 10072 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10073 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10074 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10075 | case WLAN_AKM_SUITE_FT_8021X: |
| 10076 | #endif |
| 10077 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10078 | __func__); |
| 10079 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 10080 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10081 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10082 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 10083 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 10084 | case WLAN_AKM_SUITE_CCKM: |
| 10085 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 10086 | __func__); |
| 10087 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 10088 | break; |
| 10089 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 10090 | #ifndef WLAN_AKM_SUITE_OSEN |
| 10091 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 10092 | case WLAN_AKM_SUITE_OSEN: |
| 10093 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 10094 | __func__); |
| 10095 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 10096 | break; |
| 10097 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10098 | |
| 10099 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10100 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10101 | __func__, key_mgmt); |
| 10102 | return -EINVAL; |
| 10103 | |
| 10104 | } |
| 10105 | return 0; |
| 10106 | } |
| 10107 | |
| 10108 | /* |
| 10109 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10110 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10111 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 10112 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10113 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 10114 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10115 | bool ucast |
| 10116 | ) |
| 10117 | { |
| 10118 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10119 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10120 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10121 | |
| 10122 | ENTER(); |
| 10123 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10124 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10125 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10126 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10127 | __func__, cipher); |
| 10128 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10129 | } |
| 10130 | else |
| 10131 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10132 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10133 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10134 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10135 | { |
| 10136 | case IW_AUTH_CIPHER_NONE: |
| 10137 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10138 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10140 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10141 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10142 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10144 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10145 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10146 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10148 | case WLAN_CIPHER_SUITE_TKIP: |
| 10149 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 10150 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10152 | case WLAN_CIPHER_SUITE_CCMP: |
| 10153 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 10154 | break; |
| 10155 | #ifdef FEATURE_WLAN_WAPI |
| 10156 | case WLAN_CIPHER_SUITE_SMS4: |
| 10157 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 10158 | break; |
| 10159 | #endif |
| 10160 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10161 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10162 | case WLAN_CIPHER_SUITE_KRK: |
| 10163 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 10164 | break; |
| 10165 | #endif |
| 10166 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10167 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10168 | __func__, cipher); |
| 10169 | return -EOPNOTSUPP; |
| 10170 | } |
| 10171 | } |
| 10172 | |
| 10173 | if (ucast) |
| 10174 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10175 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10176 | __func__, encryptionType); |
| 10177 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 10178 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10179 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10180 | encryptionType; |
| 10181 | } |
| 10182 | else |
| 10183 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10184 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10185 | __func__, encryptionType); |
| 10186 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 10187 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 10188 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 10189 | } |
| 10190 | |
| 10191 | return 0; |
| 10192 | } |
| 10193 | |
| 10194 | |
| 10195 | /* |
| 10196 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 10197 | * This function is used to parse WPA/RSN IE's. |
| 10198 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10199 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 10200 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10201 | size_t ie_len |
| 10202 | ) |
| 10203 | { |
| 10204 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10205 | u8 *genie = ie; |
| 10206 | v_U16_t remLen = ie_len; |
| 10207 | #ifdef FEATURE_WLAN_WAPI |
| 10208 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 10209 | u16 *tmp; |
| 10210 | v_U16_t akmsuiteCount; |
| 10211 | int *akmlist; |
| 10212 | #endif |
| 10213 | ENTER(); |
| 10214 | |
| 10215 | /* clear previous assocAddIE */ |
| 10216 | pWextState->assocAddIE.length = 0; |
| 10217 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10218 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10219 | |
| 10220 | while (remLen >= 2) |
| 10221 | { |
| 10222 | v_U16_t eLen = 0; |
| 10223 | v_U8_t elementId; |
| 10224 | elementId = *genie++; |
| 10225 | eLen = *genie++; |
| 10226 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10227 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10228 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10229 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10230 | |
| 10231 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10232 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10233 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10234 | 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] | 10235 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10236 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10237 | "%s: Invalid WPA IE", __func__); |
| 10238 | return -EINVAL; |
| 10239 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10240 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10241 | { |
| 10242 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10243 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10244 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10246 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10247 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10248 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 10249 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10250 | VOS_ASSERT(0); |
| 10251 | return -ENOMEM; |
| 10252 | } |
| 10253 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 10254 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10255 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10257 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 10258 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10259 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10260 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10261 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 10262 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 10264 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 10265 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 10266 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 10267 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 10268 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10269 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 10270 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10271 | { |
| 10272 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10273 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10274 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10276 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10277 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10278 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10279 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10280 | VOS_ASSERT(0); |
| 10281 | return -ENOMEM; |
| 10282 | } |
| 10283 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 10284 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10285 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10287 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10288 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10289 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10290 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10291 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 10292 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10293 | /*Consider WFD IE, only for P2P Client */ |
| 10294 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 10295 | { |
| 10296 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10297 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10298 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10300 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10301 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10302 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10303 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10304 | VOS_ASSERT(0); |
| 10305 | return -ENOMEM; |
| 10306 | } |
| 10307 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 10308 | // WPS IE + P2P IE + WFD IE |
| 10309 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10310 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10312 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10313 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10314 | } |
| 10315 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10316 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10317 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10318 | HS20_OUI_TYPE_SIZE)) ) |
| 10319 | { |
| 10320 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10321 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10322 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10323 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10324 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10325 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10326 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10327 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10328 | VOS_ASSERT(0); |
| 10329 | return -ENOMEM; |
| 10330 | } |
| 10331 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10332 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10333 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10334 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10335 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10336 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10337 | /* Appending OSEN Information Element in Assiciation Request */ |
| 10338 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 10339 | OSEN_OUI_TYPE_SIZE)) ) |
| 10340 | { |
| 10341 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 10342 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 10343 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10344 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10345 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10346 | { |
| 10347 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10348 | "Need bigger buffer space"); |
| 10349 | VOS_ASSERT(0); |
| 10350 | return -ENOMEM; |
| 10351 | } |
| 10352 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10353 | pWextState->assocAddIE.length += eLen + 2; |
| 10354 | |
| 10355 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 10356 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10357 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10358 | } |
| 10359 | |
| 10360 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 10361 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 10362 | |
| 10363 | /* populating as ADDIE in beacon frames */ |
| 10364 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10365 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 10366 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 10367 | { |
| 10368 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10369 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 10370 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10371 | { |
| 10372 | hddLog(LOGE, |
| 10373 | "Coldn't pass " |
| 10374 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 10375 | } |
| 10376 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 10377 | else |
| 10378 | hddLog(LOGE, |
| 10379 | "Could not pass on " |
| 10380 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 10381 | |
| 10382 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 10383 | beaconIE's need to be populated in probe response frames */ |
| 10384 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 10385 | { |
| 10386 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 10387 | u8 probe_rsp_ie_len[3] = {0}; |
| 10388 | u8 counter = 0; |
| 10389 | |
| 10390 | /* Check Probe Resp Length if it is greater then 255 then |
| 10391 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 10392 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 10393 | not able Store More then 255 bytes into One Variable */ |
| 10394 | |
| 10395 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 10396 | { |
| 10397 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 10398 | { |
| 10399 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 10400 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 10401 | } |
| 10402 | else |
| 10403 | { |
| 10404 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 10405 | rem_probe_resp_ie_len = 0; |
| 10406 | } |
| 10407 | } |
| 10408 | |
| 10409 | rem_probe_resp_ie_len = 0; |
| 10410 | |
| 10411 | if (probe_rsp_ie_len[0] > 0) |
| 10412 | { |
| 10413 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10414 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 10415 | (tANI_U8*)(genie - 2), |
| 10416 | probe_rsp_ie_len[0], NULL, |
| 10417 | eANI_BOOLEAN_FALSE) |
| 10418 | == eHAL_STATUS_FAILURE) |
| 10419 | { |
| 10420 | hddLog(LOGE, |
| 10421 | "Could not pass" |
| 10422 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 10423 | } |
| 10424 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 10425 | } |
| 10426 | |
| 10427 | if (probe_rsp_ie_len[1] > 0) |
| 10428 | { |
| 10429 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10430 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 10431 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10432 | probe_rsp_ie_len[1], NULL, |
| 10433 | eANI_BOOLEAN_FALSE) |
| 10434 | == eHAL_STATUS_FAILURE) |
| 10435 | { |
| 10436 | hddLog(LOGE, |
| 10437 | "Could not pass" |
| 10438 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 10439 | } |
| 10440 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 10441 | } |
| 10442 | |
| 10443 | if (probe_rsp_ie_len[2] > 0) |
| 10444 | { |
| 10445 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10446 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 10447 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10448 | probe_rsp_ie_len[2], NULL, |
| 10449 | eANI_BOOLEAN_FALSE) |
| 10450 | == eHAL_STATUS_FAILURE) |
| 10451 | { |
| 10452 | hddLog(LOGE, |
| 10453 | "Could not pass" |
| 10454 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 10455 | } |
| 10456 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 10457 | } |
| 10458 | |
| 10459 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10460 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 10461 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10462 | { |
| 10463 | hddLog(LOGE, |
| 10464 | "Could not pass" |
| 10465 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 10466 | } |
| 10467 | } |
| 10468 | else |
| 10469 | { |
| 10470 | // Reset WNI_CFG_PROBE_RSP Flags |
| 10471 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 10472 | |
| 10473 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10474 | "%s: No Probe Response IE received in set beacon", |
| 10475 | __func__); |
| 10476 | } |
| 10477 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10478 | break; |
| 10479 | case DOT11F_EID_RSN: |
| 10480 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 10481 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 10482 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 10483 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 10484 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 10485 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10486 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 10487 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10488 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10489 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10490 | 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] | 10491 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10492 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10493 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10494 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10495 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10496 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10497 | VOS_ASSERT(0); |
| 10498 | return -ENOMEM; |
| 10499 | } |
| 10500 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10501 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10502 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10503 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10504 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10505 | break; |
| 10506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10507 | #ifdef FEATURE_WLAN_WAPI |
| 10508 | case WLAN_EID_WAPI: |
| 10509 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 10510 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10511 | pAdapter->wapi_info.nWapiMode); |
| 10512 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10513 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10514 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 10515 | tmp = tmp + 1; |
| 10516 | akmlist = (int *)(tmp); |
| 10517 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 10518 | { |
| 10519 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 10520 | } |
| 10521 | else |
| 10522 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10523 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10524 | VOS_ASSERT(0); |
| 10525 | return -EINVAL; |
| 10526 | } |
| 10527 | |
| 10528 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 10529 | { |
| 10530 | 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] | 10531 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10532 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10534 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10535 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10536 | 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] | 10537 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10538 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 10539 | } |
| 10540 | break; |
| 10541 | #endif |
| 10542 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10543 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10544 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10545 | /* when Unknown IE is received we should break and continue |
| 10546 | * to the next IE in the buffer instead we were returning |
| 10547 | * so changing this to break */ |
| 10548 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10549 | } |
| 10550 | genie += eLen; |
| 10551 | remLen -= eLen; |
| 10552 | } |
| 10553 | EXIT(); |
| 10554 | return 0; |
| 10555 | } |
| 10556 | |
| 10557 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 10558 | * FUNCTION: hdd_isWPAIEPresent |
| 10559 | * Parse the received IE to find the WPA IE |
| 10560 | * |
| 10561 | */ |
| 10562 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 10563 | { |
| 10564 | v_U8_t eLen = 0; |
| 10565 | v_U16_t remLen = ie_len; |
| 10566 | v_U8_t elementId = 0; |
| 10567 | |
| 10568 | while (remLen >= 2) |
| 10569 | { |
| 10570 | elementId = *ie++; |
| 10571 | eLen = *ie++; |
| 10572 | remLen -= 2; |
| 10573 | if (eLen > remLen) |
| 10574 | { |
| 10575 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10576 | "%s: IE length is wrong %d", __func__, eLen); |
| 10577 | return FALSE; |
| 10578 | } |
| 10579 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 10580 | { |
| 10581 | /* OUI - 0x00 0X50 0XF2 |
| 10582 | WPA Information Element - 0x01 |
| 10583 | WPA version - 0x01*/ |
| 10584 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 10585 | return TRUE; |
| 10586 | } |
| 10587 | ie += eLen; |
| 10588 | remLen -= eLen; |
| 10589 | } |
| 10590 | return FALSE; |
| 10591 | } |
| 10592 | |
| 10593 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10594 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10595 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | * parameters during connect operation. |
| 10597 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10598 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10599 | struct cfg80211_connect_params *req |
| 10600 | ) |
| 10601 | { |
| 10602 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10603 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10604 | ENTER(); |
| 10605 | |
| 10606 | /*set wpa version*/ |
| 10607 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 10608 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10609 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10610 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 10611 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10612 | { |
| 10613 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 10614 | } |
| 10615 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 10616 | { |
| 10617 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 10618 | } |
| 10619 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10620 | |
| 10621 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10622 | pWextState->wpaVersion); |
| 10623 | |
| 10624 | /*set authentication type*/ |
| 10625 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 10626 | |
| 10627 | if (0 > status) |
| 10628 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10629 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10630 | "%s: failed to set authentication type ", __func__); |
| 10631 | return status; |
| 10632 | } |
| 10633 | |
| 10634 | /*set key mgmt type*/ |
| 10635 | if (req->crypto.n_akm_suites) |
| 10636 | { |
| 10637 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 10638 | if (0 > status) |
| 10639 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10640 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10641 | __func__); |
| 10642 | return status; |
| 10643 | } |
| 10644 | } |
| 10645 | |
| 10646 | /*set pairwise cipher type*/ |
| 10647 | if (req->crypto.n_ciphers_pairwise) |
| 10648 | { |
| 10649 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 10650 | req->crypto.ciphers_pairwise[0], true); |
| 10651 | if (0 > status) |
| 10652 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10654 | "%s: failed to set unicast cipher type", __func__); |
| 10655 | return status; |
| 10656 | } |
| 10657 | } |
| 10658 | else |
| 10659 | { |
| 10660 | /*Reset previous cipher suite to none*/ |
| 10661 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 10662 | if (0 > status) |
| 10663 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10664 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10665 | "%s: failed to set unicast cipher type", __func__); |
| 10666 | return status; |
| 10667 | } |
| 10668 | } |
| 10669 | |
| 10670 | /*set group cipher type*/ |
| 10671 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 10672 | false); |
| 10673 | |
| 10674 | if (0 > status) |
| 10675 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10676 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10677 | __func__); |
| 10678 | return status; |
| 10679 | } |
| 10680 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10681 | #ifdef WLAN_FEATURE_11W |
| 10682 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 10683 | #endif |
| 10684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10685 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 10686 | if (req->ie_len) |
| 10687 | { |
| 10688 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 10689 | if ( 0 > status) |
| 10690 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10691 | 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] | 10692 | __func__); |
| 10693 | return status; |
| 10694 | } |
| 10695 | } |
| 10696 | |
| 10697 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10698 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10699 | { |
| 10700 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 10701 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 10702 | ) |
| 10703 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10704 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10705 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 10706 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10707 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10708 | __func__); |
| 10709 | return -EOPNOTSUPP; |
| 10710 | } |
| 10711 | else |
| 10712 | { |
| 10713 | u8 key_len = req->key_len; |
| 10714 | u8 key_idx = req->key_idx; |
| 10715 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10716 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10717 | && (CSR_MAX_NUM_KEY > key_idx) |
| 10718 | ) |
| 10719 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10720 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10721 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10722 | __func__, key_idx, key_len); |
| 10723 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10724 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10725 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10726 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10727 | (u8)key_len; |
| 10728 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 10729 | } |
| 10730 | } |
| 10731 | } |
| 10732 | } |
| 10733 | |
| 10734 | return status; |
| 10735 | } |
| 10736 | |
| 10737 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10738 | * FUNCTION: wlan_hdd_try_disconnect |
| 10739 | * This function is used to disconnect from previous |
| 10740 | * connection |
| 10741 | */ |
| 10742 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 10743 | { |
| 10744 | long ret = 0; |
| 10745 | hdd_station_ctx_t *pHddStaCtx; |
| 10746 | eMib_dot11DesiredBssType connectedBssType; |
| 10747 | |
| 10748 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10749 | |
| 10750 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 10751 | |
| 10752 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 10753 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 10754 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 10755 | { |
| 10756 | /* Issue disconnect to CSR */ |
| 10757 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10758 | if( eHAL_STATUS_SUCCESS == |
| 10759 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10760 | pAdapter->sessionId, |
| 10761 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 10762 | { |
| 10763 | ret = wait_for_completion_interruptible_timeout( |
| 10764 | &pAdapter->disconnect_comp_var, |
| 10765 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10766 | if (0 >= ret) |
| 10767 | { |
| 10768 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10769 | return -EALREADY; |
| 10770 | } |
| 10771 | } |
| 10772 | } |
| 10773 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 10774 | { |
| 10775 | ret = wait_for_completion_interruptible_timeout( |
| 10776 | &pAdapter->disconnect_comp_var, |
| 10777 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10778 | if (0 >= ret) |
| 10779 | { |
| 10780 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 10781 | return -EALREADY; |
| 10782 | } |
| 10783 | } |
| 10784 | |
| 10785 | return 0; |
| 10786 | } |
| 10787 | |
| 10788 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10789 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 10790 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10791 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10792 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10793 | struct net_device *ndev, |
| 10794 | struct cfg80211_connect_params *req |
| 10795 | ) |
| 10796 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10797 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10798 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10799 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 10800 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10801 | |
| 10802 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10803 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10804 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10805 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 10806 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10807 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10808 | "%s: device_mode = %s (%d)", __func__, |
| 10809 | hdd_device_modetoString(pAdapter->device_mode), |
| 10810 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10811 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10812 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10813 | if (!pHddCtx) |
| 10814 | { |
| 10815 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10816 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10817 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10818 | } |
| 10819 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10820 | status = wlan_hdd_validate_context(pHddCtx); |
| 10821 | |
| 10822 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10823 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10824 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10825 | "%s: HDD context is not valid", __func__); |
| 10826 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10827 | } |
| 10828 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10829 | if (vos_max_concurrent_connections_reached()) { |
| 10830 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10831 | return -ECONNREFUSED; |
| 10832 | } |
| 10833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10834 | #ifdef WLAN_BTAMP_FEATURE |
| 10835 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10836 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10837 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10838 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10839 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 10840 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10841 | } |
| 10842 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10843 | |
| 10844 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 10845 | //P2P Mode will be taken care in Open/close adapter |
| 10846 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10847 | (vos_concurrent_open_sessions_running())) { |
| 10848 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 10849 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 10850 | } |
| 10851 | |
| 10852 | /*Try disconnecting if already in connected state*/ |
| 10853 | status = wlan_hdd_try_disconnect(pAdapter); |
| 10854 | if ( 0 > status) |
| 10855 | { |
| 10856 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 10857 | " connection")); |
| 10858 | return -EALREADY; |
| 10859 | } |
| 10860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10861 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10862 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10863 | |
| 10864 | if ( 0 > status) |
| 10865 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10866 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10867 | __func__); |
| 10868 | return status; |
| 10869 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10870 | if ( req->channel ) |
| 10871 | { |
| 10872 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 10873 | req->ssid_len, req->bssid, |
| 10874 | req->channel->hw_value); |
| 10875 | } |
| 10876 | else |
| 10877 | { |
| 10878 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10879 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 10880 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10881 | |
| 10882 | if (0 > status) |
| 10883 | { |
| 10884 | //ReEnable BMPS if disabled |
| 10885 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 10886 | (NULL != pHddCtx)) |
| 10887 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 10888 | if (pHddCtx->hdd_wlan_suspended) |
| 10889 | { |
| 10890 | hdd_set_pwrparams(pHddCtx); |
| 10891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | //ReEnable Bmps and Imps back |
| 10893 | hdd_enable_bmps_imps(pHddCtx); |
| 10894 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10895 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10896 | return status; |
| 10897 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10898 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10899 | EXIT(); |
| 10900 | return status; |
| 10901 | } |
| 10902 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10903 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 10904 | struct net_device *ndev, |
| 10905 | struct cfg80211_connect_params *req) |
| 10906 | { |
| 10907 | int ret; |
| 10908 | vos_ssr_protect(__func__); |
| 10909 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 10910 | vos_ssr_unprotect(__func__); |
| 10911 | |
| 10912 | return ret; |
| 10913 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10914 | |
| 10915 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10916 | * FUNCTION: wlan_hdd_disconnect |
| 10917 | * This function is used to issue a disconnect request to SME |
| 10918 | */ |
| 10919 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 10920 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10921 | int status; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10922 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10923 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10924 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10925 | |
| 10926 | status = wlan_hdd_validate_context(pHddCtx); |
| 10927 | |
| 10928 | if (0 != status) |
| 10929 | { |
| 10930 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10931 | "%s: HDD context is not valid", __func__); |
| 10932 | return status; |
| 10933 | } |
| 10934 | |
| 10935 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10936 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10937 | /* Need to apply spin lock before decreasing active sessions |
| 10938 | * as there can be chance for double decrement if context switch |
| 10939 | * Calls hdd_DisConnectHandler. |
| 10940 | */ |
| 10941 | |
| 10942 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10943 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 10944 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10945 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 10946 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10947 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 10948 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 10949 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10950 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 10951 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 10952 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10953 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10954 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 10955 | /* |
| 10956 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 10957 | * tx has to be disabled because the firmware can get busy dropping |
| 10958 | * the tx frames after BSS/STA has been deleted and will not send |
| 10959 | * back a response resulting in WDI timeout |
| 10960 | */ |
| 10961 | netif_tx_disable(pAdapter->dev); |
| 10962 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10963 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 10964 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10965 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10966 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10967 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 10968 | { |
| 10969 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10970 | FL("status = %d, already disconnected"), |
| 10971 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10972 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10973 | } |
| 10974 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10975 | { |
| 10976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10977 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10978 | __func__, (int)status ); |
| 10979 | return -EINVAL; |
| 10980 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10981 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 10982 | &pAdapter->disconnect_comp_var, |
| 10983 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10984 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10985 | { |
| 10986 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10987 | "%s: Failed to disconnect, timed out", __func__); |
| 10988 | return -ETIMEDOUT; |
| 10989 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10990 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10991 | { |
| 10992 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10993 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10994 | return ret; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10995 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 10996 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10997 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 10998 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 10999 | |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11000 | return 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11001 | } |
| 11002 | |
| 11003 | |
| 11004 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11005 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11006 | * This function is used to issue a disconnect request to SME |
| 11007 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11008 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | struct net_device *dev, |
| 11010 | u16 reason |
| 11011 | ) |
| 11012 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11013 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11014 | tCsrRoamProfile *pRoamProfile = |
| 11015 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11016 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11017 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11018 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11019 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11020 | tANI_U8 staIdx; |
| 11021 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11023 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11024 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11025 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11026 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 11027 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11028 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 11029 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11030 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11031 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11032 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 11033 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11034 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11035 | status = wlan_hdd_validate_context(pHddCtx); |
| 11036 | |
| 11037 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11039 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11040 | "%s: HDD context is not valid", __func__); |
| 11041 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11042 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11044 | if (NULL != pRoamProfile) |
| 11045 | { |
| 11046 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 11047 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 11048 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11049 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11050 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11051 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11052 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11053 | switch(reason) |
| 11054 | { |
| 11055 | case WLAN_REASON_MIC_FAILURE: |
| 11056 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 11057 | break; |
| 11058 | |
| 11059 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 11060 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 11061 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 11062 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 11063 | break; |
| 11064 | |
| 11065 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 11066 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 11067 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11068 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 11069 | break; |
| 11070 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11071 | default: |
| 11072 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 11073 | break; |
| 11074 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11075 | pScanInfo = &pHddCtx->scan_info; |
| 11076 | if (pScanInfo->mScanPending) |
| 11077 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 11078 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11079 | "Aborting Scan"); |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 11080 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 11081 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11082 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11083 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11084 | #ifdef FEATURE_WLAN_TDLS |
| 11085 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11086 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11087 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11088 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 11089 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11090 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11091 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11092 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11093 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11094 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11095 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11096 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11097 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11098 | pAdapter->sessionId, |
| 11099 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11100 | } |
| 11101 | } |
| 11102 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11103 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11104 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 11105 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11106 | { |
| 11107 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11108 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11109 | __func__, (int)status ); |
| 11110 | return -EINVAL; |
| 11111 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11112 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 11113 | else |
| 11114 | { |
| 11115 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 11116 | "called while in %d state", __func__, |
| 11117 | pHddStaCtx->conn_info.connState); |
| 11118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11119 | } |
| 11120 | else |
| 11121 | { |
| 11122 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 11123 | } |
| 11124 | |
| 11125 | return status; |
| 11126 | } |
| 11127 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11128 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 11129 | struct net_device *dev, |
| 11130 | u16 reason |
| 11131 | ) |
| 11132 | { |
| 11133 | int ret; |
| 11134 | vos_ssr_protect(__func__); |
| 11135 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 11136 | vos_ssr_unprotect(__func__); |
| 11137 | |
| 11138 | return ret; |
| 11139 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11141 | /* |
| 11142 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11143 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11144 | * settings in IBSS mode. |
| 11145 | */ |
| 11146 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11147 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11148 | struct cfg80211_ibss_params *params |
| 11149 | ) |
| 11150 | { |
| 11151 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11152 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11153 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11154 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11156 | ENTER(); |
| 11157 | |
| 11158 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 11159 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11160 | |
| 11161 | if (params->ie_len && ( NULL != params->ie) ) |
| 11162 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11163 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 11164 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11165 | { |
| 11166 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11167 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11168 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11169 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11170 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11171 | tDot11fIEWPA dot11WPAIE; |
| 11172 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11173 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11174 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 11175 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11176 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 11177 | params->ie_len, DOT11F_EID_WPA); |
| 11178 | if ( NULL != ie ) |
| 11179 | { |
| 11180 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11181 | // Unpack the WPA IE |
| 11182 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 11183 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 11184 | &ie[2+4], |
| 11185 | ie[1] - 4, |
| 11186 | &dot11WPAIE); |
| 11187 | /*Extract the multicast cipher, the encType for unicast |
| 11188 | cipher for wpa-none is none*/ |
| 11189 | encryptionType = |
| 11190 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 11191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11192 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11193 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11194 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 11195 | |
| 11196 | if (0 > status) |
| 11197 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11198 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11199 | __func__); |
| 11200 | return status; |
| 11201 | } |
| 11202 | } |
| 11203 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11204 | pWextState->roamProfile.AuthType.authType[0] = |
| 11205 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11206 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11207 | |
| 11208 | if (params->privacy) |
| 11209 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11210 | /* Security enabled IBSS, At this time there is no information available |
| 11211 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11212 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11213 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11214 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11215 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | *enable privacy bit in beacons */ |
| 11217 | |
| 11218 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 11219 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11220 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11221 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11222 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11223 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 11224 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11225 | return status; |
| 11226 | } |
| 11227 | |
| 11228 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11229 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11230 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11231 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11232 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11233 | struct net_device *dev, |
| 11234 | struct cfg80211_ibss_params *params |
| 11235 | ) |
| 11236 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11237 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11238 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11239 | tCsrRoamProfile *pRoamProfile; |
| 11240 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11241 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11242 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11243 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11244 | |
| 11245 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11246 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11247 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11248 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 11249 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11250 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11251 | "%s: device_mode = %s (%d)", __func__, |
| 11252 | hdd_device_modetoString(pAdapter->device_mode), |
| 11253 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11254 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11255 | status = wlan_hdd_validate_context(pHddCtx); |
| 11256 | |
| 11257 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11258 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11259 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11260 | "%s: HDD context is not valid", __func__); |
| 11261 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11262 | } |
| 11263 | |
| 11264 | if (NULL == pWextState) |
| 11265 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11266 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11267 | __func__); |
| 11268 | return -EIO; |
| 11269 | } |
| 11270 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11271 | if (vos_max_concurrent_connections_reached()) { |
| 11272 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11273 | return -ECONNREFUSED; |
| 11274 | } |
| 11275 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11276 | /*Try disconnecting if already in connected state*/ |
| 11277 | status = wlan_hdd_try_disconnect(pAdapter); |
| 11278 | if ( 0 > status) |
| 11279 | { |
| 11280 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11281 | " IBSS connection")); |
| 11282 | return -EALREADY; |
| 11283 | } |
| 11284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11285 | pRoamProfile = &pWextState->roamProfile; |
| 11286 | |
| 11287 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 11288 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11289 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11290 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11291 | return -EINVAL; |
| 11292 | } |
| 11293 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11294 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 11295 | if (NULL != params->bssid) { |
| 11296 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11297 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 11298 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11299 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11300 | return -EIO; |
| 11301 | } |
| 11302 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11303 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 11304 | { |
| 11305 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11306 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 11307 | { |
| 11308 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11309 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11310 | return -EIO; |
| 11311 | } |
| 11312 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 11313 | if (!params->bssid) |
| 11314 | { |
| 11315 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11316 | "%s:Failed memory allocation", __func__); |
| 11317 | return -EIO; |
| 11318 | } |
| 11319 | vos_mem_copy((v_U8_t *)params->bssid, |
| 11320 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 11321 | VOS_MAC_ADDR_SIZE); |
| 11322 | alloc_bssid = VOS_TRUE; |
| 11323 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11325 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11326 | if (NULL != |
| 11327 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11328 | params->chandef.chan) |
| 11329 | #else |
| 11330 | params->channel) |
| 11331 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11332 | { |
| 11333 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11334 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 11335 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 11336 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11337 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11338 | |
| 11339 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11340 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11341 | ieee80211_frequency_to_channel( |
| 11342 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11343 | params->chandef.chan->center_freq); |
| 11344 | #else |
| 11345 | params->channel->center_freq); |
| 11346 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11347 | |
| 11348 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 11349 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11350 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11351 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 11352 | __func__); |
| 11353 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11354 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11355 | |
| 11356 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11357 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11358 | if (channelNum == validChan[indx]) |
| 11359 | { |
| 11360 | break; |
| 11361 | } |
| 11362 | } |
| 11363 | if (indx >= numChans) |
| 11364 | { |
| 11365 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11366 | __func__, channelNum); |
| 11367 | return -EINVAL; |
| 11368 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11369 | /* Set the Operational Channel */ |
| 11370 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 11371 | channelNum); |
| 11372 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11373 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 11374 | pRoamProfile->ChannelInfo.ChannelList = |
| 11375 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | } |
| 11377 | |
| 11378 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11379 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11380 | if (status < 0) |
| 11381 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11382 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11383 | __func__); |
| 11384 | return status; |
| 11385 | } |
| 11386 | |
| 11387 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11388 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11389 | params->ssid_len, params->bssid, |
| 11390 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11391 | |
| 11392 | if (0 > status) |
| 11393 | { |
| 11394 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 11395 | return status; |
| 11396 | } |
| 11397 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11398 | if (NULL != params->bssid && |
| 11399 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 11400 | alloc_bssid == VOS_TRUE) |
| 11401 | { |
| 11402 | vos_mem_free(params->bssid); |
| 11403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11404 | return 0; |
| 11405 | } |
| 11406 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11407 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 11408 | struct net_device *dev, |
| 11409 | struct cfg80211_ibss_params *params |
| 11410 | ) |
| 11411 | { |
| 11412 | int ret = 0; |
| 11413 | |
| 11414 | vos_ssr_protect(__func__); |
| 11415 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 11416 | vos_ssr_unprotect(__func__); |
| 11417 | |
| 11418 | return ret; |
| 11419 | } |
| 11420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11421 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11422 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11423 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11424 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11425 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11426 | struct net_device *dev |
| 11427 | ) |
| 11428 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11429 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11430 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11431 | tCsrRoamProfile *pRoamProfile; |
| 11432 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11433 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11434 | |
| 11435 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11436 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11437 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11438 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 11439 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11440 | status = wlan_hdd_validate_context(pHddCtx); |
| 11441 | |
| 11442 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11443 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11444 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11445 | "%s: HDD context is not valid", __func__); |
| 11446 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11447 | } |
| 11448 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11449 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 11450 | hdd_device_modetoString(pAdapter->device_mode), |
| 11451 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11452 | if (NULL == pWextState) |
| 11453 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11454 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11455 | __func__); |
| 11456 | return -EIO; |
| 11457 | } |
| 11458 | |
| 11459 | pRoamProfile = &pWextState->roamProfile; |
| 11460 | |
| 11461 | /* Issue disconnect only if interface type is set to IBSS */ |
| 11462 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 11463 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11464 | 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] | 11465 | __func__); |
| 11466 | return -EINVAL; |
| 11467 | } |
| 11468 | |
| 11469 | /* Issue Disconnect request */ |
| 11470 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11471 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 11472 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 11473 | |
| 11474 | return 0; |
| 11475 | } |
| 11476 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11477 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 11478 | struct net_device *dev |
| 11479 | ) |
| 11480 | { |
| 11481 | int ret = 0; |
| 11482 | |
| 11483 | vos_ssr_protect(__func__); |
| 11484 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 11485 | vos_ssr_unprotect(__func__); |
| 11486 | |
| 11487 | return ret; |
| 11488 | } |
| 11489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11490 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11491 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11492 | * This function is used to set the phy parameters |
| 11493 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 11494 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11495 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11496 | u32 changed) |
| 11497 | { |
| 11498 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 11499 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11500 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11501 | |
| 11502 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11503 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11504 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 11505 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11506 | status = wlan_hdd_validate_context(pHddCtx); |
| 11507 | |
| 11508 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11509 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11510 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11511 | "%s: HDD context is not valid", __func__); |
| 11512 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11513 | } |
| 11514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11515 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 11516 | { |
| 11517 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 11518 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 11519 | wiphy->rts_threshold; |
| 11520 | |
| 11521 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11522 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11523 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11524 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11525 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11526 | __func__, rts_threshold); |
| 11527 | return -EINVAL; |
| 11528 | } |
| 11529 | |
| 11530 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 11531 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11532 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11533 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11534 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11535 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11536 | __func__, rts_threshold); |
| 11537 | return -EIO; |
| 11538 | } |
| 11539 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11540 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11541 | rts_threshold); |
| 11542 | } |
| 11543 | |
| 11544 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 11545 | { |
| 11546 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 11547 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 11548 | wiphy->frag_threshold; |
| 11549 | |
| 11550 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11551 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11552 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11553 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11554 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11555 | frag_threshold); |
| 11556 | return -EINVAL; |
| 11557 | } |
| 11558 | |
| 11559 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 11560 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11561 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11562 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11563 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11564 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11565 | __func__, frag_threshold); |
| 11566 | return -EIO; |
| 11567 | } |
| 11568 | |
| 11569 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 11570 | frag_threshold); |
| 11571 | } |
| 11572 | |
| 11573 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 11574 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 11575 | { |
| 11576 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 11577 | wiphy->retry_short : |
| 11578 | wiphy->retry_long; |
| 11579 | |
| 11580 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 11581 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 11582 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11583 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11584 | __func__, retry_value); |
| 11585 | return -EINVAL; |
| 11586 | } |
| 11587 | |
| 11588 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 11589 | { |
| 11590 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 11591 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11592 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11593 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11594 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11595 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11596 | __func__, retry_value); |
| 11597 | return -EIO; |
| 11598 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11599 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11600 | __func__, retry_value); |
| 11601 | } |
| 11602 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 11603 | { |
| 11604 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 11605 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11606 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11607 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11608 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11609 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11610 | __func__, retry_value); |
| 11611 | return -EIO; |
| 11612 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11613 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11614 | __func__, retry_value); |
| 11615 | } |
| 11616 | } |
| 11617 | |
| 11618 | return 0; |
| 11619 | } |
| 11620 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11621 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 11622 | u32 changed) |
| 11623 | { |
| 11624 | int ret; |
| 11625 | |
| 11626 | vos_ssr_protect(__func__); |
| 11627 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 11628 | vos_ssr_unprotect(__func__); |
| 11629 | |
| 11630 | return ret; |
| 11631 | } |
| 11632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11633 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11634 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11635 | * This function is used to set the txpower |
| 11636 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11637 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11638 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11639 | struct wireless_dev *wdev, |
| 11640 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11641 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11642 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11643 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11644 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11645 | #endif |
| 11646 | int dbm) |
| 11647 | { |
| 11648 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11649 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11650 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 11651 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11652 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11653 | |
| 11654 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11655 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11656 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 11657 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11658 | status = wlan_hdd_validate_context(pHddCtx); |
| 11659 | |
| 11660 | if (0 != status) |
| 11661 | { |
| 11662 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11663 | "%s: HDD context is not valid", __func__); |
| 11664 | return status; |
| 11665 | } |
| 11666 | |
| 11667 | hHal = pHddCtx->hHal; |
| 11668 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11669 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 11670 | dbm, ccmCfgSetCallback, |
| 11671 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11672 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11673 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11674 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 11675 | return -EIO; |
| 11676 | } |
| 11677 | |
| 11678 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 11679 | dbm); |
| 11680 | |
| 11681 | switch(type) |
| 11682 | { |
| 11683 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 11684 | /* Fall through */ |
| 11685 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 11686 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 11687 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11688 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 11689 | __func__); |
| 11690 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11691 | } |
| 11692 | break; |
| 11693 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11694 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11695 | __func__); |
| 11696 | return -EOPNOTSUPP; |
| 11697 | break; |
| 11698 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11699 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 11700 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11701 | return -EIO; |
| 11702 | } |
| 11703 | |
| 11704 | return 0; |
| 11705 | } |
| 11706 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 11707 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 11708 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11709 | struct wireless_dev *wdev, |
| 11710 | #endif |
| 11711 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11712 | enum tx_power_setting type, |
| 11713 | #else |
| 11714 | enum nl80211_tx_power_setting type, |
| 11715 | #endif |
| 11716 | int dbm) |
| 11717 | { |
| 11718 | int ret; |
| 11719 | vos_ssr_protect(__func__); |
| 11720 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 11721 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11722 | wdev, |
| 11723 | #endif |
| 11724 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 11725 | type, |
| 11726 | #else |
| 11727 | type, |
| 11728 | #endif |
| 11729 | dbm); |
| 11730 | vos_ssr_unprotect(__func__); |
| 11731 | |
| 11732 | return ret; |
| 11733 | } |
| 11734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11735 | /* |
| 11736 | * FUNCTION: wlan_hdd_cfg80211_get_txpower |
| 11737 | * This function is used to read the txpower |
| 11738 | */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11739 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 11740 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 11741 | struct wireless_dev *wdev, |
| 11742 | #endif |
| 11743 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11744 | { |
| 11745 | |
| 11746 | hdd_adapter_t *pAdapter; |
| 11747 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11748 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11749 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11750 | ENTER(); |
| 11751 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11752 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11753 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11754 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11755 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11756 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11757 | "%s: HDD context is not valid", __func__); |
| 11758 | *dbm = 0; |
| 11759 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11760 | } |
| 11761 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11762 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 11763 | if (NULL == pAdapter) |
| 11764 | { |
| 11765 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 11766 | return -ENOENT; |
| 11767 | } |
| 11768 | |
| 11769 | wlan_hdd_get_classAstats(pAdapter); |
| 11770 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 11771 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11772 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11773 | return 0; |
| 11774 | } |
| 11775 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11776 | 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] | 11777 | u8* mac, struct station_info *sinfo) |
| 11778 | { |
| 11779 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 11780 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11781 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11782 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11783 | |
| 11784 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 11785 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11786 | |
| 11787 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 11788 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 11789 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 11790 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 11791 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 11792 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 11793 | tANI_U16 maxRate = 0; |
| 11794 | tANI_U16 myRate; |
| 11795 | tANI_U16 currentRate = 0; |
| 11796 | tANI_U8 maxSpeedMCS = 0; |
| 11797 | tANI_U8 maxMCSIdx = 0; |
| 11798 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11799 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 11800 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11801 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11802 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11803 | #ifdef WLAN_FEATURE_11AC |
| 11804 | tANI_U32 vht_mcs_map; |
| 11805 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 11806 | #endif /* WLAN_FEATURE_11AC */ |
| 11807 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11808 | ENTER(); |
| 11809 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 11811 | (0 == ssidlen)) |
| 11812 | { |
| 11813 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 11814 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 11815 | /*To keep GUI happy*/ |
| 11816 | return 0; |
| 11817 | } |
| 11818 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 11819 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 11820 | { |
| 11821 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11822 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 11823 | return 0; |
| 11824 | } |
| 11825 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11826 | status = wlan_hdd_validate_context(pHddCtx); |
| 11827 | |
| 11828 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11829 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11830 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11831 | "%s: HDD context is not valid", __func__); |
| 11832 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11833 | } |
| 11834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11835 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 11836 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 11837 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 11838 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 11839 | wlan_hdd_get_station_stats(pAdapter); |
| 11840 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 11841 | |
| 11842 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11843 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 11844 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11845 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11846 | { |
| 11847 | rate_flags = pAdapter->maxRateFlags; |
| 11848 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 11849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11850 | //convert to the UI units of 100kbps |
| 11851 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 11852 | |
| 11853 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11854 | 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] | 11855 | sinfo->signal, |
| 11856 | pCfg->reportMaxLinkSpeed, |
| 11857 | myRate, |
| 11858 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11859 | (int) pCfg->linkSpeedRssiMid, |
| 11860 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11861 | (int) rate_flags, |
| 11862 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11863 | #endif //LINKSPEED_DEBUG_ENABLED |
| 11864 | |
| 11865 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 11866 | { |
| 11867 | // we do not want to necessarily report the current speed |
| 11868 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 11869 | { |
| 11870 | // report the max possible speed |
| 11871 | rssidx = 0; |
| 11872 | } |
| 11873 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 11874 | { |
| 11875 | // report the max possible speed with RSSI scaling |
| 11876 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 11877 | { |
| 11878 | // report the max possible speed |
| 11879 | rssidx = 0; |
| 11880 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11881 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11882 | { |
| 11883 | // report middle speed |
| 11884 | rssidx = 1; |
| 11885 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11886 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 11887 | { |
| 11888 | // report middle speed |
| 11889 | rssidx = 2; |
| 11890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11891 | else |
| 11892 | { |
| 11893 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 11894 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11895 | } |
| 11896 | } |
| 11897 | else |
| 11898 | { |
| 11899 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 11900 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11901 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 11902 | __func__, pCfg->reportMaxLinkSpeed); |
| 11903 | rssidx = 0; |
| 11904 | } |
| 11905 | |
| 11906 | maxRate = 0; |
| 11907 | |
| 11908 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11909 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 11910 | OperationalRates, &ORLeng)) |
| 11911 | { |
| 11912 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11913 | /*To keep GUI happy*/ |
| 11914 | return 0; |
| 11915 | } |
| 11916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11917 | for (i = 0; i < ORLeng; i++) |
| 11918 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11919 | 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] | 11920 | { |
| 11921 | /* Validate Rate Set */ |
| 11922 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 11923 | { |
| 11924 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11925 | break; |
| 11926 | } |
| 11927 | } |
| 11928 | /* Update MAX rate */ |
| 11929 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11930 | } |
| 11931 | |
| 11932 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11933 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 11934 | ExtendedRates, &ERLeng)) |
| 11935 | { |
| 11936 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11937 | /*To keep GUI happy*/ |
| 11938 | return 0; |
| 11939 | } |
| 11940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11941 | for (i = 0; i < ERLeng; i++) |
| 11942 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11943 | 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] | 11944 | { |
| 11945 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 11946 | { |
| 11947 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 11948 | break; |
| 11949 | } |
| 11950 | } |
| 11951 | /* Update MAX rate */ |
| 11952 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 11953 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11954 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11955 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 11956 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 11957 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11958 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11959 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 11960 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 11961 | mode = 2; |
| 11962 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 11963 | mode = 1; |
| 11964 | else |
| 11965 | mode = 0; |
| 11966 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 11967 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 11968 | MCSRates, &MCSLeng)) |
| 11969 | { |
| 11970 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 11971 | /*To keep GUI happy*/ |
| 11972 | return 0; |
| 11973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11974 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11975 | #ifdef WLAN_FEATURE_11AC |
| 11976 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11977 | 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] | 11978 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11979 | 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] | 11980 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11981 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11982 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11983 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11984 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11985 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11986 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 11987 | maxMCSIdx = 7; |
| 11988 | } |
| 11989 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 11990 | { |
| 11991 | maxMCSIdx = 8; |
| 11992 | } |
| 11993 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 11994 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 11995 | //VHT20 is supporting 0~8 |
| 11996 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 11997 | maxMCSIdx = 8; |
| 11998 | else |
| 11999 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12000 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12001 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12002 | if (0 != rssidx)/*check for scaled */ |
| 12003 | { |
| 12004 | //get middle rate MCS index if rssi=1/2 |
| 12005 | for (i=0; i <= maxMCSIdx; i++) |
| 12006 | { |
| 12007 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12008 | { |
| 12009 | maxMCSIdx = i; |
| 12010 | break; |
| 12011 | } |
| 12012 | } |
| 12013 | } |
| 12014 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12015 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12016 | { |
| 12017 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 12018 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 12019 | } |
| 12020 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 12021 | { |
| 12022 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 12023 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 12024 | } |
| 12025 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12026 | { |
| 12027 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 12028 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 12029 | } |
| 12030 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12031 | maxSpeedMCS = 1; |
| 12032 | if (currentRate > maxRate) |
| 12033 | { |
| 12034 | maxRate = currentRate; |
| 12035 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12036 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12037 | } |
| 12038 | else |
| 12039 | #endif /* WLAN_FEATURE_11AC */ |
| 12040 | { |
| 12041 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12042 | { |
| 12043 | rateFlag |= 1; |
| 12044 | } |
| 12045 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12046 | { |
| 12047 | rateFlag |= 2; |
| 12048 | } |
| 12049 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 12050 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12051 | if (rssidx == 1 || rssidx == 2) |
| 12052 | { |
| 12053 | //get middle rate MCS index if rssi=1/2 |
| 12054 | for (i=0; i <= 7; i++) |
| 12055 | { |
| 12056 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12057 | { |
| 12058 | temp = i+1; |
| 12059 | break; |
| 12060 | } |
| 12061 | } |
| 12062 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12063 | |
| 12064 | for (i = 0; i < MCSLeng; i++) |
| 12065 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12066 | for (j = 0; j < temp; j++) |
| 12067 | { |
| 12068 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 12069 | { |
| 12070 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 12071 | break; |
| 12072 | } |
| 12073 | } |
| 12074 | if ((j < temp) && (currentRate > maxRate)) |
| 12075 | { |
| 12076 | maxRate = currentRate; |
| 12077 | maxSpeedMCS = 1; |
| 12078 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 12079 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12080 | } |
| 12081 | } |
| 12082 | } |
| 12083 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12084 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 12085 | { |
| 12086 | maxRate = myRate; |
| 12087 | maxSpeedMCS = 1; |
| 12088 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 12089 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12090 | // 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] | 12091 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12092 | { |
| 12093 | maxRate = myRate; |
| 12094 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 12095 | { |
| 12096 | maxSpeedMCS = 0; |
| 12097 | } |
| 12098 | else |
| 12099 | { |
| 12100 | maxSpeedMCS = 1; |
| 12101 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 12102 | } |
| 12103 | } |
| 12104 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12105 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12106 | { |
| 12107 | sinfo->txrate.legacy = maxRate; |
| 12108 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12109 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 12110 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12111 | } |
| 12112 | else |
| 12113 | { |
| 12114 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12115 | #ifdef WLAN_FEATURE_11AC |
| 12116 | sinfo->txrate.nss = 1; |
| 12117 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12118 | { |
| 12119 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12120 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12121 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12122 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12123 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12124 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12125 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12126 | } |
| 12127 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12128 | { |
| 12129 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12130 | } |
| 12131 | #endif /* WLAN_FEATURE_11AC */ |
| 12132 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 12133 | { |
| 12134 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 12135 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12136 | { |
| 12137 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12138 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12140 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12141 | { |
| 12142 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 12143 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12144 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12145 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12146 | pr_info("Reporting MCS rate %d flags %x\n", |
| 12147 | sinfo->txrate.mcs, |
| 12148 | sinfo->txrate.flags ); |
| 12149 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12150 | } |
| 12151 | } |
| 12152 | else |
| 12153 | { |
| 12154 | // report current rate instead of max rate |
| 12155 | |
| 12156 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 12157 | { |
| 12158 | //provide to the UI in units of 100kbps |
| 12159 | sinfo->txrate.legacy = myRate; |
| 12160 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12161 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 12162 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12163 | } |
| 12164 | else |
| 12165 | { |
| 12166 | //must be MCS |
| 12167 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12168 | #ifdef WLAN_FEATURE_11AC |
| 12169 | sinfo->txrate.nss = 1; |
| 12170 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12171 | { |
| 12172 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12173 | } |
| 12174 | else |
| 12175 | #endif /* WLAN_FEATURE_11AC */ |
| 12176 | { |
| 12177 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 12178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12179 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12180 | { |
| 12181 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 12182 | } |
| 12183 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12184 | { |
| 12185 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12186 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12187 | #ifdef WLAN_FEATURE_11AC |
| 12188 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12189 | { |
| 12190 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 12191 | } |
| 12192 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12193 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12194 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 12195 | sinfo->txrate.mcs, |
| 12196 | sinfo->txrate.flags ); |
| 12197 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12198 | } |
| 12199 | } |
| 12200 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 12201 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 12202 | sinfo->tx_packets = |
| 12203 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 12204 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 12205 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 12206 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 12207 | |
| 12208 | sinfo->tx_retries = |
| 12209 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 12210 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 12211 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 12212 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 12213 | |
| 12214 | sinfo->tx_failed = |
| 12215 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 12216 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 12217 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 12218 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 12219 | |
| 12220 | sinfo->filled |= |
| 12221 | STATION_INFO_TX_PACKETS | |
| 12222 | STATION_INFO_TX_RETRIES | |
| 12223 | STATION_INFO_TX_FAILED; |
| 12224 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12225 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12226 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 12227 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 12228 | EXIT(); |
| 12229 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12230 | } |
| 12231 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12232 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 12233 | u8* mac, struct station_info *sinfo) |
| 12234 | { |
| 12235 | int ret; |
| 12236 | |
| 12237 | vos_ssr_protect(__func__); |
| 12238 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 12239 | vos_ssr_unprotect(__func__); |
| 12240 | |
| 12241 | return ret; |
| 12242 | } |
| 12243 | |
| 12244 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 12245 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12246 | { |
| 12247 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12248 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12249 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12250 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12251 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12252 | ENTER(); |
| 12253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12254 | if (NULL == pAdapter) |
| 12255 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12256 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12257 | return -ENODEV; |
| 12258 | } |
| 12259 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12260 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12261 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 12262 | pAdapter->sessionId, timeout)); |
| 12263 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12264 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12265 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12266 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12267 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12268 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12269 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12270 | "%s: HDD context is not valid", __func__); |
| 12271 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12272 | } |
| 12273 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12274 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 12275 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 12276 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 12277 | (eConnectionState_Associated == |
| 12278 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 12279 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 12280 | |
| 12281 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12282 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 12283 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12284 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12285 | { |
| 12286 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12287 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12288 | __func__, vos_status); |
| 12289 | } |
| 12290 | } |
| 12291 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12292 | /**The get power cmd from the supplicant gets updated by the nl only |
| 12293 | *on successful execution of the function call |
| 12294 | *we are oppositely mapped w.r.t mode in the driver |
| 12295 | **/ |
| 12296 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 12297 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12298 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12299 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 12300 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12302 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12303 | return -EINVAL; |
| 12304 | } |
| 12305 | return 0; |
| 12306 | } |
| 12307 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12308 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 12309 | struct net_device *dev, bool mode, int timeout) |
| 12310 | { |
| 12311 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12312 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12313 | vos_ssr_protect(__func__); |
| 12314 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 12315 | vos_ssr_unprotect(__func__); |
| 12316 | |
| 12317 | return ret; |
| 12318 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12319 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12320 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 12321 | struct net_device *netdev, |
| 12322 | u8 key_index) |
| 12323 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12324 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | return 0; |
| 12326 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12327 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12328 | |
| 12329 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 12330 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12331 | struct net_device *dev, |
| 12332 | struct ieee80211_txq_params *params) |
| 12333 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12334 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12335 | return 0; |
| 12336 | } |
| 12337 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12338 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12339 | struct ieee80211_txq_params *params) |
| 12340 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12341 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12342 | return 0; |
| 12343 | } |
| 12344 | #endif //LINUX_VERSION_CODE |
| 12345 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12346 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12347 | struct net_device *dev, u8 *mac) |
| 12348 | { |
| 12349 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12350 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12351 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12352 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12353 | v_U8_t staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12354 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12355 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12356 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12357 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12358 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12359 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12360 | return -EINVAL; |
| 12361 | } |
| 12362 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12363 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12364 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 12365 | pAdapter->sessionId, pAdapter->device_mode)); |
| 12366 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12367 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12368 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12369 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12370 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12371 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12372 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12373 | "%s: HDD context is not valid", __func__); |
| 12374 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12375 | } |
| 12376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12377 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12378 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12379 | ) |
| 12380 | { |
| 12381 | if( NULL == mac ) |
| 12382 | { |
| 12383 | v_U16_t i; |
| 12384 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 12385 | { |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 12386 | if ((pAdapter->aStaInfo[i].isUsed) && |
| 12387 | (!pAdapter->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12388 | { |
| 12389 | u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes; |
| 12390 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12391 | "%s: Delete STA with MAC::" |
| 12392 | MAC_ADDRESS_STR, |
| 12393 | __func__, MAC_ADDR_ARRAY(macAddr)); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 12394 | vos_status = hdd_softap_sta_deauth(pAdapter, macAddr); |
| 12395 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12396 | pAdapter->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12397 | } |
| 12398 | } |
| 12399 | } |
| 12400 | else |
| 12401 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12402 | |
| 12403 | vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId); |
| 12404 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12405 | { |
| 12406 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12407 | "%s: Skip this DEL STA as this is not used::" |
| 12408 | MAC_ADDRESS_STR, |
| 12409 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12410 | return -ENOENT; |
| 12411 | } |
| 12412 | |
| 12413 | if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE) |
| 12414 | { |
| 12415 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12416 | "%s: Skip this DEL STA as deauth is in progress::" |
| 12417 | MAC_ADDRESS_STR, |
| 12418 | __func__, MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12419 | return -ENOENT; |
| 12420 | } |
| 12421 | |
| 12422 | pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE; |
| 12423 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12424 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12425 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12426 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12427 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12428 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12429 | |
| 12430 | vos_status = hdd_softap_sta_deauth(pAdapter, mac); |
| 12431 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12432 | { |
| 12433 | pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE; |
| 12434 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12435 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12436 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12437 | __func__, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12438 | MAC_ADDR_ARRAY(mac)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12439 | return -ENOENT; |
| 12440 | } |
| 12441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12442 | } |
| 12443 | } |
| 12444 | |
| 12445 | EXIT(); |
| 12446 | |
| 12447 | return 0; |
| 12448 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12449 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 12450 | struct net_device *dev, u8 *mac) |
| 12451 | { |
| 12452 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12453 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12454 | vos_ssr_protect(__func__); |
| 12455 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, mac); |
| 12456 | vos_ssr_unprotect(__func__); |
| 12457 | |
| 12458 | return ret; |
| 12459 | } |
| 12460 | |
| 12461 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12462 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 12463 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12464 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12465 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12466 | #ifdef FEATURE_WLAN_TDLS |
| 12467 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12468 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12469 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12470 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12471 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 12472 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12473 | mask = params->sta_flags_mask; |
| 12474 | |
| 12475 | set = params->sta_flags_set; |
| 12476 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12477 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 12478 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12479 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 12480 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 12481 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12482 | |
| 12483 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 12484 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12485 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 12486 | } |
| 12487 | } |
| 12488 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 12489 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12490 | } |
| 12491 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12492 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 12493 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 12494 | { |
| 12495 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12496 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12497 | vos_ssr_protect(__func__); |
| 12498 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 12499 | vos_ssr_unprotect(__func__); |
| 12500 | |
| 12501 | return ret; |
| 12502 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12503 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12504 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12505 | 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] | 12506 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12507 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12508 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12509 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12510 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12511 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12512 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12513 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12514 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12515 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12516 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12517 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12518 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12519 | return -EINVAL; |
| 12520 | } |
| 12521 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12522 | if (!pmksa) { |
| 12523 | hddLog(LOGE, FL("pmksa is NULL")); |
| 12524 | return -EINVAL; |
| 12525 | } |
| 12526 | |
| 12527 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 12528 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 12529 | pmksa->bssid, pmksa->pmkid); |
| 12530 | return -EINVAL; |
| 12531 | } |
| 12532 | |
| 12533 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 12534 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 12535 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12536 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12537 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12538 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12539 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12540 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12541 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12542 | "%s: HDD context is not valid", __func__); |
| 12543 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12544 | } |
| 12545 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12546 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12547 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12548 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12549 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 12550 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12551 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12552 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12553 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12554 | &pmk_id, 1, FALSE); |
| 12555 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12556 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12557 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 12558 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12559 | |
| 12560 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12561 | } |
| 12562 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12563 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 12564 | struct cfg80211_pmksa *pmksa) |
| 12565 | { |
| 12566 | int ret; |
| 12567 | |
| 12568 | vos_ssr_protect(__func__); |
| 12569 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 12570 | vos_ssr_unprotect(__func__); |
| 12571 | |
| 12572 | return ret; |
| 12573 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12574 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12575 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12576 | 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] | 12577 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12578 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12579 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12580 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12581 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12582 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12583 | |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12584 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 12585 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12586 | |
| 12587 | /* Validate pAdapter */ |
| 12588 | if (NULL == pAdapter) |
| 12589 | { |
| 12590 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 12591 | return -EINVAL; |
| 12592 | } |
| 12593 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12594 | if (!pmksa) { |
| 12595 | hddLog(LOGE, FL("pmksa is NULL")); |
| 12596 | return -EINVAL; |
| 12597 | } |
| 12598 | |
| 12599 | if (!pmksa->bssid) { |
| 12600 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 12601 | return -EINVAL; |
| 12602 | } |
| 12603 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12604 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12605 | status = wlan_hdd_validate_context(pHddCtx); |
| 12606 | |
| 12607 | if (0 != status) |
| 12608 | { |
| 12609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12610 | "%s: HDD context is not valid", __func__); |
| 12611 | return status; |
| 12612 | } |
| 12613 | |
| 12614 | /*Retrieve halHandle*/ |
| 12615 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12616 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12617 | /* Delete the PMKID CSR cache */ |
| 12618 | if (eHAL_STATUS_SUCCESS != |
| 12619 | sme_RoamDelPMKIDfromCache(halHandle, |
| 12620 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 12621 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 12622 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 12623 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12624 | } |
| 12625 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12626 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12627 | } |
| 12628 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12629 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12630 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 12631 | struct cfg80211_pmksa *pmksa) |
| 12632 | { |
| 12633 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12634 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12635 | vos_ssr_protect(__func__); |
| 12636 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 12637 | vos_ssr_unprotect(__func__); |
| 12638 | |
| 12639 | return ret; |
| 12640 | |
| 12641 | } |
| 12642 | |
| 12643 | 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] | 12644 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12645 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12646 | tHalHandle halHandle; |
| 12647 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12648 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12649 | |
| 12650 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 12651 | |
| 12652 | /* Validate pAdapter */ |
| 12653 | if (NULL == pAdapter) |
| 12654 | { |
| 12655 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12656 | "%s: Invalid Adapter" ,__func__); |
| 12657 | return -EINVAL; |
| 12658 | } |
| 12659 | |
| 12660 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12661 | status = wlan_hdd_validate_context(pHddCtx); |
| 12662 | |
| 12663 | if (0 != status) |
| 12664 | { |
| 12665 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12666 | "%s: HDD context is not valid", __func__); |
| 12667 | return status; |
| 12668 | } |
| 12669 | |
| 12670 | /*Retrieve halHandle*/ |
| 12671 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12672 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12673 | /* Flush the PMKID cache in CSR */ |
| 12674 | if (eHAL_STATUS_SUCCESS != |
| 12675 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 12676 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 12677 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 12678 | } |
| 12679 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 12680 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12681 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 12682 | |
| 12683 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 12684 | { |
| 12685 | int ret; |
| 12686 | |
| 12687 | vos_ssr_protect(__func__); |
| 12688 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 12689 | vos_ssr_unprotect(__func__); |
| 12690 | |
| 12691 | return ret; |
| 12692 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12693 | #endif |
| 12694 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12695 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12696 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12697 | struct net_device *dev, |
| 12698 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12699 | { |
| 12700 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12701 | hdd_station_ctx_t *pHddStaCtx; |
| 12702 | |
| 12703 | if (NULL == pAdapter) |
| 12704 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12705 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12706 | return -ENODEV; |
| 12707 | } |
| 12708 | |
| 12709 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12710 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12711 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12712 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 12713 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12714 | // Added for debug on reception of Re-assoc Req. |
| 12715 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 12716 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12717 | 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] | 12718 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12719 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12720 | } |
| 12721 | |
| 12722 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12723 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12724 | ftie->ie_len); |
| 12725 | #endif |
| 12726 | |
| 12727 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 12728 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12729 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12730 | ftie->ie_len); |
| 12731 | return 0; |
| 12732 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12733 | |
| 12734 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 12735 | struct net_device *dev, |
| 12736 | struct cfg80211_update_ft_ies_params *ftie) |
| 12737 | { |
| 12738 | int ret; |
| 12739 | |
| 12740 | vos_ssr_protect(__func__); |
| 12741 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 12742 | vos_ssr_unprotect(__func__); |
| 12743 | |
| 12744 | return ret; |
| 12745 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12746 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12747 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12748 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 12749 | |
| 12750 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 12751 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 12752 | { |
| 12753 | int ret; |
| 12754 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 12755 | hdd_context_t *pHddCtx; |
| 12756 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12757 | ENTER(); |
| 12758 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12759 | if (NULL == pAdapter) |
| 12760 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 12761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12762 | "%s: HDD adapter is Null", __func__); |
| 12763 | return ; |
| 12764 | } |
| 12765 | |
| 12766 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12767 | if (NULL == pHddCtx) |
| 12768 | { |
| 12769 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12770 | "%s: HDD context is Null!!!", __func__); |
| 12771 | return ; |
| 12772 | } |
| 12773 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12774 | spin_lock(&pHddCtx->schedScan_lock); |
| 12775 | if (TRUE == pHddCtx->isWiphySuspended) |
| 12776 | { |
| 12777 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 12778 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12779 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12780 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 12781 | return ; |
| 12782 | } |
| 12783 | spin_unlock(&pHddCtx->schedScan_lock); |
| 12784 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12785 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 12786 | |
| 12787 | if (0 > ret) |
| 12788 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 12789 | |
| 12790 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12791 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12792 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12793 | } |
| 12794 | |
| 12795 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12796 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12797 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12798 | */ |
| 12799 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 12800 | { |
| 12801 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 12802 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12803 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12804 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12805 | int status = 0; |
| 12806 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 12807 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12808 | /* The current firmware design does not allow PNO during any |
| 12809 | * active sessions. Hence, determine the active sessions |
| 12810 | * and return a failure. |
| 12811 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12812 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 12813 | { |
| 12814 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12815 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12816 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12817 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 12818 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 12819 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 12820 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 12821 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
| 12822 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12823 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12824 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12825 | } |
| 12826 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 12827 | pAdapterNode = pNext; |
| 12828 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12829 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12830 | } |
| 12831 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12832 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 12833 | { |
| 12834 | hdd_adapter_t *pAdapter = callbackContext; |
| 12835 | hdd_context_t *pHddCtx; |
| 12836 | |
| 12837 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 12838 | { |
| 12839 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12840 | FL("Invalid adapter or adapter has invalid magic")); |
| 12841 | return; |
| 12842 | } |
| 12843 | |
| 12844 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12845 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 12846 | { |
| 12847 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12848 | FL("HDD context is not valid")); |
| 12849 | return; |
| 12850 | } |
| 12851 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 12852 | if (VOS_STATUS_SUCCESS != status) |
| 12853 | { |
| 12854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12855 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 12856 | pHddCtx->isPnoEnable = FALSE; |
| 12857 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 12858 | |
| 12859 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 12860 | complete(&pAdapter->pno_comp_var); |
| 12861 | } |
| 12862 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12863 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12864 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 12865 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12866 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 12867 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12868 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 12869 | { |
| 12870 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12871 | tpSirPNOScanReq pPnoRequest = NULL; |
| 12872 | hdd_context_t *pHddCtx; |
| 12873 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 12874 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 12875 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 12876 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12877 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12878 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12879 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12880 | |
| 12881 | if (NULL == pAdapter) |
| 12882 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12884 | "%s: HDD adapter is Null", __func__); |
| 12885 | return -ENODEV; |
| 12886 | } |
| 12887 | |
| 12888 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12889 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12890 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12891 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12892 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 12893 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12894 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12895 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12896 | } |
| 12897 | |
| 12898 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12899 | if (NULL == hHal) |
| 12900 | { |
| 12901 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12902 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 12903 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12904 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 12905 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12906 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 12907 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 12908 | { |
| 12909 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12910 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 12911 | return -EBUSY; |
| 12912 | } |
| 12913 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12914 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12915 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 12916 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 12917 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 12918 | return -EBUSY; |
| 12919 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12920 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12921 | if (TRUE == pHddCtx->isPnoEnable) |
| 12922 | { |
| 12923 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 12924 | FL("already PNO is enabled")); |
| 12925 | return -EBUSY; |
| 12926 | } |
| 12927 | pHddCtx->isPnoEnable = TRUE; |
| 12928 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12929 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 12930 | if (NULL == pPnoRequest) |
| 12931 | { |
| 12932 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12933 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 12934 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12935 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12936 | } |
| 12937 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 12938 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12939 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 12940 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 12941 | |
| 12942 | if (( !pPnoRequest->ucNetworksCount ) || |
| 12943 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 12944 | { |
| 12945 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 12946 | "%s: Network input is not correct %d Max Network supported is %d", |
| 12947 | __func__, pPnoRequest->ucNetworksCount, |
| 12948 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12949 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12950 | goto error; |
| 12951 | } |
| 12952 | |
| 12953 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 12954 | { |
| 12955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12956 | "%s: Incorrect number of channels %d", |
| 12957 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12958 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12959 | goto error; |
| 12960 | } |
| 12961 | |
| 12962 | /* Framework provides one set of channels(all) |
| 12963 | * common for all saved profile */ |
| 12964 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12965 | channels_allowed, &num_channels_allowed)) |
| 12966 | { |
| 12967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12968 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 12969 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12970 | goto error; |
| 12971 | } |
| 12972 | /* Checking each channel against allowed channel list */ |
| 12973 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12974 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12975 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12976 | char chList [(request->n_channels*5)+1]; |
| 12977 | int len; |
| 12978 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12979 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12980 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12981 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12982 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 12983 | { |
| 12984 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 12985 | len += snprintf(chList+len, 5, "%d ", |
| 12986 | request->channels[i]->hw_value); |
| 12987 | break ; |
| 12988 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12989 | } |
| 12990 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 12991 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
| 12992 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 12993 | |
| 12994 | /* Filling per profile params */ |
| 12995 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 12996 | { |
| 12997 | pPnoRequest->aNetworks[i].ssId.length = |
| 12998 | request->match_sets[i].ssid.ssid_len; |
| 12999 | |
| 13000 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 13001 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 13002 | { |
| 13003 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13004 | "%s: SSID Len %d is not correct for network %d", |
| 13005 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13006 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13007 | goto error; |
| 13008 | } |
| 13009 | |
| 13010 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 13011 | request->match_sets[i].ssid.ssid, |
| 13012 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 13013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13014 | "%s: SSID of network %d is %s ", __func__, |
| 13015 | i, pPnoRequest->aNetworks[i].ssId.ssId); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13016 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 13017 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 13018 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 13019 | |
| 13020 | /*Copying list of valid channel into request */ |
| 13021 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 13022 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 13023 | |
| 13024 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 13025 | } |
| 13026 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 13027 | for (i = 0; i < request->n_ssids; i++) |
| 13028 | { |
| 13029 | j = 0; |
| 13030 | while (j < pPnoRequest->ucNetworksCount) |
| 13031 | { |
| 13032 | if ((pPnoRequest->aNetworks[j].ssId.length == |
| 13033 | request->ssids[i].ssid_len) && |
| 13034 | (0 == memcmp(pPnoRequest->aNetworks[j].ssId.ssId, |
| 13035 | request->ssids[i].ssid, |
| 13036 | pPnoRequest->aNetworks[j].ssId.length))) |
| 13037 | { |
| 13038 | pPnoRequest->aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
| 13039 | break; |
| 13040 | } |
| 13041 | j++; |
| 13042 | } |
| 13043 | } |
| 13044 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13045 | "Number of hidden networks being Configured = %d", |
| 13046 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 13047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 13048 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 13049 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 13050 | { |
| 13051 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 13052 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 13053 | pPnoRequest->us24GProbeTemplateLen); |
| 13054 | |
| 13055 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 13056 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 13057 | pPnoRequest->us5GProbeTemplateLen); |
| 13058 | } |
| 13059 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 13060 | /* Driver gets only one time interval which is hardcoded in |
| 13061 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 13062 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 13063 | * 80,160,320 secs. And number of scan cycle for each timer |
| 13064 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 13065 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 13066 | * will be repeated after each interval specified by supplicant |
| 13067 | * till PNO is disabled. |
| 13068 | */ |
| 13069 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 13070 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 13071 | else |
| 13072 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 13073 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 13074 | |
| 13075 | tempInterval = (request->interval)/1000; |
| 13076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13077 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 13078 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 13079 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 13080 | { |
| 13081 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 13082 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 13083 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 13084 | tempInterval *= 2; |
| 13085 | } |
| 13086 | //Repeat last timer until pno disabled. |
| 13087 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 13088 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 13089 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13090 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13091 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 13092 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 13093 | pPnoRequest->callbackContext = pAdapter; |
| 13094 | pAdapter->pno_req_status = 0; |
| 13095 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13096 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13097 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 13098 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 13099 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 13100 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13101 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13102 | pPnoRequest, pAdapter->sessionId, |
| 13103 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 13104 | if (eHAL_STATUS_SUCCESS != status) |
| 13105 | { |
| 13106 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13107 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13108 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13109 | goto error; |
| 13110 | } |
| 13111 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13112 | ret = wait_for_completion_timeout( |
| 13113 | &pAdapter->pno_comp_var, |
| 13114 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 13115 | if (0 >= ret) |
| 13116 | { |
| 13117 | // Did not receive the response for PNO enable in time. |
| 13118 | // Assuming the PNO enable was success. |
| 13119 | // Returning error from here, because we timeout, results |
| 13120 | // in side effect of Wifi (Wifi Setting) not to work. |
| 13121 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13122 | FL("Timed out waiting for PNO to be Enabled")); |
| 13123 | ret = 0; |
| 13124 | goto error; |
| 13125 | } |
| 13126 | |
c_hpothu | 3c986b2 | 2014-07-09 14:45:09 +0530 | [diff] [blame] | 13127 | vos_mem_free(pPnoRequest); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13128 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13129 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13130 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13131 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13132 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13133 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13134 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13135 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13136 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13137 | } |
| 13138 | |
| 13139 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13140 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 13141 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13142 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13143 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 13144 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 13145 | { |
| 13146 | int ret; |
| 13147 | |
| 13148 | vos_ssr_protect(__func__); |
| 13149 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 13150 | vos_ssr_unprotect(__func__); |
| 13151 | |
| 13152 | return ret; |
| 13153 | } |
| 13154 | |
| 13155 | /* |
| 13156 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 13157 | * Function to disable PNO |
| 13158 | */ |
| 13159 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13160 | struct net_device *dev) |
| 13161 | { |
| 13162 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13163 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13164 | hdd_context_t *pHddCtx; |
| 13165 | tHalHandle hHal; |
| 13166 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13167 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13168 | |
| 13169 | ENTER(); |
| 13170 | |
| 13171 | if (NULL == pAdapter) |
| 13172 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13174 | "%s: HDD adapter is Null", __func__); |
| 13175 | return -ENODEV; |
| 13176 | } |
| 13177 | |
| 13178 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13179 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13180 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13181 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13182 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13183 | "%s: HDD context is Null", __func__); |
| 13184 | return -ENODEV; |
| 13185 | } |
| 13186 | |
| 13187 | /* The return 0 is intentional when isLogpInProgress and |
| 13188 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 13189 | * failure in sched_scan_stop , especially for a case where the unload |
| 13190 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 13191 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 13192 | * success. If it returns a failure , then its next invocation due to the |
| 13193 | * clean up of the second interface will have the dev pointer corresponding |
| 13194 | * to the first one leading to a crash. |
| 13195 | */ |
| 13196 | if (pHddCtx->isLogpInProgress) |
| 13197 | { |
| 13198 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13199 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13200 | return ret; |
| 13201 | } |
| 13202 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 13203 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13204 | { |
| 13205 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13206 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 13207 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13208 | } |
| 13209 | |
| 13210 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13211 | if (NULL == hHal) |
| 13212 | { |
| 13213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13214 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13215 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13216 | } |
| 13217 | |
| 13218 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 13219 | if (NULL == pPnoRequest) |
| 13220 | { |
| 13221 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13222 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13223 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13224 | } |
| 13225 | |
| 13226 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 13227 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 13228 | pPnoRequest->ucNetworksCount = 0; |
| 13229 | |
| 13230 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 13231 | pAdapter->sessionId, |
| 13232 | NULL, pAdapter); |
| 13233 | if (eHAL_STATUS_SUCCESS != status) |
| 13234 | { |
| 13235 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13236 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13237 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13238 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13239 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13240 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13241 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13242 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13243 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13244 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13245 | vos_mem_free(pPnoRequest); |
| 13246 | |
| 13247 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13248 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13249 | } |
| 13250 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13251 | /* |
| 13252 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 13253 | * NL interface to disable PNO |
| 13254 | */ |
| 13255 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 13256 | struct net_device *dev) |
| 13257 | { |
| 13258 | int ret; |
| 13259 | |
| 13260 | vos_ssr_protect(__func__); |
| 13261 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 13262 | vos_ssr_unprotect(__func__); |
| 13263 | |
| 13264 | return ret; |
| 13265 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13266 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 13267 | |
| 13268 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13269 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13270 | #if TDLS_MGMT_VERSION2 |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13271 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 13272 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13273 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 13274 | #else |
| 13275 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 13276 | u8 *peer, u8 action_code, u8 dialog_token, |
| 13277 | u16 status_code, const u8 *buf, size_t len) |
| 13278 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13279 | { |
| 13280 | |
| 13281 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13282 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13283 | u8 peerMac[6]; |
| 13284 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13285 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13286 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13287 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13288 | #if !(TDLS_MGMT_VERSION2) |
| 13289 | u32 peer_capability = 0; |
| 13290 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13291 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13292 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13293 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13294 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 13295 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13296 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13297 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13298 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13299 | "Invalid arguments"); |
| 13300 | return -EINVAL; |
| 13301 | } |
| 13302 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13303 | if (pHddCtx->isLogpInProgress) |
| 13304 | { |
| 13305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13306 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13307 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 13308 | peer, |
| 13309 | eTDLS_LINK_IDLE, |
| 13310 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13311 | return -EBUSY; |
| 13312 | } |
| 13313 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13314 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13315 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13316 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13317 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 13318 | MAC_ADDRESS_STR " action %d declined.", |
| 13319 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13320 | return -ENOTSUPP; |
| 13321 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13322 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13323 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 13324 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 13325 | { |
| 13326 | /* if tdls_mode is disabled to respond to peer's request */ |
| 13327 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 13328 | { |
| 13329 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13330 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13331 | " TDLS mode is disabled. action %d declined.", |
| 13332 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13333 | |
| 13334 | return -ENOTSUPP; |
| 13335 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 13336 | |
| 13337 | if (vos_max_concurrent_connections_reached()) |
| 13338 | { |
| 13339 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 13340 | return -EINVAL; |
| 13341 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13342 | } |
| 13343 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13344 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 13345 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13346 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13347 | { |
| 13348 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13349 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13350 | " TDLS setup is ongoing. action %d declined.", |
| 13351 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 13352 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13353 | } |
| 13354 | } |
| 13355 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13356 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 13357 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13358 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13359 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 13360 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13361 | { |
| 13362 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 13363 | we return error code at 'add_station()'. Hence we have this |
| 13364 | check again in addtion to add_station(). |
| 13365 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13366 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13367 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13368 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13369 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13370 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 13371 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 13372 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13373 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13374 | } |
| 13375 | else |
| 13376 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13377 | /* maximum reached. tweak to send error code to peer and return |
| 13378 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13379 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13380 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13381 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13382 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 13383 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 13384 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13385 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13386 | /* fall through to send setup resp with failure status |
| 13387 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13388 | } |
| 13389 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13390 | else |
| 13391 | { |
| 13392 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13393 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13394 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13395 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13396 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13397 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 13398 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13399 | return -EPERM; |
| 13400 | } |
| 13401 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13402 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13403 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13404 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13405 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 13406 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 13407 | "%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] | 13408 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 13409 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13410 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13411 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13412 | /*Except teardown responder will not be used so just make 0*/ |
| 13413 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13414 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13415 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13416 | |
| 13417 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 13418 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13419 | |
| 13420 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 13421 | responder = pTdlsPeer->is_responder; |
| 13422 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13423 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 13424 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 13425 | "%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] | 13426 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 13427 | dialog_token, status_code, len); |
| 13428 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13429 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13430 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13431 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13432 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 13433 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13434 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13435 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 13436 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13437 | { |
| 13438 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 13439 | { |
| 13440 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13441 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13442 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 13443 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 13444 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 13445 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13446 | } |
| 13447 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13448 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 13449 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 13450 | { |
| 13451 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13452 | "%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] | 13453 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 13454 | return -EBUSY; |
| 13455 | } |
| 13456 | |
| 13457 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13458 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 13459 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13460 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 13461 | 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] | 13462 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13463 | if (VOS_STATUS_SUCCESS != status) |
| 13464 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13465 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13466 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13467 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13468 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13469 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13470 | } |
| 13471 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13472 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 13473 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 13474 | |
| 13475 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13476 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13477 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 13478 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13479 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13480 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 13481 | |
| 13482 | if (pHddCtx->isLogpInProgress) |
| 13483 | { |
| 13484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13485 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13486 | return -EAGAIN; |
| 13487 | } |
| 13488 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13489 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 13490 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13491 | } |
| 13492 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13493 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13494 | { |
| 13495 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13496 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13497 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13498 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13499 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 13500 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 13501 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13502 | } |
| 13503 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 13504 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 13505 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13506 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13507 | |
| 13508 | return 0; |
| 13509 | } |
| 13510 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13511 | |
| 13512 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 13513 | u8 *peer, |
| 13514 | cfg80211_exttdls_callback callback) |
| 13515 | { |
| 13516 | |
| 13517 | hddTdlsPeer_t *pTdlsPeer; |
| 13518 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13520 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 13521 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13522 | |
| 13523 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13524 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13525 | |
| 13526 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13527 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13528 | __func__); |
| 13529 | return -ENOTSUPP; |
| 13530 | } |
| 13531 | |
| 13532 | /* To cater the requirement of establishing the TDLS link |
| 13533 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 13534 | */ |
| 13535 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 13536 | if (pTdlsPeer == NULL) { |
| 13537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13538 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 13539 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13540 | return -EINVAL; |
| 13541 | } |
| 13542 | |
| 13543 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 13544 | |
| 13545 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13546 | " %s TDLS Add Force Peer Failed", |
| 13547 | __func__); |
| 13548 | return -EINVAL; |
| 13549 | } |
| 13550 | /*EXT TDLS*/ |
| 13551 | |
| 13552 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 13553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13554 | " %s TDLS set callback Failed", |
| 13555 | __func__); |
| 13556 | return -EINVAL; |
| 13557 | } |
| 13558 | |
| 13559 | return(0); |
| 13560 | |
| 13561 | } |
| 13562 | |
| 13563 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 13564 | { |
| 13565 | |
| 13566 | hddTdlsPeer_t *pTdlsPeer; |
| 13567 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13568 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13569 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 13570 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13571 | |
| 13572 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 13573 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 13574 | |
| 13575 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13576 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 13577 | __func__); |
| 13578 | return -ENOTSUPP; |
| 13579 | } |
| 13580 | |
| 13581 | |
| 13582 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13583 | |
| 13584 | if ( NULL == pTdlsPeer ) { |
| 13585 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 13586 | " peer not exsting", |
| 13587 | __func__, MAC_ADDR_ARRAY(peer)); |
| 13588 | return -EINVAL; |
| 13589 | } |
| 13590 | else { |
| 13591 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 13592 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 13593 | } |
| 13594 | |
| 13595 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 13596 | return -EINVAL; |
| 13597 | |
| 13598 | /*EXT TDLS*/ |
| 13599 | |
| 13600 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 13601 | |
| 13602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13603 | " %s TDLS set callback Failed", |
| 13604 | __func__); |
| 13605 | return -EINVAL; |
| 13606 | } |
| 13607 | return(0); |
| 13608 | |
| 13609 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13610 | 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] | 13611 | u8 *peer, enum nl80211_tdls_operation oper) |
| 13612 | { |
| 13613 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13614 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13615 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13616 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13617 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13618 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13619 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 13620 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13621 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13622 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13623 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 13624 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13625 | return -EINVAL; |
| 13626 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13627 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13628 | status = wlan_hdd_validate_context(pHddCtx); |
| 13629 | |
| 13630 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13631 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13632 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13633 | "%s: HDD context is not valid", __func__); |
| 13634 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13635 | } |
| 13636 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13637 | |
| 13638 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13639 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13640 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 13641 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 13642 | "TDLS Disabled in INI OR not enabled in FW. " |
| 13643 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13644 | return -ENOTSUPP; |
| 13645 | } |
| 13646 | |
| 13647 | switch (oper) { |
| 13648 | case NL80211_TDLS_ENABLE_LINK: |
| 13649 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13650 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13651 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13652 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13653 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13654 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13655 | |
| 13656 | if ( NULL == pTdlsPeer ) { |
| 13657 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13658 | " (oper %d) not exsting. ignored", |
| 13659 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13660 | return -EINVAL; |
| 13661 | } |
| 13662 | |
| 13663 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13664 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13665 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13666 | "NL80211_TDLS_ENABLE_LINK"); |
| 13667 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 13668 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 13669 | { |
| 13670 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 13671 | MAC_ADDRESS_STR " failed", |
| 13672 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 13673 | return -EINVAL; |
| 13674 | } |
| 13675 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13676 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13677 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13678 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 13679 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13680 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 13681 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 13682 | return -EINVAL; |
| 13683 | } |
| 13684 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13685 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 13686 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13687 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 13688 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 13689 | * register with the TL on after the response for this operation |
| 13690 | * is received . |
| 13691 | */ |
| 13692 | ret = wait_for_completion_interruptible_timeout( |
| 13693 | &pAdapter->tdls_link_establish_req_comp, |
| 13694 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 13695 | if (ret <= 0) |
| 13696 | { |
| 13697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13698 | "%s: Link Establish Request Faled Status %ld", |
| 13699 | __func__, ret); |
| 13700 | return -EINVAL; |
| 13701 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13702 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13703 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13704 | eTDLS_LINK_CONNECTED, |
| 13705 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 13706 | /* Mark TDLS client Authenticated .*/ |
| 13707 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 13708 | pTdlsPeer->staId, |
| 13709 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13710 | if (VOS_STATUS_SUCCESS == status) |
| 13711 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 13712 | if (pTdlsPeer->is_responder == 0) |
| 13713 | { |
| 13714 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 13715 | |
| 13716 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 13717 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 13718 | WAIT_TIME_TDLS_INITIATOR); |
| 13719 | /* suspend initiator TX until it receives direct packet from the |
| 13720 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 13721 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13722 | &staId, NULL); |
| 13723 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 13724 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 13725 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13726 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13727 | |
| 13728 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13729 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 13730 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13731 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 13732 | int ac; |
| 13733 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 13734 | WLANTL_AC_VI, |
| 13735 | WLANTL_AC_BK, |
| 13736 | WLANTL_AC_BE }; |
| 13737 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 13738 | for(ac=0; ac < 4; ac++) |
| 13739 | { |
| 13740 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 13741 | pTdlsPeer->staId, ucAc[ac], |
| 13742 | tlTid[ac], tlTid[ac], 0, 0, |
| 13743 | WLANTL_BI_DIR ); |
| 13744 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13745 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13746 | } |
| 13747 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13748 | } |
| 13749 | break; |
| 13750 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13751 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13752 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 13753 | |
| 13754 | if ( NULL == pTdlsPeer ) { |
| 13755 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 13756 | " (oper %d) not exsting. ignored", |
| 13757 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 13758 | return -EINVAL; |
| 13759 | } |
| 13760 | |
| 13761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13762 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 13763 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 13764 | "NL80211_TDLS_DISABLE_LINK"); |
| 13765 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13766 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13767 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13768 | long status; |
| 13769 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 13770 | |
| 13771 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13772 | eTDLS_LINK_TEARING, |
| 13773 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 13774 | eTDLS_LINK_UNSPECIFIED: |
| 13775 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13776 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 13777 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13778 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13779 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13780 | |
| 13781 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 13782 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 13783 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 13784 | eTDLS_LINK_IDLE, |
| 13785 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 13786 | eTDLS_LINK_UNSPECIFIED: |
| 13787 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13788 | if (status <= 0) |
| 13789 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13791 | "%s: Del station failed status %ld", |
| 13792 | __func__, status); |
| 13793 | return -EPERM; |
| 13794 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13795 | } |
| 13796 | else |
| 13797 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13798 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13799 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13800 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13801 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13802 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13803 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13804 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13805 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13806 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13807 | if (0 != status) |
| 13808 | { |
| 13809 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13810 | "%s: Error in TDLS Teardown", __func__); |
| 13811 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13812 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13813 | break; |
| 13814 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13815 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13816 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13817 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 13818 | peer, |
| 13819 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13820 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13821 | if (0 != status) |
| 13822 | { |
| 13823 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13824 | "%s: Error in TDLS Setup", __func__); |
| 13825 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 13826 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 13827 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 13828 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13829 | case NL80211_TDLS_DISCOVERY_REQ: |
| 13830 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13831 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13832 | "%s: We don't support in-driver setup/teardown/discovery " |
| 13833 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13834 | return -ENOTSUPP; |
| 13835 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13837 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13838 | return -ENOTSUPP; |
| 13839 | } |
| 13840 | return 0; |
| 13841 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13842 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13843 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 13844 | u8 *peer, enum nl80211_tdls_operation oper) |
| 13845 | { |
| 13846 | int ret; |
| 13847 | |
| 13848 | vos_ssr_protect(__func__); |
| 13849 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 13850 | vos_ssr_unprotect(__func__); |
| 13851 | |
| 13852 | return ret; |
| 13853 | } |
| 13854 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13855 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 13856 | struct net_device *dev, u8 *peer) |
| 13857 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 13858 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13859 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 13860 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13861 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13862 | #if TDLS_MGMT_VERSION2 |
| 13863 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13864 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 13865 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13866 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 13867 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13868 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 13869 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13870 | #endif |
| 13871 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13872 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 13873 | /* |
| 13874 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 13875 | * Callback rountine called upon receiving response for |
| 13876 | * get offload info |
| 13877 | */ |
| 13878 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 13879 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 13880 | { |
| 13881 | |
| 13882 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13883 | tANI_U8 tempReplayCounter[8]; |
| 13884 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13885 | |
| 13886 | ENTER(); |
| 13887 | |
| 13888 | if (NULL == pAdapter) |
| 13889 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13890 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13891 | "%s: HDD adapter is Null", __func__); |
| 13892 | return ; |
| 13893 | } |
| 13894 | |
| 13895 | if (NULL == pGtkOffloadGetInfoRsp) |
| 13896 | { |
| 13897 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13898 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 13899 | return ; |
| 13900 | } |
| 13901 | |
| 13902 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 13903 | { |
| 13904 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13905 | "%s: wlan Failed to get replay counter value", |
| 13906 | __func__); |
| 13907 | return ; |
| 13908 | } |
| 13909 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13910 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13911 | /* Update replay counter */ |
| 13912 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 13913 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13914 | |
| 13915 | { |
| 13916 | /* changing from little to big endian since supplicant |
| 13917 | * works on big endian format |
| 13918 | */ |
| 13919 | int i; |
| 13920 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 13921 | |
| 13922 | for (i = 0; i < 8; i++) |
| 13923 | { |
| 13924 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 13925 | } |
| 13926 | } |
| 13927 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13928 | /* Update replay counter to NL */ |
| 13929 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13930 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13931 | } |
| 13932 | |
| 13933 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13934 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13935 | * This function is used to offload GTK rekeying job to the firmware. |
| 13936 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13937 | 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] | 13938 | struct cfg80211_gtk_rekey_data *data) |
| 13939 | { |
| 13940 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13941 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13942 | hdd_station_ctx_t *pHddStaCtx; |
| 13943 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13944 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13945 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13946 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13947 | |
| 13948 | ENTER(); |
| 13949 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13950 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13951 | if (NULL == pAdapter) |
| 13952 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13953 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13954 | "%s: HDD adapter is Null", __func__); |
| 13955 | return -ENODEV; |
| 13956 | } |
| 13957 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13958 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13959 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 13960 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13961 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13962 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13963 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13964 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13965 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13966 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13967 | "%s: HDD context is not valid", __func__); |
| 13968 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13969 | } |
| 13970 | |
| 13971 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13972 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13973 | if (NULL == hHal) |
| 13974 | { |
| 13975 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13976 | "%s: HAL context is Null!!!", __func__); |
| 13977 | return -EAGAIN; |
| 13978 | } |
| 13979 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13980 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 13981 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 13982 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 13983 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13984 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13985 | { |
| 13986 | /* changing from big to little endian since driver |
| 13987 | * works on little endian format |
| 13988 | */ |
| 13989 | tANI_U8 *p = |
| 13990 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 13991 | int i; |
| 13992 | |
| 13993 | for (i = 0; i < 8; i++) |
| 13994 | { |
| 13995 | p[7-i] = data->replay_ctr[i]; |
| 13996 | } |
| 13997 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13998 | |
| 13999 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 14000 | { |
| 14001 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14002 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 14003 | sizeof (tSirGtkOffloadParams)); |
| 14004 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14005 | pAdapter->sessionId); |
| 14006 | |
| 14007 | if (eHAL_STATUS_SUCCESS != status) |
| 14008 | { |
| 14009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14010 | "%s: sme_SetGTKOffload failed, returned %d", |
| 14011 | __func__, status); |
| 14012 | return status; |
| 14013 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14014 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14015 | "%s: sme_SetGTKOffload successfull", __func__); |
| 14016 | } |
| 14017 | else |
| 14018 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14019 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14020 | "%s: wlan not suspended GTKOffload request is stored", |
| 14021 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14022 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14023 | |
| 14024 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14025 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14026 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14027 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 14028 | struct cfg80211_gtk_rekey_data *data) |
| 14029 | { |
| 14030 | int ret; |
| 14031 | |
| 14032 | vos_ssr_protect(__func__); |
| 14033 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 14034 | vos_ssr_unprotect(__func__); |
| 14035 | |
| 14036 | return ret; |
| 14037 | } |
| 14038 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14039 | /* |
| 14040 | * FUNCTION: wlan_hdd_cfg80211_set_mac_acl |
| 14041 | * This function is used to set access control policy |
| 14042 | */ |
| 14043 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 14044 | struct net_device *dev, const struct cfg80211_acl_data *params) |
| 14045 | { |
| 14046 | int i; |
| 14047 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14048 | hdd_hostapd_state_t *pHostapdState; |
| 14049 | tsap_Config_t *pConfig; |
| 14050 | v_CONTEXT_t pVosContext = NULL; |
| 14051 | hdd_context_t *pHddCtx; |
| 14052 | int status; |
| 14053 | |
| 14054 | ENTER(); |
| 14055 | |
| 14056 | if (NULL == pAdapter) |
| 14057 | { |
| 14058 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14059 | "%s: HDD adapter is Null", __func__); |
| 14060 | return -ENODEV; |
| 14061 | } |
| 14062 | |
| 14063 | if (NULL == params) |
| 14064 | { |
| 14065 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14066 | "%s: params is Null", __func__); |
| 14067 | return -EINVAL; |
| 14068 | } |
| 14069 | |
| 14070 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14071 | status = wlan_hdd_validate_context(pHddCtx); |
| 14072 | |
| 14073 | if (0 != status) |
| 14074 | { |
| 14075 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14076 | "%s: HDD context is not valid", __func__); |
| 14077 | return status; |
| 14078 | } |
| 14079 | |
| 14080 | pVosContext = pHddCtx->pvosContext; |
| 14081 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 14082 | |
| 14083 | if (NULL == pHostapdState) |
| 14084 | { |
| 14085 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14086 | "%s: pHostapdState is Null", __func__); |
| 14087 | return -EINVAL; |
| 14088 | } |
| 14089 | |
| 14090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 14091 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 14092 | |
| 14093 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 14094 | { |
| 14095 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 14096 | |
| 14097 | /* default value */ |
| 14098 | pConfig->num_accept_mac = 0; |
| 14099 | pConfig->num_deny_mac = 0; |
| 14100 | |
| 14101 | /** |
| 14102 | * access control policy |
| 14103 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 14104 | * listed in hostapd.deny file. |
| 14105 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 14106 | * listed in hostapd.accept file. |
| 14107 | */ |
| 14108 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 14109 | { |
| 14110 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 14111 | } |
| 14112 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 14113 | { |
| 14114 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 14115 | } |
| 14116 | else |
| 14117 | { |
| 14118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14119 | "%s:Acl Policy : %d is not supported", |
| 14120 | __func__, params->acl_policy); |
| 14121 | return -ENOTSUPP; |
| 14122 | } |
| 14123 | |
| 14124 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 14125 | { |
| 14126 | pConfig->num_accept_mac = params->n_acl_entries; |
| 14127 | for (i = 0; i < params->n_acl_entries; i++) |
| 14128 | { |
| 14129 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14130 | "** Add ACL MAC entry %i in WhiletList :" |
| 14131 | MAC_ADDRESS_STR, i, |
| 14132 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 14133 | |
| 14134 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 14135 | sizeof(qcmacaddr)); |
| 14136 | } |
| 14137 | } |
| 14138 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 14139 | { |
| 14140 | pConfig->num_deny_mac = params->n_acl_entries; |
| 14141 | for (i = 0; i < params->n_acl_entries; i++) |
| 14142 | { |
| 14143 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14144 | "** Add ACL MAC entry %i in BlackList :" |
| 14145 | MAC_ADDRESS_STR, i, |
| 14146 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 14147 | |
| 14148 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 14149 | sizeof(qcmacaddr)); |
| 14150 | } |
| 14151 | } |
| 14152 | |
| 14153 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 14154 | { |
| 14155 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14156 | "%s: SAP Set Mac Acl fail", __func__); |
| 14157 | return -EINVAL; |
| 14158 | } |
| 14159 | } |
| 14160 | else |
| 14161 | { |
| 14162 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14163 | "%s: Invalid device_mode = %s (%d)", |
| 14164 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 14165 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14166 | return -EINVAL; |
| 14167 | } |
| 14168 | |
| 14169 | return 0; |
| 14170 | } |
| 14171 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14172 | #ifdef WLAN_NL80211_TESTMODE |
| 14173 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14174 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14175 | ( |
| 14176 | void *pAdapter, |
| 14177 | void *indCont |
| 14178 | ) |
| 14179 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14180 | tSirLPHBInd *lphbInd; |
| 14181 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14182 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14183 | |
| 14184 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14185 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14186 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14187 | if (pAdapter == NULL) |
| 14188 | { |
| 14189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14190 | "%s: pAdapter is NULL\n",__func__); |
| 14191 | return; |
| 14192 | } |
| 14193 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14194 | if (NULL == indCont) |
| 14195 | { |
| 14196 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14197 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14198 | return; |
| 14199 | } |
| 14200 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14201 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14202 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14203 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14204 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14205 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14206 | GFP_ATOMIC); |
| 14207 | if (!skb) |
| 14208 | { |
| 14209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14210 | "LPHB timeout, NL buffer alloc fail"); |
| 14211 | return; |
| 14212 | } |
| 14213 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14214 | 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] | 14215 | { |
| 14216 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14217 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 14218 | goto nla_put_failure; |
| 14219 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14220 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14221 | { |
| 14222 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14223 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 14224 | goto nla_put_failure; |
| 14225 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14226 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14227 | sizeof(tSirLPHBInd), lphbInd)) |
| 14228 | { |
| 14229 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14230 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 14231 | goto nla_put_failure; |
| 14232 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14233 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 14234 | return; |
| 14235 | |
| 14236 | nla_put_failure: |
| 14237 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14238 | "NLA Put fail"); |
| 14239 | kfree_skb(skb); |
| 14240 | |
| 14241 | return; |
| 14242 | } |
| 14243 | #endif /* FEATURE_WLAN_LPHB */ |
| 14244 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14245 | 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] | 14246 | { |
| 14247 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 14248 | int err = 0; |
| 14249 | #ifdef FEATURE_WLAN_LPHB |
| 14250 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14251 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14252 | #endif /* FEATURE_WLAN_LPHB */ |
| 14253 | |
| 14254 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 14255 | if (err) |
| 14256 | { |
| 14257 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14258 | "%s Testmode INV ATTR", __func__); |
| 14259 | return err; |
| 14260 | } |
| 14261 | |
| 14262 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 14263 | { |
| 14264 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14265 | "%s Testmode INV CMD", __func__); |
| 14266 | return -EINVAL; |
| 14267 | } |
| 14268 | |
| 14269 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 14270 | { |
| 14271 | #ifdef FEATURE_WLAN_LPHB |
| 14272 | /* Low Power Heartbeat configuration request */ |
| 14273 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 14274 | { |
| 14275 | int buf_len; |
| 14276 | void *buf; |
| 14277 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 14278 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14279 | |
| 14280 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 14281 | { |
| 14282 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14283 | "%s Testmode INV DATA", __func__); |
| 14284 | return -EINVAL; |
| 14285 | } |
| 14286 | |
| 14287 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 14288 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 14289 | |
| 14290 | hb_params_temp =(tSirLPHBReq *)buf; |
| 14291 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 14292 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 14293 | return -EINVAL; |
| 14294 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14295 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 14296 | if (NULL == hb_params) |
| 14297 | { |
| 14298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14299 | "%s Request Buffer Alloc Fail", __func__); |
| 14300 | return -EINVAL; |
| 14301 | } |
| 14302 | |
| 14303 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14304 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 14305 | hb_params, |
| 14306 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 14307 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14308 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14309 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14310 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14311 | vos_mem_free(hb_params); |
| 14312 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14313 | return 0; |
| 14314 | } |
| 14315 | #endif /* FEATURE_WLAN_LPHB */ |
| 14316 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14318 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14319 | return -EOPNOTSUPP; |
| 14320 | } |
| 14321 | |
| 14322 | return err; |
| 14323 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14324 | |
| 14325 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 14326 | { |
| 14327 | int ret; |
| 14328 | |
| 14329 | vos_ssr_protect(__func__); |
| 14330 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 14331 | vos_ssr_unprotect(__func__); |
| 14332 | |
| 14333 | return ret; |
| 14334 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14335 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 14336 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14337 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14338 | struct net_device *dev, |
| 14339 | int idx, struct survey_info *survey) |
| 14340 | { |
| 14341 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14342 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14343 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14344 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14345 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14346 | v_S7_t snr,rssi; |
| 14347 | int status, i, j, filled = 0; |
| 14348 | |
| 14349 | ENTER(); |
| 14350 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14351 | if (NULL == pAdapter) |
| 14352 | { |
| 14353 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14354 | "%s: HDD adapter is Null", __func__); |
| 14355 | return -ENODEV; |
| 14356 | } |
| 14357 | |
| 14358 | if (NULL == wiphy) |
| 14359 | { |
| 14360 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14361 | "%s: wiphy is Null", __func__); |
| 14362 | return -ENODEV; |
| 14363 | } |
| 14364 | |
| 14365 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14366 | status = wlan_hdd_validate_context(pHddCtx); |
| 14367 | |
| 14368 | if (0 != status) |
| 14369 | { |
| 14370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14371 | "%s: HDD context is not valid", __func__); |
| 14372 | return status; |
| 14373 | } |
| 14374 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14375 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14376 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14377 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 14378 | 0 != pAdapter->survey_idx || |
| 14379 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14380 | { |
| 14381 | /* The survey dump ops when implemented completely is expected to |
| 14382 | * return a survey of all channels and the ops is called by the |
| 14383 | * kernel with incremental values of the argument 'idx' till it |
| 14384 | * returns -ENONET. But we can only support the survey for the |
| 14385 | * operating channel for now. survey_idx is used to track |
| 14386 | * that the ops is called only once and then return -ENONET for |
| 14387 | * the next iteration |
| 14388 | */ |
| 14389 | pAdapter->survey_idx = 0; |
| 14390 | return -ENONET; |
| 14391 | } |
| 14392 | |
| 14393 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14394 | |
| 14395 | wlan_hdd_get_snr(pAdapter, &snr); |
| 14396 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 14397 | |
| 14398 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 14399 | hdd_wlan_get_freq(channel, &freq); |
| 14400 | |
| 14401 | |
| 14402 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 14403 | { |
| 14404 | if (NULL == wiphy->bands[i]) |
| 14405 | { |
| 14406 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 14407 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 14408 | continue; |
| 14409 | } |
| 14410 | |
| 14411 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 14412 | { |
| 14413 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 14414 | |
| 14415 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 14416 | { |
| 14417 | survey->channel = &band->channels[j]; |
| 14418 | /* The Rx BDs contain SNR values in dB for the received frames |
| 14419 | * while the supplicant expects noise. So we calculate and |
| 14420 | * return the value of noise (dBm) |
| 14421 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 14422 | */ |
| 14423 | survey->noise = rssi - snr; |
| 14424 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 14425 | filled = 1; |
| 14426 | } |
| 14427 | } |
| 14428 | } |
| 14429 | |
| 14430 | if (filled) |
| 14431 | pAdapter->survey_idx = 1; |
| 14432 | else |
| 14433 | { |
| 14434 | pAdapter->survey_idx = 0; |
| 14435 | return -ENONET; |
| 14436 | } |
| 14437 | |
| 14438 | return 0; |
| 14439 | } |
| 14440 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14441 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 14442 | struct net_device *dev, |
| 14443 | int idx, struct survey_info *survey) |
| 14444 | { |
| 14445 | int ret; |
| 14446 | |
| 14447 | vos_ssr_protect(__func__); |
| 14448 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 14449 | vos_ssr_unprotect(__func__); |
| 14450 | |
| 14451 | return ret; |
| 14452 | } |
| 14453 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14454 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14455 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14456 | * this is called when cfg80211 driver resume |
| 14457 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 14458 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14459 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14460 | { |
| 14461 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 14462 | hdd_adapter_t *pAdapter; |
| 14463 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 14464 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14465 | |
| 14466 | ENTER(); |
| 14467 | |
| 14468 | if ( NULL == pHddCtx ) |
| 14469 | { |
| 14470 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14471 | "%s: HddCtx validation failed", __func__); |
| 14472 | return 0; |
| 14473 | } |
| 14474 | |
| 14475 | if (pHddCtx->isLogpInProgress) |
| 14476 | { |
| 14477 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14478 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14479 | return 0; |
| 14480 | } |
| 14481 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14482 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14483 | { |
| 14484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14485 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14486 | return 0; |
| 14487 | } |
| 14488 | |
| 14489 | spin_lock(&pHddCtx->schedScan_lock); |
| 14490 | pHddCtx->isWiphySuspended = FALSE; |
| 14491 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 14492 | { |
| 14493 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14494 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14495 | "%s: Return resume is not due to PNO indication", __func__); |
| 14496 | return 0; |
| 14497 | } |
| 14498 | // Reset flag to avoid updatating cfg80211 data old results again |
| 14499 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 14500 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14501 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14502 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14503 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 14504 | |
| 14505 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 14506 | { |
| 14507 | pAdapter = pAdapterNode->pAdapter; |
| 14508 | if ( (NULL != pAdapter) && |
| 14509 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 14510 | { |
| 14511 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14512 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14513 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14514 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14515 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14516 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14517 | { |
| 14518 | /* Acquire wakelock to handle the case where APP's tries to |
| 14519 | * suspend immediately after updating the scan results. Whis |
| 14520 | * results in app's is in suspended state and not able to |
| 14521 | * process the connect request to AP |
| 14522 | */ |
| 14523 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14524 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 14525 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14526 | |
| 14527 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14528 | "%s : cfg80211 scan result database updated", __func__); |
| 14529 | |
| 14530 | return 0; |
| 14531 | |
| 14532 | } |
| 14533 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14534 | pAdapterNode = pNext; |
| 14535 | } |
| 14536 | |
| 14537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14538 | "%s: Failed to find Adapter", __func__); |
| 14539 | return 0; |
| 14540 | } |
| 14541 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14542 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 14543 | { |
| 14544 | int ret; |
| 14545 | |
| 14546 | vos_ssr_protect(__func__); |
| 14547 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 14548 | vos_ssr_unprotect(__func__); |
| 14549 | |
| 14550 | return ret; |
| 14551 | } |
| 14552 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14553 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14554 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14555 | * this is called when cfg80211 driver suspends |
| 14556 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14557 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14558 | struct cfg80211_wowlan *wow) |
| 14559 | { |
| 14560 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 14561 | |
| 14562 | ENTER(); |
| 14563 | if (NULL == pHddCtx) |
| 14564 | { |
| 14565 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14566 | "%s: HddCtx validation failed", __func__); |
| 14567 | return 0; |
| 14568 | } |
| 14569 | |
| 14570 | pHddCtx->isWiphySuspended = TRUE; |
| 14571 | |
| 14572 | EXIT(); |
| 14573 | |
| 14574 | return 0; |
| 14575 | } |
| 14576 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 14577 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 14578 | struct cfg80211_wowlan *wow) |
| 14579 | { |
| 14580 | int ret; |
| 14581 | |
| 14582 | vos_ssr_protect(__func__); |
| 14583 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 14584 | vos_ssr_unprotect(__func__); |
| 14585 | |
| 14586 | return ret; |
| 14587 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14588 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14589 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14590 | { |
| 14591 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 14592 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 14593 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 14594 | .change_station = wlan_hdd_change_station, |
| 14595 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 14596 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 14597 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 14598 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14599 | #else |
| 14600 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 14601 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 14602 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14603 | #endif |
| 14604 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 14605 | .add_key = wlan_hdd_cfg80211_add_key, |
| 14606 | .get_key = wlan_hdd_cfg80211_get_key, |
| 14607 | .del_key = wlan_hdd_cfg80211_del_key, |
| 14608 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 14609 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14610 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 14611 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14612 | .scan = wlan_hdd_cfg80211_scan, |
| 14613 | .connect = wlan_hdd_cfg80211_connect, |
| 14614 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 14615 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 14616 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 14617 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 14618 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 14619 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14620 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 14621 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 14622 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14623 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14624 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 14625 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 14626 | .set_txq_params = wlan_hdd_set_txq_params, |
| 14627 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14628 | .get_station = wlan_hdd_cfg80211_get_station, |
| 14629 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 14630 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14631 | .add_station = wlan_hdd_cfg80211_add_station, |
| 14632 | #ifdef FEATURE_WLAN_LFR |
| 14633 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 14634 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 14635 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 14636 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14637 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 14638 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 14639 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14640 | #ifdef FEATURE_WLAN_TDLS |
| 14641 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 14642 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 14643 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14644 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 14645 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 14646 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14647 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14648 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 14649 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 14650 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14651 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 14652 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14653 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14654 | #ifdef WLAN_NL80211_TESTMODE |
| 14655 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 14656 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14657 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14658 | }; |
| 14659 | |