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 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 146 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 147 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 148 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 149 | /* |
| 150 | * Used to allocate the size of 4096 for the link layer stats. |
| 151 | * The size of 4096 is considered assuming that all data per |
| 152 | * respective event fit with in the limit.Please take a call |
| 153 | * on the limit based on the data requirements on link layer |
| 154 | * statistics. |
| 155 | */ |
| 156 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 157 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 158 | #ifdef WLAN_FEATURE_EXTSCAN |
| 159 | /* |
| 160 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 161 | * The size of 4096 is considered assuming that all data per |
| 162 | * respective event fit with in the limit.Please take a call |
| 163 | * on the limit based on the data requirements. |
| 164 | */ |
| 165 | |
| 166 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 167 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 168 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 169 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 170 | /*EXT TDLS*/ |
| 171 | /* |
| 172 | * Used to allocate the size of 4096 for the TDLS. |
| 173 | * The size of 4096 is considered assuming that all data per |
| 174 | * respective event fit with in the limit.Please take a call |
| 175 | * on the limit based on the data requirements on link layer |
| 176 | * statistics. |
| 177 | */ |
| 178 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 179 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 180 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | { |
| 182 | WLAN_CIPHER_SUITE_WEP40, |
| 183 | WLAN_CIPHER_SUITE_WEP104, |
| 184 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 185 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 186 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 187 | WLAN_CIPHER_SUITE_KRK, |
| 188 | WLAN_CIPHER_SUITE_CCMP, |
| 189 | #else |
| 190 | WLAN_CIPHER_SUITE_CCMP, |
| 191 | #endif |
| 192 | #ifdef FEATURE_WLAN_WAPI |
| 193 | WLAN_CIPHER_SUITE_SMS4, |
| 194 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 195 | #ifdef WLAN_FEATURE_11W |
| 196 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 197 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | }; |
| 199 | |
| 200 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 201 | { |
| 202 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 203 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 204 | } |
| 205 | |
| 206 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 207 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 208 | HDD2GHZCHAN(2412, 1, 0) , |
| 209 | HDD2GHZCHAN(2417, 2, 0) , |
| 210 | HDD2GHZCHAN(2422, 3, 0) , |
| 211 | HDD2GHZCHAN(2427, 4, 0) , |
| 212 | HDD2GHZCHAN(2432, 5, 0) , |
| 213 | HDD2GHZCHAN(2437, 6, 0) , |
| 214 | HDD2GHZCHAN(2442, 7, 0) , |
| 215 | HDD2GHZCHAN(2447, 8, 0) , |
| 216 | HDD2GHZCHAN(2452, 9, 0) , |
| 217 | HDD2GHZCHAN(2457, 10, 0) , |
| 218 | HDD2GHZCHAN(2462, 11, 0) , |
| 219 | HDD2GHZCHAN(2467, 12, 0) , |
| 220 | HDD2GHZCHAN(2472, 13, 0) , |
| 221 | HDD2GHZCHAN(2484, 14, 0) , |
| 222 | }; |
| 223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 224 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 225 | { |
| 226 | HDD2GHZCHAN(2412, 1, 0) , |
| 227 | HDD2GHZCHAN(2437, 6, 0) , |
| 228 | HDD2GHZCHAN(2462, 11, 0) , |
| 229 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | |
| 231 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 232 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 233 | HDD5GHZCHAN(4920, 240, 0) , |
| 234 | HDD5GHZCHAN(4940, 244, 0) , |
| 235 | HDD5GHZCHAN(4960, 248, 0) , |
| 236 | HDD5GHZCHAN(4980, 252, 0) , |
| 237 | HDD5GHZCHAN(5040, 208, 0) , |
| 238 | HDD5GHZCHAN(5060, 212, 0) , |
| 239 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | HDD5GHZCHAN(5180, 36, 0) , |
| 241 | HDD5GHZCHAN(5200, 40, 0) , |
| 242 | HDD5GHZCHAN(5220, 44, 0) , |
| 243 | HDD5GHZCHAN(5240, 48, 0) , |
| 244 | HDD5GHZCHAN(5260, 52, 0) , |
| 245 | HDD5GHZCHAN(5280, 56, 0) , |
| 246 | HDD5GHZCHAN(5300, 60, 0) , |
| 247 | HDD5GHZCHAN(5320, 64, 0) , |
| 248 | HDD5GHZCHAN(5500,100, 0) , |
| 249 | HDD5GHZCHAN(5520,104, 0) , |
| 250 | HDD5GHZCHAN(5540,108, 0) , |
| 251 | HDD5GHZCHAN(5560,112, 0) , |
| 252 | HDD5GHZCHAN(5580,116, 0) , |
| 253 | HDD5GHZCHAN(5600,120, 0) , |
| 254 | HDD5GHZCHAN(5620,124, 0) , |
| 255 | HDD5GHZCHAN(5640,128, 0) , |
| 256 | HDD5GHZCHAN(5660,132, 0) , |
| 257 | HDD5GHZCHAN(5680,136, 0) , |
| 258 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 259 | #ifdef FEATURE_WLAN_CH144 |
| 260 | HDD5GHZCHAN(5720,144, 0) , |
| 261 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | HDD5GHZCHAN(5745,149, 0) , |
| 263 | HDD5GHZCHAN(5765,153, 0) , |
| 264 | HDD5GHZCHAN(5785,157, 0) , |
| 265 | HDD5GHZCHAN(5805,161, 0) , |
| 266 | HDD5GHZCHAN(5825,165, 0) , |
| 267 | }; |
| 268 | |
| 269 | static struct ieee80211_rate g_mode_rates[] = |
| 270 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 271 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 272 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 273 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 274 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 275 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 276 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 277 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 278 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 279 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 280 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 281 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 283 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | |
| 285 | static struct ieee80211_rate a_mode_rates[] = |
| 286 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 287 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 288 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 289 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 290 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 291 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 292 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 293 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 295 | }; |
| 296 | |
| 297 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 298 | { |
| 299 | .channels = hdd_channels_2_4_GHZ, |
| 300 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 301 | .band = IEEE80211_BAND_2GHZ, |
| 302 | .bitrates = g_mode_rates, |
| 303 | .n_bitrates = g_mode_rates_size, |
| 304 | .ht_cap.ht_supported = 1, |
| 305 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 306 | | IEEE80211_HT_CAP_GRN_FLD |
| 307 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 308 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 309 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 310 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 311 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 312 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 313 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 314 | }; |
| 315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 317 | { |
| 318 | .channels = hdd_social_channels_2_4_GHZ, |
| 319 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 320 | .band = IEEE80211_BAND_2GHZ, |
| 321 | .bitrates = g_mode_rates, |
| 322 | .n_bitrates = g_mode_rates_size, |
| 323 | .ht_cap.ht_supported = 1, |
| 324 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 325 | | IEEE80211_HT_CAP_GRN_FLD |
| 326 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 327 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 328 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 329 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 330 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 331 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 332 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 333 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 334 | |
| 335 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 336 | { |
| 337 | .channels = hdd_channels_5_GHZ, |
| 338 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 339 | .band = IEEE80211_BAND_5GHZ, |
| 340 | .bitrates = a_mode_rates, |
| 341 | .n_bitrates = a_mode_rates_size, |
| 342 | .ht_cap.ht_supported = 1, |
| 343 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 344 | | IEEE80211_HT_CAP_GRN_FLD |
| 345 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 346 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 347 | | IEEE80211_HT_CAP_SGI_40 |
| 348 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 349 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 350 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 351 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 352 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 353 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 354 | }; |
| 355 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 356 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | TX/RX direction for each kind of interface */ |
| 358 | static const struct ieee80211_txrx_stypes |
| 359 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 360 | [NL80211_IFTYPE_STATION] = { |
| 361 | .tx = 0xffff, |
| 362 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 363 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 364 | }, |
| 365 | [NL80211_IFTYPE_AP] = { |
| 366 | .tx = 0xffff, |
| 367 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 368 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 369 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 370 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 371 | BIT(SIR_MAC_MGMT_AUTH) | |
| 372 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 373 | BIT(SIR_MAC_MGMT_ACTION), |
| 374 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 375 | [NL80211_IFTYPE_ADHOC] = { |
| 376 | .tx = 0xffff, |
| 377 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 378 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 379 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 380 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 381 | BIT(SIR_MAC_MGMT_AUTH) | |
| 382 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 383 | BIT(SIR_MAC_MGMT_ACTION), |
| 384 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 386 | .tx = 0xffff, |
| 387 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 388 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 389 | }, |
| 390 | [NL80211_IFTYPE_P2P_GO] = { |
| 391 | /* This is also same as for SoftAP */ |
| 392 | .tx = 0xffff, |
| 393 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 394 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 395 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 396 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 397 | BIT(SIR_MAC_MGMT_AUTH) | |
| 398 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 399 | BIT(SIR_MAC_MGMT_ACTION), |
| 400 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | }; |
| 402 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 403 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 404 | static const struct ieee80211_iface_limit |
| 405 | wlan_hdd_iface_limit[] = { |
| 406 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 407 | /* max = 3 ; Our driver create two interfaces during driver init |
| 408 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 409 | * interface until a group is formed. In JB architecture, once the |
| 410 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 411 | * Client. |
| 412 | * When supplicant remove the group, it first issue a set interface |
| 413 | * cmd to change the mode back to Station. In JB this works fine as |
| 414 | * we advertize two station type interface during driver init. |
| 415 | * Some vendors create separate interface for P2P GO/Client, |
| 416 | * after group formation(Third one). But while group remove |
| 417 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 418 | * But as we advertized only two sta type interfaces nl80211 was |
| 419 | * returning error for the third one which was leading to failure in |
| 420 | * delete interface. Ideally while removing the group, supplicant |
| 421 | * should not try to change the 3rd interface mode to Station type. |
| 422 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 423 | * interface type to 3 |
| 424 | */ |
| 425 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 426 | .types = BIT(NL80211_IFTYPE_STATION), |
| 427 | }, |
| 428 | { |
| 429 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 430 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 431 | }, |
| 432 | { |
| 433 | .max = 1, |
| 434 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 435 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 436 | }, |
| 437 | }; |
| 438 | |
| 439 | /* By default, only single channel concurrency is allowed */ |
| 440 | static struct ieee80211_iface_combination |
| 441 | wlan_hdd_iface_combination = { |
| 442 | .limits = wlan_hdd_iface_limit, |
| 443 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 444 | /* |
| 445 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 446 | * and p2p0 interfaces during driver init |
| 447 | * Some vendors create separate interface for P2P operations. |
| 448 | * wlan0: STA interface |
| 449 | * p2p0: P2P Device interface, action frames goes |
| 450 | * through this interface. |
| 451 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 452 | * created for p2p operations(GO/CLIENT interface). |
| 453 | */ |
| 454 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 455 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 456 | .beacon_int_infra_match = false, |
| 457 | }; |
| 458 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 461 | |
| 462 | /* Data rate 100KBPS based on IE Index */ |
| 463 | struct index_data_rate_type |
| 464 | { |
| 465 | v_U8_t beacon_rate_index; |
| 466 | v_U16_t supported_rate[4]; |
| 467 | }; |
| 468 | |
| 469 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 470 | The IDX field is the rate index |
| 471 | The HI field is the rate when RSSI is strong or being ignored |
| 472 | (in this case we report actual rate) |
| 473 | The MID field is the rate when RSSI is moderate |
| 474 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 475 | The LO field is the rate when RSSI is low |
| 476 | (in this case we don't report rates, actual current rate used) |
| 477 | */ |
| 478 | static const struct |
| 479 | { |
| 480 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 481 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 482 | } supported_data_rate[] = |
| 483 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 484 | /* IDX HI HM LM LO (RSSI-based index */ |
| 485 | {2, { 10, 10, 10, 0}}, |
| 486 | {4, { 20, 20, 10, 0}}, |
| 487 | {11, { 55, 20, 10, 0}}, |
| 488 | {12, { 60, 55, 20, 0}}, |
| 489 | {18, { 90, 55, 20, 0}}, |
| 490 | {22, {110, 55, 20, 0}}, |
| 491 | {24, {120, 90, 60, 0}}, |
| 492 | {36, {180, 120, 60, 0}}, |
| 493 | {44, {220, 180, 60, 0}}, |
| 494 | {48, {240, 180, 90, 0}}, |
| 495 | {66, {330, 180, 90, 0}}, |
| 496 | {72, {360, 240, 90, 0}}, |
| 497 | {96, {480, 240, 120, 0}}, |
| 498 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 499 | }; |
| 500 | |
| 501 | /* MCS Based rate table */ |
| 502 | static struct index_data_rate_type supported_mcs_rate[] = |
| 503 | { |
| 504 | /* MCS L20 L40 S20 S40 */ |
| 505 | {0, {65, 135, 72, 150}}, |
| 506 | {1, {130, 270, 144, 300}}, |
| 507 | {2, {195, 405, 217, 450}}, |
| 508 | {3, {260, 540, 289, 600}}, |
| 509 | {4, {390, 810, 433, 900}}, |
| 510 | {5, {520, 1080, 578, 1200}}, |
| 511 | {6, {585, 1215, 650, 1350}}, |
| 512 | {7, {650, 1350, 722, 1500}} |
| 513 | }; |
| 514 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 515 | #ifdef WLAN_FEATURE_11AC |
| 516 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 517 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 518 | |
| 519 | struct index_vht_data_rate_type |
| 520 | { |
| 521 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 522 | v_U16_t supported_VHT80_rate[2]; |
| 523 | v_U16_t supported_VHT40_rate[2]; |
| 524 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 525 | }; |
| 526 | |
| 527 | typedef enum |
| 528 | { |
| 529 | DATA_RATE_11AC_MAX_MCS_7, |
| 530 | DATA_RATE_11AC_MAX_MCS_8, |
| 531 | DATA_RATE_11AC_MAX_MCS_9, |
| 532 | DATA_RATE_11AC_MAX_MCS_NA |
| 533 | } eDataRate11ACMaxMcs; |
| 534 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 535 | /* SSID broadcast type */ |
| 536 | typedef enum eSSIDBcastType |
| 537 | { |
| 538 | eBCAST_UNKNOWN = 0, |
| 539 | eBCAST_NORMAL = 1, |
| 540 | eBCAST_HIDDEN = 2, |
| 541 | } tSSIDBcastType; |
| 542 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 543 | /* MCS Based VHT rate table */ |
| 544 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 545 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 546 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 547 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 548 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 549 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 550 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 551 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 552 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 553 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 554 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 555 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 556 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 557 | }; |
| 558 | #endif /* WLAN_FEATURE_11AC */ |
| 559 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 560 | /*array index points to MCS and array value points respective rssi*/ |
| 561 | static int rssiMcsTbl[][10] = |
| 562 | { |
| 563 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 564 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 565 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 566 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 567 | }; |
| 568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 570 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 571 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 572 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 574 | #ifdef WLAN_NL80211_TESTMODE |
| 575 | enum wlan_hdd_tm_attr |
| 576 | { |
| 577 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 578 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 579 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 580 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 581 | /* keep last */ |
| 582 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 583 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 584 | }; |
| 585 | |
| 586 | enum wlan_hdd_tm_cmd |
| 587 | { |
| 588 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 589 | }; |
| 590 | |
| 591 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 592 | |
| 593 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 594 | { |
| 595 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 596 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 597 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 598 | }; |
| 599 | #endif /* WLAN_NL80211_TESTMODE */ |
| 600 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 601 | #ifdef FEATURE_WLAN_CH_AVOID |
| 602 | /* |
| 603 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 604 | * This is called when wlan driver needs to send vendor specific |
| 605 | * avoid frequency range event to userspace |
| 606 | */ |
| 607 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 608 | tHddAvoidFreqList *pAvoidFreqList) |
| 609 | { |
| 610 | struct sk_buff *vendor_event; |
| 611 | |
| 612 | ENTER(); |
| 613 | |
| 614 | if (!pHddCtx) |
| 615 | { |
| 616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 617 | "%s: HDD context is null", __func__); |
| 618 | return -1; |
| 619 | } |
| 620 | |
| 621 | if (!pAvoidFreqList) |
| 622 | { |
| 623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 624 | "%s: pAvoidFreqList is null", __func__); |
| 625 | return -1; |
| 626 | } |
| 627 | |
| 628 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 629 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 630 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 631 | GFP_KERNEL); |
| 632 | if (!vendor_event) |
| 633 | { |
| 634 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 635 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 636 | return -1; |
| 637 | } |
| 638 | |
| 639 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 640 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 641 | |
| 642 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 643 | |
| 644 | EXIT(); |
| 645 | return 0; |
| 646 | } |
| 647 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 648 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 649 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 650 | |
| 651 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 652 | struct sk_buff *vendor_event) |
| 653 | { |
| 654 | if (nla_put_u8(vendor_event, |
| 655 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 656 | stats->rate.preamble) || |
| 657 | nla_put_u8(vendor_event, |
| 658 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 659 | stats->rate.nss) || |
| 660 | nla_put_u8(vendor_event, |
| 661 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 662 | stats->rate.bw) || |
| 663 | nla_put_u8(vendor_event, |
| 664 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 665 | stats->rate.rateMcsIdx) || |
| 666 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 667 | stats->rate.bitrate ) || |
| 668 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 669 | stats->txMpdu ) || |
| 670 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 671 | stats->rxMpdu ) || |
| 672 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 673 | stats->mpduLost ) || |
| 674 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 675 | stats->retries) || |
| 676 | nla_put_u32(vendor_event, |
| 677 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 678 | stats->retriesShort ) || |
| 679 | nla_put_u32(vendor_event, |
| 680 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 681 | stats->retriesLong)) |
| 682 | { |
| 683 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 684 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 685 | return FALSE; |
| 686 | } |
| 687 | return TRUE; |
| 688 | } |
| 689 | |
| 690 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 691 | struct sk_buff *vendor_event) |
| 692 | { |
| 693 | u32 i = 0; |
| 694 | struct nlattr *rateInfo; |
| 695 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 696 | stats->type) || |
| 697 | nla_put(vendor_event, |
| 698 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 699 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 700 | nla_put_u32(vendor_event, |
| 701 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 702 | stats->capabilities) || |
| 703 | nla_put_u32(vendor_event, |
| 704 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 705 | stats->numRate)) |
| 706 | { |
| 707 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 708 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 709 | goto error; |
| 710 | } |
| 711 | |
| 712 | rateInfo = nla_nest_start(vendor_event, |
| 713 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
| 714 | for (i = 0; i < stats->numRate; i++) |
| 715 | { |
| 716 | struct nlattr *rates; |
| 717 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 718 | stats->rateStats + |
| 719 | (i * sizeof(tSirWifiRateStat))); |
| 720 | rates = nla_nest_start(vendor_event, i); |
| 721 | |
| 722 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 723 | { |
| 724 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 725 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 726 | return FALSE; |
| 727 | } |
| 728 | nla_nest_end(vendor_event, rates); |
| 729 | } |
| 730 | nla_nest_end(vendor_event, rateInfo); |
| 731 | |
| 732 | return TRUE; |
| 733 | error: |
| 734 | return FALSE; |
| 735 | } |
| 736 | |
| 737 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 738 | struct sk_buff *vendor_event) |
| 739 | { |
| 740 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 741 | stats->ac ) || |
| 742 | nla_put_u32(vendor_event, |
| 743 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 744 | stats->txMpdu ) || |
| 745 | nla_put_u32(vendor_event, |
| 746 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 747 | stats->rxMpdu ) || |
| 748 | nla_put_u32(vendor_event, |
| 749 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 750 | stats->txMcast ) || |
| 751 | nla_put_u32(vendor_event, |
| 752 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 753 | stats->rxMcast ) || |
| 754 | nla_put_u32(vendor_event, |
| 755 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 756 | stats->rxAmpdu ) || |
| 757 | nla_put_u32(vendor_event, |
| 758 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 759 | stats->txAmpdu ) || |
| 760 | nla_put_u32(vendor_event, |
| 761 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 762 | stats->mpduLost )|| |
| 763 | nla_put_u32(vendor_event, |
| 764 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 765 | stats->retries ) || |
| 766 | nla_put_u32(vendor_event, |
| 767 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 768 | stats->retriesShort ) || |
| 769 | nla_put_u32(vendor_event, |
| 770 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 771 | stats->retriesLong ) || |
| 772 | nla_put_u32(vendor_event, |
| 773 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 774 | stats->contentionTimeMin ) || |
| 775 | nla_put_u32(vendor_event, |
| 776 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 777 | stats->contentionTimeMax ) || |
| 778 | nla_put_u32(vendor_event, |
| 779 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 780 | stats->contentionTimeAvg ) || |
| 781 | nla_put_u32(vendor_event, |
| 782 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 783 | stats->contentionNumSamples )) |
| 784 | { |
| 785 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 786 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 787 | return FALSE; |
| 788 | } |
| 789 | return TRUE; |
| 790 | } |
| 791 | |
| 792 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 793 | struct sk_buff *vendor_event) |
| 794 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 795 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 796 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 797 | nla_put(vendor_event, |
| 798 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 799 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 800 | nla_put_u32(vendor_event, |
| 801 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 802 | stats->state ) || |
| 803 | nla_put_u32(vendor_event, |
| 804 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 805 | stats->roaming ) || |
| 806 | nla_put_u32(vendor_event, |
| 807 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 808 | stats->capabilities ) || |
| 809 | nla_put(vendor_event, |
| 810 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 811 | strlen(stats->ssid), stats->ssid) || |
| 812 | nla_put(vendor_event, |
| 813 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 814 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 815 | nla_put(vendor_event, |
| 816 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 817 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 818 | nla_put(vendor_event, |
| 819 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 820 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 821 | ) |
| 822 | { |
| 823 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 824 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 825 | return FALSE; |
| 826 | } |
| 827 | return TRUE; |
| 828 | } |
| 829 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 830 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 831 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 832 | struct sk_buff *vendor_event) |
| 833 | { |
| 834 | int i = 0; |
| 835 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 836 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 837 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 838 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 839 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 840 | if (FALSE == put_wifi_interface_info( |
| 841 | &pWifiIfaceStat->info, |
| 842 | vendor_event)) |
| 843 | { |
| 844 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 845 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 846 | return FALSE; |
| 847 | |
| 848 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 849 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 850 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 851 | if (NULL == pWifiIfaceStatTL) |
| 852 | { |
| 853 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 854 | return FALSE; |
| 855 | } |
| 856 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 857 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 858 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 859 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 860 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 861 | |
| 862 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 863 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 864 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 865 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 866 | |
| 867 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 868 | { |
| 869 | if (VOS_STATUS_SUCCESS == |
| 870 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 871 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 872 | { |
| 873 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 874 | * obtained from TL structure |
| 875 | */ |
| 876 | |
| 877 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 878 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 879 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 880 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 881 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 882 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 883 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 884 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 885 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 886 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 887 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 888 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 889 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 890 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 891 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 892 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 893 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 894 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 895 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 896 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 897 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 898 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 899 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 900 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 901 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 902 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 903 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 904 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 905 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 906 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 907 | } |
| 908 | else |
| 909 | { |
| 910 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 911 | } |
| 912 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 913 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 914 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 915 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 916 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 917 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 918 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 919 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 920 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 921 | } |
| 922 | else |
| 923 | { |
| 924 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 925 | } |
| 926 | |
| 927 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 928 | |
| 929 | if (nla_put_u32(vendor_event, |
| 930 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 931 | pWifiIfaceStat->beaconRx) || |
| 932 | nla_put_u32(vendor_event, |
| 933 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 934 | pWifiIfaceStat->mgmtRx) || |
| 935 | nla_put_u32(vendor_event, |
| 936 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 937 | pWifiIfaceStat->mgmtActionRx) || |
| 938 | nla_put_u32(vendor_event, |
| 939 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 940 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 941 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 942 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 943 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 944 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 945 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 946 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 947 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 948 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 949 | pWifiIfaceStat->rssiAck)) |
| 950 | { |
| 951 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 952 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 953 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 954 | return FALSE; |
| 955 | } |
| 956 | |
| 957 | wmmInfo = nla_nest_start(vendor_event, |
| 958 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
| 959 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 960 | { |
| 961 | struct nlattr *wmmStats; |
| 962 | wmmStats = nla_nest_start(vendor_event, i); |
| 963 | if (FALSE == put_wifi_wmm_ac_stat( |
| 964 | &pWifiIfaceStat->AccessclassStats[i], |
| 965 | vendor_event)) |
| 966 | { |
| 967 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 968 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
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 FALSE; |
| 971 | } |
| 972 | |
| 973 | nla_nest_end(vendor_event, wmmStats); |
| 974 | } |
| 975 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 976 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 977 | return TRUE; |
| 978 | } |
| 979 | |
| 980 | static tSirWifiInterfaceMode |
| 981 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 982 | { |
| 983 | switch (deviceMode) |
| 984 | { |
| 985 | case WLAN_HDD_INFRA_STATION: |
| 986 | return WIFI_INTERFACE_STA; |
| 987 | case WLAN_HDD_SOFTAP: |
| 988 | return WIFI_INTERFACE_SOFTAP; |
| 989 | case WLAN_HDD_P2P_CLIENT: |
| 990 | return WIFI_INTERFACE_P2P_CLIENT; |
| 991 | case WLAN_HDD_P2P_GO: |
| 992 | return WIFI_INTERFACE_P2P_GO; |
| 993 | case WLAN_HDD_IBSS: |
| 994 | return WIFI_INTERFACE_IBSS; |
| 995 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 996 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 997 | } |
| 998 | } |
| 999 | |
| 1000 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1001 | tpSirWifiInterfaceInfo pInfo) |
| 1002 | { |
| 1003 | v_U8_t *staMac = NULL; |
| 1004 | hdd_station_ctx_t *pHddStaCtx; |
| 1005 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1006 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1007 | |
| 1008 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1009 | |
| 1010 | vos_mem_copy(pInfo->macAddr, |
| 1011 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1012 | |
| 1013 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1014 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1015 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1016 | { |
| 1017 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1018 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1019 | { |
| 1020 | pInfo->state = WIFI_DISCONNECTED; |
| 1021 | } |
| 1022 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1023 | { |
| 1024 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1025 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1026 | pAdapter->sessionId); |
| 1027 | pInfo->state = WIFI_ASSOCIATING; |
| 1028 | } |
| 1029 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1030 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1031 | { |
| 1032 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1033 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1034 | "%s: client " MAC_ADDRESS_STR |
| 1035 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1036 | MAC_ADDR_ARRAY(staMac)); |
| 1037 | pInfo->state = WIFI_AUTHENTICATING; |
| 1038 | } |
| 1039 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1040 | { |
| 1041 | pInfo->state = WIFI_ASSOCIATED; |
| 1042 | vos_mem_copy(pInfo->bssid, |
| 1043 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1044 | vos_mem_copy(pInfo->ssid, |
| 1045 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1046 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1047 | //NULL Terminate the string. |
| 1048 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1049 | } |
| 1050 | } |
| 1051 | vos_mem_copy(pInfo->countryStr, |
| 1052 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1053 | |
| 1054 | vos_mem_copy(pInfo->apCountryStr, |
| 1055 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1056 | |
| 1057 | return TRUE; |
| 1058 | } |
| 1059 | |
| 1060 | /* |
| 1061 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1062 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1063 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1064 | * layers. |
| 1065 | */ |
| 1066 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1067 | v_VOID_t *pData) |
| 1068 | { |
| 1069 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1070 | tpSirWifiRateStat pWifiRateStat; |
| 1071 | tpSirWifiPeerStat pWifiPeerStat; |
| 1072 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1073 | struct nlattr *peerInfo; |
| 1074 | struct sk_buff *vendor_event; |
| 1075 | int status, i; |
| 1076 | |
| 1077 | status = wlan_hdd_validate_context(pHddCtx); |
| 1078 | if (0 != status) |
| 1079 | { |
| 1080 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1081 | FL("HDD context is not valid") ); |
| 1082 | return; |
| 1083 | } |
| 1084 | |
| 1085 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1086 | |
| 1087 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1088 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1089 | pWifiPeerStat->numPeers); |
| 1090 | { |
| 1091 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1092 | { |
| 1093 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1094 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1095 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1096 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1097 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1098 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1099 | } |
| 1100 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1101 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1102 | } |
| 1103 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1104 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1105 | " %d) LL_STATS Channel Stats " |
| 1106 | " Peer Type %u " |
| 1107 | " peerMacAddress %pM " |
| 1108 | " capabilities 0x%x " |
| 1109 | " numRate %u ", |
| 1110 | i, |
| 1111 | pWifiPeerInfo->type, |
| 1112 | pWifiPeerInfo->peerMacAddress, |
| 1113 | pWifiPeerInfo->capabilities, |
| 1114 | pWifiPeerInfo->numRate); |
| 1115 | { |
| 1116 | int j; |
| 1117 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1118 | { |
| 1119 | pWifiRateStat = (tpSirWifiRateStat) |
| 1120 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1121 | ( j * sizeof(tSirWifiRateStat))); |
| 1122 | |
| 1123 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1124 | " peer Rate Stats " |
| 1125 | " preamble %u " |
| 1126 | " nss %u " |
| 1127 | " bw %u " |
| 1128 | " rateMcsIdx %u " |
| 1129 | " reserved %u " |
| 1130 | " bitrate %u " |
| 1131 | " txMpdu %u " |
| 1132 | " rxMpdu %u " |
| 1133 | " mpduLost %u " |
| 1134 | " retries %u " |
| 1135 | " retriesShort %u " |
| 1136 | " retriesLong %u", |
| 1137 | pWifiRateStat->rate.preamble, |
| 1138 | pWifiRateStat->rate.nss, |
| 1139 | pWifiRateStat->rate.bw, |
| 1140 | pWifiRateStat->rate.rateMcsIdx, |
| 1141 | pWifiRateStat->rate.reserved, |
| 1142 | pWifiRateStat->rate.bitrate, |
| 1143 | pWifiRateStat->txMpdu, |
| 1144 | pWifiRateStat->rxMpdu, |
| 1145 | pWifiRateStat->mpduLost, |
| 1146 | pWifiRateStat->retries, |
| 1147 | pWifiRateStat->retriesShort, |
| 1148 | pWifiRateStat->retriesLong); |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | } |
| 1153 | |
| 1154 | /* |
| 1155 | * Allocate a size of 4096 for the peer stats comprising |
| 1156 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1157 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1158 | * NL attribute.The size of 4096 is considered assuming |
| 1159 | * that number of rates shall not exceed beyond 50 with |
| 1160 | * the sizeof (tSirWifiRateStat) being 32. |
| 1161 | */ |
| 1162 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1163 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1164 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1165 | GFP_KERNEL); |
| 1166 | if (!vendor_event) |
| 1167 | { |
| 1168 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1169 | "%s: cfg80211_vendor_event_alloc failed", |
| 1170 | __func__); |
| 1171 | return; |
| 1172 | } |
| 1173 | if (nla_put_u32(vendor_event, |
| 1174 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1175 | pWifiPeerStat->numPeers)) |
| 1176 | { |
| 1177 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1178 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1179 | kfree_skb(vendor_event); |
| 1180 | return; |
| 1181 | } |
| 1182 | |
| 1183 | peerInfo = nla_nest_start(vendor_event, |
| 1184 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
| 1185 | |
| 1186 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1187 | pWifiPeerStat->peerInfo); |
| 1188 | |
| 1189 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1190 | { |
| 1191 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
| 1192 | int numRate = pWifiPeerInfo->numRate; |
| 1193 | |
| 1194 | if (FALSE == put_wifi_peer_info( |
| 1195 | pWifiPeerInfo, vendor_event)) |
| 1196 | { |
| 1197 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1198 | "%s: put_wifi_peer_info put fail", __func__); |
| 1199 | kfree_skb(vendor_event); |
| 1200 | return; |
| 1201 | } |
| 1202 | |
| 1203 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1204 | pWifiPeerStat->peerInfo + |
| 1205 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1206 | (numRate * sizeof (tSirWifiRateStat))); |
| 1207 | nla_nest_end(vendor_event, peers); |
| 1208 | } |
| 1209 | nla_nest_end(vendor_event, peerInfo); |
| 1210 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1211 | } |
| 1212 | |
| 1213 | /* |
| 1214 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1215 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1216 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1217 | * layers. |
| 1218 | */ |
| 1219 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1220 | v_VOID_t *pData) |
| 1221 | { |
| 1222 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1223 | struct sk_buff *vendor_event; |
| 1224 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1225 | int status; |
| 1226 | |
| 1227 | status = wlan_hdd_validate_context(pHddCtx); |
| 1228 | if (0 != status) |
| 1229 | { |
| 1230 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1231 | FL("HDD context is not valid") ); |
| 1232 | return; |
| 1233 | } |
| 1234 | /* |
| 1235 | * Allocate a size of 4096 for the interface stats comprising |
| 1236 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1237 | * assuming that all these fit with in the limit.Please take |
| 1238 | * a call on the limit based on the data requirements on |
| 1239 | * interface statistics. |
| 1240 | */ |
| 1241 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1242 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1243 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1244 | GFP_KERNEL); |
| 1245 | if (!vendor_event) |
| 1246 | { |
| 1247 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1248 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1249 | return; |
| 1250 | } |
| 1251 | |
| 1252 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1253 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1254 | |
| 1255 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1256 | &pWifiIfaceStat->info)) |
| 1257 | { |
| 1258 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1259 | FL("hdd_get_interface_info get fail") ); |
| 1260 | kfree_skb(vendor_event); |
| 1261 | return; |
| 1262 | } |
| 1263 | |
| 1264 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1265 | vendor_event)) |
| 1266 | { |
| 1267 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1268 | FL("put_wifi_iface_stats fail") ); |
| 1269 | kfree_skb(vendor_event); |
| 1270 | return; |
| 1271 | } |
| 1272 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1273 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1274 | "WMI_LINK_STATS_IFACE Data"); |
| 1275 | |
| 1276 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1277 | "LL_STATS_IFACE: " |
| 1278 | " Mode %u " |
| 1279 | " MAC %pM " |
| 1280 | " State %u " |
| 1281 | " Roaming %u " |
| 1282 | " capabilities 0x%x " |
| 1283 | " SSID %s " |
| 1284 | " BSSID %pM", |
| 1285 | pWifiIfaceStat->info.mode, |
| 1286 | pWifiIfaceStat->info.macAddr, |
| 1287 | pWifiIfaceStat->info.state, |
| 1288 | pWifiIfaceStat->info.roaming, |
| 1289 | pWifiIfaceStat->info.capabilities, |
| 1290 | pWifiIfaceStat->info.ssid, |
| 1291 | pWifiIfaceStat->info.bssid); |
| 1292 | |
| 1293 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1294 | " AP country str: %c%c%c", |
| 1295 | pWifiIfaceStat->info.apCountryStr[0], |
| 1296 | pWifiIfaceStat->info.apCountryStr[1], |
| 1297 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1298 | |
| 1299 | |
| 1300 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1301 | " Country Str Association: %c%c%c", |
| 1302 | pWifiIfaceStat->info.countryStr[0], |
| 1303 | pWifiIfaceStat->info.countryStr[1], |
| 1304 | pWifiIfaceStat->info.countryStr[2]); |
| 1305 | |
| 1306 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1307 | " beaconRx %u " |
| 1308 | " mgmtRx %u " |
| 1309 | " mgmtActionRx %u " |
| 1310 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1311 | " rssiMgmt %d " |
| 1312 | " rssiData %d " |
| 1313 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1314 | pWifiIfaceStat->beaconRx, |
| 1315 | pWifiIfaceStat->mgmtRx, |
| 1316 | pWifiIfaceStat->mgmtActionRx, |
| 1317 | pWifiIfaceStat->mgmtActionTx, |
| 1318 | pWifiIfaceStat->rssiMgmt, |
| 1319 | pWifiIfaceStat->rssiData, |
| 1320 | pWifiIfaceStat->rssiAck ); |
| 1321 | |
| 1322 | |
| 1323 | { |
| 1324 | int i; |
| 1325 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1326 | { |
| 1327 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1328 | |
| 1329 | " %d) LL_STATS IFACE: " |
| 1330 | " ac: %u txMpdu: %u " |
| 1331 | " rxMpdu: %u txMcast: %u " |
| 1332 | " rxMcast: %u rxAmpdu: %u " |
| 1333 | " txAmpdu: %u mpduLost: %u " |
| 1334 | " retries: %u retriesShort: %u " |
| 1335 | " retriesLong: %u contentionTimeMin: %u " |
| 1336 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1337 | " contentionNumSamples: %u", |
| 1338 | i, |
| 1339 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1340 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1341 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1342 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1343 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1344 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1345 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1346 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1347 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1348 | pWifiIfaceStat-> |
| 1349 | AccessclassStats[i].retriesShort, |
| 1350 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1351 | pWifiIfaceStat-> |
| 1352 | AccessclassStats[i].contentionTimeMin, |
| 1353 | pWifiIfaceStat-> |
| 1354 | AccessclassStats[i].contentionTimeMax, |
| 1355 | pWifiIfaceStat-> |
| 1356 | AccessclassStats[i].contentionTimeAvg, |
| 1357 | pWifiIfaceStat-> |
| 1358 | AccessclassStats[i].contentionNumSamples); |
| 1359 | |
| 1360 | } |
| 1361 | } |
| 1362 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1363 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1364 | } |
| 1365 | |
| 1366 | /* |
| 1367 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1368 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1369 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1370 | * layers. |
| 1371 | */ |
| 1372 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1373 | v_VOID_t *pData) |
| 1374 | { |
| 1375 | int status, i; |
| 1376 | tpSirWifiRadioStat pWifiRadioStat; |
| 1377 | tpSirWifiChannelStats pWifiChannelStats; |
| 1378 | struct sk_buff *vendor_event; |
| 1379 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1380 | struct nlattr *chList; |
| 1381 | |
| 1382 | status = wlan_hdd_validate_context(pHddCtx); |
| 1383 | if (0 != status) |
| 1384 | { |
| 1385 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1386 | FL("HDD context is not valid") ); |
| 1387 | return; |
| 1388 | } |
| 1389 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1390 | |
| 1391 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1392 | "LL_STATS_RADIO" |
| 1393 | " radio is %d onTime is %u " |
| 1394 | " txTime is %u rxTime is %u " |
| 1395 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1396 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1397 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1398 | " numChannels is %u", |
| 1399 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1400 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1401 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1402 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1403 | pWifiRadioStat->onTimeRoamScan, |
| 1404 | pWifiRadioStat->onTimePnoScan, |
| 1405 | pWifiRadioStat->onTimeHs20, |
| 1406 | pWifiRadioStat->numChannels); |
| 1407 | /* |
| 1408 | * Allocate a size of 4096 for the Radio stats comprising |
| 1409 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1410 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1411 | * NL attribute.The size of 4096 is considered assuming that |
| 1412 | * number of channels shall not exceed beyond 60 with the |
| 1413 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1414 | */ |
| 1415 | |
| 1416 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1417 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1418 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1419 | GFP_KERNEL); |
| 1420 | |
| 1421 | if (!vendor_event) |
| 1422 | { |
| 1423 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1424 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1425 | return; |
| 1426 | } |
| 1427 | |
| 1428 | if (nla_put_u32(vendor_event, |
| 1429 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1430 | pWifiRadioStat->radio) || |
| 1431 | nla_put_u32(vendor_event, |
| 1432 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1433 | pWifiRadioStat->onTime) || |
| 1434 | nla_put_u32(vendor_event, |
| 1435 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1436 | pWifiRadioStat->txTime) || |
| 1437 | nla_put_u32(vendor_event, |
| 1438 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1439 | pWifiRadioStat->rxTime) || |
| 1440 | nla_put_u32(vendor_event, |
| 1441 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1442 | pWifiRadioStat->onTimeScan) || |
| 1443 | nla_put_u32(vendor_event, |
| 1444 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1445 | pWifiRadioStat->onTimeNbd) || |
| 1446 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1447 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1448 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1449 | nla_put_u32(vendor_event, |
| 1450 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1451 | pWifiRadioStat->onTimeRoamScan) || |
| 1452 | nla_put_u32(vendor_event, |
| 1453 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1454 | pWifiRadioStat->onTimePnoScan) || |
| 1455 | nla_put_u32(vendor_event, |
| 1456 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1457 | pWifiRadioStat->onTimeHs20) || |
| 1458 | nla_put_u32(vendor_event, |
| 1459 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1460 | pWifiRadioStat->numChannels)) |
| 1461 | { |
| 1462 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1463 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1464 | kfree_skb(vendor_event); |
| 1465 | return ; |
| 1466 | } |
| 1467 | |
| 1468 | chList = nla_nest_start(vendor_event, |
| 1469 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
| 1470 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1471 | { |
| 1472 | struct nlattr *chInfo; |
| 1473 | |
| 1474 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1475 | pWifiRadioStat->channels + |
| 1476 | (i * sizeof(tSirWifiChannelStats))); |
| 1477 | |
| 1478 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1479 | " %d) Channel Info" |
| 1480 | " width is %u " |
| 1481 | " CenterFreq %u " |
| 1482 | " CenterFreq0 %u " |
| 1483 | " CenterFreq1 %u " |
| 1484 | " onTime %u " |
| 1485 | " ccaBusyTime %u", |
| 1486 | i, |
| 1487 | pWifiChannelStats->channel.width, |
| 1488 | pWifiChannelStats->channel.centerFreq, |
| 1489 | pWifiChannelStats->channel.centerFreq0, |
| 1490 | pWifiChannelStats->channel.centerFreq1, |
| 1491 | pWifiChannelStats->onTime, |
| 1492 | pWifiChannelStats->ccaBusyTime); |
| 1493 | |
| 1494 | |
| 1495 | chInfo = nla_nest_start(vendor_event, i); |
| 1496 | |
| 1497 | if (nla_put_u32(vendor_event, |
| 1498 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1499 | pWifiChannelStats->channel.width) || |
| 1500 | nla_put_u32(vendor_event, |
| 1501 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1502 | pWifiChannelStats->channel.centerFreq) || |
| 1503 | nla_put_u32(vendor_event, |
| 1504 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1505 | pWifiChannelStats->channel.centerFreq0) || |
| 1506 | nla_put_u32(vendor_event, |
| 1507 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1508 | pWifiChannelStats->channel.centerFreq1) || |
| 1509 | nla_put_u32(vendor_event, |
| 1510 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1511 | pWifiChannelStats->onTime) || |
| 1512 | nla_put_u32(vendor_event, |
| 1513 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1514 | pWifiChannelStats->ccaBusyTime)) |
| 1515 | { |
| 1516 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1517 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1518 | kfree_skb(vendor_event); |
| 1519 | return ; |
| 1520 | } |
| 1521 | nla_nest_end(vendor_event, chInfo); |
| 1522 | } |
| 1523 | nla_nest_end(vendor_event, chList); |
| 1524 | |
| 1525 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1526 | return; |
| 1527 | } |
| 1528 | |
| 1529 | /* |
| 1530 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1531 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1532 | * data to the NL data and send the same to the kernel/upper layers. |
| 1533 | */ |
| 1534 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1535 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1536 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1537 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1538 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1539 | hdd_adapter_t *pAdapter = NULL; |
| 1540 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1541 | int status; |
| 1542 | |
| 1543 | status = wlan_hdd_validate_context(pHddCtx); |
| 1544 | |
| 1545 | if (0 != status) |
| 1546 | { |
| 1547 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1548 | FL("HDD context is not valid")); |
| 1549 | return; |
| 1550 | } |
| 1551 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1552 | |
| 1553 | |
| 1554 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1555 | if (NULL == pAdapter) |
| 1556 | { |
| 1557 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1558 | FL(" MAC address %pM does not exist with host"), |
| 1559 | macAddr); |
| 1560 | return; |
| 1561 | } |
| 1562 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1563 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1564 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1565 | pAdapter->dev->name, indType); |
| 1566 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1567 | switch (indType) |
| 1568 | { |
| 1569 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1570 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1571 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1572 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1573 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1574 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1575 | linkLayerStatsResults->paramId); |
| 1576 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1577 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1578 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1579 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1580 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1581 | linkLayerStatsResults->respId); |
| 1582 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1583 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1584 | linkLayerStatsResults->moreResultToFollow); |
| 1585 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1586 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1587 | linkLayerStatsResults->result); |
| 1588 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1589 | { |
| 1590 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1591 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1592 | } |
| 1593 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1594 | { |
| 1595 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1596 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1597 | } |
| 1598 | else if ( linkLayerStatsResults->paramId & |
| 1599 | WMI_LINK_STATS_ALL_PEER ) |
| 1600 | { |
| 1601 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1602 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1603 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1604 | else |
| 1605 | { |
| 1606 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1607 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1608 | } |
| 1609 | |
| 1610 | break; |
| 1611 | } |
| 1612 | default: |
| 1613 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1614 | break; |
| 1615 | } |
| 1616 | return; |
| 1617 | } |
| 1618 | |
| 1619 | const struct |
| 1620 | nla_policy |
| 1621 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1622 | { |
| 1623 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1624 | { .type = NLA_U32 }, |
| 1625 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1626 | { .type = NLA_U32 }, |
| 1627 | }; |
| 1628 | |
| 1629 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1630 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 1631 | const void *data, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1632 | int data_len) |
| 1633 | { |
| 1634 | int status; |
| 1635 | 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] | 1636 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1637 | struct net_device *dev = wdev->netdev; |
| 1638 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1639 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1640 | hdd_station_ctx_t *pHddStaCtx; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1641 | |
| 1642 | status = wlan_hdd_validate_context(pHddCtx); |
| 1643 | if (0 != status) |
| 1644 | { |
| 1645 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1646 | FL("HDD context is not valid")); |
| 1647 | return -EINVAL; |
| 1648 | } |
| 1649 | |
| 1650 | if (NULL == pAdapter) |
| 1651 | { |
| 1652 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1653 | FL("HDD adapter is Null")); |
| 1654 | return -ENODEV; |
| 1655 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1656 | /* check the LLStats Capability */ |
| 1657 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1658 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1659 | { |
| 1660 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1661 | FL("Link Layer Statistics not supported by Firmware")); |
| 1662 | return -EINVAL; |
| 1663 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1664 | |
| 1665 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1666 | (struct nlattr *)data, |
| 1667 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1668 | { |
| 1669 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1670 | return -EINVAL; |
| 1671 | } |
| 1672 | if (!tb_vendor |
| 1673 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1674 | { |
| 1675 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1676 | return -EINVAL; |
| 1677 | } |
| 1678 | if (!tb_vendor[ |
| 1679 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1680 | { |
| 1681 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1682 | return -EINVAL; |
| 1683 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1684 | // 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] | 1685 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1686 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1687 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1688 | nla_get_u32( |
| 1689 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1690 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1691 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1692 | nla_get_u32( |
| 1693 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1694 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1695 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1696 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1697 | |
| 1698 | |
| 1699 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1700 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1701 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1702 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1703 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1704 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1705 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1706 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1707 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1708 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1709 | |
| 1710 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1711 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1712 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1713 | { |
| 1714 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1715 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1716 | return -EINVAL; |
| 1717 | |
| 1718 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1719 | |
| 1720 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1721 | if (VOS_STATUS_SUCCESS != |
| 1722 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1723 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE)) |
| 1724 | { |
| 1725 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1726 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1727 | return -EINVAL; |
| 1728 | } |
| 1729 | |
| 1730 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1731 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1732 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1733 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1734 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1735 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1736 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1737 | { |
| 1738 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1739 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1740 | return -EINVAL; |
| 1741 | } |
| 1742 | |
| 1743 | pAdapter->isLinkLayerStatsSet = 1; |
| 1744 | |
| 1745 | return 0; |
| 1746 | } |
| 1747 | |
| 1748 | const struct |
| 1749 | nla_policy |
| 1750 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1751 | { |
| 1752 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1753 | * command. When reporting |
| 1754 | * the stats results, the driver uses the same value to indicate |
| 1755 | * which GET request the results |
| 1756 | * correspond to. |
| 1757 | */ |
| 1758 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1759 | |
| 1760 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1761 | requested for retrieval */ |
| 1762 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1763 | }; |
| 1764 | |
| 1765 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1766 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 1767 | const void *data, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1768 | int data_len) |
| 1769 | { |
| 1770 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1771 | 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] | 1772 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1773 | struct net_device *dev = wdev->netdev; |
| 1774 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1775 | int status; |
| 1776 | |
| 1777 | status = wlan_hdd_validate_context(pHddCtx); |
| 1778 | if (0 != status) |
| 1779 | { |
| 1780 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1781 | FL("HDD context is not valid")); |
| 1782 | return -EINVAL ; |
| 1783 | } |
| 1784 | |
| 1785 | if (NULL == pAdapter) |
| 1786 | { |
| 1787 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1788 | "%s: HDD adapter is Null", __func__); |
| 1789 | return -ENODEV; |
| 1790 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1791 | /* check the LLStats Capability */ |
| 1792 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1793 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1794 | { |
| 1795 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1796 | FL("Link Layer Statistics not supported by Firmware")); |
| 1797 | return -EINVAL; |
| 1798 | } |
| 1799 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1800 | |
| 1801 | if (!pAdapter->isLinkLayerStatsSet) |
| 1802 | { |
| 1803 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1804 | "%s: isLinkLayerStatsSet : %d", |
| 1805 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1806 | return -EINVAL; |
| 1807 | } |
| 1808 | |
| 1809 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1810 | (struct nlattr *)data, |
| 1811 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1812 | { |
| 1813 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1814 | return -EINVAL; |
| 1815 | } |
| 1816 | |
| 1817 | if (!tb_vendor |
| 1818 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1819 | { |
| 1820 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1821 | return -EINVAL; |
| 1822 | } |
| 1823 | |
| 1824 | if (!tb_vendor |
| 1825 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1826 | { |
| 1827 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1828 | return -EINVAL; |
| 1829 | } |
| 1830 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1831 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1832 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1833 | nla_get_u32( tb_vendor[ |
| 1834 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1835 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1836 | nla_get_u32( tb_vendor[ |
| 1837 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1838 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1839 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1840 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1841 | |
| 1842 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1843 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1844 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1845 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1846 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1847 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1848 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1849 | |
| 1850 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1851 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1852 | { |
| 1853 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1854 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1855 | return -EINVAL; |
| 1856 | } |
| 1857 | return 0; |
| 1858 | } |
| 1859 | |
| 1860 | const struct |
| 1861 | nla_policy |
| 1862 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1863 | { |
| 1864 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1865 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1866 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1867 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1868 | }; |
| 1869 | |
| 1870 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1871 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 1872 | const void *data, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1873 | int data_len) |
| 1874 | { |
| 1875 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1876 | 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] | 1877 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1878 | struct net_device *dev = wdev->netdev; |
| 1879 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1880 | u32 statsClearReqMask; |
| 1881 | u8 stopReq; |
| 1882 | int status; |
| 1883 | |
| 1884 | status = wlan_hdd_validate_context(pHddCtx); |
| 1885 | if (0 != status) |
| 1886 | { |
| 1887 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1888 | FL("HDD context is not valid")); |
| 1889 | return -EINVAL; |
| 1890 | } |
| 1891 | |
| 1892 | if (NULL == pAdapter) |
| 1893 | { |
| 1894 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1895 | "%s: HDD adapter is Null", __func__); |
| 1896 | return -ENODEV; |
| 1897 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1898 | /* check the LLStats Capability */ |
| 1899 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1900 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1901 | { |
| 1902 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1903 | FL("Enable LLStats Capability")); |
| 1904 | return -EINVAL; |
| 1905 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1906 | |
| 1907 | if (!pAdapter->isLinkLayerStatsSet) |
| 1908 | { |
| 1909 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1910 | "%s: isLinkLayerStatsSet : %d", |
| 1911 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1912 | return -EINVAL; |
| 1913 | } |
| 1914 | |
| 1915 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1916 | (struct nlattr *)data, |
| 1917 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1918 | { |
| 1919 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1920 | return -EINVAL; |
| 1921 | } |
| 1922 | |
| 1923 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1924 | |
| 1925 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 1926 | { |
| 1927 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 1928 | return -EINVAL; |
| 1929 | |
| 1930 | } |
| 1931 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1932 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1933 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1934 | nla_get_u32( |
| 1935 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 1936 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1937 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1938 | nla_get_u8( |
| 1939 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 1940 | |
| 1941 | // 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] | 1942 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1943 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1944 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 1945 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1946 | |
| 1947 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1948 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1949 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1950 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1951 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1952 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1953 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1954 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1955 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1956 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1957 | |
| 1958 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1959 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1960 | { |
| 1961 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1962 | hdd_station_ctx_t *pHddStaCtx; |
| 1963 | |
| 1964 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1965 | if (VOS_STATUS_SUCCESS != |
| 1966 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1967 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 1968 | { |
| 1969 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1970 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1971 | return -EINVAL; |
| 1972 | } |
| 1973 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 1974 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 1975 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1976 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1977 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1978 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1979 | } |
| 1980 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1981 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 1982 | 2 * sizeof(u32) + |
| 1983 | NLMSG_HDRLEN); |
| 1984 | |
| 1985 | if (temp_skbuff != NULL) |
| 1986 | { |
| 1987 | |
| 1988 | if (nla_put_u32(temp_skbuff, |
| 1989 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 1990 | statsClearReqMask) || |
| 1991 | nla_put_u32(temp_skbuff, |
| 1992 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 1993 | stopReq)) |
| 1994 | { |
| 1995 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 1996 | kfree_skb(temp_skbuff); |
| 1997 | return -EINVAL; |
| 1998 | } |
| 1999 | /* If the ask is to stop the stats collection as part of clear |
| 2000 | * (stopReq = 1) , ensure that no further requests of get |
| 2001 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2002 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2003 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2004 | * case the firmware is just asked to clear the statistics. |
| 2005 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2006 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2007 | pAdapter->isLinkLayerStatsSet = 0; |
| 2008 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2009 | } |
| 2010 | return -ENOMEM; |
| 2011 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2012 | return -EINVAL; |
| 2013 | } |
| 2014 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2015 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2016 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2017 | static const struct nla_policy |
| 2018 | wlan_hdd_extscan_config_policy |
| 2019 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2020 | { |
| 2021 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2022 | { .type = NLA_U32 }, |
| 2023 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2024 | { .type = NLA_U32 }, |
| 2025 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2026 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2027 | { .type = NLA_U32 }, |
| 2028 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2029 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2030 | |
| 2031 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2032 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2033 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2034 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2035 | { .type = NLA_U8 }, |
| 2036 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2037 | { .type = NLA_U32 }, |
| 2038 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2039 | { .type = NLA_U32 }, |
| 2040 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2041 | { .type = NLA_U32 }, |
| 2042 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2043 | { .type = NLA_U8 }, |
| 2044 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2045 | { .type = NLA_U8 }, |
| 2046 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2047 | { .type = NLA_U8 }, |
| 2048 | |
| 2049 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2050 | { .type = NLA_U32 }, |
| 2051 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2052 | { .type = NLA_UNSPEC }, |
| 2053 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2054 | { .type = NLA_S32 }, |
| 2055 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2056 | { .type = NLA_S32 }, |
| 2057 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2058 | { .type = NLA_U32 }, |
| 2059 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2060 | { .type = NLA_U32 }, |
| 2061 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2062 | { .type = NLA_U32 }, |
| 2063 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2064 | = { .type = NLA_U32 }, |
| 2065 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2066 | { .type = NLA_U32 }, |
| 2067 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2068 | NLA_U32 }, |
| 2069 | }; |
| 2070 | |
| 2071 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2072 | { |
| 2073 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2074 | struct sk_buff *skb = NULL; |
| 2075 | tpSirEXTScanCapabilitiesEvent pData = |
| 2076 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2077 | |
| 2078 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2079 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2080 | "or pData(%p) is null"), pData); |
| 2081 | return; |
| 2082 | } |
| 2083 | |
| 2084 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2085 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2086 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2087 | GFP_KERNEL); |
| 2088 | |
| 2089 | if (!skb) { |
| 2090 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2091 | FL("cfg80211_vendor_event_alloc failed")); |
| 2092 | return; |
| 2093 | } |
| 2094 | |
| 2095 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2096 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2097 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2098 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2099 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2100 | pData->maxRssiSampleSize); |
| 2101 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2102 | pData->maxScanReportingThreshold); |
| 2103 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2104 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2105 | pData->maxSignificantWifiChangeAPs); |
| 2106 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2107 | pData->maxBsidHistoryEntries); |
| 2108 | |
| 2109 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2110 | pData->requestId) || |
| 2111 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2112 | nla_put_u32(skb, |
| 2113 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2114 | pData->scanCacheSize) || |
| 2115 | nla_put_u32(skb, |
| 2116 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2117 | pData->scanBuckets) || |
| 2118 | nla_put_u32(skb, |
| 2119 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2120 | pData->maxApPerScan) || |
| 2121 | nla_put_u32(skb, |
| 2122 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2123 | pData->maxRssiSampleSize) || |
| 2124 | nla_put_u32(skb, |
| 2125 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2126 | pData->maxScanReportingThreshold) || |
| 2127 | nla_put_u32(skb, |
| 2128 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2129 | pData->maxHotlistAPs) || |
| 2130 | nla_put_u32(skb, |
| 2131 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2132 | pData->maxSignificantWifiChangeAPs) || |
| 2133 | nla_put_u32(skb, |
| 2134 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2135 | pData->maxBsidHistoryEntries)) { |
| 2136 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2137 | goto nla_put_failure; |
| 2138 | } |
| 2139 | |
| 2140 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2141 | return; |
| 2142 | |
| 2143 | nla_put_failure: |
| 2144 | kfree_skb(skb); |
| 2145 | return; |
| 2146 | } |
| 2147 | |
| 2148 | |
| 2149 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2150 | { |
| 2151 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2152 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2153 | struct sk_buff *skb = NULL; |
| 2154 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2155 | |
| 2156 | |
| 2157 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2158 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2159 | "or pData(%p) is null"), pData); |
| 2160 | return; |
| 2161 | } |
| 2162 | |
| 2163 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2164 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2165 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2166 | GFP_KERNEL); |
| 2167 | |
| 2168 | if (!skb) { |
| 2169 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2170 | FL("cfg80211_vendor_event_alloc failed")); |
| 2171 | return; |
| 2172 | } |
| 2173 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2174 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2175 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2176 | |
| 2177 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2178 | pData->requestId) || |
| 2179 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2180 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2181 | goto nla_put_failure; |
| 2182 | } |
| 2183 | |
| 2184 | /* |
| 2185 | * Store the Request ID for comparing with the requestID obtained |
| 2186 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2187 | * request is issued with a different requestId as that of the |
| 2188 | * extscan_start request. Also, This requestId shall be used while |
| 2189 | * indicating the full scan results to the upper layers. |
| 2190 | * The requestId is stored with the assumption that the firmware |
| 2191 | * shall return the ext scan start request's requestId in ext scan |
| 2192 | * start response. |
| 2193 | */ |
| 2194 | if (pData->status == 0) |
| 2195 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2196 | |
| 2197 | |
| 2198 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2199 | return; |
| 2200 | |
| 2201 | nla_put_failure: |
| 2202 | kfree_skb(skb); |
| 2203 | return; |
| 2204 | } |
| 2205 | |
| 2206 | |
| 2207 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2208 | { |
| 2209 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2210 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2211 | struct sk_buff *skb = NULL; |
| 2212 | |
| 2213 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2214 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2215 | "or pData(%p) is null"), pData); |
| 2216 | return; |
| 2217 | } |
| 2218 | |
| 2219 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2220 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2221 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2222 | GFP_KERNEL); |
| 2223 | |
| 2224 | if (!skb) { |
| 2225 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2226 | FL("cfg80211_vendor_event_alloc failed")); |
| 2227 | return; |
| 2228 | } |
| 2229 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2230 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2231 | |
| 2232 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2233 | pData->requestId) || |
| 2234 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2235 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2236 | goto nla_put_failure; |
| 2237 | } |
| 2238 | |
| 2239 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2240 | return; |
| 2241 | |
| 2242 | nla_put_failure: |
| 2243 | kfree_skb(skb); |
| 2244 | return; |
| 2245 | } |
| 2246 | |
| 2247 | |
| 2248 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2249 | void *pMsg) |
| 2250 | { |
| 2251 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2252 | struct sk_buff *skb = NULL; |
| 2253 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2254 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2255 | |
| 2256 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2257 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2258 | "or pData(%p) is null"), pData); |
| 2259 | return; |
| 2260 | } |
| 2261 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2262 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2263 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2264 | GFP_KERNEL); |
| 2265 | |
| 2266 | if (!skb) { |
| 2267 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2268 | FL("cfg80211_vendor_event_alloc failed")); |
| 2269 | return; |
| 2270 | } |
| 2271 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2272 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2273 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2274 | |
| 2275 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2276 | pData->requestId) || |
| 2277 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2278 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2279 | goto nla_put_failure; |
| 2280 | } |
| 2281 | |
| 2282 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2283 | return; |
| 2284 | |
| 2285 | nla_put_failure: |
| 2286 | kfree_skb(skb); |
| 2287 | return; |
| 2288 | } |
| 2289 | |
| 2290 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2291 | void *pMsg) |
| 2292 | { |
| 2293 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2294 | struct sk_buff *skb = NULL; |
| 2295 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2296 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2297 | |
| 2298 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2299 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2300 | "or pData(%p) is null"), pData); |
| 2301 | return; |
| 2302 | } |
| 2303 | |
| 2304 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2305 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2306 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2307 | GFP_KERNEL); |
| 2308 | |
| 2309 | if (!skb) { |
| 2310 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2311 | FL("cfg80211_vendor_event_alloc failed")); |
| 2312 | return; |
| 2313 | } |
| 2314 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2315 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2316 | |
| 2317 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2318 | pData->requestId) || |
| 2319 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2320 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2321 | goto nla_put_failure; |
| 2322 | } |
| 2323 | |
| 2324 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2325 | return; |
| 2326 | |
| 2327 | nla_put_failure: |
| 2328 | kfree_skb(skb); |
| 2329 | return; |
| 2330 | } |
| 2331 | |
| 2332 | |
| 2333 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2334 | void *pMsg) |
| 2335 | { |
| 2336 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2337 | struct sk_buff *skb = NULL; |
| 2338 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2339 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2340 | |
| 2341 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2342 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2343 | "or pData(%p) is null"), pData); |
| 2344 | return; |
| 2345 | } |
| 2346 | |
| 2347 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2348 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2349 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2350 | GFP_KERNEL); |
| 2351 | |
| 2352 | if (!skb) { |
| 2353 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2354 | FL("cfg80211_vendor_event_alloc failed")); |
| 2355 | return; |
| 2356 | } |
| 2357 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2358 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2359 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2360 | |
| 2361 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2362 | pData->requestId) || |
| 2363 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2364 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2365 | goto nla_put_failure; |
| 2366 | } |
| 2367 | |
| 2368 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2369 | return; |
| 2370 | |
| 2371 | nla_put_failure: |
| 2372 | kfree_skb(skb); |
| 2373 | return; |
| 2374 | } |
| 2375 | |
| 2376 | |
| 2377 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2378 | void *pMsg) |
| 2379 | { |
| 2380 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2381 | struct sk_buff *skb = NULL; |
| 2382 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2383 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2384 | |
| 2385 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2386 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2387 | "or pData(%p) is null"), pData); |
| 2388 | return; |
| 2389 | } |
| 2390 | |
| 2391 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2392 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2393 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2394 | GFP_KERNEL); |
| 2395 | |
| 2396 | if (!skb) { |
| 2397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2398 | FL("cfg80211_vendor_event_alloc failed")); |
| 2399 | return; |
| 2400 | } |
| 2401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2402 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2403 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2404 | |
| 2405 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2406 | pData->requestId) || |
| 2407 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2408 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2409 | goto nla_put_failure; |
| 2410 | } |
| 2411 | |
| 2412 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2413 | return; |
| 2414 | |
| 2415 | nla_put_failure: |
| 2416 | kfree_skb(skb); |
| 2417 | return; |
| 2418 | } |
| 2419 | |
| 2420 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2421 | void *pMsg) |
| 2422 | { |
| 2423 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2424 | struct sk_buff *skb = NULL; |
| 2425 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2426 | tANI_S32 totalResults; |
| 2427 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2428 | tpSirWifiScanResult pSirWifiScanResult; |
| 2429 | |
| 2430 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2431 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2432 | "or pData(%p) is null"), pData); |
| 2433 | return; |
| 2434 | } |
| 2435 | totalResults = pData->numOfAps; |
| 2436 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2437 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2438 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2439 | |
| 2440 | do{ |
| 2441 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2442 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2443 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2444 | |
| 2445 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2446 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2447 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2448 | GFP_KERNEL); |
| 2449 | |
| 2450 | if (!skb) { |
| 2451 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2452 | FL("cfg80211_vendor_event_alloc failed")); |
| 2453 | return; |
| 2454 | } |
| 2455 | |
| 2456 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2457 | |
| 2458 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2459 | pData->requestId) || |
| 2460 | nla_put_u32(skb, |
| 2461 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2462 | resultsPerEvent)) { |
| 2463 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2464 | goto fail; |
| 2465 | } |
| 2466 | if (nla_put_u8(skb, |
| 2467 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2468 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2469 | { |
| 2470 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2471 | goto fail; |
| 2472 | } |
| 2473 | |
| 2474 | if (resultsPerEvent) { |
| 2475 | struct nlattr *aps; |
| 2476 | |
| 2477 | aps = nla_nest_start(skb, |
| 2478 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2479 | if (!aps) |
| 2480 | { |
| 2481 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2482 | goto fail; |
| 2483 | } |
| 2484 | |
| 2485 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2486 | struct nlattr *ap; |
| 2487 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2488 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2489 | |
| 2490 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2491 | "Ssid (%s)" |
| 2492 | "Bssid: %pM " |
| 2493 | "Channel (%u)" |
| 2494 | "Rssi (%d)" |
| 2495 | "RTT (%u)" |
| 2496 | "RTT_SD (%u)", |
| 2497 | i, |
| 2498 | pSirWifiScanResult->ts, |
| 2499 | pSirWifiScanResult->ssid, |
| 2500 | pSirWifiScanResult->bssid, |
| 2501 | pSirWifiScanResult->channel, |
| 2502 | pSirWifiScanResult->rssi, |
| 2503 | pSirWifiScanResult->rtt, |
| 2504 | pSirWifiScanResult->rtt_sd); |
| 2505 | |
| 2506 | ap = nla_nest_start(skb, j + 1); |
| 2507 | if (!ap) |
| 2508 | { |
| 2509 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2510 | goto fail; |
| 2511 | } |
| 2512 | |
| 2513 | if (nla_put_u64(skb, |
| 2514 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2515 | pSirWifiScanResult->ts) ) |
| 2516 | { |
| 2517 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2518 | goto fail; |
| 2519 | } |
| 2520 | if (nla_put(skb, |
| 2521 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2522 | sizeof(pSirWifiScanResult->ssid), |
| 2523 | pSirWifiScanResult->ssid) ) |
| 2524 | { |
| 2525 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2526 | goto fail; |
| 2527 | } |
| 2528 | if (nla_put(skb, |
| 2529 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2530 | sizeof(pSirWifiScanResult->bssid), |
| 2531 | pSirWifiScanResult->bssid) ) |
| 2532 | { |
| 2533 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2534 | goto fail; |
| 2535 | } |
| 2536 | if (nla_put_u32(skb, |
| 2537 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2538 | pSirWifiScanResult->channel) ) |
| 2539 | { |
| 2540 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2541 | goto fail; |
| 2542 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2543 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2544 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2545 | pSirWifiScanResult->rssi) ) |
| 2546 | { |
| 2547 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2548 | goto fail; |
| 2549 | } |
| 2550 | if (nla_put_u32(skb, |
| 2551 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2552 | pSirWifiScanResult->rtt) ) |
| 2553 | { |
| 2554 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2555 | goto fail; |
| 2556 | } |
| 2557 | if (nla_put_u32(skb, |
| 2558 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2559 | pSirWifiScanResult->rtt_sd)) |
| 2560 | { |
| 2561 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2562 | goto fail; |
| 2563 | } |
| 2564 | |
| 2565 | nla_nest_end(skb, ap); |
| 2566 | } |
| 2567 | nla_nest_end(skb, aps); |
| 2568 | |
| 2569 | } |
| 2570 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2571 | } while (totalResults > 0); |
| 2572 | |
| 2573 | return; |
| 2574 | fail: |
| 2575 | kfree_skb(skb); |
| 2576 | return; |
| 2577 | } |
| 2578 | |
| 2579 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2580 | void *pMsg) |
| 2581 | { |
| 2582 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2583 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2584 | struct sk_buff *skb = NULL; |
| 2585 | tANI_U32 i; |
| 2586 | |
| 2587 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2588 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2589 | "or pData(%p) is null"), pData); |
| 2590 | return; |
| 2591 | } |
| 2592 | |
| 2593 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2594 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2595 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2596 | GFP_KERNEL); |
| 2597 | |
| 2598 | if (!skb) { |
| 2599 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2600 | FL("cfg80211_vendor_event_alloc failed")); |
| 2601 | return; |
| 2602 | } |
| 2603 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2604 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2605 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2606 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2607 | |
| 2608 | for (i = 0; i < pData->numOfAps; i++) { |
| 2609 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2610 | "Ssid (%s) " |
| 2611 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2612 | "Channel (%u) " |
| 2613 | "Rssi (%d) " |
| 2614 | "RTT (%u) " |
| 2615 | "RTT_SD (%u) ", |
| 2616 | i, |
| 2617 | pData->ap[i].ts, |
| 2618 | pData->ap[i].ssid, |
| 2619 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2620 | pData->ap[i].channel, |
| 2621 | pData->ap[i].rssi, |
| 2622 | pData->ap[i].rtt, |
| 2623 | pData->ap[i].rtt_sd); |
| 2624 | } |
| 2625 | |
| 2626 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2627 | pData->requestId) || |
| 2628 | nla_put_u32(skb, |
| 2629 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2630 | pData->numOfAps)) { |
| 2631 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2632 | goto fail; |
| 2633 | } |
| 2634 | if (pData->numOfAps) { |
| 2635 | struct nlattr *aps; |
| 2636 | |
| 2637 | aps = nla_nest_start(skb, |
| 2638 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2639 | if (!aps) |
| 2640 | goto fail; |
| 2641 | |
| 2642 | for (i = 0; i < pData->numOfAps; i++) { |
| 2643 | struct nlattr *ap; |
| 2644 | |
| 2645 | ap = nla_nest_start(skb, i + 1); |
| 2646 | if (!ap) |
| 2647 | goto fail; |
| 2648 | |
| 2649 | if (nla_put_u64(skb, |
| 2650 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2651 | pData->ap[i].ts) || |
| 2652 | nla_put(skb, |
| 2653 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2654 | sizeof(pData->ap[i].ssid), |
| 2655 | pData->ap[i].ssid) || |
| 2656 | nla_put(skb, |
| 2657 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2658 | sizeof(pData->ap[i].bssid), |
| 2659 | pData->ap[i].bssid) || |
| 2660 | nla_put_u32(skb, |
| 2661 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2662 | pData->ap[i].channel) || |
| 2663 | nla_put_s32(skb, |
| 2664 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2665 | pData->ap[i].rssi) || |
| 2666 | nla_put_u32(skb, |
| 2667 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2668 | pData->ap[i].rtt) || |
| 2669 | nla_put_u32(skb, |
| 2670 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2671 | pData->ap[i].rtt_sd)) |
| 2672 | goto fail; |
| 2673 | |
| 2674 | nla_nest_end(skb, ap); |
| 2675 | } |
| 2676 | nla_nest_end(skb, aps); |
| 2677 | |
| 2678 | if (nla_put_u8(skb, |
| 2679 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2680 | pData->moreData)) |
| 2681 | goto fail; |
| 2682 | } |
| 2683 | |
| 2684 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2685 | return; |
| 2686 | |
| 2687 | fail: |
| 2688 | kfree_skb(skb); |
| 2689 | return; |
| 2690 | |
| 2691 | } |
| 2692 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2693 | void *pMsg) |
| 2694 | { |
| 2695 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2696 | struct sk_buff *skb = NULL; |
| 2697 | tANI_U32 i, j; |
| 2698 | tpSirWifiSignificantChangeEvent pData = |
| 2699 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2700 | |
| 2701 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2702 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2703 | "or pData(%p) is null"), pData); |
| 2704 | return; |
| 2705 | } |
| 2706 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2707 | EXTSCAN_EVENT_BUF_SIZE, |
| 2708 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2709 | GFP_KERNEL); |
| 2710 | |
| 2711 | if (!skb) { |
| 2712 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2713 | FL("cfg80211_vendor_event_alloc failed")); |
| 2714 | return; |
| 2715 | } |
| 2716 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2717 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2718 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2719 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2720 | pData->numSigRssiBss); |
| 2721 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2722 | |
| 2723 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2724 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2725 | " num RSSI %u ", |
| 2726 | i, pData->sigRssiResult[i].bssid, |
| 2727 | pData->sigRssiResult[i].channel, |
| 2728 | pData->sigRssiResult[i].numRssi); |
| 2729 | |
| 2730 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2731 | |
| 2732 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2733 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2734 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2735 | |
| 2736 | } |
| 2737 | } |
| 2738 | |
| 2739 | |
| 2740 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2741 | pData->requestId) || |
| 2742 | nla_put_u32(skb, |
| 2743 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2744 | pData->numSigRssiBss)) { |
| 2745 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2746 | goto fail; |
| 2747 | } |
| 2748 | |
| 2749 | if (pData->numSigRssiBss) { |
| 2750 | struct nlattr *aps; |
| 2751 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2752 | if (!aps) |
| 2753 | goto fail; |
| 2754 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2755 | struct nlattr *ap; |
| 2756 | |
| 2757 | ap = nla_nest_start(skb, i); |
| 2758 | if (!ap) |
| 2759 | goto fail; |
| 2760 | if (nla_put(skb, |
| 2761 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2762 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2763 | nla_put_u32(skb, |
| 2764 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2765 | pData->sigRssiResult[i].channel) || |
| 2766 | nla_put_u32(skb, |
| 2767 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2768 | pData->sigRssiResult[i].numRssi) || |
| 2769 | nla_put(skb, |
| 2770 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2771 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2772 | pData->sigRssiResult[i].rssi)) |
| 2773 | goto fail; |
| 2774 | nla_nest_end(skb, ap); |
| 2775 | } |
| 2776 | nla_nest_end(skb, aps); |
| 2777 | if (nla_put_u8(skb, |
| 2778 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2779 | pData->moreData)) |
| 2780 | goto fail; |
| 2781 | } |
| 2782 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2783 | return; |
| 2784 | fail: |
| 2785 | kfree_skb(skb); |
| 2786 | return; |
| 2787 | } |
| 2788 | |
| 2789 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2790 | void *pMsg) |
| 2791 | { |
| 2792 | struct sk_buff *skb; |
| 2793 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2794 | tpSirWifiFullScanResultEvent pData = |
| 2795 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2796 | |
| 2797 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2798 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2799 | "or pData(%p) is null"), pData); |
| 2800 | return; |
| 2801 | } |
| 2802 | |
| 2803 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2804 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2805 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2806 | GFP_KERNEL); |
| 2807 | |
| 2808 | if (!skb) { |
| 2809 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2810 | FL("cfg80211_vendor_event_alloc failed")); |
| 2811 | return; |
| 2812 | } |
| 2813 | |
| 2814 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2815 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2816 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2817 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2818 | "Ssid (%s)" |
| 2819 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2820 | "Channel (%u)" |
| 2821 | "Rssi (%d)" |
| 2822 | "RTT (%u)" |
| 2823 | "RTT_SD (%u)"), |
| 2824 | pData->ap.ts, |
| 2825 | pData->ap.ssid, |
| 2826 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2827 | pData->ap.channel, |
| 2828 | pData->ap.rssi, |
| 2829 | pData->ap.rtt, |
| 2830 | pData->ap.rtt_sd); |
| 2831 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2832 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2833 | pData->requestId) || |
| 2834 | nla_put_u64(skb, |
| 2835 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2836 | pData->ap.ts) || |
| 2837 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2838 | sizeof(pData->ap.ssid), |
| 2839 | pData->ap.ssid) || |
| 2840 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2841 | WNI_CFG_BSSID_LEN, |
| 2842 | pData->ap.bssid) || |
| 2843 | nla_put_u32(skb, |
| 2844 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2845 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2846 | nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2847 | pData->ap.rssi) || |
| 2848 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2849 | pData->ap.rtt) || |
| 2850 | nla_put_u32(skb, |
| 2851 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2852 | pData->ap.rtt_sd) || |
| 2853 | nla_put_u16(skb, |
| 2854 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2855 | pData->ap.beaconPeriod) || |
| 2856 | nla_put_u16(skb, |
| 2857 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2858 | pData->ap.capability) || |
| 2859 | nla_put_u32(skb, |
| 2860 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2861 | pData->ieLength)) |
| 2862 | { |
| 2863 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2864 | goto nla_put_failure; |
| 2865 | } |
| 2866 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2867 | pData->ieLength, |
| 2868 | pData->ie)) |
| 2869 | { |
| 2870 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2871 | goto nla_put_failure; |
| 2872 | } |
| 2873 | |
| 2874 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2875 | return; |
| 2876 | |
| 2877 | nla_put_failure: |
| 2878 | kfree_skb(skb); |
| 2879 | return; |
| 2880 | } |
| 2881 | |
| 2882 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 2883 | void *pMsg) |
| 2884 | { |
| 2885 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2886 | struct sk_buff *skb = NULL; |
| 2887 | tpSirEXTScanResultsAvailableIndParams pData = |
| 2888 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 2889 | |
| 2890 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2891 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2892 | "or pData(%p) is null"), pData); |
| 2893 | return; |
| 2894 | } |
| 2895 | |
| 2896 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2897 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2898 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 2899 | GFP_KERNEL); |
| 2900 | |
| 2901 | if (!skb) { |
| 2902 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2903 | FL("cfg80211_vendor_event_alloc failed")); |
| 2904 | return; |
| 2905 | } |
| 2906 | |
| 2907 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2908 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2909 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 2910 | pData->numResultsAvailable); |
| 2911 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2912 | pData->requestId) || |
| 2913 | nla_put_u32(skb, |
| 2914 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2915 | pData->numResultsAvailable)) { |
| 2916 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2917 | goto nla_put_failure; |
| 2918 | } |
| 2919 | |
| 2920 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2921 | return; |
| 2922 | |
| 2923 | nla_put_failure: |
| 2924 | kfree_skb(skb); |
| 2925 | return; |
| 2926 | } |
| 2927 | |
| 2928 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 2929 | { |
| 2930 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2931 | struct sk_buff *skb = NULL; |
| 2932 | tpSirEXTScanProgressIndParams pData = |
| 2933 | (tpSirEXTScanProgressIndParams) pMsg; |
| 2934 | |
| 2935 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2936 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2937 | "or pData(%p) is null"), pData); |
| 2938 | return; |
| 2939 | } |
| 2940 | |
| 2941 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2942 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2943 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 2944 | GFP_KERNEL); |
| 2945 | |
| 2946 | if (!skb) { |
| 2947 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2948 | FL("cfg80211_vendor_event_alloc failed")); |
| 2949 | return; |
| 2950 | } |
| 2951 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2952 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 2953 | pData->extScanEventType); |
| 2954 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 2955 | pData->status); |
| 2956 | |
| 2957 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 2958 | pData->extScanEventType) || |
| 2959 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 2960 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2961 | pData->requestId) || |
| 2962 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2963 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 2964 | pData->status)) { |
| 2965 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2966 | goto nla_put_failure; |
| 2967 | } |
| 2968 | |
| 2969 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2970 | return; |
| 2971 | |
| 2972 | nla_put_failure: |
| 2973 | kfree_skb(skb); |
| 2974 | return; |
| 2975 | } |
| 2976 | |
| 2977 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 2978 | void *pMsg) |
| 2979 | { |
| 2980 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2981 | |
| 2982 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dasari Srinivas | b46ed1d | 2014-10-08 13:03:08 +0530 | [diff] [blame] | 2983 | hddLog(VOS_TRACE_LEVEL_INFO, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2984 | return; |
| 2985 | } |
| 2986 | |
| 2987 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 2988 | |
| 2989 | |
| 2990 | switch(evType) { |
| 2991 | case SIR_HAL_EXTSCAN_START_RSP: |
| 2992 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 2993 | break; |
| 2994 | |
| 2995 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 2996 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 2997 | break; |
| 2998 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 2999 | /* There is no need to send this response to upper layer |
| 3000 | Just log the message */ |
| 3001 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3002 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3003 | break; |
| 3004 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3005 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3006 | break; |
| 3007 | |
| 3008 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3009 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3010 | break; |
| 3011 | |
| 3012 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3013 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3014 | break; |
| 3015 | |
| 3016 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3017 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3018 | break; |
| 3019 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3020 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3021 | break; |
| 3022 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3023 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3024 | break; |
| 3025 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3026 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3027 | break; |
| 3028 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3029 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3030 | break; |
| 3031 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3032 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3033 | break; |
| 3034 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3035 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3036 | break; |
| 3037 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3038 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3039 | break; |
| 3040 | default: |
| 3041 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3042 | break; |
| 3043 | } |
| 3044 | } |
| 3045 | |
| 3046 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3047 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3048 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3049 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3050 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3051 | struct net_device *dev = wdev->netdev; |
| 3052 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3053 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3054 | struct nlattr |
| 3055 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3056 | eHalStatus status; |
| 3057 | |
| 3058 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3059 | status = wlan_hdd_validate_context(pHddCtx); |
| 3060 | if (0 != status) |
| 3061 | { |
| 3062 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3063 | FL("HDD context is not valid")); |
| 3064 | return -EINVAL; |
| 3065 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3066 | /* check the EXTScan Capability */ |
| 3067 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3068 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3069 | { |
| 3070 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3071 | FL("EXTScan not enabled/supported by Firmware")); |
| 3072 | return -EINVAL; |
| 3073 | } |
| 3074 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3075 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3076 | data, dataLen, |
| 3077 | wlan_hdd_extscan_config_policy)) { |
| 3078 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3079 | return -EINVAL; |
| 3080 | } |
| 3081 | |
| 3082 | /* Parse and fetch request Id */ |
| 3083 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3084 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3085 | return -EINVAL; |
| 3086 | } |
| 3087 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3088 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3089 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3090 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3091 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3092 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3093 | reqMsg.sessionId = pAdapter->sessionId; |
| 3094 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3095 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3096 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3097 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3099 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3100 | return -EINVAL; |
| 3101 | } |
| 3102 | |
| 3103 | return 0; |
| 3104 | } |
| 3105 | |
| 3106 | |
| 3107 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3108 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3109 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3110 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3111 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3112 | struct net_device *dev = wdev->netdev; |
| 3113 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3114 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3115 | struct nlattr |
| 3116 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3117 | eHalStatus status; |
| 3118 | |
| 3119 | status = wlan_hdd_validate_context(pHddCtx); |
| 3120 | if (0 != status) |
| 3121 | { |
| 3122 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3123 | FL("HDD context is not valid")); |
| 3124 | return -EINVAL; |
| 3125 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3126 | /* check the EXTScan Capability */ |
| 3127 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3128 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3129 | { |
| 3130 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3131 | FL("EXTScan not enabled/supported by Firmware")); |
| 3132 | return -EINVAL; |
| 3133 | } |
| 3134 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3135 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3136 | data, dataLen, |
| 3137 | wlan_hdd_extscan_config_policy)) { |
| 3138 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3139 | return -EINVAL; |
| 3140 | } |
| 3141 | /* Parse and fetch request Id */ |
| 3142 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3143 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3144 | return -EINVAL; |
| 3145 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3146 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3147 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3148 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3149 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3150 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3151 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3152 | reqMsg.sessionId = pAdapter->sessionId; |
| 3153 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3154 | |
| 3155 | /* Parse and fetch flush parameter */ |
| 3156 | if (!tb |
| 3157 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3158 | { |
| 3159 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3160 | goto failed; |
| 3161 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3162 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3163 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3164 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3165 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3166 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3167 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3168 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3169 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3170 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3171 | return -EINVAL; |
| 3172 | } |
| 3173 | return 0; |
| 3174 | |
| 3175 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3176 | return -EINVAL; |
| 3177 | } |
| 3178 | |
| 3179 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3180 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3181 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3182 | { |
| 3183 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3184 | struct net_device *dev = wdev->netdev; |
| 3185 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3186 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3187 | struct nlattr |
| 3188 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3189 | struct nlattr |
| 3190 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3191 | struct nlattr *apTh; |
| 3192 | eHalStatus status; |
| 3193 | tANI_U8 i = 0; |
| 3194 | int rem; |
| 3195 | |
| 3196 | status = wlan_hdd_validate_context(pHddCtx); |
| 3197 | if (0 != status) |
| 3198 | { |
| 3199 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3200 | FL("HDD context is not valid")); |
| 3201 | return -EINVAL; |
| 3202 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3203 | /* check the EXTScan Capability */ |
| 3204 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3205 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3206 | { |
| 3207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3208 | FL("EXTScan not enabled/supported by Firmware")); |
| 3209 | return -EINVAL; |
| 3210 | } |
| 3211 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3212 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3213 | data, dataLen, |
| 3214 | wlan_hdd_extscan_config_policy)) { |
| 3215 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3216 | return -EINVAL; |
| 3217 | } |
| 3218 | |
| 3219 | /* Parse and fetch request Id */ |
| 3220 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3221 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3222 | return -EINVAL; |
| 3223 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3224 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3225 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3226 | if (!pReqMsg) { |
| 3227 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3228 | return -ENOMEM; |
| 3229 | } |
| 3230 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3231 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3232 | pReqMsg->requestId = nla_get_u32( |
| 3233 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3234 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3235 | |
| 3236 | /* Parse and fetch number of APs */ |
| 3237 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3238 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3239 | goto fail; |
| 3240 | } |
| 3241 | |
| 3242 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3243 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3244 | |
| 3245 | pReqMsg->numAp = nla_get_u32( |
| 3246 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3247 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3248 | |
| 3249 | nla_for_each_nested(apTh, |
| 3250 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3251 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3252 | nla_data(apTh), nla_len(apTh), |
| 3253 | NULL)) { |
| 3254 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3255 | goto fail; |
| 3256 | } |
| 3257 | |
| 3258 | /* Parse and fetch MAC address */ |
| 3259 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3261 | goto fail; |
| 3262 | } |
| 3263 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3264 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3265 | sizeof(tSirMacAddr)); |
| 3266 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3267 | |
| 3268 | /* Parse and fetch low RSSI */ |
| 3269 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3270 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3271 | goto fail; |
| 3272 | } |
| 3273 | pReqMsg->ap[i].low = nla_get_s32( |
| 3274 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3275 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3276 | |
| 3277 | /* Parse and fetch high RSSI */ |
| 3278 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3279 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3280 | goto fail; |
| 3281 | } |
| 3282 | pReqMsg->ap[i].high = nla_get_s32( |
| 3283 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3284 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3285 | pReqMsg->ap[i].high); |
| 3286 | |
| 3287 | /* Parse and fetch channel */ |
| 3288 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3289 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3290 | goto fail; |
| 3291 | } |
| 3292 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3293 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3294 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3295 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3296 | i++; |
| 3297 | } |
| 3298 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3299 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3300 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3301 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3302 | vos_mem_free(pReqMsg); |
| 3303 | return -EINVAL; |
| 3304 | } |
| 3305 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3306 | vos_mem_free(pReqMsg); |
| 3307 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3308 | return 0; |
| 3309 | |
| 3310 | fail: |
| 3311 | vos_mem_free(pReqMsg); |
| 3312 | return -EINVAL; |
| 3313 | } |
| 3314 | |
| 3315 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3316 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3317 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3318 | { |
| 3319 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3320 | struct net_device *dev = wdev->netdev; |
| 3321 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3322 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3323 | struct nlattr |
| 3324 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3325 | struct nlattr |
| 3326 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3327 | struct nlattr *apTh; |
| 3328 | eHalStatus status; |
| 3329 | int i = 0; |
| 3330 | int rem; |
| 3331 | |
| 3332 | status = wlan_hdd_validate_context(pHddCtx); |
| 3333 | if (0 != status) |
| 3334 | { |
| 3335 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3336 | FL("HDD context is not valid")); |
| 3337 | return -EINVAL; |
| 3338 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3339 | /* check the EXTScan Capability */ |
| 3340 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3341 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3342 | { |
| 3343 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3344 | FL("EXTScan not enabled/supported by Firmware")); |
| 3345 | return -EINVAL; |
| 3346 | } |
| 3347 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3348 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3349 | data, dataLen, |
| 3350 | wlan_hdd_extscan_config_policy)) { |
| 3351 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3352 | return -EINVAL; |
| 3353 | } |
| 3354 | |
| 3355 | /* Parse and fetch request Id */ |
| 3356 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3357 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3358 | return -EINVAL; |
| 3359 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3360 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3361 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3362 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3363 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3364 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3365 | } |
| 3366 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3367 | |
| 3368 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3369 | pReqMsg->requestId = nla_get_u32( |
| 3370 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3371 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3372 | |
| 3373 | /* Parse and fetch RSSI sample size */ |
| 3374 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3375 | { |
| 3376 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3377 | goto fail; |
| 3378 | } |
| 3379 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3380 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3381 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3382 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3383 | |
| 3384 | /* Parse and fetch lost AP sample size */ |
| 3385 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3386 | { |
| 3387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3388 | goto fail; |
| 3389 | } |
| 3390 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3391 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3392 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3393 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3394 | /* Parse and fetch minimum Breaching */ |
| 3395 | if (!tb |
| 3396 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3397 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3398 | goto fail; |
| 3399 | } |
| 3400 | pReqMsg->minBreaching = nla_get_u32( |
| 3401 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3402 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3403 | |
| 3404 | /* Parse and fetch number of APs */ |
| 3405 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3406 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3407 | goto fail; |
| 3408 | } |
| 3409 | pReqMsg->numAp = nla_get_u32( |
| 3410 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3411 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3412 | |
| 3413 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3414 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3415 | |
| 3416 | nla_for_each_nested(apTh, |
| 3417 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3418 | if(nla_parse(tb2, |
| 3419 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3420 | nla_data(apTh), nla_len(apTh), |
| 3421 | NULL)) { |
| 3422 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3423 | goto fail; |
| 3424 | } |
| 3425 | |
| 3426 | /* Parse and fetch MAC address */ |
| 3427 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3428 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3429 | goto fail; |
| 3430 | } |
| 3431 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3432 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3433 | sizeof(tSirMacAddr)); |
| 3434 | |
| 3435 | /* Parse and fetch low RSSI */ |
| 3436 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3437 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3438 | goto fail; |
| 3439 | } |
| 3440 | pReqMsg->ap[i].low = nla_get_s32( |
| 3441 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3442 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3443 | |
| 3444 | /* Parse and fetch high RSSI */ |
| 3445 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3446 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3447 | goto fail; |
| 3448 | } |
| 3449 | pReqMsg->ap[i].high = nla_get_s32( |
| 3450 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3451 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3452 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3453 | |
| 3454 | /* Parse and fetch channel */ |
| 3455 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3456 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3457 | goto fail; |
| 3458 | } |
| 3459 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3460 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3461 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3462 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3463 | i++; |
| 3464 | } |
| 3465 | |
| 3466 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3467 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3468 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3469 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3470 | vos_mem_free(pReqMsg); |
| 3471 | return -EINVAL; |
| 3472 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3473 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3474 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3475 | return 0; |
| 3476 | |
| 3477 | fail: |
| 3478 | vos_mem_free(pReqMsg); |
| 3479 | return -EINVAL; |
| 3480 | } |
| 3481 | |
| 3482 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3483 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3484 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3485 | { |
| 3486 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3487 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3488 | tANI_U8 numChannels = 0; |
| 3489 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3490 | tANI_U32 requestId; |
| 3491 | tWifiBand wifiBand; |
| 3492 | eHalStatus status; |
| 3493 | struct sk_buff *replySkb; |
| 3494 | tANI_U8 i; |
| 3495 | |
| 3496 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3497 | status = wlan_hdd_validate_context(pHddCtx); |
| 3498 | if (0 != status) |
| 3499 | { |
| 3500 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3501 | FL("HDD context is not valid")); |
| 3502 | return -EINVAL; |
| 3503 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3504 | /* check the EXTScan Capability */ |
| 3505 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3506 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3507 | { |
| 3508 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3509 | FL("EXTScan not enabled/supported by Firmware")); |
| 3510 | return -EINVAL; |
| 3511 | } |
| 3512 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3513 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3514 | data, dataLen, |
| 3515 | wlan_hdd_extscan_config_policy)) { |
| 3516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3517 | return -EINVAL; |
| 3518 | } |
| 3519 | |
| 3520 | /* Parse and fetch request Id */ |
| 3521 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3522 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3523 | return -EINVAL; |
| 3524 | } |
| 3525 | requestId = nla_get_u32( |
| 3526 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3527 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3528 | |
| 3529 | /* Parse and fetch wifi band */ |
| 3530 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3531 | { |
| 3532 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3533 | return -EINVAL; |
| 3534 | } |
| 3535 | wifiBand = nla_get_u32( |
| 3536 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3537 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3538 | |
| 3539 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3540 | wifiBand, ChannelList, |
| 3541 | &numChannels); |
| 3542 | if (eHAL_STATUS_SUCCESS != status) { |
| 3543 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3544 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3545 | return -EINVAL; |
| 3546 | } |
| 3547 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3548 | for (i = 0; i < numChannels; i++) |
| 3549 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3550 | |
| 3551 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3552 | sizeof(u32) * numChannels + |
| 3553 | NLMSG_HDRLEN); |
| 3554 | |
| 3555 | if (!replySkb) { |
| 3556 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3557 | FL("valid channels: buffer alloc fail")); |
| 3558 | return -EINVAL; |
| 3559 | } |
| 3560 | if (nla_put_u32(replySkb, |
| 3561 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3562 | numChannels) || |
| 3563 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3564 | sizeof(u32) * numChannels, ChannelList)) { |
| 3565 | |
| 3566 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3567 | kfree_skb(replySkb); |
| 3568 | return -EINVAL; |
| 3569 | } |
| 3570 | |
| 3571 | return cfg80211_vendor_cmd_reply(replySkb); |
| 3572 | } |
| 3573 | |
| 3574 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 3575 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3576 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3577 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3578 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3579 | struct net_device *dev = wdev->netdev; |
| 3580 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3581 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3582 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3583 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3584 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3585 | struct nlattr *buckets; |
| 3586 | struct nlattr *channels; |
| 3587 | int rem1; |
| 3588 | int rem2; |
| 3589 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3590 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3591 | |
| 3592 | status = wlan_hdd_validate_context(pHddCtx); |
| 3593 | if (0 != status) |
| 3594 | { |
| 3595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3596 | FL("HDD context is not valid")); |
| 3597 | return -EINVAL; |
| 3598 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3599 | /* check the EXTScan Capability */ |
| 3600 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3601 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3602 | { |
| 3603 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3604 | FL("EXTScan not enabled/supported by Firmware")); |
| 3605 | return -EINVAL; |
| 3606 | } |
| 3607 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3608 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3609 | data, dataLen, |
| 3610 | wlan_hdd_extscan_config_policy)) { |
| 3611 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3612 | return -EINVAL; |
| 3613 | } |
| 3614 | |
| 3615 | /* Parse and fetch request Id */ |
| 3616 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3617 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3618 | return -EINVAL; |
| 3619 | } |
| 3620 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3621 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3622 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3623 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3624 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3625 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3626 | } |
| 3627 | |
| 3628 | pReqMsg->requestId = nla_get_u32( |
| 3629 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3630 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3631 | |
| 3632 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3633 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3634 | |
| 3635 | /* Parse and fetch base period */ |
| 3636 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3637 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3638 | goto fail; |
| 3639 | } |
| 3640 | pReqMsg->basePeriod = nla_get_u32( |
| 3641 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3642 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3643 | pReqMsg->basePeriod); |
| 3644 | |
| 3645 | /* Parse and fetch max AP per scan */ |
| 3646 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3647 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3648 | goto fail; |
| 3649 | } |
| 3650 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3651 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3652 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3653 | pReqMsg->maxAPperScan); |
| 3654 | |
| 3655 | /* Parse and fetch report threshold */ |
| 3656 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3657 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3658 | goto fail; |
| 3659 | } |
| 3660 | pReqMsg->reportThreshold = nla_get_u8( |
| 3661 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3662 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3663 | pReqMsg->reportThreshold); |
| 3664 | |
| 3665 | /* Parse and fetch number of buckets */ |
| 3666 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3668 | goto fail; |
| 3669 | } |
| 3670 | pReqMsg->numBuckets = nla_get_u8( |
| 3671 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3672 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3673 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3674 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3675 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3676 | } |
| 3677 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3678 | pReqMsg->numBuckets); |
| 3679 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3680 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3681 | goto fail; |
| 3682 | } |
| 3683 | |
| 3684 | nla_for_each_nested(buckets, |
| 3685 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3686 | if(nla_parse(bucket, |
| 3687 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3688 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3689 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3690 | goto fail; |
| 3691 | } |
| 3692 | |
| 3693 | /* Parse and fetch bucket spec */ |
| 3694 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3695 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3696 | goto fail; |
| 3697 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3698 | |
| 3699 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 3700 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3701 | |
| 3702 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 3703 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3704 | |
| 3705 | /* Parse and fetch wifi band */ |
| 3706 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3707 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3708 | goto fail; |
| 3709 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3710 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3711 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3712 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3713 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3714 | |
| 3715 | /* Parse and fetch period */ |
| 3716 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3717 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3718 | goto fail; |
| 3719 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3720 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3721 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3722 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3723 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3724 | |
| 3725 | /* Parse and fetch report events */ |
| 3726 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3727 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3728 | goto fail; |
| 3729 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3730 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3731 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3732 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3733 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3734 | |
| 3735 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3736 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 3737 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3738 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3739 | goto fail; |
| 3740 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3741 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3742 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3743 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3744 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3745 | |
| 3746 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3747 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3748 | goto fail; |
| 3749 | } |
| 3750 | |
| 3751 | j = 0; |
| 3752 | nla_for_each_nested(channels, |
| 3753 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3754 | if(nla_parse(channel, |
| 3755 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3756 | nla_data(channels), nla_len(channels), |
| 3757 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 3758 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3759 | goto fail; |
| 3760 | } |
| 3761 | |
| 3762 | /* Parse and fetch channel */ |
| 3763 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 3764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3765 | goto fail; |
| 3766 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3767 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3768 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 3769 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3770 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3771 | |
| 3772 | /* Parse and fetch dwell time */ |
| 3773 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 3774 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 3775 | goto fail; |
| 3776 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3777 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3778 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 3779 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3780 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3781 | |
| 3782 | /* Parse and fetch channel spec passive */ |
| 3783 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 3784 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3785 | FL("attr channel spec passive failed")); |
| 3786 | goto fail; |
| 3787 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3788 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3789 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 3790 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3791 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3792 | j++; |
| 3793 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3794 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3795 | } |
| 3796 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 3797 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3798 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3799 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 3800 | vos_mem_free(pReqMsg); |
| 3801 | return -EINVAL; |
| 3802 | } |
| 3803 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3804 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3805 | return 0; |
| 3806 | |
| 3807 | fail: |
| 3808 | vos_mem_free(pReqMsg); |
| 3809 | return -EINVAL; |
| 3810 | } |
| 3811 | |
| 3812 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 3813 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3814 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3815 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3816 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3817 | struct net_device *dev = wdev->netdev; |
| 3818 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3819 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3820 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3821 | eHalStatus status; |
| 3822 | |
| 3823 | status = wlan_hdd_validate_context(pHddCtx); |
| 3824 | if (0 != status) |
| 3825 | { |
| 3826 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3827 | FL("HDD context is not valid")); |
| 3828 | return -EINVAL; |
| 3829 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3830 | /* check the EXTScan Capability */ |
| 3831 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3832 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3833 | { |
| 3834 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3835 | FL("EXTScan not enabled/supported by Firmware")); |
| 3836 | return -EINVAL; |
| 3837 | } |
| 3838 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3839 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3840 | data, dataLen, |
| 3841 | wlan_hdd_extscan_config_policy)) { |
| 3842 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3843 | return -EINVAL; |
| 3844 | } |
| 3845 | |
| 3846 | /* Parse and fetch request Id */ |
| 3847 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3848 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3849 | return -EINVAL; |
| 3850 | } |
| 3851 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3852 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3853 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3854 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3855 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3856 | reqMsg.sessionId = pAdapter->sessionId; |
| 3857 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3858 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3859 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3860 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3861 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3862 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3863 | return -EINVAL; |
| 3864 | } |
| 3865 | |
| 3866 | return 0; |
| 3867 | } |
| 3868 | |
| 3869 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 3870 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3871 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3872 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3873 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3874 | struct net_device *dev = wdev->netdev; |
| 3875 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3876 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3877 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3878 | eHalStatus status; |
| 3879 | |
| 3880 | status = wlan_hdd_validate_context(pHddCtx); |
| 3881 | if (0 != status) |
| 3882 | { |
| 3883 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3884 | FL("HDD context is not valid")); |
| 3885 | return -EINVAL; |
| 3886 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3887 | /* check the EXTScan Capability */ |
| 3888 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3889 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3890 | { |
| 3891 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3892 | FL("EXTScan not enabled/supported by Firmware")); |
| 3893 | return -EINVAL; |
| 3894 | } |
| 3895 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3896 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3897 | data, dataLen, |
| 3898 | wlan_hdd_extscan_config_policy)) { |
| 3899 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3900 | return -EINVAL; |
| 3901 | } |
| 3902 | |
| 3903 | /* Parse and fetch request Id */ |
| 3904 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3905 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3906 | return -EINVAL; |
| 3907 | } |
| 3908 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3909 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3910 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3911 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3912 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3913 | reqMsg.sessionId = pAdapter->sessionId; |
| 3914 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3915 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3916 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3917 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3918 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3919 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3920 | return -EINVAL; |
| 3921 | } |
| 3922 | |
| 3923 | return 0; |
| 3924 | } |
| 3925 | |
| 3926 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 3927 | struct wiphy *wiphy, |
| 3928 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3929 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3930 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3931 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3932 | struct net_device *dev = wdev->netdev; |
| 3933 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3934 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3935 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3936 | eHalStatus status; |
| 3937 | |
| 3938 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering")); |
| 3939 | status = wlan_hdd_validate_context(pHddCtx); |
| 3940 | if (0 != status) |
| 3941 | { |
| 3942 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3943 | FL("HDD context is not valid")); |
| 3944 | return -EINVAL; |
| 3945 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3946 | /* check the EXTScan Capability */ |
| 3947 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3948 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3949 | { |
| 3950 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3951 | FL("EXTScan not enabled/supported by Firmware")); |
| 3952 | return -EINVAL; |
| 3953 | } |
| 3954 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3955 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3956 | data, dataLen, |
| 3957 | wlan_hdd_extscan_config_policy)) { |
| 3958 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3959 | return -EINVAL; |
| 3960 | } |
| 3961 | |
| 3962 | /* Parse and fetch request Id */ |
| 3963 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3964 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3965 | return -EINVAL; |
| 3966 | } |
| 3967 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3968 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3969 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3970 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3971 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3972 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3973 | reqMsg.sessionId = pAdapter->sessionId; |
| 3974 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3975 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3976 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3977 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3978 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3979 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3980 | return -EINVAL; |
| 3981 | } |
| 3982 | |
| 3983 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3984 | return 0; |
| 3985 | } |
| 3986 | |
| 3987 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 3988 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3989 | /*EXT TDLS*/ |
| 3990 | static const struct nla_policy |
| 3991 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 3992 | { |
| 3993 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 3994 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 3995 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 3996 | {.type = NLA_S32 }, |
| 3997 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 3998 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 3999 | |
| 4000 | }; |
| 4001 | |
| 4002 | static const struct nla_policy |
| 4003 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4004 | { |
| 4005 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4006 | |
| 4007 | }; |
| 4008 | |
| 4009 | static const struct nla_policy |
| 4010 | wlan_hdd_tdls_config_state_change_policy[ |
| 4011 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4012 | { |
| 4013 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4014 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4015 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4016 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4017 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4018 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4019 | |
| 4020 | }; |
| 4021 | |
| 4022 | static const struct nla_policy |
| 4023 | wlan_hdd_tdls_config_get_status_policy[ |
| 4024 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4025 | { |
| 4026 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4027 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4028 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4029 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4030 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4031 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4032 | |
| 4033 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4034 | |
| 4035 | static const struct nla_policy |
| 4036 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4037 | { |
| 4038 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4039 | }; |
| 4040 | |
| 4041 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4042 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4043 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4044 | int data_len) |
| 4045 | { |
| 4046 | |
| 4047 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4048 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4049 | |
| 4050 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
| 4051 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("hdd Ctx invalid while spoof macAddr")); |
| 4052 | return -EINVAL; |
| 4053 | } |
| 4054 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4055 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4056 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4057 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4058 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4059 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4060 | return -ENOTSUPP; |
| 4061 | } |
| 4062 | |
| 4063 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4064 | data, data_len, wlan_hdd_mac_config)) { |
| 4065 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4066 | return -EINVAL; |
| 4067 | } |
| 4068 | |
| 4069 | /* Parse and fetch mac address */ |
| 4070 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4071 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4072 | return -EINVAL; |
| 4073 | } |
| 4074 | |
| 4075 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4076 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4077 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4078 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4079 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4080 | |
| 4081 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, nla_data( |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4082 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4083 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4084 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4085 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4086 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4087 | { |
| 4088 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4089 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4090 | VOS_MAC_ADDRESS_LEN); |
| 4091 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4092 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4093 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4094 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4095 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4096 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4097 | } |
| 4098 | |
| 4099 | return 0; |
| 4100 | } |
| 4101 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4102 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4103 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4104 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4105 | int data_len) |
| 4106 | { |
| 4107 | u8 peer[6] = {0}; |
| 4108 | struct net_device *dev = wdev->netdev; |
| 4109 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4110 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4111 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4112 | eHalStatus ret; |
| 4113 | tANI_S32 state; |
| 4114 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4115 | tANI_S32 global_operating_class = 0; |
| 4116 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4117 | struct sk_buff *skb = NULL; |
| 4118 | |
| 4119 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4120 | if (0 != ret) { |
| 4121 | |
| 4122 | return -EINVAL; |
| 4123 | } |
| 4124 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4125 | |
| 4126 | return -ENOTSUPP; |
| 4127 | } |
| 4128 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4129 | data, data_len, |
| 4130 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4131 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4132 | return -EINVAL; |
| 4133 | } |
| 4134 | |
| 4135 | /* Parse and fetch mac address */ |
| 4136 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4137 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4138 | return -EINVAL; |
| 4139 | } |
| 4140 | |
| 4141 | memcpy(peer, nla_data( |
| 4142 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4143 | sizeof(peer)); |
| 4144 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4145 | |
| 4146 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4147 | |
| 4148 | if (0 != ret) { |
| 4149 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4150 | FL("get status Failed")); |
| 4151 | return -EINVAL; |
| 4152 | } |
| 4153 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4154 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4155 | NLMSG_HDRLEN); |
| 4156 | |
| 4157 | if (!skb) { |
| 4158 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4159 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4160 | return -EINVAL; |
| 4161 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4162 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reason (%d) Status (%d) class (%d) channel (%d) peer" MAC_ADDRESS_STR), |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4163 | reason, |
| 4164 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4165 | global_operating_class, |
| 4166 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4167 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4168 | if (nla_put_s32(skb, |
| 4169 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4170 | state) || |
| 4171 | nla_put_s32(skb, |
| 4172 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4173 | reason) || |
| 4174 | nla_put_s32(skb, |
| 4175 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4176 | global_operating_class) || |
| 4177 | nla_put_s32(skb, |
| 4178 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4179 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4180 | |
| 4181 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4182 | goto nla_put_failure; |
| 4183 | } |
| 4184 | |
| 4185 | return cfg80211_vendor_cmd_reply(skb); |
| 4186 | |
| 4187 | nla_put_failure: |
| 4188 | kfree_skb(skb); |
| 4189 | return -EINVAL; |
| 4190 | } |
| 4191 | |
| 4192 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4193 | tANI_S32 state, |
| 4194 | tANI_S32 reason, |
| 4195 | void *ctx) |
| 4196 | { |
| 4197 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
| 4198 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4199 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4200 | tANI_S32 global_operating_class = 0; |
| 4201 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4202 | |
| 4203 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 4204 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid ")); |
| 4205 | return -EINVAL; |
| 4206 | } |
| 4207 | |
| 4208 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4209 | |
| 4210 | return -ENOTSUPP; |
| 4211 | } |
| 4212 | skb = cfg80211_vendor_event_alloc( |
| 4213 | pHddCtx->wiphy, |
| 4214 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4215 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4216 | GFP_KERNEL); |
| 4217 | |
| 4218 | if (!skb) { |
| 4219 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4220 | FL("cfg80211_vendor_event_alloc failed")); |
| 4221 | return -EINVAL; |
| 4222 | } |
| 4223 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4224 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4225 | reason, |
| 4226 | state, |
| 4227 | global_operating_class, |
| 4228 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4229 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4230 | MAC_ADDR_ARRAY(mac)); |
| 4231 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4232 | if (nla_put(skb, |
| 4233 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4234 | VOS_MAC_ADDR_SIZE, mac) || |
| 4235 | nla_put_s32(skb, |
| 4236 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4237 | state) || |
| 4238 | nla_put_s32(skb, |
| 4239 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4240 | reason) || |
| 4241 | nla_put_s32(skb, |
| 4242 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4243 | channel) || |
| 4244 | nla_put_s32(skb, |
| 4245 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4246 | global_operating_class) |
| 4247 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4248 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4249 | goto nla_put_failure; |
| 4250 | } |
| 4251 | |
| 4252 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 4253 | return (0); |
| 4254 | |
| 4255 | nla_put_failure: |
| 4256 | kfree_skb(skb); |
| 4257 | return -EINVAL; |
| 4258 | } |
| 4259 | |
| 4260 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4261 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4262 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4263 | int data_len) |
| 4264 | { |
| 4265 | u8 peer[6] = {0}; |
| 4266 | struct net_device *dev = wdev->netdev; |
| 4267 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4268 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4269 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4270 | eHalStatus status; |
| 4271 | tdls_req_params_t pReqMsg = {0}; |
| 4272 | |
| 4273 | status = wlan_hdd_validate_context(pHddCtx); |
| 4274 | if (0 != status) { |
| 4275 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4276 | FL("HDD context is not valid")); |
| 4277 | return -EINVAL; |
| 4278 | } |
| 4279 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4280 | |
| 4281 | return -ENOTSUPP; |
| 4282 | } |
| 4283 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4284 | data, data_len, |
| 4285 | wlan_hdd_tdls_config_enable_policy)) { |
| 4286 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4287 | return -EINVAL; |
| 4288 | } |
| 4289 | |
| 4290 | /* Parse and fetch mac address */ |
| 4291 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4292 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4293 | return -EINVAL; |
| 4294 | } |
| 4295 | |
| 4296 | memcpy(peer, nla_data( |
| 4297 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4298 | sizeof(peer)); |
| 4299 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4300 | |
| 4301 | /* Parse and fetch channel */ |
| 4302 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4303 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4304 | return -EINVAL; |
| 4305 | } |
| 4306 | pReqMsg.channel = nla_get_s32( |
| 4307 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4308 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4309 | |
| 4310 | /* Parse and fetch global operating class */ |
| 4311 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4312 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4313 | return -EINVAL; |
| 4314 | } |
| 4315 | pReqMsg.global_operating_class = nla_get_s32( |
| 4316 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4317 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4318 | pReqMsg.global_operating_class); |
| 4319 | |
| 4320 | /* Parse and fetch latency ms */ |
| 4321 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4322 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4323 | return -EINVAL; |
| 4324 | } |
| 4325 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4326 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4327 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4328 | pReqMsg.max_latency_ms); |
| 4329 | |
| 4330 | /* Parse and fetch required bandwidth kbps */ |
| 4331 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4332 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4333 | return -EINVAL; |
| 4334 | } |
| 4335 | |
| 4336 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4337 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4338 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4339 | pReqMsg.min_bandwidth_kbps); |
| 4340 | |
| 4341 | return (wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 4342 | peer, |
| 4343 | wlan_hdd_cfg80211_exttdls_callback)); |
| 4344 | } |
| 4345 | |
| 4346 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4347 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4348 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4349 | int data_len) |
| 4350 | { |
| 4351 | u8 peer[6] = {0}; |
| 4352 | struct net_device *dev = wdev->netdev; |
| 4353 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4354 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4355 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4356 | eHalStatus status; |
| 4357 | |
| 4358 | status = wlan_hdd_validate_context(pHddCtx); |
| 4359 | if (0 != status) { |
| 4360 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4361 | FL("HDD context is not valid")); |
| 4362 | return -EINVAL; |
| 4363 | } |
| 4364 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4365 | |
| 4366 | return -ENOTSUPP; |
| 4367 | } |
| 4368 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4369 | data, data_len, |
| 4370 | wlan_hdd_tdls_config_disable_policy)) { |
| 4371 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4372 | return -EINVAL; |
| 4373 | } |
| 4374 | /* Parse and fetch mac address */ |
| 4375 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4376 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4377 | return -EINVAL; |
| 4378 | } |
| 4379 | |
| 4380 | memcpy(peer, nla_data( |
| 4381 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4382 | sizeof(peer)); |
| 4383 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4384 | |
| 4385 | return (wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer)); |
| 4386 | } |
| 4387 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4388 | static int |
| 4389 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 4390 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4391 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4392 | { |
| 4393 | struct net_device *dev = wdev->netdev; |
| 4394 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4395 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4396 | struct sk_buff *skb = NULL; |
| 4397 | tANI_U32 fset = 0; |
| 4398 | |
| 4399 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4400 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4401 | fset |= WIFI_FEATURE_INFRA; |
| 4402 | } |
| 4403 | |
| 4404 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4405 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4406 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4407 | } |
| 4408 | |
| 4409 | #ifdef WLAN_FEATURE_P2P |
| 4410 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4411 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4412 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4413 | fset |= WIFI_FEATURE_P2P; |
| 4414 | } |
| 4415 | #endif |
| 4416 | |
| 4417 | /* Soft-AP is supported currently by default */ |
| 4418 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4419 | |
| 4420 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4421 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4422 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4423 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4424 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4425 | } |
| 4426 | #endif |
| 4427 | |
| 4428 | #ifdef WLAN_FEATURE_NAN |
| 4429 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4430 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4431 | fset |= WIFI_FEATURE_NAN; |
| 4432 | } |
| 4433 | #endif |
| 4434 | |
| 4435 | /* D2D RTT is not supported currently by default */ |
| 4436 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4437 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4438 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 4439 | } |
| 4440 | |
| 4441 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 4442 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 4443 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 4444 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 4445 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 4446 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 4447 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 4448 | } |
| 4449 | #endif |
| 4450 | |
| 4451 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4452 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 4453 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 4454 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 4455 | fset |= WIFI_FEATURE_PNO; |
| 4456 | } |
| 4457 | #endif |
| 4458 | |
| 4459 | /* STA+STA is supported currently by default */ |
| 4460 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 4461 | |
| 4462 | #ifdef FEATURE_WLAN_TDLS |
| 4463 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 4464 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 4465 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 4466 | fset |= WIFI_FEATURE_TDLS; |
| 4467 | } |
| 4468 | |
| 4469 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 4470 | #endif |
| 4471 | |
| 4472 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 4473 | /* AP+STA concurrency is supported currently by default */ |
| 4474 | fset |= WIFI_FEATURE_AP_STA; |
| 4475 | #endif |
| 4476 | |
| 4477 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 4478 | NLMSG_HDRLEN); |
| 4479 | |
| 4480 | if (!skb) { |
| 4481 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4482 | return -EINVAL; |
| 4483 | } |
| 4484 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 4485 | |
| 4486 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 4487 | hddLog(LOGE, FL("nla put fail")); |
| 4488 | goto nla_put_failure; |
| 4489 | } |
| 4490 | |
| 4491 | return cfg80211_vendor_cmd_reply(skb); |
| 4492 | |
| 4493 | nla_put_failure: |
| 4494 | kfree_skb(skb); |
| 4495 | return -EINVAL; |
| 4496 | } |
| 4497 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4498 | static int |
| 4499 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 4500 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4501 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4502 | { |
| 4503 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 4504 | uint8_t i, feature_sets, max_feature_sets; |
| 4505 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 4506 | struct sk_buff *reply_skb; |
| 4507 | |
| 4508 | ENTER(); |
| 4509 | |
| 4510 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 4511 | data, data_len, NULL)) { |
| 4512 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4513 | return -EINVAL; |
| 4514 | } |
| 4515 | |
| 4516 | /* Parse and fetch max feature set */ |
| 4517 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 4518 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 4519 | return -EINVAL; |
| 4520 | } |
| 4521 | max_feature_sets = nla_get_u32( |
| 4522 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 4523 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 4524 | |
| 4525 | /* Fill feature combination matrix */ |
| 4526 | feature_sets = 0; |
| 4527 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4528 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4529 | WIFI_FEATURE_P2P; |
| 4530 | |
| 4531 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4532 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4533 | WIFI_FEATURE_SOFT_AP; |
| 4534 | |
| 4535 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4536 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 4537 | WIFI_FEATURE_SOFT_AP; |
| 4538 | |
| 4539 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4540 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4541 | WIFI_FEATURE_SOFT_AP | |
| 4542 | WIFI_FEATURE_P2P; |
| 4543 | |
| 4544 | /* Add more feature combinations here */ |
| 4545 | |
| 4546 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 4547 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 4548 | hddLog(LOG1, "Feature set matrix"); |
| 4549 | for (i = 0; i < feature_sets; i++) |
| 4550 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 4551 | |
| 4552 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 4553 | sizeof(u32) * feature_sets + |
| 4554 | NLMSG_HDRLEN); |
| 4555 | |
| 4556 | if (reply_skb) { |
| 4557 | if (nla_put_u32(reply_skb, |
| 4558 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 4559 | feature_sets) || |
| 4560 | nla_put(reply_skb, |
| 4561 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 4562 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 4563 | hddLog(LOGE, FL("nla put fail")); |
| 4564 | kfree_skb(reply_skb); |
| 4565 | return -EINVAL; |
| 4566 | } |
| 4567 | |
| 4568 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 4569 | } |
| 4570 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 4571 | return -ENOMEM; |
| 4572 | |
| 4573 | max_buffer_err: |
| 4574 | hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"), |
| 4575 | feature_sets, WLAN_HDD_MAX_FEATURE_SET); |
| 4576 | return -EINVAL; |
| 4577 | } |
| 4578 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4579 | static const struct nla_policy |
| 4580 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 4581 | +1] = |
| 4582 | { |
| 4583 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 4584 | }; |
| 4585 | |
| 4586 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 4587 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4588 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4589 | int data_len) |
| 4590 | { |
| 4591 | struct net_device *dev = wdev->netdev; |
| 4592 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4593 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4594 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4595 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 4596 | eHalStatus status; |
| 4597 | u32 dfsFlag = 0; |
| 4598 | |
| 4599 | status = wlan_hdd_validate_context(pHddCtx); |
| 4600 | if (0 != status) { |
| 4601 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4602 | FL("HDD context is not valid")); |
| 4603 | return -EINVAL; |
| 4604 | } |
| 4605 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 4606 | data, data_len, |
| 4607 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 4608 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4609 | return -EINVAL; |
| 4610 | } |
| 4611 | |
| 4612 | /* Parse and fetch required bandwidth kbps */ |
| 4613 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 4614 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 4615 | return -EINVAL; |
| 4616 | } |
| 4617 | |
| 4618 | dfsFlag = nla_get_u32( |
| 4619 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 4620 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 4621 | dfsFlag); |
| 4622 | |
| 4623 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 4624 | |
| 4625 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 4626 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
| 4627 | return 0; |
| 4628 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4629 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4630 | const struct |
| 4631 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 4632 | { |
| 4633 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 4634 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 4635 | }; |
| 4636 | |
| 4637 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4638 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4639 | { |
| 4640 | |
| 4641 | u8 bssid[6] = {0}; |
| 4642 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4643 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 4644 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4645 | v_U32_t isFwrRoamEnabled = FALSE; |
| 4646 | int ret; |
| 4647 | |
| 4648 | if (NULL == pHddCtx) { |
| 4649 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4650 | FL("HDD context is not valid")); |
| 4651 | return -EINVAL; |
| 4652 | } |
| 4653 | |
| 4654 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 4655 | data, data_len, |
| 4656 | qca_wlan_vendor_attr); |
| 4657 | if (ret){ |
| 4658 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4659 | return -EINVAL; |
| 4660 | } |
| 4661 | |
| 4662 | /* Parse and fetch Enable flag */ |
| 4663 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 4664 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 4665 | return -EINVAL; |
| 4666 | } |
| 4667 | |
| 4668 | isFwrRoamEnabled = nla_get_u32( |
| 4669 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 4670 | |
| 4671 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 4672 | |
| 4673 | /* Parse and fetch bssid */ |
| 4674 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 4675 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 4676 | return -EINVAL; |
| 4677 | } |
| 4678 | |
| 4679 | memcpy(bssid, nla_data( |
| 4680 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 4681 | sizeof(bssid)); |
| 4682 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 4683 | |
| 4684 | //Update roaming |
| 4685 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
| 4686 | return status; |
| 4687 | } |
| 4688 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4689 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 4690 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4691 | { |
| 4692 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4693 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 4694 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4695 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4696 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4697 | .doit = (void *)wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4698 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4699 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4700 | { |
| 4701 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4702 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 4703 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4704 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4705 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4706 | .doit = (void *)wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4707 | }, |
| 4708 | |
| 4709 | { |
| 4710 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4711 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 4712 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4713 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4714 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4715 | .doit = (void *)wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4716 | }, |
| 4717 | |
| 4718 | { |
| 4719 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4720 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 4721 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4722 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4723 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4724 | .doit = (void *)wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4725 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4726 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4727 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4728 | { |
| 4729 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4730 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 4731 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4732 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4733 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4734 | .doit = (void *)wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4735 | }, |
| 4736 | { |
| 4737 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4738 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 4739 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4740 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4741 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4742 | .doit = (void *)wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4743 | }, |
| 4744 | { |
| 4745 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4746 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 4747 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4748 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4749 | .doit = (void *)wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4750 | }, |
| 4751 | { |
| 4752 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4753 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 4754 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4755 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4756 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4757 | .doit = (void *)wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4758 | }, |
| 4759 | { |
| 4760 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4761 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 4762 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4763 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4764 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4765 | .doit = (void *)wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4766 | }, |
| 4767 | { |
| 4768 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4769 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 4770 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4771 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4772 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4773 | .doit = (void *)wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4774 | }, |
| 4775 | { |
| 4776 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4777 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 4778 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4779 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4780 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4781 | .doit = (void *)wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4782 | }, |
| 4783 | { |
| 4784 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4785 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 4786 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4787 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4788 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4789 | .doit = (void *)wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4790 | }, |
| 4791 | { |
| 4792 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4793 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 4794 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4795 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4796 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4797 | .doit = (void *)wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4798 | }, |
| 4799 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4800 | /*EXT TDLS*/ |
| 4801 | { |
| 4802 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4803 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 4804 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4805 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4806 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4807 | .doit = (void *)wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4808 | }, |
| 4809 | { |
| 4810 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4811 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 4812 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4813 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 4814 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4815 | .doit = (void *)wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4816 | }, |
| 4817 | { |
| 4818 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4819 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 4820 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4821 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4822 | .doit = (void *)wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4823 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4824 | { |
| 4825 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4826 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 4827 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4828 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4829 | .doit = (void *)wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4830 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4831 | { |
| 4832 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4833 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 4834 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4835 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4836 | .doit = (void *)wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4837 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4838 | { |
| 4839 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4840 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 4841 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4842 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4843 | .doit = (void *) wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4844 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4845 | { |
| 4846 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 4847 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 4848 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 4849 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4850 | .doit = (void *)wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4851 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4852 | }; |
| 4853 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4854 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4855 | static const |
| 4856 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4857 | { |
| 4858 | #ifdef FEATURE_WLAN_CH_AVOID |
| 4859 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4860 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4861 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4862 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4863 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 4864 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 4865 | { |
| 4866 | /* Index = 1*/ |
| 4867 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4868 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 4869 | }, |
| 4870 | { |
| 4871 | /* Index = 2*/ |
| 4872 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4873 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 4874 | }, |
| 4875 | { |
| 4876 | /* Index = 3*/ |
| 4877 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4878 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 4879 | }, |
| 4880 | { |
| 4881 | /* Index = 4*/ |
| 4882 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4883 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 4884 | }, |
| 4885 | { |
| 4886 | /* Index = 5*/ |
| 4887 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4888 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 4889 | }, |
| 4890 | { |
| 4891 | /* Index = 6*/ |
| 4892 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4893 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 4894 | }, |
| 4895 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4896 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4897 | { |
| 4898 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4899 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 4900 | }, |
| 4901 | { |
| 4902 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4903 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 4904 | }, |
| 4905 | { |
| 4906 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4907 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 4908 | }, |
| 4909 | { |
| 4910 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4911 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 4912 | }, |
| 4913 | { |
| 4914 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4915 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 4916 | }, |
| 4917 | { |
| 4918 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4919 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 4920 | }, |
| 4921 | { |
| 4922 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4923 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 4924 | }, |
| 4925 | { |
| 4926 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4927 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 4928 | }, |
| 4929 | { |
| 4930 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4931 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 4932 | }, |
| 4933 | { |
| 4934 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4935 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 4936 | }, |
| 4937 | { |
| 4938 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4939 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 4940 | }, |
| 4941 | { |
| 4942 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4943 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 4944 | }, |
| 4945 | { |
| 4946 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4947 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 4948 | }, |
| 4949 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4950 | /*EXT TDLS*/ |
| 4951 | { |
| 4952 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 4953 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 4954 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 4955 | }; |
| 4956 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4957 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4958 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4959 | * This function is called by hdd_wlan_startup() |
| 4960 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4961 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4962 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 4963 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | { |
| 4965 | struct wiphy *wiphy; |
| 4966 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4967 | /* |
| 4968 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | */ |
| 4970 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 4971 | |
| 4972 | if (!wiphy) |
| 4973 | { |
| 4974 | /* Print error and jump into err label and free the memory */ |
| 4975 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 4976 | return NULL; |
| 4977 | } |
| 4978 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 4979 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4980 | return wiphy; |
| 4981 | } |
| 4982 | |
| 4983 | /* |
| 4984 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 4985 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | * private ioctl to change the band value |
| 4987 | */ |
| 4988 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 4989 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4990 | int i, j; |
| 4991 | eNVChannelEnabledType channelEnabledState; |
| 4992 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4993 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 4994 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4995 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4996 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 4997 | |
| 4998 | if (NULL == wiphy->bands[i]) |
| 4999 | { |
| 5000 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5001 | __func__, i); |
| 5002 | continue; |
| 5003 | } |
| 5004 | |
| 5005 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5006 | { |
| 5007 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5008 | |
| 5009 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5010 | band->channels[j].hw_value); |
| 5011 | |
| 5012 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5013 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5014 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5015 | continue; |
| 5016 | } |
| 5017 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5018 | { |
| 5019 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5020 | continue; |
| 5021 | } |
| 5022 | |
| 5023 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5024 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5025 | { |
| 5026 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5027 | } |
| 5028 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5029 | { |
| 5030 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5031 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5032 | } |
| 5033 | else |
| 5034 | { |
| 5035 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5036 | |IEEE80211_CHAN_RADAR); |
| 5037 | } |
| 5038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | } |
| 5040 | return 0; |
| 5041 | } |
| 5042 | /* |
| 5043 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5044 | * This function is called by hdd_wlan_startup() |
| 5045 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5046 | * This function is used to initialize and register wiphy structure. |
| 5047 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5048 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5049 | struct wiphy *wiphy, |
| 5050 | hdd_config_t *pCfg |
| 5051 | ) |
| 5052 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5053 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5054 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5055 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5056 | ENTER(); |
| 5057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5058 | /* Now bind the underlying wlan device with wiphy */ |
| 5059 | set_wiphy_dev(wiphy, dev); |
| 5060 | |
| 5061 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5062 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5063 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5064 | /* the flag for the other case would be initialzed in |
| 5065 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5066 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5067 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5068 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5069 | /* This will disable updating of NL channels from passive to |
| 5070 | * active if a beacon is received on passive channel. */ |
| 5071 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5072 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5073 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5074 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5075 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5076 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5077 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5078 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5079 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5080 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5081 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5082 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5083 | #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] | 5084 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5085 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5086 | || pCfg->isFastRoamIniFeatureEnabled |
| 5087 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5088 | #ifdef FEATURE_WLAN_ESE |
| 5089 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5090 | #endif |
| 5091 | ) |
| 5092 | { |
| 5093 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5094 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5095 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5096 | #ifdef FEATURE_WLAN_TDLS |
| 5097 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5098 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5099 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5100 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5101 | if (pCfg->configPNOScanSupport) |
| 5102 | { |
| 5103 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5104 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5105 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5106 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5107 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5108 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5109 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5110 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5111 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5112 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5113 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5114 | driver need to determine what to do with both |
| 5115 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5116 | |
| 5117 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5118 | #else |
| 5119 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5120 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5121 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5122 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5123 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 5124 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5125 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5126 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5128 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5129 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5130 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5131 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5132 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5133 | | BIT(NL80211_IFTYPE_AP); |
| 5134 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5135 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5136 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5137 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5138 | if( pCfg->enableMCC ) |
| 5139 | { |
| 5140 | /* Currently, supports up to two channels */ |
| 5141 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5142 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5143 | if( !pCfg->allowMCCGODiffBI ) |
| 5144 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5145 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5146 | } |
| 5147 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5148 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5149 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5150 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5152 | /* Before registering we need to update the ht capabilitied based |
| 5153 | * on ini values*/ |
| 5154 | if( !pCfg->ShortGI20MhzEnable ) |
| 5155 | { |
| 5156 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5157 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5158 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5159 | } |
| 5160 | |
| 5161 | if( !pCfg->ShortGI40MhzEnable ) |
| 5162 | { |
| 5163 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5164 | } |
| 5165 | |
| 5166 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5167 | { |
| 5168 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5169 | } |
| 5170 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5171 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5172 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5173 | { |
| 5174 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5175 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5176 | |
| 5177 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5178 | { |
| 5179 | |
| 5180 | if (NULL == wiphy->bands[i]) |
| 5181 | { |
| 5182 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5183 | __func__, i); |
| 5184 | continue; |
| 5185 | } |
| 5186 | |
| 5187 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5188 | { |
| 5189 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5190 | |
| 5191 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5192 | { |
| 5193 | // Enable social channels for P2P |
| 5194 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5195 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5196 | else |
| 5197 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5198 | continue; |
| 5199 | } |
| 5200 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5201 | { |
| 5202 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5203 | continue; |
| 5204 | } |
| 5205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | } |
| 5207 | /*Initialise the supported cipher suite details*/ |
| 5208 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5209 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5210 | |
| 5211 | /*signal strength in mBm (100*dBm) */ |
| 5212 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5213 | |
| 5214 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5215 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5216 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5218 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5219 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5220 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5221 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5222 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5223 | EXIT(); |
| 5224 | return 0; |
| 5225 | } |
| 5226 | |
| 5227 | /* In this function we are registering wiphy. */ |
| 5228 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5229 | { |
| 5230 | ENTER(); |
| 5231 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5232 | if (0 > wiphy_register(wiphy)) |
| 5233 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5234 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5235 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5236 | return -EIO; |
| 5237 | } |
| 5238 | |
| 5239 | EXIT(); |
| 5240 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5241 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5242 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5243 | /* In this function we are updating channel list when, |
| 5244 | regulatory domain is FCC and country code is US. |
| 5245 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5246 | As per FCC smart phone is not a indoor device. |
| 5247 | GO should not opeate on indoor channels */ |
| 5248 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5249 | { |
| 5250 | int j; |
| 5251 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5252 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5253 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5254 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5255 | &defaultCountryCode[0])) |
| 5256 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5257 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5258 | } |
| 5259 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5260 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5261 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5262 | { |
| 5263 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5264 | return; |
| 5265 | } |
| 5266 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5267 | { |
| 5268 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5269 | // Mark UNII -1 band channel as passive |
| 5270 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5271 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5272 | } |
| 5273 | } |
| 5274 | } |
| 5275 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5276 | /* This function registers for all frame which supplicant is interested in */ |
| 5277 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5278 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5279 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5280 | /* Register for all P2P action, public action etc frames */ |
| 5281 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5282 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5283 | ENTER(); |
| 5284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5285 | /* Right now we are registering these frame when driver is getting |
| 5286 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5287 | frame register ops, we will move this code as a part of that */ |
| 5288 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5289 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5290 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5291 | |
| 5292 | /* GAS Initial Response */ |
| 5293 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5294 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5296 | /* GAS Comeback Request */ |
| 5297 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5298 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5299 | |
| 5300 | /* GAS Comeback Response */ |
| 5301 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5302 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5303 | |
| 5304 | /* P2P Public Action */ |
| 5305 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5306 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5307 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5308 | |
| 5309 | /* P2P Action */ |
| 5310 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5311 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5312 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5313 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5314 | /* WNM BSS Transition Request frame */ |
| 5315 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5316 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5317 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5318 | |
| 5319 | /* WNM-Notification */ |
| 5320 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5321 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5322 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | } |
| 5324 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5325 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5326 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5327 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5328 | /* Register for all P2P action, public action etc frames */ |
| 5329 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5330 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5331 | ENTER(); |
| 5332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | /* Right now we are registering these frame when driver is getting |
| 5334 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5335 | frame register ops, we will move this code as a part of that */ |
| 5336 | /* GAS Initial Request */ |
| 5337 | |
| 5338 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5339 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5340 | |
| 5341 | /* GAS Initial Response */ |
| 5342 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5343 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5345 | /* GAS Comeback Request */ |
| 5346 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5347 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5348 | |
| 5349 | /* GAS Comeback Response */ |
| 5350 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5351 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5352 | |
| 5353 | /* P2P Public Action */ |
| 5354 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5355 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5356 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5357 | |
| 5358 | /* P2P Action */ |
| 5359 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5360 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5361 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5362 | /* WNM-Notification */ |
| 5363 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5364 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5365 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5366 | } |
| 5367 | |
| 5368 | #ifdef FEATURE_WLAN_WAPI |
| 5369 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 5370 | const u8 *mac_addr, u8 *key , int key_Len) |
| 5371 | { |
| 5372 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5373 | tCsrRoamSetKey setKey; |
| 5374 | v_BOOL_t isConnected = TRUE; |
| 5375 | int status = 0; |
| 5376 | v_U32_t roamId= 0xFF; |
| 5377 | tANI_U8 *pKeyPtr = NULL; |
| 5378 | int n = 0; |
| 5379 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5380 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 5381 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5382 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5383 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 5384 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5385 | setKey.keyId = key_index; // Store Key ID |
| 5386 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 5387 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 5388 | setKey.paeRole = 0 ; // the PAE role |
| 5389 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 5390 | { |
| 5391 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 5392 | } |
| 5393 | else |
| 5394 | { |
| 5395 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 5396 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 5397 | } |
| 5398 | setKey.keyLength = key_Len; |
| 5399 | pKeyPtr = setKey.Key; |
| 5400 | memcpy( pKeyPtr, key, key_Len); |
| 5401 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5402 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5403 | __func__, key_Len); |
| 5404 | for (n = 0 ; n < key_Len; n++) |
| 5405 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 5406 | __func__,n,setKey.Key[n]); |
| 5407 | |
| 5408 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5409 | if ( isConnected ) |
| 5410 | { |
| 5411 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5412 | pAdapter->sessionId, &setKey, &roamId ); |
| 5413 | } |
| 5414 | if ( status != 0 ) |
| 5415 | { |
| 5416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5417 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 5418 | __LINE__, status ); |
| 5419 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5420 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 5421 | /* Need to clear any trace of key value in the memory. |
| 5422 | * Thus zero out the memory even though it is local |
| 5423 | * variable. |
| 5424 | */ |
| 5425 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | } |
| 5427 | #endif /* FEATURE_WLAN_WAPI*/ |
| 5428 | |
| 5429 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5430 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5431 | beacon_data_t **ppBeacon, |
| 5432 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5433 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5434 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5435 | beacon_data_t **ppBeacon, |
| 5436 | struct cfg80211_beacon_data *params, |
| 5437 | int dtim_period) |
| 5438 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5439 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5440 | int size; |
| 5441 | beacon_data_t *beacon = NULL; |
| 5442 | beacon_data_t *old = NULL; |
| 5443 | int head_len,tail_len; |
| 5444 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5445 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5446 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5447 | { |
| 5448 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5449 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5450 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5451 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5452 | |
| 5453 | old = pAdapter->sessionCtx.ap.beacon; |
| 5454 | |
| 5455 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5456 | { |
| 5457 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5458 | FL("session(%d) old and new heads points to NULL"), |
| 5459 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5461 | } |
| 5462 | |
| 5463 | if (params->tail && !params->tail_len) |
| 5464 | { |
| 5465 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5466 | FL("tail_len is zero but tail is not NULL")); |
| 5467 | return -EINVAL; |
| 5468 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5470 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 5471 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 5472 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5473 | { |
| 5474 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5475 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | #endif |
| 5479 | |
| 5480 | if(params->head) |
| 5481 | head_len = params->head_len; |
| 5482 | else |
| 5483 | head_len = old->head_len; |
| 5484 | |
| 5485 | if(params->tail || !old) |
| 5486 | tail_len = params->tail_len; |
| 5487 | else |
| 5488 | tail_len = old->tail_len; |
| 5489 | |
| 5490 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 5491 | |
| 5492 | beacon = kzalloc(size, GFP_KERNEL); |
| 5493 | |
| 5494 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5495 | { |
| 5496 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5497 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5498 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5501 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | if(params->dtim_period || !old ) |
| 5503 | beacon->dtim_period = params->dtim_period; |
| 5504 | else |
| 5505 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5506 | #else |
| 5507 | if(dtim_period || !old ) |
| 5508 | beacon->dtim_period = dtim_period; |
| 5509 | else |
| 5510 | beacon->dtim_period = old->dtim_period; |
| 5511 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5512 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5513 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 5514 | beacon->tail = beacon->head + head_len; |
| 5515 | beacon->head_len = head_len; |
| 5516 | beacon->tail_len = tail_len; |
| 5517 | |
| 5518 | if(params->head) { |
| 5519 | memcpy (beacon->head,params->head,beacon->head_len); |
| 5520 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5521 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5522 | if(old) |
| 5523 | memcpy (beacon->head,old->head,beacon->head_len); |
| 5524 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5525 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | if(params->tail) { |
| 5527 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 5528 | } |
| 5529 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5530 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5531 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 5532 | } |
| 5533 | |
| 5534 | *ppBeacon = beacon; |
| 5535 | |
| 5536 | kfree(old); |
| 5537 | |
| 5538 | return 0; |
| 5539 | |
| 5540 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5541 | |
| 5542 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 5543 | { |
| 5544 | int left = length; |
| 5545 | v_U8_t *ptr = pIes; |
| 5546 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5549 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | elem_id = ptr[0]; |
| 5551 | elem_len = ptr[1]; |
| 5552 | left -= 2; |
| 5553 | if(elem_len > left) |
| 5554 | { |
| 5555 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 5556 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5557 | eid,elem_len,left); |
| 5558 | return NULL; |
| 5559 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5560 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5561 | { |
| 5562 | return ptr; |
| 5563 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5565 | left -= elem_len; |
| 5566 | ptr += (elem_len + 2); |
| 5567 | } |
| 5568 | return NULL; |
| 5569 | } |
| 5570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5571 | /* Check if rate is 11g rate or not */ |
| 5572 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 5573 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 5574 | 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] | 5575 | u8 i; |
| 5576 | for (i = 0; i < 8; i++) |
| 5577 | { |
| 5578 | if(rate == gRateArray[i]) |
| 5579 | return TRUE; |
| 5580 | } |
| 5581 | return FALSE; |
| 5582 | } |
| 5583 | |
| 5584 | /* Check for 11g rate and set proper 11g only mode */ |
| 5585 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 5586 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 5587 | { |
| 5588 | u8 i, num_rates = pIe[0]; |
| 5589 | |
| 5590 | pIe += 1; |
| 5591 | for ( i = 0; i < num_rates; i++) |
| 5592 | { |
| 5593 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 5594 | { |
| 5595 | /* If rate set have 11g rate than change the mode to 11G */ |
| 5596 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 5597 | if (pIe[i] & BASIC_RATE_MASK) |
| 5598 | { |
| 5599 | /* If we have 11g rate as basic rate, it means mode |
| 5600 | is 11g only mode. |
| 5601 | */ |
| 5602 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 5603 | *pCheckRatesfor11g = FALSE; |
| 5604 | } |
| 5605 | } |
| 5606 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 5607 | { |
| 5608 | *require_ht = TRUE; |
| 5609 | } |
| 5610 | } |
| 5611 | return; |
| 5612 | } |
| 5613 | |
| 5614 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 5615 | { |
| 5616 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5617 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5618 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5619 | u8 checkRatesfor11g = TRUE; |
| 5620 | u8 require_ht = FALSE; |
| 5621 | u8 *pIe=NULL; |
| 5622 | |
| 5623 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 5624 | |
| 5625 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 5626 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 5627 | if (pIe != NULL) |
| 5628 | { |
| 5629 | pIe += 1; |
| 5630 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5631 | &pConfig->SapHw_mode); |
| 5632 | } |
| 5633 | |
| 5634 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5635 | WLAN_EID_EXT_SUPP_RATES); |
| 5636 | if (pIe != NULL) |
| 5637 | { |
| 5638 | |
| 5639 | pIe += 1; |
| 5640 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5641 | &pConfig->SapHw_mode); |
| 5642 | } |
| 5643 | |
| 5644 | if( pConfig->channel > 14 ) |
| 5645 | { |
| 5646 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 5647 | } |
| 5648 | |
| 5649 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5650 | WLAN_EID_HT_CAPABILITY); |
| 5651 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5652 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | { |
| 5654 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 5655 | if(require_ht) |
| 5656 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 5657 | } |
| 5658 | } |
| 5659 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5660 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 5661 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 5662 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5663 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5664 | v_U8_t *pIe = NULL; |
| 5665 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5666 | |
| 5667 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 5668 | pBeacon->tail, pBeacon->tail_len); |
| 5669 | |
| 5670 | if (pIe) |
| 5671 | { |
| 5672 | ielen = pIe[1] + 2; |
| 5673 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5674 | { |
| 5675 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 5676 | } |
| 5677 | else |
| 5678 | { |
| 5679 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 5680 | return -EINVAL; |
| 5681 | } |
| 5682 | *total_ielen += ielen; |
| 5683 | } |
| 5684 | return 0; |
| 5685 | } |
| 5686 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5687 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 5688 | v_U8_t *genie, v_U8_t *total_ielen) |
| 5689 | { |
| 5690 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5691 | int left = pBeacon->tail_len; |
| 5692 | v_U8_t *ptr = pBeacon->tail; |
| 5693 | v_U8_t elem_id, elem_len; |
| 5694 | v_U16_t ielen = 0; |
| 5695 | |
| 5696 | if ( NULL == ptr || 0 == left ) |
| 5697 | return; |
| 5698 | |
| 5699 | while (left >= 2) |
| 5700 | { |
| 5701 | elem_id = ptr[0]; |
| 5702 | elem_len = ptr[1]; |
| 5703 | left -= 2; |
| 5704 | if (elem_len > left) |
| 5705 | { |
| 5706 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5707 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 5708 | elem_id, elem_len, left); |
| 5709 | return; |
| 5710 | } |
| 5711 | if (IE_EID_VENDOR == elem_id) |
| 5712 | { |
| 5713 | /* skipping the VSIE's which we don't want to include or |
| 5714 | * it will be included by existing code |
| 5715 | */ |
| 5716 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 5717 | #ifdef WLAN_FEATURE_WFD |
| 5718 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 5719 | #endif |
| 5720 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5721 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5722 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 5723 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 5724 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 5725 | { |
| 5726 | ielen = ptr[1] + 2; |
| 5727 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 5728 | { |
| 5729 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 5730 | *total_ielen += ielen; |
| 5731 | } |
| 5732 | else |
| 5733 | { |
| 5734 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 5735 | "IE Length is too big " |
| 5736 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 5737 | elem_id, elem_len, *total_ielen); |
| 5738 | } |
| 5739 | } |
| 5740 | } |
| 5741 | |
| 5742 | left -= elem_len; |
| 5743 | ptr += (elem_len + 2); |
| 5744 | } |
| 5745 | return; |
| 5746 | } |
| 5747 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5748 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5749 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5750 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5751 | #else |
| 5752 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 5753 | struct cfg80211_beacon_data *params) |
| 5754 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5755 | { |
| 5756 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5757 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5758 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5759 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5760 | |
| 5761 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 5762 | |
| 5763 | if(genie == NULL) { |
| 5764 | |
| 5765 | return -ENOMEM; |
| 5766 | } |
| 5767 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5768 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5769 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5770 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5771 | hddLog(LOGE, |
| 5772 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5773 | ret = -EINVAL; |
| 5774 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | } |
| 5776 | |
| 5777 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5778 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5779 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 5780 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5781 | hddLog(LOGE, |
| 5782 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5783 | ret = -EINVAL; |
| 5784 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | } |
| 5786 | #endif |
| 5787 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5788 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 5789 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5790 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5791 | hddLog(LOGE, |
| 5792 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5793 | ret = -EINVAL; |
| 5794 | goto done; |
| 5795 | } |
| 5796 | |
| 5797 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 5798 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 5799 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5800 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5801 | |
| 5802 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5803 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 5804 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 5805 | { |
| 5806 | hddLog(LOGE, |
| 5807 | "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] | 5808 | ret = -EINVAL; |
| 5809 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5810 | } |
| 5811 | |
| 5812 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5813 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 5814 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5815 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5816 | ==eHAL_STATUS_FAILURE) |
| 5817 | { |
| 5818 | hddLog(LOGE, |
| 5819 | "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] | 5820 | ret = -EINVAL; |
| 5821 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | } |
| 5823 | |
| 5824 | // Added for ProResp IE |
| 5825 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 5826 | { |
| 5827 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 5828 | u8 probe_rsp_ie_len[3] = {0}; |
| 5829 | u8 counter = 0; |
| 5830 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 5831 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 5832 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 5833 | Store More then 255 bytes into One Variable. |
| 5834 | */ |
| 5835 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 5836 | { |
| 5837 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 5838 | { |
| 5839 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 5840 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 5841 | } |
| 5842 | else |
| 5843 | { |
| 5844 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 5845 | rem_probe_resp_ie_len = 0; |
| 5846 | } |
| 5847 | } |
| 5848 | |
| 5849 | rem_probe_resp_ie_len = 0; |
| 5850 | |
| 5851 | if (probe_rsp_ie_len[0] > 0) |
| 5852 | { |
| 5853 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5854 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 5855 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5856 | probe_rsp_ie_len[0], NULL, |
| 5857 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5858 | { |
| 5859 | hddLog(LOGE, |
| 5860 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5861 | ret = -EINVAL; |
| 5862 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5863 | } |
| 5864 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 5865 | } |
| 5866 | |
| 5867 | if (probe_rsp_ie_len[1] > 0) |
| 5868 | { |
| 5869 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5870 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 5871 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5872 | probe_rsp_ie_len[1], NULL, |
| 5873 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5874 | { |
| 5875 | hddLog(LOGE, |
| 5876 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5877 | ret = -EINVAL; |
| 5878 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | } |
| 5880 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 5881 | } |
| 5882 | |
| 5883 | if (probe_rsp_ie_len[2] > 0) |
| 5884 | { |
| 5885 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5886 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 5887 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 5888 | probe_rsp_ie_len[2], NULL, |
| 5889 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5890 | { |
| 5891 | hddLog(LOGE, |
| 5892 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5893 | ret = -EINVAL; |
| 5894 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | } |
| 5896 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 5897 | } |
| 5898 | |
| 5899 | if (probe_rsp_ie_len[1] == 0 ) |
| 5900 | { |
| 5901 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5902 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 5903 | eANI_BOOLEAN_FALSE) ) |
| 5904 | { |
| 5905 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5906 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5907 | } |
| 5908 | } |
| 5909 | |
| 5910 | if (probe_rsp_ie_len[2] == 0 ) |
| 5911 | { |
| 5912 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5913 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 5914 | eANI_BOOLEAN_FALSE) ) |
| 5915 | { |
| 5916 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5917 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5918 | } |
| 5919 | } |
| 5920 | |
| 5921 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5922 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 5923 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5924 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5925 | == eHAL_STATUS_FAILURE) |
| 5926 | { |
| 5927 | hddLog(LOGE, |
| 5928 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5929 | ret = -EINVAL; |
| 5930 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5931 | } |
| 5932 | } |
| 5933 | else |
| 5934 | { |
| 5935 | // Reset WNI_CFG_PROBE_RSP Flags |
| 5936 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 5937 | |
| 5938 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5939 | "%s: No Probe Response IE received in set beacon", |
| 5940 | __func__); |
| 5941 | } |
| 5942 | |
| 5943 | // Added for AssocResp IE |
| 5944 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 5945 | { |
| 5946 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5947 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 5948 | params->assocresp_ies_len, NULL, |
| 5949 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 5950 | { |
| 5951 | hddLog(LOGE, |
| 5952 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5953 | ret = -EINVAL; |
| 5954 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5955 | } |
| 5956 | |
| 5957 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5958 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 5959 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 5960 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 5961 | == eHAL_STATUS_FAILURE) |
| 5962 | { |
| 5963 | hddLog(LOGE, |
| 5964 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5965 | ret = -EINVAL; |
| 5966 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | } |
| 5968 | } |
| 5969 | else |
| 5970 | { |
| 5971 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5972 | "%s: No Assoc Response IE received in set beacon", |
| 5973 | __func__); |
| 5974 | |
| 5975 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 5976 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 5977 | eANI_BOOLEAN_FALSE) ) |
| 5978 | { |
| 5979 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5980 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | } |
| 5982 | } |
| 5983 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5984 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5985 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 5986 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5989 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5990 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 5991 | * called by wlan_hdd_cfg80211_start_bss() and |
| 5992 | * wlan_hdd_cfg80211_set_channel() |
| 5993 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5994 | * channel list. |
| 5995 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 5996 | 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] | 5997 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5998 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5999 | v_U32_t num_ch = 0; |
| 6000 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6001 | u32 indx = 0; |
| 6002 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6003 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6004 | 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] | 6005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6006 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6007 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6008 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6009 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6010 | /* Validate the channel */ |
| 6011 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6013 | if ( channel == rfChannels[count].channelNum ) |
| 6014 | { |
| 6015 | fValidChannel = TRUE; |
| 6016 | break; |
| 6017 | } |
| 6018 | } |
| 6019 | if (fValidChannel != TRUE) |
| 6020 | { |
| 6021 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6022 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6023 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6024 | } |
| 6025 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6026 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6027 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6028 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6029 | valid_ch, &num_ch)) |
| 6030 | { |
| 6031 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6032 | "%s: failed to get valid channel list", __func__); |
| 6033 | return VOS_STATUS_E_FAILURE; |
| 6034 | } |
| 6035 | for (indx = 0; indx < num_ch; indx++) |
| 6036 | { |
| 6037 | if (channel == valid_ch[indx]) |
| 6038 | { |
| 6039 | break; |
| 6040 | } |
| 6041 | } |
| 6042 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6043 | if (indx >= num_ch) |
| 6044 | { |
| 6045 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6046 | { |
| 6047 | eCsrBand band; |
| 6048 | unsigned int freq; |
| 6049 | |
| 6050 | sme_GetFreqBand(hHal, &band); |
| 6051 | |
| 6052 | if (eCSR_BAND_5G == band) |
| 6053 | { |
| 6054 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6055 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6056 | { |
| 6057 | freq = ieee80211_channel_to_frequency(channel, |
| 6058 | IEEE80211_BAND_2GHZ); |
| 6059 | } |
| 6060 | else |
| 6061 | { |
| 6062 | freq = ieee80211_channel_to_frequency(channel, |
| 6063 | IEEE80211_BAND_5GHZ); |
| 6064 | } |
| 6065 | #else |
| 6066 | freq = ieee80211_channel_to_frequency(channel); |
| 6067 | #endif |
| 6068 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6069 | return VOS_STATUS_SUCCESS; |
| 6070 | } |
| 6071 | } |
| 6072 | |
| 6073 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6074 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6075 | return VOS_STATUS_E_FAILURE; |
| 6076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6077 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6079 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6080 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6081 | } |
| 6082 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6083 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6084 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6085 | * This function is used to set the channel number |
| 6086 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6087 | static int __wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev, |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6088 | struct ieee80211_channel *chan, |
| 6089 | enum nl80211_channel_type channel_type |
| 6090 | ) |
| 6091 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6092 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6093 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6094 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6095 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6096 | hdd_context_t *pHddCtx; |
| 6097 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6098 | |
| 6099 | ENTER(); |
| 6100 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6101 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6102 | if( NULL == dev ) |
| 6103 | { |
| 6104 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6105 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6106 | return -ENODEV; |
| 6107 | } |
| 6108 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6109 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6110 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6111 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6112 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6113 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6114 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6115 | hdd_device_modetoString(pAdapter->device_mode), |
| 6116 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6117 | |
| 6118 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6119 | status = wlan_hdd_validate_context(pHddCtx); |
| 6120 | |
| 6121 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6122 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6123 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6124 | "%s: HDD context is not valid", __func__); |
| 6125 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6126 | } |
| 6127 | |
| 6128 | /* |
| 6129 | * Do freq to chan conversion |
| 6130 | * TODO: for 11a |
| 6131 | */ |
| 6132 | |
| 6133 | channel = ieee80211_frequency_to_channel(freq); |
| 6134 | |
| 6135 | /* Check freq range */ |
| 6136 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6137 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6138 | { |
| 6139 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6140 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6141 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6142 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6143 | return -EINVAL; |
| 6144 | } |
| 6145 | |
| 6146 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6147 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6148 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6149 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6150 | { |
| 6151 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6152 | { |
| 6153 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6154 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6155 | return -EINVAL; |
| 6156 | } |
| 6157 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6158 | "%s: set channel to [%d] for device mode =%d", |
| 6159 | __func__, channel,pAdapter->device_mode); |
| 6160 | } |
| 6161 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6162 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6163 | ) |
| 6164 | { |
| 6165 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6166 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6167 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6168 | |
| 6169 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6170 | { |
| 6171 | /* Link is up then return cant set channel*/ |
| 6172 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6173 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6174 | return -EINVAL; |
| 6175 | } |
| 6176 | |
| 6177 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6178 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6179 | pRoamProfile->ChannelInfo.ChannelList = |
| 6180 | &pHddStaCtx->conn_info.operationChannel; |
| 6181 | } |
| 6182 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6183 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6184 | ) |
| 6185 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6186 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6187 | { |
| 6188 | if(VOS_STATUS_SUCCESS != |
| 6189 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6190 | { |
| 6191 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6192 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6193 | return -EINVAL; |
| 6194 | } |
| 6195 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6196 | } |
| 6197 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6198 | { |
| 6199 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6200 | |
| 6201 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6202 | channel set by supplicant |
| 6203 | */ |
| 6204 | if ( cfg_param->apAutoChannelSelection ) |
| 6205 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6206 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6207 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6208 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6209 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6210 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6211 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6212 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6213 | else |
| 6214 | { |
| 6215 | if(VOS_STATUS_SUCCESS != |
| 6216 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6217 | { |
| 6218 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6219 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6220 | return -EINVAL; |
| 6221 | } |
| 6222 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6223 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6224 | } |
| 6225 | } |
| 6226 | else |
| 6227 | { |
| 6228 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6229 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6230 | return -EINVAL; |
| 6231 | } |
| 6232 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6233 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6234 | } |
| 6235 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6236 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6237 | struct net_device *dev, |
| 6238 | struct ieee80211_channel *chan, |
| 6239 | enum nl80211_channel_type channel_type |
| 6240 | ) |
| 6241 | { |
| 6242 | int ret; |
| 6243 | |
| 6244 | vos_ssr_protect(__func__); |
| 6245 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6246 | vos_ssr_unprotect(__func__); |
| 6247 | |
| 6248 | return ret; |
| 6249 | } |
| 6250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6251 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6252 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6253 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6254 | #else |
| 6255 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6256 | struct cfg80211_beacon_data *params, |
| 6257 | const u8 *ssid, size_t ssid_len, |
| 6258 | enum nl80211_hidden_ssid hidden_ssid) |
| 6259 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | { |
| 6261 | tsap_Config_t *pConfig; |
| 6262 | beacon_data_t *pBeacon = NULL; |
| 6263 | struct ieee80211_mgmt *pMgmt_frame; |
| 6264 | v_U8_t *pIe=NULL; |
| 6265 | v_U16_t capab_info; |
| 6266 | eCsrAuthType RSNAuthType; |
| 6267 | eCsrEncryptionType RSNEncryptType; |
| 6268 | eCsrEncryptionType mcRSNEncryptType; |
| 6269 | int status = VOS_STATUS_SUCCESS; |
| 6270 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6271 | hdd_hostapd_state_t *pHostapdState; |
| 6272 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6273 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6274 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6275 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6276 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6277 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6278 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6279 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6280 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6281 | v_BOOL_t MFPRequired = VOS_FALSE; |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 6282 | eHddDot11Mode sapDot11Mode = |
| 6283 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | |
| 6285 | ENTER(); |
| 6286 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6287 | iniConfig = pHddCtx->cfg_ini; |
| 6288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6289 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6290 | |
| 6291 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6292 | |
| 6293 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6294 | |
| 6295 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6296 | |
| 6297 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6298 | |
| 6299 | //channel is already set in the set_channel Call back |
| 6300 | //pConfig->channel = pCommitConfig->channel; |
| 6301 | |
| 6302 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6303 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6304 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6305 | |
| 6306 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6307 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6308 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6309 | pConfig->dtim_period); |
| 6310 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6311 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6312 | { |
| 6313 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6314 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6315 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6316 | { |
| 6317 | tANI_BOOLEAN restartNeeded; |
| 6318 | pConfig->ieee80211d = 1; |
| 6319 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6320 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6321 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6322 | } |
| 6323 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6324 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6325 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6326 | pConfig->ieee80211d = 1; |
| 6327 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6328 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6329 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6330 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6331 | else |
| 6332 | { |
| 6333 | pConfig->ieee80211d = 0; |
| 6334 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6335 | /* |
| 6336 | * If auto channel is configured i.e. channel is 0, |
| 6337 | * so skip channel validation. |
| 6338 | */ |
| 6339 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6340 | { |
| 6341 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6342 | { |
| 6343 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6344 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6345 | return -EINVAL; |
| 6346 | } |
| 6347 | } |
| 6348 | else |
| 6349 | { |
| 6350 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 6351 | { |
| 6352 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 6353 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 6354 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 6355 | } |
| 6356 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 6357 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6359 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | { |
| 6361 | pConfig->ieee80211d = 0; |
| 6362 | } |
| 6363 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 6364 | |
| 6365 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6366 | |
| 6367 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6368 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 6369 | |
| 6370 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 6371 | |
| 6372 | /*Set wps station to configured*/ |
| 6373 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 6374 | |
| 6375 | if(pIe) |
| 6376 | { |
| 6377 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 6378 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6379 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | return -EINVAL; |
| 6381 | } |
| 6382 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 6383 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6384 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 6386 | * WPS state |
| 6387 | */ |
| 6388 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 6389 | { |
| 6390 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 6391 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 6392 | { |
| 6393 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 6394 | } |
| 6395 | } |
| 6396 | } |
| 6397 | else |
| 6398 | { |
| 6399 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 6400 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6401 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 6403 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6404 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6405 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 6406 | eCSR_ENCRYPT_TYPE_NONE; |
| 6407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | pConfig->RSNWPAReqIELength = 0; |
| 6409 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6410 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6411 | WLAN_EID_RSN); |
| 6412 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6413 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6414 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6415 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6416 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6417 | /* The actual processing may eventually be more extensive than |
| 6418 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | * by the app. |
| 6420 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6421 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6422 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6423 | &RSNEncryptType, |
| 6424 | &mcRSNEncryptType, |
| 6425 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6426 | &MFPCapable, |
| 6427 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6428 | pConfig->pRSNWPAReqIE[1]+2, |
| 6429 | pConfig->pRSNWPAReqIE ); |
| 6430 | |
| 6431 | if( VOS_STATUS_SUCCESS == status ) |
| 6432 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6433 | /* Now copy over all the security attributes you have |
| 6434 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6435 | * */ |
| 6436 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6437 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6438 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6439 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6440 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6441 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6442 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6443 | } |
| 6444 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6446 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6447 | pBeacon->tail, pBeacon->tail_len); |
| 6448 | |
| 6449 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 6450 | { |
| 6451 | if (pConfig->pRSNWPAReqIE) |
| 6452 | { |
| 6453 | /*Mixed mode WPA/WPA2*/ |
| 6454 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 6455 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 6456 | } |
| 6457 | else |
| 6458 | { |
| 6459 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6460 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6461 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6462 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6463 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6464 | &RSNEncryptType, |
| 6465 | &mcRSNEncryptType, |
| 6466 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6467 | &MFPCapable, |
| 6468 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6469 | pConfig->pRSNWPAReqIE[1]+2, |
| 6470 | pConfig->pRSNWPAReqIE ); |
| 6471 | |
| 6472 | if( VOS_STATUS_SUCCESS == status ) |
| 6473 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6474 | /* Now copy over all the security attributes you have |
| 6475 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6476 | * */ |
| 6477 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6478 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6479 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6480 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6481 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6482 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6483 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6484 | } |
| 6485 | } |
| 6486 | } |
| 6487 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6488 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 6489 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 6490 | return -EINVAL; |
| 6491 | } |
| 6492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6493 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 6494 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6495 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6496 | if (params->ssid != NULL) |
| 6497 | { |
| 6498 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 6499 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 6500 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6501 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6502 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6503 | #else |
| 6504 | if (ssid != NULL) |
| 6505 | { |
| 6506 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 6507 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 6508 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6509 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6510 | } |
| 6511 | #endif |
| 6512 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6513 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6516 | /* default value */ |
| 6517 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 6518 | pConfig->num_accept_mac = 0; |
| 6519 | pConfig->num_deny_mac = 0; |
| 6520 | |
| 6521 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6522 | pBeacon->tail, pBeacon->tail_len); |
| 6523 | |
| 6524 | /* pIe for black list is following form: |
| 6525 | type : 1 byte |
| 6526 | length : 1 byte |
| 6527 | OUI : 4 bytes |
| 6528 | acl type : 1 byte |
| 6529 | no of mac addr in black list: 1 byte |
| 6530 | 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] | 6531 | */ |
| 6532 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6533 | { |
| 6534 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6535 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6536 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6537 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6538 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 6539 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6540 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6541 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 6542 | { |
| 6543 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6544 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6546 | } |
| 6547 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6548 | pBeacon->tail, pBeacon->tail_len); |
| 6549 | |
| 6550 | /* pIe for white list is following form: |
| 6551 | type : 1 byte |
| 6552 | length : 1 byte |
| 6553 | OUI : 4 bytes |
| 6554 | acl type : 1 byte |
| 6555 | no of mac addr in white list: 1 byte |
| 6556 | 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] | 6557 | */ |
| 6558 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6559 | { |
| 6560 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6561 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6562 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6563 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6564 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 6565 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6566 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6567 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 6568 | { |
| 6569 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6570 | acl_entry++; |
| 6571 | } |
| 6572 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6574 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 6575 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6576 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6577 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 6578 | * This is valid only if mode is set to 11n in hostapd, either AUTO or |
| 6579 | * 11ac in .ini and 11ac is supported by both host and firmware. |
| 6580 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 6581 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6582 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 6583 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Abhishek Singh | f0ac175 | 2014-03-05 17:47:09 +0530 | [diff] [blame] | 6584 | (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) || |
| 6585 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) || |
| 6586 | ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) && |
| 6587 | (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 6588 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6589 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6590 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6591 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6592 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6593 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6594 | /* If ACS disable and selected channel <= 14 |
| 6595 | * OR |
| 6596 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 6597 | * AND |
| 6598 | * VHT in 2.4G Disabled |
| 6599 | * THEN |
| 6600 | * Fallback to 11N mode |
| 6601 | */ |
| 6602 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 6603 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 6604 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6605 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6606 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6607 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 6608 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6609 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 6610 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6611 | } |
| 6612 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6614 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 6615 | pConfig->ht_capab = |
| 6616 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 6617 | |
| 6618 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 6619 | { |
| 6620 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 6621 | return -EINVAL; |
| 6622 | } |
| 6623 | |
| 6624 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6625 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 6627 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6628 | pConfig->obssProtEnabled = |
| 6629 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6631 | #ifdef WLAN_FEATURE_11W |
| 6632 | pConfig->mfpCapable = MFPCapable; |
| 6633 | pConfig->mfpRequired = MFPRequired; |
| 6634 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 6635 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 6636 | #endif |
| 6637 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6638 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6639 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6640 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 6641 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 6642 | (int)pConfig->channel); |
| 6643 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 6644 | pConfig->SapHw_mode, pConfig->privacy, |
| 6645 | pConfig->authType); |
| 6646 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 6647 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 6648 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 6649 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6651 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6652 | { |
| 6653 | //Bss already started. just return. |
| 6654 | //TODO Probably it should update some beacon params. |
| 6655 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 6656 | EXIT(); |
| 6657 | return 0; |
| 6658 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6659 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6660 | if (vos_max_concurrent_connections_reached()) { |
| 6661 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6662 | return -EINVAL; |
| 6663 | } |
| 6664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | pConfig->persona = pHostapdAdapter->device_mode; |
| 6666 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6667 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 6668 | if ( NULL != psmeConfig) |
| 6669 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 6670 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6671 | sme_GetConfigParam(hHal, psmeConfig); |
| 6672 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 6673 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 6674 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 6675 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 6676 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 6677 | { |
| 6678 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 6679 | sme_UpdateConfig (hHal, psmeConfig); |
| 6680 | } |
| 6681 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6682 | vos_mem_free(psmeConfig); |
| 6683 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 6684 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6686 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 6687 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 6688 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 6689 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6690 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6691 | return -EINVAL; |
| 6692 | } |
| 6693 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6694 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6695 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 6696 | |
| 6697 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6698 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6699 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6700 | { |
| 6701 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6702 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 6703 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | VOS_ASSERT(0); |
| 6705 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6707 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 6708 | /* Initialize WMM configuation */ |
| 6709 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6710 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6711 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6712 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 6713 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 6714 | { |
| 6715 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 6716 | { |
| 6717 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6718 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6719 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6720 | } |
| 6721 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 6722 | { |
| 6723 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 6724 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 6725 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 6726 | } |
| 6727 | } |
| 6728 | #endif |
| 6729 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | pHostapdState->bCommit = TRUE; |
| 6731 | EXIT(); |
| 6732 | |
| 6733 | return 0; |
| 6734 | } |
| 6735 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6736 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 6737 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6738 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6739 | struct beacon_parameters *params) |
| 6740 | { |
| 6741 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6742 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6743 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6744 | |
| 6745 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6746 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6747 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6748 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 6749 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6750 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 6751 | hdd_device_modetoString(pAdapter->device_mode), |
| 6752 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6753 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6754 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6755 | status = wlan_hdd_validate_context(pHddCtx); |
| 6756 | |
| 6757 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6758 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6759 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6760 | "%s: HDD context is not valid", __func__); |
| 6761 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6762 | } |
| 6763 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6764 | if (vos_max_concurrent_connections_reached()) { |
| 6765 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 6766 | return -EINVAL; |
| 6767 | } |
| 6768 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6769 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6770 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6771 | ) |
| 6772 | { |
| 6773 | beacon_data_t *old,*new; |
| 6774 | |
| 6775 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6777 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6778 | { |
| 6779 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 6780 | FL("already beacon info added to session(%d)"), |
| 6781 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6782 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6784 | |
| 6785 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6786 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6787 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6788 | { |
| 6789 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6790 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6791 | return -EINVAL; |
| 6792 | } |
| 6793 | |
| 6794 | pAdapter->sessionCtx.ap.beacon = new; |
| 6795 | |
| 6796 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6797 | } |
| 6798 | |
| 6799 | EXIT(); |
| 6800 | return status; |
| 6801 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6802 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 6803 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 6804 | struct net_device *dev, |
| 6805 | struct beacon_parameters *params) |
| 6806 | { |
| 6807 | int ret; |
| 6808 | |
| 6809 | vos_ssr_protect(__func__); |
| 6810 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 6811 | vos_ssr_unprotect(__func__); |
| 6812 | |
| 6813 | return ret; |
| 6814 | } |
| 6815 | |
| 6816 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6817 | struct net_device *dev, |
| 6818 | struct beacon_parameters *params) |
| 6819 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6820 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6821 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6822 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6823 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6824 | |
| 6825 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6826 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6827 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 6828 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 6829 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6830 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6831 | pAdapter->device_mode); |
| 6832 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6833 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6834 | status = wlan_hdd_validate_context(pHddCtx); |
| 6835 | |
| 6836 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6837 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6838 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6839 | "%s: HDD context is not valid", __func__); |
| 6840 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6841 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6842 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6843 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6844 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6845 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6846 | { |
| 6847 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6848 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6849 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6851 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6852 | { |
| 6853 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6854 | FL("session(%d) old and new heads points to NULL"), |
| 6855 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6856 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6858 | |
| 6859 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 6860 | |
| 6861 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6862 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6863 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6864 | return -EINVAL; |
| 6865 | } |
| 6866 | |
| 6867 | pAdapter->sessionCtx.ap.beacon = new; |
| 6868 | |
| 6869 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 6870 | } |
| 6871 | |
| 6872 | EXIT(); |
| 6873 | return status; |
| 6874 | } |
| 6875 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 6876 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 6877 | struct net_device *dev, |
| 6878 | struct beacon_parameters *params) |
| 6879 | { |
| 6880 | int ret; |
| 6881 | |
| 6882 | vos_ssr_protect(__func__); |
| 6883 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 6884 | vos_ssr_unprotect(__func__); |
| 6885 | |
| 6886 | return ret; |
| 6887 | } |
| 6888 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6889 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6890 | |
| 6891 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 6892 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6893 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6894 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 6895 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6896 | struct net_device *dev) |
| 6897 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6898 | { |
| 6899 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6900 | hdd_context_t *pHddCtx = NULL; |
| 6901 | hdd_scaninfo_t *pScanInfo = NULL; |
| 6902 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6903 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6904 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6905 | |
| 6906 | ENTER(); |
| 6907 | |
| 6908 | if (NULL == pAdapter) |
| 6909 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6910 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6911 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6912 | return -ENODEV; |
| 6913 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6914 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6915 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6916 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 6917 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6918 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6919 | status = wlan_hdd_validate_context(pHddCtx); |
| 6920 | |
| 6921 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6922 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6923 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6924 | "%s: HDD context is not valid", __func__); |
| 6925 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6926 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6927 | |
| 6928 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 6929 | if (NULL == staAdapter) |
| 6930 | { |
| 6931 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 6932 | if (NULL == staAdapter) |
| 6933 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 6934 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6935 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 6936 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 6937 | } |
| 6938 | } |
| 6939 | |
| 6940 | pScanInfo = &pHddCtx->scan_info; |
| 6941 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6942 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 6943 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6944 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6945 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6946 | ret = wlan_hdd_scan_abort(pAdapter); |
| 6947 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 6948 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6949 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6950 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6951 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6952 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6953 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6954 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6956 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 6957 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6958 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6959 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6960 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 6961 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6962 | } |
| 6963 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 6964 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 6965 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 6966 | hdd_hostapd_stop(dev); |
| 6967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6968 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6969 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6970 | ) |
| 6971 | { |
| 6972 | beacon_data_t *old; |
| 6973 | |
| 6974 | old = pAdapter->sessionCtx.ap.beacon; |
| 6975 | |
| 6976 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6977 | { |
| 6978 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6979 | FL("session(%d) beacon data points to NULL"), |
| 6980 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6982 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6984 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6985 | |
| 6986 | mutex_lock(&pHddCtx->sap_lock); |
| 6987 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 6988 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6989 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | { |
| 6991 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 6992 | |
| 6993 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 6994 | |
| 6995 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 6996 | { |
| 6997 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6998 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6999 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7000 | } |
| 7001 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7002 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7003 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7004 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7005 | } |
| 7006 | mutex_unlock(&pHddCtx->sap_lock); |
| 7007 | |
| 7008 | if(status != VOS_STATUS_SUCCESS) |
| 7009 | { |
| 7010 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7011 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7012 | return -EINVAL; |
| 7013 | } |
| 7014 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7015 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7016 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7017 | ==eHAL_STATUS_FAILURE) |
| 7018 | { |
| 7019 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7020 | "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] | 7021 | } |
| 7022 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7023 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7024 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7025 | eANI_BOOLEAN_FALSE) ) |
| 7026 | { |
| 7027 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7028 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | } |
| 7030 | |
| 7031 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7032 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7033 | |
| 7034 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7035 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7036 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7037 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7038 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7039 | { |
| 7040 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7041 | "GO got removed"); |
| 7042 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7043 | } |
| 7044 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | } |
| 7046 | EXIT(); |
| 7047 | return status; |
| 7048 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7049 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7050 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7051 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7052 | struct net_device *dev) |
| 7053 | { |
| 7054 | int ret; |
| 7055 | |
| 7056 | vos_ssr_protect(__func__); |
| 7057 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7058 | vos_ssr_unprotect(__func__); |
| 7059 | |
| 7060 | return ret; |
| 7061 | } |
| 7062 | #else |
| 7063 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7064 | struct net_device *dev) |
| 7065 | { |
| 7066 | int ret; |
| 7067 | |
| 7068 | vos_ssr_protect(__func__); |
| 7069 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7070 | vos_ssr_unprotect(__func__); |
| 7071 | |
| 7072 | return ret; |
| 7073 | } |
| 7074 | #endif |
| 7075 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7076 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7077 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7078 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7079 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7080 | struct cfg80211_ap_settings *params) |
| 7081 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7082 | hdd_adapter_t *pAdapter; |
| 7083 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7084 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7085 | |
| 7086 | ENTER(); |
| 7087 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7088 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7089 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7090 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7091 | "%s: Device is Null", __func__); |
| 7092 | return -ENODEV; |
| 7093 | } |
| 7094 | |
| 7095 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7096 | if (NULL == pAdapter) |
| 7097 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7098 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7099 | "%s: HDD adapter is Null", __func__); |
| 7100 | return -ENODEV; |
| 7101 | } |
| 7102 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7103 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7104 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7105 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7106 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7107 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7108 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7109 | "%s: HDD adapter magic is invalid", __func__); |
| 7110 | return -ENODEV; |
| 7111 | } |
| 7112 | |
| 7113 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7114 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7115 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7116 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7117 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7118 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7119 | "%s: HDD context is not valid", __func__); |
| 7120 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7121 | } |
| 7122 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7123 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7124 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7125 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7126 | |
| 7127 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7128 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7129 | ) |
| 7130 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7131 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7132 | |
| 7133 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7134 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7135 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7136 | { |
| 7137 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7138 | FL("already beacon info added to session(%d)"), |
| 7139 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7140 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7141 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7142 | |
| 7143 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 7144 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7145 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7146 | { |
| 7147 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7148 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7149 | return -EINVAL; |
| 7150 | } |
| 7151 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7152 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7153 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7154 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7155 | params->channel, params->channel_type); |
| 7156 | #else |
| 7157 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7158 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7159 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7160 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 7161 | params->ssid_len, params->hidden_ssid); |
| 7162 | } |
| 7163 | |
| 7164 | EXIT(); |
| 7165 | return status; |
| 7166 | } |
| 7167 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7168 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7169 | struct net_device *dev, |
| 7170 | struct cfg80211_ap_settings *params) |
| 7171 | { |
| 7172 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7173 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7174 | vos_ssr_protect(__func__); |
| 7175 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7176 | vos_ssr_unprotect(__func__); |
| 7177 | |
| 7178 | return ret; |
| 7179 | } |
| 7180 | |
| 7181 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7182 | struct net_device *dev, |
| 7183 | struct cfg80211_beacon_data *params) |
| 7184 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7185 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7186 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7187 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7188 | |
| 7189 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7190 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7191 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7192 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7193 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7194 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7195 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7196 | |
| 7197 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7198 | status = wlan_hdd_validate_context(pHddCtx); |
| 7199 | |
| 7200 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7201 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7202 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7203 | "%s: HDD context is not valid", __func__); |
| 7204 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7205 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7206 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7207 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7208 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7209 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7210 | { |
| 7211 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7212 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7213 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7214 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7215 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7216 | { |
| 7217 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7218 | FL("session(%d) beacon data points to NULL"), |
| 7219 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7220 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7221 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7222 | |
| 7223 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7224 | |
| 7225 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7226 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7227 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7228 | return -EINVAL; |
| 7229 | } |
| 7230 | |
| 7231 | pAdapter->sessionCtx.ap.beacon = new; |
| 7232 | |
| 7233 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 7234 | } |
| 7235 | |
| 7236 | EXIT(); |
| 7237 | return status; |
| 7238 | } |
| 7239 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7240 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7241 | struct net_device *dev, |
| 7242 | struct cfg80211_beacon_data *params) |
| 7243 | { |
| 7244 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7245 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7246 | vos_ssr_protect(__func__); |
| 7247 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7248 | vos_ssr_unprotect(__func__); |
| 7249 | |
| 7250 | return ret; |
| 7251 | } |
| 7252 | |
| 7253 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7254 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7255 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7256 | struct net_device *dev, |
| 7257 | struct bss_parameters *params) |
| 7258 | { |
| 7259 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7260 | |
| 7261 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7262 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7263 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7264 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7265 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7266 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7267 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7268 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7269 | |
| 7270 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7271 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7272 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7273 | { |
| 7274 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7275 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7276 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7277 | { |
| 7278 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7280 | } |
| 7281 | |
| 7282 | EXIT(); |
| 7283 | return 0; |
| 7284 | } |
| 7285 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7286 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7287 | struct net_device *dev, |
| 7288 | struct bss_parameters *params) |
| 7289 | { |
| 7290 | int ret; |
| 7291 | |
| 7292 | vos_ssr_protect(__func__); |
| 7293 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7294 | vos_ssr_unprotect(__func__); |
| 7295 | |
| 7296 | return ret; |
| 7297 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7298 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7299 | * to wait for contry code completion |
| 7300 | */ |
| 7301 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7302 | { |
| 7303 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7304 | complete(&call_back_pAdapter->change_country_code); |
| 7305 | return NULL; |
| 7306 | } |
| 7307 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7308 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7309 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7310 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7311 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7312 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7313 | struct net_device *ndev, |
| 7314 | enum nl80211_iftype type, |
| 7315 | u32 *flags, |
| 7316 | struct vif_params *params |
| 7317 | ) |
| 7318 | { |
| 7319 | struct wireless_dev *wdev; |
| 7320 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7321 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7322 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7323 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7324 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7325 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | eMib_dot11DesiredBssType connectedBssType; |
| 7327 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7328 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7329 | |
| 7330 | ENTER(); |
| 7331 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7332 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7333 | { |
| 7334 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7335 | "%s: Adapter context is null", __func__); |
| 7336 | return VOS_STATUS_E_FAILURE; |
| 7337 | } |
| 7338 | |
| 7339 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7340 | if (!pHddCtx) |
| 7341 | { |
| 7342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7343 | "%s: HDD context is null", __func__); |
| 7344 | return VOS_STATUS_E_FAILURE; |
| 7345 | } |
| 7346 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7347 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7348 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 7349 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7350 | status = wlan_hdd_validate_context(pHddCtx); |
| 7351 | |
| 7352 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7353 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7354 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7355 | "%s: HDD context is not valid", __func__); |
| 7356 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7357 | } |
| 7358 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7359 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7360 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7361 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7362 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7363 | if (vos_max_concurrent_connections_reached()) { |
| 7364 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7365 | return -EINVAL; |
| 7366 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7367 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7368 | wdev = ndev->ieee80211_ptr; |
| 7369 | |
| 7370 | #ifdef WLAN_BTAMP_FEATURE |
| 7371 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 7372 | (NL80211_IFTYPE_ADHOC == type)|| |
| 7373 | (NL80211_IFTYPE_AP == type)|| |
| 7374 | (NL80211_IFTYPE_P2P_GO == type)) |
| 7375 | { |
| 7376 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 7377 | // stop AMP traffic |
| 7378 | status = WLANBAP_StopAmp(); |
| 7379 | if(VOS_STATUS_SUCCESS != status ) |
| 7380 | { |
| 7381 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7382 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7383 | "%s: Failed to stop AMP", __func__); |
| 7384 | return -EINVAL; |
| 7385 | } |
| 7386 | } |
| 7387 | #endif //WLAN_BTAMP_FEATURE |
| 7388 | /* Reset the current device mode bit mask*/ |
| 7389 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 7390 | |
| 7391 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7392 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7393 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7394 | ) |
| 7395 | { |
| 7396 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7397 | if (!pWextState) |
| 7398 | { |
| 7399 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7400 | "%s: pWextState is null", __func__); |
| 7401 | return VOS_STATUS_E_FAILURE; |
| 7402 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7403 | pRoamProfile = &pWextState->roamProfile; |
| 7404 | LastBSSType = pRoamProfile->BSSType; |
| 7405 | |
| 7406 | switch (type) |
| 7407 | { |
| 7408 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7409 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7410 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7411 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 7412 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7413 | #ifdef WLAN_FEATURE_11AC |
| 7414 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 7415 | { |
| 7416 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 7417 | } |
| 7418 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7419 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7420 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7421 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7422 | //Check for sub-string p2p to confirm its a p2p interface |
| 7423 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7424 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7425 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7426 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7427 | } |
| 7428 | else |
| 7429 | { |
| 7430 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7431 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7433 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 7434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | case NL80211_IFTYPE_ADHOC: |
| 7436 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7437 | "%s: setting interface Type to ADHOC", __func__); |
| 7438 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 7439 | pRoamProfile->phyMode = |
| 7440 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 7441 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7442 | wdev->iftype = type; |
| 7443 | break; |
| 7444 | |
| 7445 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7446 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7447 | { |
| 7448 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 7449 | "%s: setting interface Type to %s", __func__, |
| 7450 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 7451 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7452 | //Cancel any remain on channel for GO mode |
| 7453 | if (NL80211_IFTYPE_P2P_GO == type) |
| 7454 | { |
| 7455 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 7456 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7457 | if (NL80211_IFTYPE_AP == type) |
| 7458 | { |
| 7459 | /* As Loading WLAN Driver one interface being created for p2p device |
| 7460 | * address. This will take one HW STA and the max number of clients |
| 7461 | * that can connect to softAP will be reduced by one. so while changing |
| 7462 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 7463 | * interface as it is not required in SoftAP mode. |
| 7464 | */ |
| 7465 | |
| 7466 | // Get P2P Adapter |
| 7467 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 7468 | |
| 7469 | if (pP2pAdapter) |
| 7470 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 7471 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7472 | hdd_deinit_adapter(pHddCtx, pP2pAdapter); |
| 7473 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 7474 | } |
| 7475 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 7476 | //Disable IMPS & BMPS for SAP/GO |
| 7477 | if(VOS_STATUS_E_FAILURE == |
| 7478 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 7479 | { |
| 7480 | //Fail to Exit BMPS |
| 7481 | VOS_ASSERT(0); |
| 7482 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7483 | |
| 7484 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 7485 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7486 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7487 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7488 | /* A Mutex Lock is introduced while changing the mode to |
| 7489 | * protect the concurrent access for the Adapters by TDLS |
| 7490 | * module. |
| 7491 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7492 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7493 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7494 | //De-init the adapter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7495 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
| 7496 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7497 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7498 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7499 | #ifdef FEATURE_WLAN_TDLS |
| 7500 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7501 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7502 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 7503 | (pConfig->apRandomBssidEnabled)) |
| 7504 | { |
| 7505 | /* To meet Android requirements create a randomized |
| 7506 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 7507 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 7508 | ndev->dev_addr[0] = 0x02; |
| 7509 | ndev->dev_addr[1] = 0x1A; |
| 7510 | ndev->dev_addr[2] = 0x11; |
| 7511 | ndev->dev_addr[3] |= 0xF0; |
| 7512 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 7513 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7514 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 7515 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7516 | } |
| 7517 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7518 | hdd_set_ap_ops( pAdapter->dev ); |
| 7519 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7520 | /* This is for only SAP mode where users can |
| 7521 | * control country through ini. |
| 7522 | * P2P GO follows station country code |
| 7523 | * acquired during the STA scanning. */ |
| 7524 | if((NL80211_IFTYPE_AP == type) && |
| 7525 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 7526 | { |
| 7527 | int status = 0; |
| 7528 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 7529 | "%s: setting country code from INI ", __func__); |
| 7530 | init_completion(&pAdapter->change_country_code); |
| 7531 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 7532 | (void *)(tSmeChangeCountryCallback) |
| 7533 | wlan_hdd_change_country_code_cb, |
| 7534 | pConfig->apCntryCode, pAdapter, |
| 7535 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 7536 | eSIR_FALSE, |
| 7537 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7538 | if (eHAL_STATUS_SUCCESS == status) |
| 7539 | { |
| 7540 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7541 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7542 | &pAdapter->change_country_code, |
| 7543 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7544 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7545 | { |
| 7546 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7547 | FL("SME Timed out while setting country code %ld"), |
| 7548 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7549 | |
| 7550 | if (pHddCtx->isLogpInProgress) |
| 7551 | { |
| 7552 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7553 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 7554 | return -EAGAIN; |
| 7555 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7556 | } |
| 7557 | } |
| 7558 | else |
| 7559 | { |
| 7560 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7561 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7562 | return -EINVAL; |
| 7563 | } |
| 7564 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7565 | status = hdd_init_ap_mode(pAdapter); |
| 7566 | if(status != VOS_STATUS_SUCCESS) |
| 7567 | { |
| 7568 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7569 | "%s: Error initializing the ap mode", __func__); |
| 7570 | return -EINVAL; |
| 7571 | } |
| 7572 | hdd_set_conparam(1); |
| 7573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7574 | /*interface type changed update in wiphy structure*/ |
| 7575 | if(wdev) |
| 7576 | { |
| 7577 | wdev->iftype = type; |
| 7578 | pHddCtx->change_iface = type; |
| 7579 | } |
| 7580 | else |
| 7581 | { |
| 7582 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7583 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 7584 | return -EINVAL; |
| 7585 | } |
| 7586 | goto done; |
| 7587 | } |
| 7588 | |
| 7589 | default: |
| 7590 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7591 | __func__); |
| 7592 | return -EOPNOTSUPP; |
| 7593 | } |
| 7594 | } |
| 7595 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7596 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7597 | ) |
| 7598 | { |
| 7599 | switch(type) |
| 7600 | { |
| 7601 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7602 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7603 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7604 | |
| 7605 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7606 | #ifdef FEATURE_WLAN_TDLS |
| 7607 | |
| 7608 | /* A Mutex Lock is introduced while changing the mode to |
| 7609 | * protect the concurrent access for the Adapters by TDLS |
| 7610 | * module. |
| 7611 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7612 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7613 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7614 | hdd_deinit_adapter( pHddCtx, pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7615 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7616 | //Check for sub-string p2p to confirm its a p2p interface |
| 7617 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7618 | { |
| 7619 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7620 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7621 | } |
| 7622 | else |
| 7623 | { |
| 7624 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7625 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7627 | hdd_set_conparam(0); |
| 7628 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7629 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 7630 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7631 | #ifdef FEATURE_WLAN_TDLS |
| 7632 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7633 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 7634 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7635 | if( VOS_STATUS_SUCCESS != status ) |
| 7636 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7637 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 7638 | * This is the right place to enable back bmps_imps() |
| 7639 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 7640 | if (pHddCtx->hdd_wlan_suspended) |
| 7641 | { |
| 7642 | hdd_set_pwrparams(pHddCtx); |
| 7643 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7644 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7645 | goto done; |
| 7646 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7647 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7648 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7649 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7650 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7651 | goto done; |
| 7652 | default: |
| 7653 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7654 | __func__); |
| 7655 | return -EOPNOTSUPP; |
| 7656 | |
| 7657 | } |
| 7658 | |
| 7659 | } |
| 7660 | else |
| 7661 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7662 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 7663 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7664 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7665 | return -EOPNOTSUPP; |
| 7666 | } |
| 7667 | |
| 7668 | |
| 7669 | if(pRoamProfile) |
| 7670 | { |
| 7671 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 7672 | { |
| 7673 | /*interface type changed update in wiphy structure*/ |
| 7674 | wdev->iftype = type; |
| 7675 | |
| 7676 | /*the BSS mode changed, We need to issue disconnect |
| 7677 | if connected or in IBSS disconnect state*/ |
| 7678 | if ( hdd_connGetConnectedBssType( |
| 7679 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 7680 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 7681 | { |
| 7682 | /*need to issue a disconnect to CSR.*/ |
| 7683 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7684 | if( eHAL_STATUS_SUCCESS == |
| 7685 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7686 | pAdapter->sessionId, |
| 7687 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 7688 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7689 | ret = wait_for_completion_interruptible_timeout( |
| 7690 | &pAdapter->disconnect_comp_var, |
| 7691 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 7692 | if (ret <= 0) |
| 7693 | { |
| 7694 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7695 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 7696 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7697 | } |
| 7698 | } |
| 7699 | } |
| 7700 | } |
| 7701 | |
| 7702 | done: |
| 7703 | /*set bitmask based on updated value*/ |
| 7704 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 7705 | |
| 7706 | /* Only STA mode support TM now |
| 7707 | * all other mode, TM feature should be disabled */ |
| 7708 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 7709 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 7710 | { |
| 7711 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 7712 | } |
| 7713 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7714 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7715 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7716 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7717 | { |
| 7718 | //we are ok to do AMP |
| 7719 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7720 | } |
| 7721 | #endif //WLAN_BTAMP_FEATURE |
| 7722 | EXIT(); |
| 7723 | return 0; |
| 7724 | } |
| 7725 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7726 | /* |
| 7727 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 7728 | * wrapper function to protect the actual implementation from SSR. |
| 7729 | */ |
| 7730 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 7731 | struct net_device *ndev, |
| 7732 | enum nl80211_iftype type, |
| 7733 | u32 *flags, |
| 7734 | struct vif_params *params |
| 7735 | ) |
| 7736 | { |
| 7737 | int ret; |
| 7738 | |
| 7739 | vos_ssr_protect(__func__); |
| 7740 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 7741 | vos_ssr_unprotect(__func__); |
| 7742 | |
| 7743 | return ret; |
| 7744 | } |
| 7745 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7746 | #ifdef FEATURE_WLAN_TDLS |
| 7747 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 7748 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 7749 | { |
| 7750 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7751 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7752 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7753 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7754 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7755 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7756 | |
| 7757 | ENTER(); |
| 7758 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7759 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7760 | { |
| 7761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7762 | "Invalid arguments"); |
| 7763 | return -EINVAL; |
| 7764 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 7765 | |
| 7766 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 7767 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 7768 | { |
| 7769 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7770 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 7771 | MAC_ADDRESS_STR " Request declined.", |
| 7772 | __func__, MAC_ADDR_ARRAY(mac)); |
| 7773 | return -ENOTSUPP; |
| 7774 | } |
| 7775 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7776 | if (pHddCtx->isLogpInProgress) |
| 7777 | { |
| 7778 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7779 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7780 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7781 | mac, |
| 7782 | eTDLS_LINK_IDLE, |
| 7783 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7784 | return -EBUSY; |
| 7785 | } |
| 7786 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 7787 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7788 | |
| 7789 | if ( NULL == pTdlsPeer ) { |
| 7790 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7791 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 7792 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 7793 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7794 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7795 | |
| 7796 | /* in add station, we accept existing valid staId if there is */ |
| 7797 | if ((0 == update) && |
| 7798 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 7799 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7800 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7801 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7802 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7803 | " link_status %d. staId %d. add station ignored.", |
| 7804 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 7805 | return 0; |
| 7806 | } |
| 7807 | /* in change station, we accept only when staId is valid */ |
| 7808 | if ((1 == update) && |
| 7809 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 7810 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 7811 | { |
| 7812 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7813 | "%s: " MAC_ADDRESS_STR |
| 7814 | " link status %d. staId %d. change station %s.", |
| 7815 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 7816 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 7817 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7818 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7819 | |
| 7820 | /* 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] | 7821 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7822 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7823 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7824 | "%s: " MAC_ADDRESS_STR |
| 7825 | " TDLS setup is ongoing. Request declined.", |
| 7826 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7827 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7828 | } |
| 7829 | |
| 7830 | /* first to check if we reached to maximum supported TDLS peer. |
| 7831 | TODO: for now, return -EPERM looks working fine, |
| 7832 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7833 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 7834 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7835 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7836 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7837 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7838 | " TDLS Max peer already connected. Request declined." |
| 7839 | " Num of peers (%d), Max allowed (%d).", |
| 7840 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 7841 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7842 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7843 | } |
| 7844 | else |
| 7845 | { |
| 7846 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7847 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7848 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7849 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7850 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7851 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 7852 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7853 | return -EPERM; |
| 7854 | } |
| 7855 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7856 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7857 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7858 | mac, |
| 7859 | eTDLS_LINK_CONNECTING, |
| 7860 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7861 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7862 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7863 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7864 | { |
| 7865 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7866 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7867 | if(StaParams->htcap_present) |
| 7868 | { |
| 7869 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7870 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 7871 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7872 | "ht_capa->extended_capabilities: %0x", |
| 7873 | StaParams->HTCap.extendedHtCapInfo); |
| 7874 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7875 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7876 | "params->capability: %0x",StaParams->capability); |
| 7877 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7878 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 7879 | if(StaParams->vhtcap_present) |
| 7880 | { |
| 7881 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7882 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 7883 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 7884 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 7885 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7886 | { |
| 7887 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 7888 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 7889 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 7890 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 7891 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 7892 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 7893 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 7894 | else if ((1 == update) && (NULL == StaParams)) |
| 7895 | { |
| 7896 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7897 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 7898 | return -EPERM; |
| 7899 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7900 | |
| 7901 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 7902 | |
| 7903 | if (!update) |
| 7904 | { |
| 7905 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7906 | pAdapter->sessionId, mac); |
| 7907 | } |
| 7908 | else |
| 7909 | { |
| 7910 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7911 | pAdapter->sessionId, mac, StaParams); |
| 7912 | } |
| 7913 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7914 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7915 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 7916 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7917 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7918 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7919 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7920 | "%s: timeout waiting for tdls add station indication %ld", |
| 7921 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7922 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7923 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7924 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7925 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 7926 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 7927 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7928 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 7929 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7930 | } |
| 7931 | |
| 7932 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7933 | |
| 7934 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7935 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 7936 | mac, |
| 7937 | eTDLS_LINK_IDLE, |
| 7938 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 7939 | return -EPERM; |
| 7940 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7941 | } |
| 7942 | #endif |
| 7943 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 7944 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7945 | struct net_device *dev, |
| 7946 | u8 *mac, |
| 7947 | struct station_parameters *params) |
| 7948 | { |
| 7949 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 7950 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7951 | hdd_context_t *pHddCtx; |
| 7952 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7953 | v_MACADDR_t STAMacAddress; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7954 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7955 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7956 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 7957 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 7958 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7959 | ENTER(); |
| 7960 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7961 | if ((NULL == pAdapter)) |
| 7962 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7963 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7964 | "invalid adapter "); |
| 7965 | return -EINVAL; |
| 7966 | } |
| 7967 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7968 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7969 | TRACE_CODE_HDD_CHANGE_STATION, |
| 7970 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7971 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7972 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7973 | |
| 7974 | if ((NULL == pHddCtx) || (NULL == pHddStaCtx)) |
| 7975 | { |
| 7976 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7977 | "invalid HDD state or HDD station context"); |
| 7978 | return -EINVAL; |
| 7979 | } |
| 7980 | |
| 7981 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7982 | { |
| 7983 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7984 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 7985 | return -EAGAIN; |
| 7986 | } |
| 7987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7988 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 7989 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7990 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7991 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7992 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7993 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7994 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7995 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7996 | WLANTL_STA_AUTHENTICATED); |
| 7997 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 7998 | if (status != VOS_STATUS_SUCCESS) |
| 7999 | { |
| 8000 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8001 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8002 | return -EINVAL; |
| 8003 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8004 | } |
| 8005 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8006 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8007 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8008 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8009 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8010 | StaParams.capability = params->capability; |
| 8011 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8012 | StaParams.max_sp = params->max_sp; |
| 8013 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8014 | /* Convert (first channel , number of channels) tuple to |
| 8015 | * the total list of channels. This goes with the assumption |
| 8016 | * that if the first channel is < 14, then the next channels |
| 8017 | * are an incremental of 1 else an incremental of 4 till the number |
| 8018 | * of channels. |
| 8019 | */ |
| 8020 | if (0 != params->supported_channels_len) { |
| 8021 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8022 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8023 | { |
| 8024 | int wifi_chan_index; |
| 8025 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8026 | wifi_chan_index = |
| 8027 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8028 | no_of_channels = params->supported_channels[i+1]; |
| 8029 | for(k=1; k <= no_of_channels; k++) |
| 8030 | { |
| 8031 | StaParams.supported_channels[j+1] = |
| 8032 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8033 | j+=1; |
| 8034 | } |
| 8035 | } |
| 8036 | StaParams.supported_channels_len = j; |
| 8037 | } |
| 8038 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8039 | params->supported_oper_classes, |
| 8040 | params->supported_oper_classes_len); |
| 8041 | StaParams.supported_oper_classes_len = |
| 8042 | params->supported_oper_classes_len; |
| 8043 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8044 | if (0 != params->ext_capab_len) |
| 8045 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8046 | sizeof(StaParams.extn_capability)); |
| 8047 | |
| 8048 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8049 | { |
| 8050 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8051 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8052 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8053 | |
| 8054 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8055 | |
| 8056 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8057 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8058 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8059 | * modified to send more rates. |
| 8060 | */ |
| 8061 | |
| 8062 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8063 | */ |
| 8064 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8065 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8066 | |
| 8067 | if (0 != StaParams.supported_rates_len) { |
| 8068 | int i = 0; |
| 8069 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8070 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8071 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8072 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8073 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8074 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8075 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8076 | } |
| 8077 | |
| 8078 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8079 | { |
| 8080 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8081 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8082 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8083 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8084 | if (0 != params->ext_capab_len ) { |
| 8085 | /*Define A Macro : TODO Sunil*/ |
| 8086 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8087 | isBufSta = 1; |
| 8088 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8089 | /* TDLS Channel Switching Support */ |
| 8090 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8091 | isOffChannelSupported = 1; |
| 8092 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8093 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8094 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8095 | &StaParams, isBufSta, |
| 8096 | isOffChannelSupported); |
| 8097 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8098 | if (VOS_STATUS_SUCCESS != status) { |
| 8099 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8100 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8101 | return -EINVAL; |
| 8102 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8103 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8104 | |
| 8105 | if (VOS_STATUS_SUCCESS != status) { |
| 8106 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8107 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8108 | return -EINVAL; |
| 8109 | } |
| 8110 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8111 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8112 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8113 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8114 | return status; |
| 8115 | } |
| 8116 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8117 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8118 | struct net_device *dev, |
| 8119 | u8 *mac, |
| 8120 | struct station_parameters *params) |
| 8121 | { |
| 8122 | int ret; |
| 8123 | |
| 8124 | vos_ssr_protect(__func__); |
| 8125 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8126 | vos_ssr_unprotect(__func__); |
| 8127 | |
| 8128 | return ret; |
| 8129 | } |
| 8130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8131 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8132 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8133 | * This function is used to initialize the key information |
| 8134 | */ |
| 8135 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8136 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8137 | struct net_device *ndev, |
| 8138 | u8 key_index, bool pairwise, |
| 8139 | const u8 *mac_addr, |
| 8140 | struct key_params *params |
| 8141 | ) |
| 8142 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8143 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8144 | struct net_device *ndev, |
| 8145 | u8 key_index, const u8 *mac_addr, |
| 8146 | struct key_params *params |
| 8147 | ) |
| 8148 | #endif |
| 8149 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8150 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8151 | tCsrRoamSetKey setKey; |
| 8152 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8153 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8154 | v_U32_t roamId= 0xFF; |
| 8155 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8156 | hdd_hostapd_state_t *pHostapdState; |
| 8157 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8158 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8159 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | |
| 8161 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8162 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8163 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8164 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8165 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8166 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8167 | status = wlan_hdd_validate_context(pHddCtx); |
| 8168 | |
| 8169 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8170 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8171 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8172 | "%s: HDD context is not valid", __func__); |
| 8173 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8174 | } |
| 8175 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8176 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8177 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8178 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8179 | |
| 8180 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8181 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8182 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8183 | key_index); |
| 8184 | |
| 8185 | return -EINVAL; |
| 8186 | } |
| 8187 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8188 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8189 | { |
| 8190 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8191 | params->key_len); |
| 8192 | |
| 8193 | return -EINVAL; |
| 8194 | } |
| 8195 | |
| 8196 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8197 | "%s: called with key index = %d & key length %d", |
| 8198 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8199 | |
| 8200 | /*extract key idx, key len and key*/ |
| 8201 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8202 | setKey.keyId = key_index; |
| 8203 | setKey.keyLength = params->key_len; |
| 8204 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8205 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8206 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8207 | { |
| 8208 | case WLAN_CIPHER_SUITE_WEP40: |
| 8209 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8210 | break; |
| 8211 | |
| 8212 | case WLAN_CIPHER_SUITE_WEP104: |
| 8213 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8214 | break; |
| 8215 | |
| 8216 | case WLAN_CIPHER_SUITE_TKIP: |
| 8217 | { |
| 8218 | u8 *pKey = &setKey.Key[0]; |
| 8219 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8220 | |
| 8221 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8222 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8223 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8224 | |
| 8225 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8226 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8227 | |--------------|----------|----------| |
| 8228 | <---16bytes---><--8bytes--><--8bytes--> |
| 8229 | |
| 8230 | */ |
| 8231 | /*Sme expects the 32 bytes key to be in the below order |
| 8232 | |
| 8233 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8234 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8235 | |--------------|----------|----------| |
| 8236 | <---16bytes---><--8bytes--><--8bytes--> |
| 8237 | */ |
| 8238 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8239 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8240 | |
| 8241 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8242 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8243 | |
| 8244 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8245 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8246 | |
| 8247 | |
| 8248 | break; |
| 8249 | } |
| 8250 | |
| 8251 | case WLAN_CIPHER_SUITE_CCMP: |
| 8252 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8253 | break; |
| 8254 | |
| 8255 | #ifdef FEATURE_WLAN_WAPI |
| 8256 | case WLAN_CIPHER_SUITE_SMS4: |
| 8257 | { |
| 8258 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8259 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8260 | params->key, params->key_len); |
| 8261 | return 0; |
| 8262 | } |
| 8263 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8264 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8265 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8266 | case WLAN_CIPHER_SUITE_KRK: |
| 8267 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8268 | break; |
| 8269 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8270 | |
| 8271 | #ifdef WLAN_FEATURE_11W |
| 8272 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8273 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8274 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8275 | #endif |
| 8276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8277 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8278 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8279 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8280 | status = -EOPNOTSUPP; |
| 8281 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8282 | } |
| 8283 | |
| 8284 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8285 | __func__, setKey.encType); |
| 8286 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8287 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8288 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8289 | (!pairwise) |
| 8290 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8291 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8292 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8293 | ) |
| 8294 | { |
| 8295 | /* set group key*/ |
| 8296 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8297 | "%s- %d: setting Broadcast key", |
| 8298 | __func__, __LINE__); |
| 8299 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8300 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8301 | } |
| 8302 | else |
| 8303 | { |
| 8304 | /* set pairwise key*/ |
| 8305 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8306 | "%s- %d: setting pairwise key", |
| 8307 | __func__, __LINE__); |
| 8308 | setKey.keyDirection = eSIR_TX_RX; |
| 8309 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8310 | } |
| 8311 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8312 | { |
| 8313 | setKey.keyDirection = eSIR_TX_RX; |
| 8314 | /*Set the group key*/ |
| 8315 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8316 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8317 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8318 | if ( 0 != status ) |
| 8319 | { |
| 8320 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8321 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8322 | status = -EINVAL; |
| 8323 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8324 | } |
| 8325 | /*Save the keys here and call sme_RoamSetKey for setting |
| 8326 | the PTK after peer joins the IBSS network*/ |
| 8327 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 8328 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8329 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8330 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8331 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 8332 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 8333 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8334 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8335 | if( pHostapdState->bssState == BSS_START ) |
| 8336 | { |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 8337 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8338 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 8339 | |
| 8340 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 8341 | { |
| 8342 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8343 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 8344 | __LINE__, vos_status ); |
| 8345 | |
| 8346 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8347 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8348 | status = -EINVAL; |
| 8349 | goto end; |
c_hpothu | 7c55da6 | 2014-01-23 18:34:02 +0530 | [diff] [blame] | 8350 | } |
| 8351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8352 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 8353 | |
| 8354 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8355 | { |
| 8356 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8357 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8358 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8359 | status = -EINVAL; |
| 8360 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8361 | } |
| 8362 | } |
| 8363 | |
| 8364 | /* Saving WEP keys */ |
| 8365 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 8366 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 8367 | { |
| 8368 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 8369 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8370 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 8371 | } |
| 8372 | else |
| 8373 | { |
| 8374 | //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] | 8375 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8376 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 8377 | } |
| 8378 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8379 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 8380 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8381 | { |
| 8382 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8383 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8384 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8385 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8386 | if (!pairwise) |
| 8387 | #else |
| 8388 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8389 | #endif |
| 8390 | { |
| 8391 | /* set group key*/ |
| 8392 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 8393 | { |
| 8394 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8395 | "%s- %d: Perform Set key Complete", |
| 8396 | __func__, __LINE__); |
| 8397 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 8398 | } |
| 8399 | } |
| 8400 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8401 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 8402 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 8403 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 8404 | |
| 8405 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8406 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8407 | params->key, params->key_len); |
| 8408 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8410 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8411 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8412 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8413 | "%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] | 8414 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8415 | setKey.peerMac[2], setKey.peerMac[3], |
| 8416 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8417 | setKey.keyDirection); |
| 8418 | |
| 8419 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 8420 | |
| 8421 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 8422 | { |
| 8423 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8424 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 8425 | __LINE__, vos_status ); |
| 8426 | |
| 8427 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8428 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8429 | status = -EINVAL; |
| 8430 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8431 | |
| 8432 | } |
| 8433 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8434 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8435 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 8436 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 8437 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8438 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8439 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8440 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8441 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 8442 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8443 | status = 0; |
| 8444 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8445 | } |
| 8446 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 8447 | { |
| 8448 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8449 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8450 | status = -EINVAL; |
| 8451 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8452 | } |
| 8453 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8454 | |
| 8455 | /* issue set key request to SME*/ |
| 8456 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8457 | pAdapter->sessionId, &setKey, &roamId ); |
| 8458 | |
| 8459 | if ( 0 != status ) |
| 8460 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8461 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8462 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 8463 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8464 | status = -EINVAL; |
| 8465 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8466 | } |
| 8467 | |
| 8468 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8469 | /* in case of IBSS as there was no information available about WEP keys during |
| 8470 | * 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] | 8471 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8472 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 8473 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 8474 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8475 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 8476 | ) |
| 8477 | && |
| 8478 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 8479 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 8480 | ) |
| 8481 | ) |
| 8482 | { |
| 8483 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8484 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8485 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8486 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8487 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8488 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8489 | setKey.peerMac[2], setKey.peerMac[3], |
| 8490 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8491 | setKey.keyDirection); |
| 8492 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8493 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8494 | pAdapter->sessionId, &setKey, &roamId ); |
| 8495 | |
| 8496 | if ( 0 != status ) |
| 8497 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8498 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8499 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8500 | __func__, status); |
| 8501 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8502 | status = -EINVAL; |
| 8503 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8504 | } |
| 8505 | } |
| 8506 | } |
| 8507 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8508 | end: |
| 8509 | /* Need to clear any trace of key value in the memory. |
| 8510 | * Thus zero out the memory even though it is local |
| 8511 | * variable. |
| 8512 | */ |
| 8513 | vos_mem_zero(&setKey, sizeof(setKey)); |
| 8514 | |
| 8515 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8516 | } |
| 8517 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8518 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8519 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8520 | struct net_device *ndev, |
| 8521 | u8 key_index, bool pairwise, |
| 8522 | const u8 *mac_addr, |
| 8523 | struct key_params *params |
| 8524 | ) |
| 8525 | #else |
| 8526 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8527 | struct net_device *ndev, |
| 8528 | u8 key_index, const u8 *mac_addr, |
| 8529 | struct key_params *params |
| 8530 | ) |
| 8531 | #endif |
| 8532 | { |
| 8533 | int ret; |
| 8534 | vos_ssr_protect(__func__); |
| 8535 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8536 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 8537 | mac_addr, params); |
| 8538 | #else |
| 8539 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 8540 | params); |
| 8541 | #endif |
| 8542 | vos_ssr_unprotect(__func__); |
| 8543 | |
| 8544 | return ret; |
| 8545 | } |
| 8546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8547 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8548 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8549 | * This function is used to get the key information |
| 8550 | */ |
| 8551 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8552 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8553 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8554 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8555 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8556 | const u8 *mac_addr, void *cookie, |
| 8557 | void (*callback)(void *cookie, struct key_params*) |
| 8558 | ) |
| 8559 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8560 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8561 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8562 | struct net_device *ndev, |
| 8563 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 8564 | void (*callback)(void *cookie, struct key_params*) |
| 8565 | ) |
| 8566 | #endif |
| 8567 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8568 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8569 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8570 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | struct key_params params; |
| 8572 | |
| 8573 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8574 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8575 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8576 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8577 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8579 | memset(¶ms, 0, sizeof(params)); |
| 8580 | |
| 8581 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8582 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8583 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8584 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8586 | |
| 8587 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 8588 | { |
| 8589 | case eCSR_ENCRYPT_TYPE_NONE: |
| 8590 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8591 | break; |
| 8592 | |
| 8593 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 8594 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 8595 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 8596 | break; |
| 8597 | |
| 8598 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 8599 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 8600 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 8601 | break; |
| 8602 | |
| 8603 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 8604 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 8605 | break; |
| 8606 | |
| 8607 | case eCSR_ENCRYPT_TYPE_AES: |
| 8608 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 8609 | break; |
| 8610 | |
| 8611 | default: |
| 8612 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8613 | break; |
| 8614 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8615 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 8616 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8617 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 8618 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8620 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 8621 | params.seq_len = 0; |
| 8622 | params.seq = NULL; |
| 8623 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 8624 | callback(cookie, ¶ms); |
| 8625 | return 0; |
| 8626 | } |
| 8627 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8628 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8629 | static int wlan_hdd_cfg80211_get_key( |
| 8630 | struct wiphy *wiphy, |
| 8631 | struct net_device *ndev, |
| 8632 | u8 key_index, bool pairwise, |
| 8633 | const u8 *mac_addr, void *cookie, |
| 8634 | void (*callback)(void *cookie, struct key_params*) |
| 8635 | ) |
| 8636 | #else |
| 8637 | static int wlan_hdd_cfg80211_get_key( |
| 8638 | struct wiphy *wiphy, |
| 8639 | struct net_device *ndev, |
| 8640 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 8641 | void (*callback)(void *cookie, struct key_params*) |
| 8642 | ) |
| 8643 | #endif |
| 8644 | { |
| 8645 | int ret; |
| 8646 | |
| 8647 | vos_ssr_protect(__func__); |
| 8648 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8649 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 8650 | mac_addr, cookie, callback); |
| 8651 | #else |
| 8652 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 8653 | callback); |
| 8654 | #endif |
| 8655 | vos_ssr_unprotect(__func__); |
| 8656 | |
| 8657 | return ret; |
| 8658 | } |
| 8659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8660 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8661 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8662 | * This function is used to delete the key information |
| 8663 | */ |
| 8664 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8665 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8666 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8667 | u8 key_index, |
| 8668 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8669 | const u8 *mac_addr |
| 8670 | ) |
| 8671 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8672 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8673 | struct net_device *ndev, |
| 8674 | u8 key_index, |
| 8675 | const u8 *mac_addr |
| 8676 | ) |
| 8677 | #endif |
| 8678 | { |
| 8679 | int status = 0; |
| 8680 | |
| 8681 | //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] | 8682 | //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] | 8683 | //it is observed that this is invalidating peer |
| 8684 | //key index whenever re-key is done. This is affecting data link. |
| 8685 | //It should be ok to ignore del_key. |
| 8686 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8687 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 8688 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8689 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 8690 | tCsrRoamSetKey setKey; |
| 8691 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8693 | ENTER(); |
| 8694 | |
| 8695 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 8696 | __func__,pAdapter->device_mode); |
| 8697 | |
| 8698 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8699 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8700 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8701 | key_index); |
| 8702 | |
| 8703 | return -EINVAL; |
| 8704 | } |
| 8705 | |
| 8706 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8707 | setKey.keyId = key_index; |
| 8708 | |
| 8709 | if (mac_addr) |
| 8710 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8711 | else |
| 8712 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 8713 | |
| 8714 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 8715 | |
| 8716 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8717 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8718 | ) |
| 8719 | { |
| 8720 | |
| 8721 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8722 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 8723 | if( pHostapdState->bssState == BSS_START) |
| 8724 | { |
| 8725 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8726 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8727 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8728 | { |
| 8729 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8730 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8731 | __LINE__, status ); |
| 8732 | } |
| 8733 | } |
| 8734 | } |
| 8735 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8736 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8737 | ) |
| 8738 | { |
| 8739 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8740 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8741 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8742 | |
| 8743 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8744 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8745 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8746 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8747 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8748 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 8749 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8750 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8751 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8752 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | if ( 0 != status ) |
| 8755 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8757 | "%s: sme_RoamSetKey failure, returned %d", |
| 8758 | __func__, status); |
| 8759 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8760 | return -EINVAL; |
| 8761 | } |
| 8762 | } |
| 8763 | } |
| 8764 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8765 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8766 | return status; |
| 8767 | } |
| 8768 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8769 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8770 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 8771 | struct net_device *ndev, |
| 8772 | u8 key_index, |
| 8773 | bool pairwise, |
| 8774 | const u8 *mac_addr |
| 8775 | ) |
| 8776 | #else |
| 8777 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 8778 | struct net_device *ndev, |
| 8779 | u8 key_index, |
| 8780 | const u8 *mac_addr |
| 8781 | ) |
| 8782 | #endif |
| 8783 | { |
| 8784 | int ret; |
| 8785 | |
| 8786 | vos_ssr_protect(__func__); |
| 8787 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8788 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 8789 | mac_addr); |
| 8790 | #else |
| 8791 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 8792 | #endif |
| 8793 | vos_ssr_unprotect(__func__); |
| 8794 | |
| 8795 | return ret; |
| 8796 | } |
| 8797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8798 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8799 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8800 | * This function is used to set the default tx key index |
| 8801 | */ |
| 8802 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8803 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8804 | struct net_device *ndev, |
| 8805 | u8 key_index, |
| 8806 | bool unicast, bool multicast) |
| 8807 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8808 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8809 | struct net_device *ndev, |
| 8810 | u8 key_index) |
| 8811 | #endif |
| 8812 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8813 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8814 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8815 | hdd_wext_state_t *pWextState; |
| 8816 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8817 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8818 | |
| 8819 | ENTER(); |
| 8820 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8821 | if ((NULL == pAdapter)) |
| 8822 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8823 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8824 | "invalid adapter"); |
| 8825 | return -EINVAL; |
| 8826 | } |
| 8827 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8828 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8829 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 8830 | pAdapter->sessionId, key_index)); |
| 8831 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8832 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8833 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8834 | |
| 8835 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 8836 | { |
| 8837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8838 | "invalid Wext state or HDD context"); |
| 8839 | return -EINVAL; |
| 8840 | } |
| 8841 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8842 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8843 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8845 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8846 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8847 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8848 | key_index); |
| 8849 | |
| 8850 | return -EINVAL; |
| 8851 | } |
| 8852 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8853 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8854 | status = wlan_hdd_validate_context(pHddCtx); |
| 8855 | |
| 8856 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8857 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8858 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8859 | "%s: HDD context is not valid", __func__); |
| 8860 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8861 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8863 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8864 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8865 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8866 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8867 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8868 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8869 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 8870 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8871 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8872 | { |
| 8873 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8874 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8876 | tCsrRoamSetKey setKey; |
| 8877 | v_U32_t roamId= 0xFF; |
| 8878 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8879 | |
| 8880 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8881 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8883 | Keys->defaultIndex = (u8)key_index; |
| 8884 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8885 | setKey.keyId = key_index; |
| 8886 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8887 | |
| 8888 | vos_mem_copy(&setKey.Key[0], |
| 8889 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8890 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8891 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8892 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8893 | |
| 8894 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8895 | &pHddStaCtx->conn_info.bssId[0], |
| 8896 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8897 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8898 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 8899 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 8900 | eCSR_ENCRYPT_TYPE_WEP104) |
| 8901 | { |
| 8902 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 8903 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 8904 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 8905 | type(104) and switching encryption type to 40*/ |
| 8906 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 8907 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8908 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 8909 | eCSR_ENCRYPT_TYPE_WEP40; |
| 8910 | } |
| 8911 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8912 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8913 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8915 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8916 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8917 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8919 | if ( 0 != status ) |
| 8920 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8921 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8922 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8923 | status); |
| 8924 | return -EINVAL; |
| 8925 | } |
| 8926 | } |
| 8927 | } |
| 8928 | |
| 8929 | /* In SoftAp mode setting key direction for default mode */ |
| 8930 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 8931 | { |
| 8932 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 8933 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 8934 | (eCSR_ENCRYPT_TYPE_AES != |
| 8935 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 8936 | ) |
| 8937 | { |
| 8938 | /* Saving key direction for default key index to TX default */ |
| 8939 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8940 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 8941 | } |
| 8942 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8943 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8944 | return status; |
| 8945 | } |
| 8946 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8947 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8948 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8949 | struct net_device *ndev, |
| 8950 | u8 key_index, |
| 8951 | bool unicast, bool multicast) |
| 8952 | #else |
| 8953 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 8954 | struct net_device *ndev, |
| 8955 | u8 key_index) |
| 8956 | #endif |
| 8957 | { |
| 8958 | int ret; |
| 8959 | vos_ssr_protect(__func__); |
| 8960 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8961 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 8962 | multicast); |
| 8963 | #else |
| 8964 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 8965 | #endif |
| 8966 | vos_ssr_unprotect(__func__); |
| 8967 | |
| 8968 | return ret; |
| 8969 | } |
| 8970 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8971 | /* |
| 8972 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 8973 | * This function is used to inform the BSS details to nl80211 interface. |
| 8974 | */ |
| 8975 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 8976 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 8977 | { |
| 8978 | struct net_device *dev = pAdapter->dev; |
| 8979 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 8980 | struct wiphy *wiphy = wdev->wiphy; |
| 8981 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 8982 | int chan_no; |
| 8983 | int ie_length; |
| 8984 | const char *ie; |
| 8985 | unsigned int freq; |
| 8986 | struct ieee80211_channel *chan; |
| 8987 | int rssi = 0; |
| 8988 | struct cfg80211_bss *bss = NULL; |
| 8989 | |
| 8990 | ENTER(); |
| 8991 | |
| 8992 | if( NULL == pBssDesc ) |
| 8993 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8994 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8995 | return bss; |
| 8996 | } |
| 8997 | |
| 8998 | chan_no = pBssDesc->channelId; |
| 8999 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9000 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9001 | |
| 9002 | if( NULL == ie ) |
| 9003 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9004 | 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] | 9005 | return bss; |
| 9006 | } |
| 9007 | |
| 9008 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9009 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9010 | { |
| 9011 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9012 | } |
| 9013 | else |
| 9014 | { |
| 9015 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9016 | } |
| 9017 | #else |
| 9018 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9019 | #endif |
| 9020 | |
| 9021 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9022 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9023 | if (!chan) { |
| 9024 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9025 | return NULL; |
| 9026 | } |
| 9027 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9028 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9029 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9030 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9031 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9032 | pBssDesc->capabilityInfo, |
| 9033 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9034 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9035 | } |
| 9036 | |
| 9037 | |
| 9038 | |
| 9039 | /* |
| 9040 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9041 | * This function is used to inform the BSS details to nl80211 interface. |
| 9042 | */ |
| 9043 | struct cfg80211_bss* |
| 9044 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9045 | tSirBssDescription *bss_desc |
| 9046 | ) |
| 9047 | { |
| 9048 | /* |
| 9049 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9050 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9051 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9052 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9053 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9054 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9055 | cfg80211_inform_bss_frame. |
| 9056 | */ |
| 9057 | struct net_device *dev = pAdapter->dev; |
| 9058 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9059 | struct wiphy *wiphy = wdev->wiphy; |
| 9060 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9061 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9062 | qcom_ie_age *qie_age = NULL; |
| 9063 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9064 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9065 | 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] | 9066 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9067 | const char *ie = |
| 9068 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9069 | unsigned int freq; |
| 9070 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9071 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9072 | struct cfg80211_bss *bss_status = NULL; |
| 9073 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9074 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9075 | hdd_context_t *pHddCtx; |
| 9076 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9077 | #ifdef WLAN_OPEN_SOURCE |
| 9078 | struct timespec ts; |
| 9079 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9080 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9081 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9082 | status = wlan_hdd_validate_context(pHddCtx); |
| 9083 | |
| 9084 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9085 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9086 | { |
| 9087 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9088 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9089 | return NULL; |
| 9090 | } |
| 9091 | |
| 9092 | |
| 9093 | if (0 != status) |
| 9094 | { |
| 9095 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9096 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9097 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9098 | } |
| 9099 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9100 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9101 | if (!mgmt) |
| 9102 | { |
| 9103 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9104 | "%s: memory allocation failed ", __func__); |
| 9105 | return NULL; |
| 9106 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9108 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9109 | |
| 9110 | #ifdef WLAN_OPEN_SOURCE |
| 9111 | /* Android does not want the timestamp from the frame. |
| 9112 | Instead it wants a monotonic increasing value */ |
| 9113 | get_monotonic_boottime(&ts); |
| 9114 | mgmt->u.probe_resp.timestamp = |
| 9115 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9116 | #else |
| 9117 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9118 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9119 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9120 | |
| 9121 | #endif |
| 9122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9123 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9124 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9125 | |
| 9126 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9127 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9128 | /* Assuming this is the last IE, copy at the end */ |
| 9129 | ie_length -=sizeof(qcom_ie_age); |
| 9130 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9131 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9132 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9133 | qie_age->oui_1 = QCOM_OUI1; |
| 9134 | qie_age->oui_2 = QCOM_OUI2; |
| 9135 | qie_age->oui_3 = QCOM_OUI3; |
| 9136 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9137 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9138 | #endif |
| 9139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9140 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9141 | if (bss_desc->fProbeRsp) |
| 9142 | { |
| 9143 | mgmt->frame_control |= |
| 9144 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9145 | } |
| 9146 | else |
| 9147 | { |
| 9148 | mgmt->frame_control |= |
| 9149 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9150 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9151 | |
| 9152 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9153 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9154 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9155 | { |
| 9156 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9157 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9158 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9159 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9160 | |
| 9161 | { |
| 9162 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9163 | } |
| 9164 | else |
| 9165 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9166 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9167 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9168 | kfree(mgmt); |
| 9169 | return NULL; |
| 9170 | } |
| 9171 | #else |
| 9172 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9173 | #endif |
| 9174 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9175 | /*when the band is changed on the fly using the GUI, three things are done |
| 9176 | * 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) |
| 9177 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9178 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9179 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9180 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9181 | * 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 |
| 9182 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9183 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9184 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9185 | * So drop the bss and continue to next bss. |
| 9186 | */ |
| 9187 | if(chan == NULL) |
| 9188 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9189 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9190 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9191 | return NULL; |
| 9192 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9193 | /*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] | 9194 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9195 | * */ |
| 9196 | if (( eConnectionState_Associated == |
| 9197 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 9198 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 9199 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 9200 | WNI_CFG_BSSID_LEN))) |
| 9201 | { |
| 9202 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9203 | rssi = (pAdapter->rssi * 100); |
| 9204 | } |
| 9205 | else |
| 9206 | { |
| 9207 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 9208 | } |
| 9209 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9210 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9211 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9212 | chan->center_freq, (int)(rssi/100)); |
| 9213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9214 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9215 | frame_len, rssi, GFP_KERNEL); |
| 9216 | kfree(mgmt); |
| 9217 | return bss_status; |
| 9218 | } |
| 9219 | |
| 9220 | /* |
| 9221 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9222 | * This function is used to update the BSS data base of CFG8011 |
| 9223 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9224 | 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] | 9225 | tCsrRoamInfo *pRoamInfo |
| 9226 | ) |
| 9227 | { |
| 9228 | tCsrRoamConnectedProfile roamProfile; |
| 9229 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9230 | struct cfg80211_bss *bss = NULL; |
| 9231 | |
| 9232 | ENTER(); |
| 9233 | |
| 9234 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9235 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9236 | |
| 9237 | if (NULL != roamProfile.pBssDesc) |
| 9238 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9239 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9240 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9241 | |
| 9242 | if (NULL == bss) |
| 9243 | { |
| 9244 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9245 | __func__); |
| 9246 | } |
| 9247 | |
| 9248 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9249 | } |
| 9250 | else |
| 9251 | { |
| 9252 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9253 | __func__); |
| 9254 | } |
| 9255 | return bss; |
| 9256 | } |
| 9257 | |
| 9258 | /* |
| 9259 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9260 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9261 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9262 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9263 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9264 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9265 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | tCsrScanResultInfo *pScanResult; |
| 9267 | eHalStatus status = 0; |
| 9268 | tScanResultHandle pResult; |
| 9269 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9270 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9271 | |
| 9272 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9273 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9274 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9275 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9276 | NO_SESSION, pAdapter->sessionId)); |
| 9277 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9278 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9279 | |
| 9280 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9281 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9282 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9283 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9284 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9285 | } |
| 9286 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9287 | |
| 9288 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9289 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9290 | { |
| 9291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9292 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9293 | return VOS_STATUS_E_PERM; |
| 9294 | } |
| 9295 | |
| 9296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9297 | /* |
| 9298 | * start getting scan results and populate cgf80211 BSS database |
| 9299 | */ |
| 9300 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9301 | |
| 9302 | /* no scan results */ |
| 9303 | if (NULL == pResult) |
| 9304 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9305 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9306 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9307 | return status; |
| 9308 | } |
| 9309 | |
| 9310 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9311 | |
| 9312 | while (pScanResult) |
| 9313 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9314 | /* |
| 9315 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 9316 | * entry already exists in bss data base of cfg80211 for that |
| 9317 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 9318 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 9319 | * mgmt packet as input. As of now there is no possibility to get |
| 9320 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9321 | * ieee80211_mgmt(probe response) and passing to c |
| 9322 | * fg80211_inform_bss_frame. |
| 9323 | * */ |
| 9324 | |
| 9325 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9326 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9328 | |
| 9329 | if (NULL == bss_status) |
| 9330 | { |
| 9331 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9332 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9333 | } |
| 9334 | else |
| 9335 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9336 | cfg80211_put_bss( |
| 9337 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9338 | wiphy, |
| 9339 | #endif |
| 9340 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9341 | } |
| 9342 | |
| 9343 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 9344 | } |
| 9345 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9346 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9347 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9348 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9349 | } |
| 9350 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9351 | void |
| 9352 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 9353 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9354 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9355 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9356 | } /****** end hddPrintMacAddr() ******/ |
| 9357 | |
| 9358 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 9359 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9360 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9361 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9362 | "%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] | 9363 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 9364 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 9365 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9366 | } /****** end hddPrintPmkId() ******/ |
| 9367 | |
| 9368 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 9369 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 9370 | |
| 9371 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 9372 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 9373 | |
| 9374 | #define dump_bssid(bssid) \ |
| 9375 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9376 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 9377 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9378 | } |
| 9379 | |
| 9380 | #define dump_pmkid(pMac, pmkid) \ |
| 9381 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9382 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 9383 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9384 | } |
| 9385 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 9386 | #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] | 9387 | /* |
| 9388 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 9389 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 9390 | */ |
| 9391 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9392 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9393 | int index, bool preauth ) |
| 9394 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9395 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9396 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9397 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9398 | |
| 9399 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9400 | 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] | 9401 | |
| 9402 | if( NULL == pRoamInfo ) |
| 9403 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9404 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9405 | return -EINVAL; |
| 9406 | } |
| 9407 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9408 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 9409 | { |
| 9410 | dump_bssid(pRoamInfo->bssid); |
| 9411 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9412 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9413 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9414 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9415 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9416 | } |
| 9417 | #endif //FEATURE_WLAN_LFR |
| 9418 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9419 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 9420 | /* |
| 9421 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 9422 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 9423 | * |
| 9424 | */ |
| 9425 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 9426 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 9427 | tCsrRoamInfo *pRoamInfo) |
| 9428 | { |
| 9429 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9430 | union iwreq_data wrqu; |
| 9431 | |
| 9432 | ENTER(); |
| 9433 | |
| 9434 | if (NULL == pAdapter) |
| 9435 | { |
| 9436 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9437 | return VOS_STATUS_E_FAILURE; |
| 9438 | } |
| 9439 | |
| 9440 | /* create the event */ |
| 9441 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9442 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9443 | |
| 9444 | wrqu.data.pointer = metrics_notification; |
| 9445 | wrqu.data.length = scnprintf(metrics_notification, |
| 9446 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 9447 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9448 | |
| 9449 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9450 | |
| 9451 | EXIT(); |
| 9452 | |
| 9453 | return VOS_STATUS_SUCCESS; |
| 9454 | } |
| 9455 | |
| 9456 | /* |
| 9457 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 9458 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 9459 | * or failure |
| 9460 | */ |
| 9461 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 9462 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 9463 | { |
| 9464 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9465 | union iwreq_data wrqu; |
| 9466 | |
| 9467 | ENTER(); |
| 9468 | |
| 9469 | if (NULL == pAdapter) |
| 9470 | { |
| 9471 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9472 | return VOS_STATUS_E_FAILURE; |
| 9473 | } |
| 9474 | |
| 9475 | /* create the event */ |
| 9476 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9477 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9478 | |
| 9479 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 9480 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 9481 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9482 | |
| 9483 | if (1 == preauth_status) |
| 9484 | strncat(metrics_notification, " TRUE", 5); |
| 9485 | else |
| 9486 | strncat(metrics_notification, " FALSE", 6); |
| 9487 | |
| 9488 | wrqu.data.pointer = metrics_notification; |
| 9489 | wrqu.data.length = strlen(metrics_notification); |
| 9490 | |
| 9491 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9492 | |
| 9493 | EXIT(); |
| 9494 | |
| 9495 | return VOS_STATUS_SUCCESS; |
| 9496 | } |
| 9497 | |
| 9498 | /* |
| 9499 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 9500 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 9501 | * |
| 9502 | */ |
| 9503 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 9504 | tCsrRoamInfo *pRoamInfo) |
| 9505 | { |
| 9506 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9507 | union iwreq_data wrqu; |
| 9508 | |
| 9509 | ENTER(); |
| 9510 | |
| 9511 | if (NULL == pAdapter) |
| 9512 | { |
| 9513 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9514 | return VOS_STATUS_E_FAILURE; |
| 9515 | } |
| 9516 | |
| 9517 | /* create the event */ |
| 9518 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9519 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9520 | |
| 9521 | wrqu.data.pointer = metrics_notification; |
| 9522 | wrqu.data.length = scnprintf(metrics_notification, |
| 9523 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 9524 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9525 | |
| 9526 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9527 | |
| 9528 | EXIT(); |
| 9529 | |
| 9530 | return VOS_STATUS_SUCCESS; |
| 9531 | } |
| 9532 | #endif |
| 9533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9534 | /* |
| 9535 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 9536 | * scanning callback function, called after finishing scan |
| 9537 | * |
| 9538 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9539 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9540 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 9541 | { |
| 9542 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9543 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9544 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9545 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9546 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9547 | struct cfg80211_scan_request *req = NULL; |
| 9548 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 9549 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9550 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 9551 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9552 | |
| 9553 | ENTER(); |
| 9554 | |
| 9555 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9556 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9557 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9558 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 9559 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9560 | pScanInfo->mScanPendingCounter = 0; |
| 9561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9562 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9563 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9564 | &pScanInfo->scan_req_completion_event, |
| 9565 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9566 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9567 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9568 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9569 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9570 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9571 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9572 | } |
| 9573 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9574 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9575 | { |
| 9576 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9577 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9578 | } |
| 9579 | |
| 9580 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9581 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9582 | { |
| 9583 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9584 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9585 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9586 | (int) scanId); |
| 9587 | } |
| 9588 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9589 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9590 | pAdapter); |
| 9591 | |
| 9592 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9593 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9594 | |
| 9595 | |
| 9596 | /* If any client wait scan result through WEXT |
| 9597 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9598 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9599 | { |
| 9600 | /* The other scan request waiting for current scan finish |
| 9601 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9602 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9603 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9604 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9605 | } |
| 9606 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9607 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9608 | { |
| 9609 | struct net_device *dev = pAdapter->dev; |
| 9610 | union iwreq_data wrqu; |
| 9611 | int we_event; |
| 9612 | char *msg; |
| 9613 | |
| 9614 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 9615 | we_event = SIOCGIWSCAN; |
| 9616 | msg = NULL; |
| 9617 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 9618 | } |
| 9619 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9620 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | |
| 9622 | /* Get the Scan Req */ |
| 9623 | req = pAdapter->request; |
| 9624 | |
| 9625 | if (!req) |
| 9626 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9627 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9628 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9629 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9630 | } |
| 9631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9632 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9633 | /* Scan is no longer pending */ |
| 9634 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9635 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 9636 | /* last_scan_timestamp is used to decide if new scan |
| 9637 | * is needed or not on station interface. If last station |
| 9638 | * scan time and new station scan time is less then |
| 9639 | * last_scan_timestamp ; driver will return cached scan. |
| 9640 | */ |
| 9641 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 9642 | { |
| 9643 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 9644 | |
| 9645 | if ( req->n_channels ) |
| 9646 | { |
| 9647 | for (i = 0; i < req->n_channels ; i++ ) |
| 9648 | { |
| 9649 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 9650 | } |
| 9651 | /* store no of channel scanned */ |
| 9652 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 9653 | } |
| 9654 | |
| 9655 | } |
| 9656 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 9657 | /* |
| 9658 | * cfg80211_scan_done informing NL80211 about completion |
| 9659 | * of scanning |
| 9660 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 9661 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 9662 | { |
| 9663 | aborted = true; |
| 9664 | } |
| 9665 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 9666 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9667 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 9668 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 9669 | /* Generate new random mac addr for next scan */ |
| 9670 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 9671 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 9672 | } |
| 9673 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9674 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 9675 | /* release the wake lock at the end of the scan*/ |
| 9676 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9677 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 9678 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 9679 | * immediatly after the driver gets connect request(i.e after scan) |
| 9680 | * from supplicant, this result in app's is suspending and not able |
| 9681 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 9682 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 9683 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9684 | #ifdef FEATURE_WLAN_TDLS |
c_hpothu | 3c8f8e8 | 2014-06-02 18:01:50 +0530 | [diff] [blame] | 9685 | if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) |
| 9686 | { |
| 9687 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 9688 | } |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9689 | #endif |
| 9690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9691 | EXIT(); |
| 9692 | return 0; |
| 9693 | } |
| 9694 | |
| 9695 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9696 | * FUNCTION: hdd_isConnectionInProgress |
| 9697 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9698 | * |
| 9699 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 9700 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9701 | { |
| 9702 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 9703 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 9704 | hdd_adapter_t *pAdapter = NULL; |
| 9705 | VOS_STATUS status = 0; |
| 9706 | v_U8_t staId = 0; |
| 9707 | v_U8_t *staMac = NULL; |
| 9708 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 9709 | if (TRUE == pHddCtx->btCoexModeSet) |
| 9710 | { |
| 9711 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9712 | FL("BTCoex Mode operation in progress")); |
| 9713 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 9714 | } |
| 9715 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9716 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 9717 | |
| 9718 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 9719 | { |
| 9720 | pAdapter = pAdapterNode->pAdapter; |
| 9721 | |
| 9722 | if( pAdapter ) |
| 9723 | { |
| 9724 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9725 | "%s: Adapter with device mode %s (%d) exists", |
| 9726 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9727 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 9728 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9729 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9730 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 9731 | (eConnectionState_Connecting == |
| 9732 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 9733 | { |
| 9734 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9735 | "%s: %p(%d) Connection is in progress", __func__, |
| 9736 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 9737 | return VOS_TRUE; |
| 9738 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 9739 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 9740 | smeNeighborRoamIsHandoffInProgress(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 9741 | { |
| 9742 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9743 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 9744 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 9745 | return VOS_TRUE; |
| 9746 | } |
| 9747 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9748 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 9749 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9750 | { |
| 9751 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9752 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9753 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9754 | { |
| 9755 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 9756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9757 | "%s: client " MAC_ADDRESS_STR |
| 9758 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 9759 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9760 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9761 | } |
| 9762 | } |
| 9763 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 9764 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 9765 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 9766 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 9767 | ptSapContext pSapCtx = NULL; |
| 9768 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 9769 | if(pSapCtx == NULL){ |
| 9770 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9771 | FL("psapCtx is NULL")); |
| 9772 | return VOS_FALSE; |
| 9773 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9774 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 9775 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 9776 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 9777 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9778 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 9779 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9780 | |
| 9781 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9782 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 9783 | "middle of WPS/EAPOL exchange.", __func__, |
| 9784 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9785 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9786 | } |
| 9787 | } |
| 9788 | } |
| 9789 | } |
| 9790 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 9791 | pAdapterNode = pNext; |
| 9792 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 9793 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9794 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9795 | |
| 9796 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9797 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9798 | * this scan respond to scan trigger and update cfg80211 scan database |
| 9799 | * later, scan dump command can be used to recieve scan results |
| 9800 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 9801 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 9802 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9803 | struct net_device *dev, |
| 9804 | #endif |
| 9805 | struct cfg80211_scan_request *request) |
| 9806 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9807 | hdd_adapter_t *pAdapter = NULL; |
| 9808 | hdd_context_t *pHddCtx = NULL; |
| 9809 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9810 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | tCsrScanRequest scanRequest; |
| 9812 | tANI_U8 *channelList = NULL, i; |
| 9813 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9814 | int status; |
| 9815 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9816 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 9817 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9818 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9819 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 9820 | struct net_device *dev = NULL; |
| 9821 | if (NULL == request) |
| 9822 | { |
| 9823 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9824 | "%s: scan req param null", __func__); |
| 9825 | return -EINVAL; |
| 9826 | } |
| 9827 | dev = request->wdev->netdev; |
| 9828 | #endif |
| 9829 | |
| 9830 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 9831 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 9832 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9834 | ENTER(); |
| 9835 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9836 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9837 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9838 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9839 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9840 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9841 | status = wlan_hdd_validate_context(pHddCtx); |
| 9842 | |
| 9843 | if (0 != status) |
| 9844 | { |
| 9845 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9846 | "%s: HDD context is not valid", __func__); |
| 9847 | return status; |
| 9848 | } |
| 9849 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9850 | if (NULL == pwextBuf) |
| 9851 | { |
| 9852 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 9853 | __func__); |
| 9854 | return -EIO; |
| 9855 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9856 | cfg_param = pHddCtx->cfg_ini; |
| 9857 | pScanInfo = &pHddCtx->scan_info; |
| 9858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9859 | #ifdef WLAN_BTAMP_FEATURE |
| 9860 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9861 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9862 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 9863 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9864 | "%s: No scanning when AMP is on", __func__); |
| 9865 | return -EOPNOTSUPP; |
| 9866 | } |
| 9867 | #endif |
| 9868 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9869 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9870 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9872 | "%s: Not scanning on device_mode = %s (%d)", |
| 9873 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9874 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9875 | return -EOPNOTSUPP; |
| 9876 | } |
| 9877 | |
| 9878 | if (TRUE == pScanInfo->mScanPending) |
| 9879 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9880 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 9881 | { |
| 9882 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 9883 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9884 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9885 | } |
| 9886 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9887 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9888 | //Channel and action frame is pending |
| 9889 | //Otherwise Cancel Remain On Channel and allow Scan |
| 9890 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9891 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9892 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9893 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9894 | return -EBUSY; |
| 9895 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9896 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9897 | /* if tdls disagree scan right now, return immediately. |
| 9898 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 9899 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 9900 | */ |
| 9901 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 9902 | wiphy, |
| 9903 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 9904 | dev, |
Gopichand Nakkala | c3c42b9 | 2013-03-20 19:42:34 -0700 | [diff] [blame] | 9905 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9906 | request); |
| 9907 | if(status <= 0) |
| 9908 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9909 | if(!status) |
| 9910 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 9911 | "scan rejected %d", __func__, status); |
| 9912 | else |
| 9913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 9914 | __func__, status); |
| 9915 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 9916 | return status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9917 | } |
| 9918 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9920 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 9921 | { |
| 9922 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9923 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9924 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9926 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 9927 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9929 | "%s: MAX TM Level Scan not allowed", __func__); |
| 9930 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9931 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9932 | } |
| 9933 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 9934 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9935 | /* Check if scan is allowed at this point of time. |
| 9936 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 9937 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 9938 | { |
| 9939 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 9940 | return -EBUSY; |
| 9941 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9943 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 9944 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9945 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 9946 | (int)request->n_ssids); |
| 9947 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 9948 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9949 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 9950 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 9951 | * is not aging out the scan results. |
| 9952 | */ |
| 9953 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9954 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9955 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9957 | |
| 9958 | if ((request->ssids) && (0 < request->n_ssids)) |
| 9959 | { |
| 9960 | tCsrSSIDInfo *SsidInfo; |
| 9961 | int j; |
| 9962 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 9963 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 9964 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 9965 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 9966 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 9967 | |
| 9968 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 9969 | { |
| 9970 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9971 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 9972 | return -ENOMEM; |
| 9973 | } |
| 9974 | |
| 9975 | /* copy all the ssid's and their length */ |
| 9976 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 9977 | { |
| 9978 | /* get the ssid length */ |
| 9979 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 9980 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 9981 | SsidInfo->SSID.length); |
| 9982 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 9983 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 9984 | j, SsidInfo->SSID.ssId); |
| 9985 | } |
| 9986 | /* set the scan type to active */ |
| 9987 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 9988 | } |
| 9989 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9990 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 9991 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9992 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 9993 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9994 | /* set the scan type to active */ |
| 9995 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9996 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 9997 | else |
| 9998 | { |
| 9999 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10000 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10001 | } |
| 10002 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10003 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10004 | |
| 10005 | /* set BSSType to default type */ |
| 10006 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10007 | |
| 10008 | /*TODO: scan the requested channels only*/ |
| 10009 | |
| 10010 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10011 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10012 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10013 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10014 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10015 | request->n_channels = MAX_CHANNEL; |
| 10016 | } |
| 10017 | |
| 10018 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10019 | "No of Scan Channels: %d", request->n_channels); |
| 10020 | |
| 10021 | |
| 10022 | if( request->n_channels ) |
| 10023 | { |
| 10024 | char chList [(request->n_channels*5)+1]; |
| 10025 | int len; |
| 10026 | channelList = vos_mem_malloc( request->n_channels ); |
| 10027 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10028 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10029 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10030 | "%s: memory alloc failed channelList", __func__); |
| 10031 | status = -ENOMEM; |
| 10032 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10033 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10034 | |
| 10035 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10036 | { |
| 10037 | channelList[i] = request->channels[i]->hw_value; |
| 10038 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10039 | } |
| 10040 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10041 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10042 | "Channel-List: %s ", chList); |
| 10043 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10044 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10045 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10046 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10047 | |
| 10048 | /* set requestType to full scan */ |
| 10049 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10050 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10051 | /* if there is back to back scan happening in driver with in |
| 10052 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10053 | * and should provide last cached scan results instead of new channel list. |
| 10054 | * This rule is not applicable if scan is p2p scan. |
| 10055 | * This condition will work only in case when last request no of channels |
| 10056 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10057 | * This should be done only in connected state |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10058 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10059 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10060 | if ((VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
| 10061 | { |
| 10062 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10063 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10064 | { |
| 10065 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10066 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10067 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10068 | channelList, pScanInfo->last_scan_numChannels)) |
| 10069 | { |
| 10070 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10071 | " New and old station scan time differ is less then %u", |
| 10072 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10073 | |
| 10074 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10075 | pAdapter); |
| 10076 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10077 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10078 | "Return old cached scan as all channels" |
| 10079 | "and no of channles are same"); |
| 10080 | if (0 > ret) |
| 10081 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10082 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10083 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
| 10084 | return eHAL_STATUS_SUCCESS ; |
| 10085 | } |
| 10086 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10087 | } |
| 10088 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10089 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10090 | * search (Flush on both full scan and social scan but not on single |
| 10091 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10092 | */ |
| 10093 | |
| 10094 | /* Supplicant does single channel scan after 8-way handshake |
| 10095 | * and in that case driver shoudnt flush scan results. If |
| 10096 | * driver flushes the scan results here and unfortunately if |
| 10097 | * the AP doesnt respond to our probe req then association |
| 10098 | * fails which is not desired |
| 10099 | */ |
| 10100 | |
| 10101 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10102 | { |
| 10103 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10104 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10105 | pAdapter->sessionId ); |
| 10106 | } |
| 10107 | |
| 10108 | if( request->ie_len ) |
| 10109 | { |
| 10110 | /* save this for future association (join requires this) */ |
| 10111 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10112 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10113 | * CR 597966 |
| 10114 | */ |
| 10115 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10116 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10117 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10118 | |
| 10119 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10120 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10121 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10122 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10123 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10124 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10125 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10126 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10127 | request->ie, request->ie_len); |
| 10128 | } |
| 10129 | else |
| 10130 | { |
| 10131 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10132 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10133 | } |
| 10134 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10135 | } |
| 10136 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10137 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10138 | |
| 10139 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10140 | request->ie_len); |
| 10141 | if (pP2pIe != NULL) |
| 10142 | { |
| 10143 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10144 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10145 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10146 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10147 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10148 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10149 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10150 | "Go nego completed to Connection is started"); |
| 10151 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10152 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10153 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10154 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10155 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10156 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10157 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10158 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10159 | "Disconnected state to Connection is started"); |
| 10160 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10161 | "for 4way Handshake"); |
| 10162 | } |
| 10163 | #endif |
| 10164 | |
| 10165 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10166 | if(TRUE == request->no_cck) |
| 10167 | { |
| 10168 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10169 | "%s: This is a P2P Search", __func__); |
| 10170 | scanRequest.p2pSearch = 1; |
| 10171 | |
| 10172 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10173 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10174 | /* set requestType to P2P Discovery */ |
| 10175 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10176 | } |
| 10177 | |
| 10178 | /* |
| 10179 | Skip Dfs Channel in case of P2P Search |
| 10180 | if it is set in ini file |
| 10181 | */ |
| 10182 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10183 | { |
| 10184 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10185 | } |
| 10186 | else |
| 10187 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10188 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10190 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10192 | } |
| 10193 | } |
| 10194 | |
| 10195 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10196 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10197 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10198 | * address the following issues. |
| 10199 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10200 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10201 | * for long time, this result in apps running at full power for long time. |
| 10202 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10203 | * be stuck in full power because of resume BMPS |
| 10204 | */ |
| 10205 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10206 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10207 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10208 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10209 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10210 | scanRequest.requestType, scanRequest.scanType, |
| 10211 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10212 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10213 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10214 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10215 | { |
| 10216 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10217 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10218 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10219 | * to fill TxBds for probe request during current scan |
| 10220 | */ |
| 10221 | WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 10222 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 10223 | } |
| 10224 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10225 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10226 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10227 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10229 | if (eHAL_STATUS_SUCCESS != status) |
| 10230 | { |
| 10231 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10232 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10233 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10234 | if(eHAL_STATUS_RESOURCES == status) |
| 10235 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10236 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10237 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10238 | status = -EBUSY; |
| 10239 | } else { |
| 10240 | status = -EIO; |
| 10241 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10242 | hdd_allow_suspend(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10243 | goto free_mem; |
| 10244 | } |
| 10245 | |
| 10246 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10247 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10248 | pAdapter->request = request; |
| 10249 | pScanInfo->scanId = scanId; |
| 10250 | |
| 10251 | complete(&pScanInfo->scan_req_completion_event); |
| 10252 | |
| 10253 | free_mem: |
| 10254 | if( scanRequest.SSIDs.SSIDList ) |
| 10255 | { |
| 10256 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10257 | } |
| 10258 | |
| 10259 | if( channelList ) |
| 10260 | vos_mem_free( channelList ); |
| 10261 | |
| 10262 | EXIT(); |
| 10263 | |
| 10264 | return status; |
| 10265 | } |
| 10266 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10267 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10268 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10269 | struct net_device *dev, |
| 10270 | #endif |
| 10271 | struct cfg80211_scan_request *request) |
| 10272 | { |
| 10273 | int ret; |
| 10274 | |
| 10275 | vos_ssr_protect(__func__); |
| 10276 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10277 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10278 | dev, |
| 10279 | #endif |
| 10280 | request); |
| 10281 | vos_ssr_unprotect(__func__); |
| 10282 | |
| 10283 | return ret; |
| 10284 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10285 | |
| 10286 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 10287 | { |
| 10288 | v_U8_t iniDot11Mode = |
| 10289 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 10290 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 10291 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10292 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 10293 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10294 | switch ( iniDot11Mode ) |
| 10295 | { |
| 10296 | case eHDD_DOT11_MODE_AUTO: |
| 10297 | case eHDD_DOT11_MODE_11ac: |
| 10298 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 10299 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 10300 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 10301 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 10302 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 10303 | else |
| 10304 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10305 | #else |
| 10306 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10307 | #endif |
| 10308 | break; |
| 10309 | case eHDD_DOT11_MODE_11n: |
| 10310 | case eHDD_DOT11_MODE_11n_ONLY: |
| 10311 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10312 | break; |
| 10313 | default: |
| 10314 | hddDot11Mode = iniDot11Mode; |
| 10315 | break; |
| 10316 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10317 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 10318 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 10319 | #endif |
| 10320 | { |
| 10321 | /* This call decides required channel bonding mode */ |
| 10322 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10323 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 10324 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10325 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10326 | } |
| 10327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10328 | /* |
| 10329 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10330 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10331 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10332 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10333 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10334 | { |
| 10335 | int status = 0; |
| 10336 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10337 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10338 | v_U32_t roamId; |
| 10339 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10340 | eCsrAuthType RSNAuthType; |
| 10341 | |
| 10342 | ENTER(); |
| 10343 | |
| 10344 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10345 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10346 | |
| 10347 | status = wlan_hdd_validate_context(pHddCtx); |
| 10348 | if (status) |
| 10349 | { |
| 10350 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10351 | "%s: HDD context is not valid!", __func__); |
| 10352 | return status; |
| 10353 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10354 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10355 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 10356 | { |
| 10357 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 10358 | return -EINVAL; |
| 10359 | } |
| 10360 | |
| 10361 | pRoamProfile = &pWextState->roamProfile; |
| 10362 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10363 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10364 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10365 | hdd_station_ctx_t *pHddStaCtx; |
| 10366 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10367 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10368 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10369 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 10370 | { |
| 10371 | /*QoS not enabled in cfg file*/ |
| 10372 | pRoamProfile->uapsd_mask = 0; |
| 10373 | } |
| 10374 | else |
| 10375 | { |
| 10376 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10377 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10378 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 10379 | } |
| 10380 | |
| 10381 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 10382 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 10383 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10384 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10385 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 10386 | ssid, ssid_len); |
| 10387 | |
| 10388 | if (bssid) |
| 10389 | { |
| 10390 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 10391 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 10392 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10393 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 10394 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10395 | case of join failure we should send valid BSSID to supplicant |
| 10396 | */ |
| 10397 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 10398 | WNI_CFG_BSSID_LEN); |
| 10399 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 10400 | else |
| 10401 | { |
| 10402 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 10403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10404 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10405 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 10406 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10407 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 10408 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10409 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10410 | /*set gen ie*/ |
| 10411 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 10412 | /*set auth*/ |
| 10413 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 10414 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10415 | #ifdef FEATURE_WLAN_WAPI |
| 10416 | if (pAdapter->wapi_info.nWapiMode) |
| 10417 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10418 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10419 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 10420 | { |
| 10421 | case WAPI_AUTH_MODE_PSK: |
| 10422 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10423 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10424 | pAdapter->wapi_info.wapiAuthMode); |
| 10425 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 10426 | break; |
| 10427 | } |
| 10428 | case WAPI_AUTH_MODE_CERT: |
| 10429 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10430 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10431 | pAdapter->wapi_info.wapiAuthMode); |
| 10432 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 10433 | break; |
| 10434 | } |
| 10435 | } // End of switch |
| 10436 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 10437 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 10438 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10439 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10440 | pRoamProfile->AuthType.numEntries = 1; |
| 10441 | pRoamProfile->EncryptionType.numEntries = 1; |
| 10442 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10443 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 10444 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10445 | } |
| 10446 | } |
| 10447 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10448 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10449 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10450 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10451 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 10452 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10453 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 10454 | sizeof (tSirGtkOffloadParams)); |
| 10455 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10456 | } |
| 10457 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10458 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 10459 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10460 | if( operatingChannel ) |
| 10461 | { |
| 10462 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 10463 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 10464 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10465 | else |
| 10466 | { |
| 10467 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 10468 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 10469 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10470 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 10471 | { |
| 10472 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 10473 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10474 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10475 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 10476 | * 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] | 10477 | * 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] | 10478 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10479 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 10480 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 10481 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 10482 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10483 | { |
| 10484 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10485 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 10486 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10487 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 10488 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10489 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10490 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10491 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 10492 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 10493 | if ((eHAL_STATUS_SUCCESS != status) && |
| 10494 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 10495 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10496 | |
| 10497 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10498 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 10499 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 10500 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10501 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10502 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10503 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10504 | |
| 10505 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 10506 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 10507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10508 | } |
| 10509 | else |
| 10510 | { |
| 10511 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 10512 | return -EINVAL; |
| 10513 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10514 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | return status; |
| 10516 | } |
| 10517 | |
| 10518 | /* |
| 10519 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 10520 | * This function is used to set the authentication type (OPEN/SHARED). |
| 10521 | * |
| 10522 | */ |
| 10523 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 10524 | enum nl80211_auth_type auth_type) |
| 10525 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10526 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10527 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10528 | |
| 10529 | ENTER(); |
| 10530 | |
| 10531 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10532 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10533 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10534 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10535 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10536 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 10537 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 10538 | break; |
| 10539 | |
| 10540 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 10541 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10542 | case NL80211_AUTHTYPE_FT: |
| 10543 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10544 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10545 | "%s: set authentication type to OPEN", __func__); |
| 10546 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 10547 | break; |
| 10548 | |
| 10549 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10550 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10551 | "%s: set authentication type to SHARED", __func__); |
| 10552 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 10553 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10554 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10555 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10556 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10557 | "%s: set authentication type to CCKM WPA", __func__); |
| 10558 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 10559 | break; |
| 10560 | #endif |
| 10561 | |
| 10562 | |
| 10563 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10564 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10565 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | auth_type); |
| 10567 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 10568 | return -EINVAL; |
| 10569 | } |
| 10570 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10571 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10572 | pHddStaCtx->conn_info.authType; |
| 10573 | return 0; |
| 10574 | } |
| 10575 | |
| 10576 | /* |
| 10577 | * FUNCTION: wlan_hdd_set_akm_suite |
| 10578 | * This function is used to set the key mgmt type(PSK/8021x). |
| 10579 | * |
| 10580 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10581 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10582 | u32 key_mgmt |
| 10583 | ) |
| 10584 | { |
| 10585 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10586 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10587 | /* Should be in ieee802_11_defs.h */ |
| 10588 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 10589 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10590 | /*set key mgmt type*/ |
| 10591 | switch(key_mgmt) |
| 10592 | { |
| 10593 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10594 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10595 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10596 | case WLAN_AKM_SUITE_FT_PSK: |
| 10597 | #endif |
| 10598 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10599 | __func__); |
| 10600 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 10601 | break; |
| 10602 | |
| 10603 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10604 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10605 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10606 | case WLAN_AKM_SUITE_FT_8021X: |
| 10607 | #endif |
| 10608 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10609 | __func__); |
| 10610 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 10611 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10612 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10613 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 10614 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 10615 | case WLAN_AKM_SUITE_CCKM: |
| 10616 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 10617 | __func__); |
| 10618 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 10619 | break; |
| 10620 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 10621 | #ifndef WLAN_AKM_SUITE_OSEN |
| 10622 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 10623 | case WLAN_AKM_SUITE_OSEN: |
| 10624 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 10625 | __func__); |
| 10626 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 10627 | break; |
| 10628 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10629 | |
| 10630 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10631 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10632 | __func__, key_mgmt); |
| 10633 | return -EINVAL; |
| 10634 | |
| 10635 | } |
| 10636 | return 0; |
| 10637 | } |
| 10638 | |
| 10639 | /* |
| 10640 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10641 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10642 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 10643 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10644 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 10645 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10646 | bool ucast |
| 10647 | ) |
| 10648 | { |
| 10649 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10650 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10651 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10652 | |
| 10653 | ENTER(); |
| 10654 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10655 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10656 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10657 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10658 | __func__, cipher); |
| 10659 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10660 | } |
| 10661 | else |
| 10662 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10664 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10665 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10666 | { |
| 10667 | case IW_AUTH_CIPHER_NONE: |
| 10668 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 10669 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10671 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10672 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10673 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10675 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10676 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10677 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10678 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10679 | case WLAN_CIPHER_SUITE_TKIP: |
| 10680 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 10681 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10682 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10683 | case WLAN_CIPHER_SUITE_CCMP: |
| 10684 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 10685 | break; |
| 10686 | #ifdef FEATURE_WLAN_WAPI |
| 10687 | case WLAN_CIPHER_SUITE_SMS4: |
| 10688 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 10689 | break; |
| 10690 | #endif |
| 10691 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10692 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10693 | case WLAN_CIPHER_SUITE_KRK: |
| 10694 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 10695 | break; |
| 10696 | #endif |
| 10697 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10698 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10699 | __func__, cipher); |
| 10700 | return -EOPNOTSUPP; |
| 10701 | } |
| 10702 | } |
| 10703 | |
| 10704 | if (ucast) |
| 10705 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10706 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10707 | __func__, encryptionType); |
| 10708 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 10709 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10710 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10711 | encryptionType; |
| 10712 | } |
| 10713 | else |
| 10714 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10715 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10716 | __func__, encryptionType); |
| 10717 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 10718 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 10719 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 10720 | } |
| 10721 | |
| 10722 | return 0; |
| 10723 | } |
| 10724 | |
| 10725 | |
| 10726 | /* |
| 10727 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 10728 | * This function is used to parse WPA/RSN IE's. |
| 10729 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10730 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 10731 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10732 | size_t ie_len |
| 10733 | ) |
| 10734 | { |
| 10735 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10736 | u8 *genie = ie; |
| 10737 | v_U16_t remLen = ie_len; |
| 10738 | #ifdef FEATURE_WLAN_WAPI |
| 10739 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 10740 | u16 *tmp; |
| 10741 | v_U16_t akmsuiteCount; |
| 10742 | int *akmlist; |
| 10743 | #endif |
| 10744 | ENTER(); |
| 10745 | |
| 10746 | /* clear previous assocAddIE */ |
| 10747 | pWextState->assocAddIE.length = 0; |
| 10748 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10749 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10750 | |
| 10751 | while (remLen >= 2) |
| 10752 | { |
| 10753 | v_U16_t eLen = 0; |
| 10754 | v_U8_t elementId; |
| 10755 | elementId = *genie++; |
| 10756 | eLen = *genie++; |
| 10757 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10758 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10759 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10760 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10761 | |
| 10762 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10763 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10764 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10765 | 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] | 10766 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10767 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | "%s: Invalid WPA IE", __func__); |
| 10769 | return -EINVAL; |
| 10770 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10771 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10772 | { |
| 10773 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10774 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10775 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10777 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10778 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10779 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 10780 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10781 | VOS_ASSERT(0); |
| 10782 | return -ENOMEM; |
| 10783 | } |
| 10784 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 10785 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10786 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10788 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 10789 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10790 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10791 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10792 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 10793 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10794 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 10795 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 10796 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 10797 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 10798 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 10799 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10800 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 10801 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10802 | { |
| 10803 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10804 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10805 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10807 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10808 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10809 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10810 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10811 | VOS_ASSERT(0); |
| 10812 | return -ENOMEM; |
| 10813 | } |
| 10814 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 10815 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10816 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10817 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10818 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10819 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10820 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10821 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10822 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 10823 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10824 | /*Consider WFD IE, only for P2P Client */ |
| 10825 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 10826 | { |
| 10827 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10828 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10829 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10831 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10832 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10833 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10834 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10835 | VOS_ASSERT(0); |
| 10836 | return -ENOMEM; |
| 10837 | } |
| 10838 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 10839 | // WPS IE + P2P IE + WFD IE |
| 10840 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10841 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10843 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10844 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10845 | } |
| 10846 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10847 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10848 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10849 | HS20_OUI_TYPE_SIZE)) ) |
| 10850 | { |
| 10851 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10852 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10853 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10854 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10855 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10856 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 10857 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10858 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10859 | VOS_ASSERT(0); |
| 10860 | return -ENOMEM; |
| 10861 | } |
| 10862 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10863 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10864 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 10865 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10866 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10867 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10868 | /* Appending OSEN Information Element in Assiciation Request */ |
| 10869 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 10870 | OSEN_OUI_TYPE_SIZE)) ) |
| 10871 | { |
| 10872 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 10873 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 10874 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 10875 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 10876 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 10877 | { |
| 10878 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 10879 | "Need bigger buffer space"); |
| 10880 | VOS_ASSERT(0); |
| 10881 | return -ENOMEM; |
| 10882 | } |
| 10883 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 10884 | pWextState->assocAddIE.length += eLen + 2; |
| 10885 | |
| 10886 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 10887 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 10888 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 10889 | } |
| 10890 | |
| 10891 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 10892 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 10893 | |
| 10894 | /* populating as ADDIE in beacon frames */ |
| 10895 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10896 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 10897 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 10898 | { |
| 10899 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10900 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 10901 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10902 | { |
| 10903 | hddLog(LOGE, |
| 10904 | "Coldn't pass " |
| 10905 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 10906 | } |
| 10907 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 10908 | else |
| 10909 | hddLog(LOGE, |
| 10910 | "Could not pass on " |
| 10911 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 10912 | |
| 10913 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 10914 | beaconIE's need to be populated in probe response frames */ |
| 10915 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 10916 | { |
| 10917 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 10918 | u8 probe_rsp_ie_len[3] = {0}; |
| 10919 | u8 counter = 0; |
| 10920 | |
| 10921 | /* Check Probe Resp Length if it is greater then 255 then |
| 10922 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 10923 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 10924 | not able Store More then 255 bytes into One Variable */ |
| 10925 | |
| 10926 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 10927 | { |
| 10928 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 10929 | { |
| 10930 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 10931 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 10932 | } |
| 10933 | else |
| 10934 | { |
| 10935 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 10936 | rem_probe_resp_ie_len = 0; |
| 10937 | } |
| 10938 | } |
| 10939 | |
| 10940 | rem_probe_resp_ie_len = 0; |
| 10941 | |
| 10942 | if (probe_rsp_ie_len[0] > 0) |
| 10943 | { |
| 10944 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10945 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 10946 | (tANI_U8*)(genie - 2), |
| 10947 | probe_rsp_ie_len[0], NULL, |
| 10948 | eANI_BOOLEAN_FALSE) |
| 10949 | == eHAL_STATUS_FAILURE) |
| 10950 | { |
| 10951 | hddLog(LOGE, |
| 10952 | "Could not pass" |
| 10953 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 10954 | } |
| 10955 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 10956 | } |
| 10957 | |
| 10958 | if (probe_rsp_ie_len[1] > 0) |
| 10959 | { |
| 10960 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10961 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 10962 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10963 | probe_rsp_ie_len[1], NULL, |
| 10964 | eANI_BOOLEAN_FALSE) |
| 10965 | == eHAL_STATUS_FAILURE) |
| 10966 | { |
| 10967 | hddLog(LOGE, |
| 10968 | "Could not pass" |
| 10969 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 10970 | } |
| 10971 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 10972 | } |
| 10973 | |
| 10974 | if (probe_rsp_ie_len[2] > 0) |
| 10975 | { |
| 10976 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10977 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 10978 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 10979 | probe_rsp_ie_len[2], NULL, |
| 10980 | eANI_BOOLEAN_FALSE) |
| 10981 | == eHAL_STATUS_FAILURE) |
| 10982 | { |
| 10983 | hddLog(LOGE, |
| 10984 | "Could not pass" |
| 10985 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 10986 | } |
| 10987 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 10988 | } |
| 10989 | |
| 10990 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10991 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 10992 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10993 | { |
| 10994 | hddLog(LOGE, |
| 10995 | "Could not pass" |
| 10996 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 10997 | } |
| 10998 | } |
| 10999 | else |
| 11000 | { |
| 11001 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11002 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11003 | |
| 11004 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11005 | "%s: No Probe Response IE received in set beacon", |
| 11006 | __func__); |
| 11007 | } |
| 11008 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | break; |
| 11010 | case DOT11F_EID_RSN: |
| 11011 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11012 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11013 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11014 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11015 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11016 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11017 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 11018 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11019 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11020 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11021 | 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] | 11022 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11023 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11024 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11025 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11026 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11027 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11028 | VOS_ASSERT(0); |
| 11029 | return -ENOMEM; |
| 11030 | } |
| 11031 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11032 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11033 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11034 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11035 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11036 | break; |
| 11037 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | #ifdef FEATURE_WLAN_WAPI |
| 11039 | case WLAN_EID_WAPI: |
| 11040 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11041 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11042 | pAdapter->wapi_info.nWapiMode); |
| 11043 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11044 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11045 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11046 | tmp = tmp + 1; |
| 11047 | akmlist = (int *)(tmp); |
| 11048 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11049 | { |
| 11050 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11051 | } |
| 11052 | else |
| 11053 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11054 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | VOS_ASSERT(0); |
| 11056 | return -EINVAL; |
| 11057 | } |
| 11058 | |
| 11059 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11060 | { |
| 11061 | 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] | 11062 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11063 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11064 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11065 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11066 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11067 | 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] | 11068 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11069 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11070 | } |
| 11071 | break; |
| 11072 | #endif |
| 11073 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11074 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11075 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11076 | /* when Unknown IE is received we should break and continue |
| 11077 | * to the next IE in the buffer instead we were returning |
| 11078 | * so changing this to break */ |
| 11079 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11080 | } |
| 11081 | genie += eLen; |
| 11082 | remLen -= eLen; |
| 11083 | } |
| 11084 | EXIT(); |
| 11085 | return 0; |
| 11086 | } |
| 11087 | |
| 11088 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11089 | * FUNCTION: hdd_isWPAIEPresent |
| 11090 | * Parse the received IE to find the WPA IE |
| 11091 | * |
| 11092 | */ |
| 11093 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11094 | { |
| 11095 | v_U8_t eLen = 0; |
| 11096 | v_U16_t remLen = ie_len; |
| 11097 | v_U8_t elementId = 0; |
| 11098 | |
| 11099 | while (remLen >= 2) |
| 11100 | { |
| 11101 | elementId = *ie++; |
| 11102 | eLen = *ie++; |
| 11103 | remLen -= 2; |
| 11104 | if (eLen > remLen) |
| 11105 | { |
| 11106 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11107 | "%s: IE length is wrong %d", __func__, eLen); |
| 11108 | return FALSE; |
| 11109 | } |
| 11110 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11111 | { |
| 11112 | /* OUI - 0x00 0X50 0XF2 |
| 11113 | WPA Information Element - 0x01 |
| 11114 | WPA version - 0x01*/ |
| 11115 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11116 | return TRUE; |
| 11117 | } |
| 11118 | ie += eLen; |
| 11119 | remLen -= eLen; |
| 11120 | } |
| 11121 | return FALSE; |
| 11122 | } |
| 11123 | |
| 11124 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11125 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11126 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11127 | * parameters during connect operation. |
| 11128 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11129 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11130 | struct cfg80211_connect_params *req |
| 11131 | ) |
| 11132 | { |
| 11133 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11134 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11135 | ENTER(); |
| 11136 | |
| 11137 | /*set wpa version*/ |
| 11138 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11139 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11140 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11141 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11142 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11143 | { |
| 11144 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11145 | } |
| 11146 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11147 | { |
| 11148 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11149 | } |
| 11150 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11151 | |
| 11152 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11153 | pWextState->wpaVersion); |
| 11154 | |
| 11155 | /*set authentication type*/ |
| 11156 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11157 | |
| 11158 | if (0 > status) |
| 11159 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11160 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11161 | "%s: failed to set authentication type ", __func__); |
| 11162 | return status; |
| 11163 | } |
| 11164 | |
| 11165 | /*set key mgmt type*/ |
| 11166 | if (req->crypto.n_akm_suites) |
| 11167 | { |
| 11168 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11169 | if (0 > status) |
| 11170 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11171 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11172 | __func__); |
| 11173 | return status; |
| 11174 | } |
| 11175 | } |
| 11176 | |
| 11177 | /*set pairwise cipher type*/ |
| 11178 | if (req->crypto.n_ciphers_pairwise) |
| 11179 | { |
| 11180 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11181 | req->crypto.ciphers_pairwise[0], true); |
| 11182 | if (0 > status) |
| 11183 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11185 | "%s: failed to set unicast cipher type", __func__); |
| 11186 | return status; |
| 11187 | } |
| 11188 | } |
| 11189 | else |
| 11190 | { |
| 11191 | /*Reset previous cipher suite to none*/ |
| 11192 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11193 | if (0 > status) |
| 11194 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11195 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11196 | "%s: failed to set unicast cipher type", __func__); |
| 11197 | return status; |
| 11198 | } |
| 11199 | } |
| 11200 | |
| 11201 | /*set group cipher type*/ |
| 11202 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11203 | false); |
| 11204 | |
| 11205 | if (0 > status) |
| 11206 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11207 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11208 | __func__); |
| 11209 | return status; |
| 11210 | } |
| 11211 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11212 | #ifdef WLAN_FEATURE_11W |
| 11213 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11214 | #endif |
| 11215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11217 | if (req->ie_len) |
| 11218 | { |
| 11219 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11220 | if ( 0 > status) |
| 11221 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11222 | 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] | 11223 | __func__); |
| 11224 | return status; |
| 11225 | } |
| 11226 | } |
| 11227 | |
| 11228 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11229 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11230 | { |
| 11231 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11232 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11233 | ) |
| 11234 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11235 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11236 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11237 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11238 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11239 | __func__); |
| 11240 | return -EOPNOTSUPP; |
| 11241 | } |
| 11242 | else |
| 11243 | { |
| 11244 | u8 key_len = req->key_len; |
| 11245 | u8 key_idx = req->key_idx; |
| 11246 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11247 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11248 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11249 | ) |
| 11250 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11251 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11252 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11253 | __func__, key_idx, key_len); |
| 11254 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11255 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11256 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11257 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11258 | (u8)key_len; |
| 11259 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11260 | } |
| 11261 | } |
| 11262 | } |
| 11263 | } |
| 11264 | |
| 11265 | return status; |
| 11266 | } |
| 11267 | |
| 11268 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11269 | * FUNCTION: wlan_hdd_try_disconnect |
| 11270 | * This function is used to disconnect from previous |
| 11271 | * connection |
| 11272 | */ |
| 11273 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11274 | { |
| 11275 | long ret = 0; |
| 11276 | hdd_station_ctx_t *pHddStaCtx; |
| 11277 | eMib_dot11DesiredBssType connectedBssType; |
| 11278 | |
| 11279 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11280 | |
| 11281 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 11282 | |
| 11283 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 11284 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 11285 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 11286 | { |
| 11287 | /* Issue disconnect to CSR */ |
| 11288 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11289 | if( eHAL_STATUS_SUCCESS == |
| 11290 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11291 | pAdapter->sessionId, |
| 11292 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11293 | { |
| 11294 | ret = wait_for_completion_interruptible_timeout( |
| 11295 | &pAdapter->disconnect_comp_var, |
| 11296 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11297 | if (0 >= ret) |
| 11298 | { |
| 11299 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11300 | return -EALREADY; |
| 11301 | } |
| 11302 | } |
| 11303 | } |
| 11304 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 11305 | { |
| 11306 | ret = wait_for_completion_interruptible_timeout( |
| 11307 | &pAdapter->disconnect_comp_var, |
| 11308 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11309 | if (0 >= ret) |
| 11310 | { |
| 11311 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11312 | return -EALREADY; |
| 11313 | } |
| 11314 | } |
| 11315 | |
| 11316 | return 0; |
| 11317 | } |
| 11318 | |
| 11319 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11320 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 11321 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11322 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11323 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11324 | struct net_device *ndev, |
| 11325 | struct cfg80211_connect_params *req |
| 11326 | ) |
| 11327 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11328 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11329 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11330 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 11331 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11332 | |
| 11333 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11334 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11335 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11336 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 11337 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11338 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11339 | "%s: device_mode = %s (%d)", __func__, |
| 11340 | hdd_device_modetoString(pAdapter->device_mode), |
| 11341 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11342 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11343 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11344 | if (!pHddCtx) |
| 11345 | { |
| 11346 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11347 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11348 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11349 | } |
| 11350 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11351 | status = wlan_hdd_validate_context(pHddCtx); |
| 11352 | |
| 11353 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11354 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11355 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11356 | "%s: HDD context is not valid", __func__); |
| 11357 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11358 | } |
| 11359 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11360 | if (vos_max_concurrent_connections_reached()) { |
| 11361 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11362 | return -ECONNREFUSED; |
| 11363 | } |
| 11364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11365 | #ifdef WLAN_BTAMP_FEATURE |
| 11366 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11367 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11368 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11369 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11370 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 11371 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11372 | } |
| 11373 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11374 | |
| 11375 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 11376 | //P2P Mode will be taken care in Open/close adapter |
| 11377 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11378 | (vos_concurrent_open_sessions_running())) { |
| 11379 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 11380 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11381 | } |
| 11382 | |
| 11383 | /*Try disconnecting if already in connected state*/ |
| 11384 | status = wlan_hdd_try_disconnect(pAdapter); |
| 11385 | if ( 0 > status) |
| 11386 | { |
| 11387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11388 | " connection")); |
| 11389 | return -EALREADY; |
| 11390 | } |
| 11391 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11392 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11393 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | |
| 11395 | if ( 0 > status) |
| 11396 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11397 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | __func__); |
| 11399 | return status; |
| 11400 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11401 | if ( req->channel ) |
| 11402 | { |
| 11403 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 11404 | req->ssid_len, req->bssid, |
| 11405 | req->channel->hw_value); |
| 11406 | } |
| 11407 | else |
| 11408 | { |
| 11409 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11410 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11412 | |
| 11413 | if (0 > status) |
| 11414 | { |
| 11415 | //ReEnable BMPS if disabled |
| 11416 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 11417 | (NULL != pHddCtx)) |
| 11418 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 11419 | if (pHddCtx->hdd_wlan_suspended) |
| 11420 | { |
| 11421 | hdd_set_pwrparams(pHddCtx); |
| 11422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11423 | //ReEnable Bmps and Imps back |
| 11424 | hdd_enable_bmps_imps(pHddCtx); |
| 11425 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11426 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11427 | return status; |
| 11428 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11429 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11430 | EXIT(); |
| 11431 | return status; |
| 11432 | } |
| 11433 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11434 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 11435 | struct net_device *ndev, |
| 11436 | struct cfg80211_connect_params *req) |
| 11437 | { |
| 11438 | int ret; |
| 11439 | vos_ssr_protect(__func__); |
| 11440 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 11441 | vos_ssr_unprotect(__func__); |
| 11442 | |
| 11443 | return ret; |
| 11444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | |
| 11446 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11447 | * FUNCTION: wlan_hdd_disconnect |
| 11448 | * This function is used to issue a disconnect request to SME |
| 11449 | */ |
| 11450 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 11451 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11452 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11453 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11454 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11455 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11456 | |
| 11457 | status = wlan_hdd_validate_context(pHddCtx); |
| 11458 | |
| 11459 | if (0 != status) |
| 11460 | { |
| 11461 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11462 | "%s: HDD context is not valid", __func__); |
| 11463 | return status; |
| 11464 | } |
| 11465 | |
| 11466 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11467 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11468 | /* Need to apply spin lock before decreasing active sessions |
| 11469 | * as there can be chance for double decrement if context switch |
| 11470 | * Calls hdd_DisConnectHandler. |
| 11471 | */ |
| 11472 | |
| 11473 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11474 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 11475 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11476 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 11477 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11478 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 11479 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11480 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11481 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11482 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 11483 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11484 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11485 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11486 | /* |
| 11487 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 11488 | * tx has to be disabled because the firmware can get busy dropping |
| 11489 | * the tx frames after BSS/STA has been deleted and will not send |
| 11490 | * back a response resulting in WDI timeout |
| 11491 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 11492 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11493 | netif_tx_disable(pAdapter->dev); |
| 11494 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11495 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11496 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11497 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11498 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11499 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 11500 | { |
| 11501 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11502 | FL("status = %d, already disconnected"), |
| 11503 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11504 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11505 | } |
| 11506 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11507 | { |
| 11508 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11509 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11510 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11511 | result = -EINVAL; |
| 11512 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11513 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11514 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11515 | &pAdapter->disconnect_comp_var, |
| 11516 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11517 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11518 | { |
| 11519 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11520 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11521 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11522 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11523 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11524 | { |
| 11525 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11526 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11527 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11528 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11529 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11530 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11531 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 11532 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 11533 | |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11534 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11535 | } |
| 11536 | |
| 11537 | |
| 11538 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11539 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11540 | * This function is used to issue a disconnect request to SME |
| 11541 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11542 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11543 | struct net_device *dev, |
| 11544 | u16 reason |
| 11545 | ) |
| 11546 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11547 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11548 | tCsrRoamProfile *pRoamProfile = |
| 11549 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11550 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11551 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11552 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11553 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11554 | tANI_U8 staIdx; |
| 11555 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11557 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11558 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11559 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11560 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 11561 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11562 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 11563 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11564 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11565 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11566 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 11567 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11568 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11569 | status = wlan_hdd_validate_context(pHddCtx); |
| 11570 | |
| 11571 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11572 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11573 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11574 | "%s: HDD context is not valid", __func__); |
| 11575 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11576 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11578 | if (NULL != pRoamProfile) |
| 11579 | { |
| 11580 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 11581 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 11582 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11583 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11584 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11585 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11586 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11587 | switch(reason) |
| 11588 | { |
| 11589 | case WLAN_REASON_MIC_FAILURE: |
| 11590 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 11591 | break; |
| 11592 | |
| 11593 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 11594 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 11595 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 11596 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 11597 | break; |
| 11598 | |
| 11599 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 11600 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 11601 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11602 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 11603 | break; |
| 11604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11605 | default: |
| 11606 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 11607 | break; |
| 11608 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11609 | pScanInfo = &pHddCtx->scan_info; |
| 11610 | if (pScanInfo->mScanPending) |
| 11611 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 11612 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11613 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 11614 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 11615 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11616 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11617 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11618 | #ifdef FEATURE_WLAN_TDLS |
| 11619 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11620 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11621 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11622 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 11623 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11624 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11625 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11626 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 11627 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11628 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11629 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11630 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11631 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 11632 | pAdapter->sessionId, |
| 11633 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11634 | } |
| 11635 | } |
| 11636 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11637 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11638 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 11639 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11640 | { |
| 11641 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11642 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11643 | __func__, (int)status ); |
| 11644 | return -EINVAL; |
| 11645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11646 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 11647 | else |
| 11648 | { |
| 11649 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 11650 | "called while in %d state", __func__, |
| 11651 | pHddStaCtx->conn_info.connState); |
| 11652 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11653 | } |
| 11654 | else |
| 11655 | { |
| 11656 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 11657 | } |
| 11658 | |
| 11659 | return status; |
| 11660 | } |
| 11661 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11662 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 11663 | struct net_device *dev, |
| 11664 | u16 reason |
| 11665 | ) |
| 11666 | { |
| 11667 | int ret; |
| 11668 | vos_ssr_protect(__func__); |
| 11669 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 11670 | vos_ssr_unprotect(__func__); |
| 11671 | |
| 11672 | return ret; |
| 11673 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11675 | /* |
| 11676 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11677 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11678 | * settings in IBSS mode. |
| 11679 | */ |
| 11680 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11681 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11682 | struct cfg80211_ibss_params *params |
| 11683 | ) |
| 11684 | { |
| 11685 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11686 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11687 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11688 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11690 | ENTER(); |
| 11691 | |
| 11692 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 11693 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11694 | |
| 11695 | if (params->ie_len && ( NULL != params->ie) ) |
| 11696 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11697 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 11698 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11699 | { |
| 11700 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11701 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11702 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11703 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11704 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11705 | tDot11fIEWPA dot11WPAIE; |
| 11706 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11707 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11708 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 11709 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11710 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 11711 | params->ie_len, DOT11F_EID_WPA); |
| 11712 | if ( NULL != ie ) |
| 11713 | { |
| 11714 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11715 | // Unpack the WPA IE |
| 11716 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 11717 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 11718 | &ie[2+4], |
| 11719 | ie[1] - 4, |
| 11720 | &dot11WPAIE); |
| 11721 | /*Extract the multicast cipher, the encType for unicast |
| 11722 | cipher for wpa-none is none*/ |
| 11723 | encryptionType = |
| 11724 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 11725 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11726 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 11727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11728 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 11729 | |
| 11730 | if (0 > status) |
| 11731 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11732 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11733 | __func__); |
| 11734 | return status; |
| 11735 | } |
| 11736 | } |
| 11737 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11738 | pWextState->roamProfile.AuthType.authType[0] = |
| 11739 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11741 | |
| 11742 | if (params->privacy) |
| 11743 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11744 | /* Security enabled IBSS, At this time there is no information available |
| 11745 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11746 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11747 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11748 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11749 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11750 | *enable privacy bit in beacons */ |
| 11751 | |
| 11752 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 11753 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11754 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11755 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11756 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11757 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 11758 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11759 | return status; |
| 11760 | } |
| 11761 | |
| 11762 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11763 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11764 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11765 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11766 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11767 | struct net_device *dev, |
| 11768 | struct cfg80211_ibss_params *params |
| 11769 | ) |
| 11770 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11771 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11772 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11773 | tCsrRoamProfile *pRoamProfile; |
| 11774 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11775 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11776 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11777 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11778 | |
| 11779 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11780 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11781 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11782 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 11783 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11784 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11785 | "%s: device_mode = %s (%d)", __func__, |
| 11786 | hdd_device_modetoString(pAdapter->device_mode), |
| 11787 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11788 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11789 | status = wlan_hdd_validate_context(pHddCtx); |
| 11790 | |
| 11791 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11792 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11793 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11794 | "%s: HDD context is not valid", __func__); |
| 11795 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11796 | } |
| 11797 | |
| 11798 | if (NULL == pWextState) |
| 11799 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11800 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11801 | __func__); |
| 11802 | return -EIO; |
| 11803 | } |
| 11804 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11805 | if (vos_max_concurrent_connections_reached()) { |
| 11806 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11807 | return -ECONNREFUSED; |
| 11808 | } |
| 11809 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11810 | /*Try disconnecting if already in connected state*/ |
| 11811 | status = wlan_hdd_try_disconnect(pAdapter); |
| 11812 | if ( 0 > status) |
| 11813 | { |
| 11814 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11815 | " IBSS connection")); |
| 11816 | return -EALREADY; |
| 11817 | } |
| 11818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11819 | pRoamProfile = &pWextState->roamProfile; |
| 11820 | |
| 11821 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 11822 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11823 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11824 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | return -EINVAL; |
| 11826 | } |
| 11827 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11828 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 11829 | if (NULL != params->bssid) { |
| 11830 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11831 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 11832 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11833 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11834 | return -EIO; |
| 11835 | } |
| 11836 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11837 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 11838 | { |
| 11839 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 11840 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 11841 | { |
| 11842 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11843 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 11844 | return -EIO; |
| 11845 | } |
| 11846 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 11847 | if (!params->bssid) |
| 11848 | { |
| 11849 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 11850 | "%s:Failed memory allocation", __func__); |
| 11851 | return -EIO; |
| 11852 | } |
| 11853 | vos_mem_copy((v_U8_t *)params->bssid, |
| 11854 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 11855 | VOS_MAC_ADDR_SIZE); |
| 11856 | alloc_bssid = VOS_TRUE; |
| 11857 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 11858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11859 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11860 | if (NULL != |
| 11861 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11862 | params->chandef.chan) |
| 11863 | #else |
| 11864 | params->channel) |
| 11865 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11866 | { |
| 11867 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11868 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 11869 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 11870 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11871 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11872 | |
| 11873 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11874 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 11875 | ieee80211_frequency_to_channel( |
| 11876 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 11877 | params->chandef.chan->center_freq); |
| 11878 | #else |
| 11879 | params->channel->center_freq); |
| 11880 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11881 | |
| 11882 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 11883 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11884 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11885 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 11886 | __func__); |
| 11887 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11888 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11889 | |
| 11890 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11891 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11892 | if (channelNum == validChan[indx]) |
| 11893 | { |
| 11894 | break; |
| 11895 | } |
| 11896 | } |
| 11897 | if (indx >= numChans) |
| 11898 | { |
| 11899 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11900 | __func__, channelNum); |
| 11901 | return -EINVAL; |
| 11902 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11903 | /* Set the Operational Channel */ |
| 11904 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 11905 | channelNum); |
| 11906 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11907 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 11908 | pRoamProfile->ChannelInfo.ChannelList = |
| 11909 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11910 | } |
| 11911 | |
| 11912 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11913 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11914 | if (status < 0) |
| 11915 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11916 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11917 | __func__); |
| 11918 | return status; |
| 11919 | } |
| 11920 | |
| 11921 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11922 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11923 | params->ssid_len, params->bssid, |
| 11924 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11925 | |
| 11926 | if (0 > status) |
| 11927 | { |
| 11928 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 11929 | return status; |
| 11930 | } |
| 11931 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 11932 | if (NULL != params->bssid && |
| 11933 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 11934 | alloc_bssid == VOS_TRUE) |
| 11935 | { |
| 11936 | vos_mem_free(params->bssid); |
| 11937 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11938 | return 0; |
| 11939 | } |
| 11940 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11941 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 11942 | struct net_device *dev, |
| 11943 | struct cfg80211_ibss_params *params |
| 11944 | ) |
| 11945 | { |
| 11946 | int ret = 0; |
| 11947 | |
| 11948 | vos_ssr_protect(__func__); |
| 11949 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 11950 | vos_ssr_unprotect(__func__); |
| 11951 | |
| 11952 | return ret; |
| 11953 | } |
| 11954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11955 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11956 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11957 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11958 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 11959 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11960 | struct net_device *dev |
| 11961 | ) |
| 11962 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11963 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11964 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11965 | tCsrRoamProfile *pRoamProfile; |
| 11966 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11967 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | |
| 11969 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11970 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11971 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11972 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 11973 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11974 | status = wlan_hdd_validate_context(pHddCtx); |
| 11975 | |
| 11976 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11977 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11978 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11979 | "%s: HDD context is not valid", __func__); |
| 11980 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11981 | } |
| 11982 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11983 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 11984 | hdd_device_modetoString(pAdapter->device_mode), |
| 11985 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11986 | if (NULL == pWextState) |
| 11987 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11988 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11989 | __func__); |
| 11990 | return -EIO; |
| 11991 | } |
| 11992 | |
| 11993 | pRoamProfile = &pWextState->roamProfile; |
| 11994 | |
| 11995 | /* Issue disconnect only if interface type is set to IBSS */ |
| 11996 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 11997 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11998 | 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] | 11999 | __func__); |
| 12000 | return -EINVAL; |
| 12001 | } |
| 12002 | |
| 12003 | /* Issue Disconnect request */ |
| 12004 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12005 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12006 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12007 | |
| 12008 | return 0; |
| 12009 | } |
| 12010 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12011 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12012 | struct net_device *dev |
| 12013 | ) |
| 12014 | { |
| 12015 | int ret = 0; |
| 12016 | |
| 12017 | vos_ssr_protect(__func__); |
| 12018 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12019 | vos_ssr_unprotect(__func__); |
| 12020 | |
| 12021 | return ret; |
| 12022 | } |
| 12023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12024 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12025 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12026 | * This function is used to set the phy parameters |
| 12027 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12028 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12029 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12030 | u32 changed) |
| 12031 | { |
| 12032 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12033 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12034 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12035 | |
| 12036 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12037 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12038 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12039 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12040 | status = wlan_hdd_validate_context(pHddCtx); |
| 12041 | |
| 12042 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12043 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12044 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12045 | "%s: HDD context is not valid", __func__); |
| 12046 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12047 | } |
| 12048 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12049 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12050 | { |
| 12051 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12052 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12053 | wiphy->rts_threshold; |
| 12054 | |
| 12055 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12056 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12057 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12058 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12059 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12060 | __func__, rts_threshold); |
| 12061 | return -EINVAL; |
| 12062 | } |
| 12063 | |
| 12064 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12065 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12066 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12067 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12068 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12069 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12070 | __func__, rts_threshold); |
| 12071 | return -EIO; |
| 12072 | } |
| 12073 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12074 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12075 | rts_threshold); |
| 12076 | } |
| 12077 | |
| 12078 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12079 | { |
| 12080 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12081 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12082 | wiphy->frag_threshold; |
| 12083 | |
| 12084 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12085 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12086 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12087 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12088 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12089 | frag_threshold); |
| 12090 | return -EINVAL; |
| 12091 | } |
| 12092 | |
| 12093 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12094 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12095 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12096 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12097 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12098 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12099 | __func__, frag_threshold); |
| 12100 | return -EIO; |
| 12101 | } |
| 12102 | |
| 12103 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12104 | frag_threshold); |
| 12105 | } |
| 12106 | |
| 12107 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12108 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12109 | { |
| 12110 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12111 | wiphy->retry_short : |
| 12112 | wiphy->retry_long; |
| 12113 | |
| 12114 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12115 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12116 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12117 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12118 | __func__, retry_value); |
| 12119 | return -EINVAL; |
| 12120 | } |
| 12121 | |
| 12122 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12123 | { |
| 12124 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12125 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12126 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12127 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12128 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12129 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12130 | __func__, retry_value); |
| 12131 | return -EIO; |
| 12132 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12133 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12134 | __func__, retry_value); |
| 12135 | } |
| 12136 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12137 | { |
| 12138 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12139 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12140 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12141 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12142 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12143 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12144 | __func__, retry_value); |
| 12145 | return -EIO; |
| 12146 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12147 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12148 | __func__, retry_value); |
| 12149 | } |
| 12150 | } |
| 12151 | |
| 12152 | return 0; |
| 12153 | } |
| 12154 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12155 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12156 | u32 changed) |
| 12157 | { |
| 12158 | int ret; |
| 12159 | |
| 12160 | vos_ssr_protect(__func__); |
| 12161 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12162 | vos_ssr_unprotect(__func__); |
| 12163 | |
| 12164 | return ret; |
| 12165 | } |
| 12166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12167 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12168 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12169 | * This function is used to set the txpower |
| 12170 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12171 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12172 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12173 | struct wireless_dev *wdev, |
| 12174 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12175 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12176 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12177 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12178 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12179 | #endif |
| 12180 | int dbm) |
| 12181 | { |
| 12182 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12183 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12184 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12185 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12186 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12187 | |
| 12188 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12189 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12190 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12191 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12192 | status = wlan_hdd_validate_context(pHddCtx); |
| 12193 | |
| 12194 | if (0 != status) |
| 12195 | { |
| 12196 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12197 | "%s: HDD context is not valid", __func__); |
| 12198 | return status; |
| 12199 | } |
| 12200 | |
| 12201 | hHal = pHddCtx->hHal; |
| 12202 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12203 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12204 | dbm, ccmCfgSetCallback, |
| 12205 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12206 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12208 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12209 | return -EIO; |
| 12210 | } |
| 12211 | |
| 12212 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12213 | dbm); |
| 12214 | |
| 12215 | switch(type) |
| 12216 | { |
| 12217 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12218 | /* Fall through */ |
| 12219 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12220 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12221 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12222 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12223 | __func__); |
| 12224 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12225 | } |
| 12226 | break; |
| 12227 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12228 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12229 | __func__); |
| 12230 | return -EOPNOTSUPP; |
| 12231 | break; |
| 12232 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12233 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12234 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12235 | return -EIO; |
| 12236 | } |
| 12237 | |
| 12238 | return 0; |
| 12239 | } |
| 12240 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12241 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12242 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12243 | struct wireless_dev *wdev, |
| 12244 | #endif |
| 12245 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12246 | enum tx_power_setting type, |
| 12247 | #else |
| 12248 | enum nl80211_tx_power_setting type, |
| 12249 | #endif |
| 12250 | int dbm) |
| 12251 | { |
| 12252 | int ret; |
| 12253 | vos_ssr_protect(__func__); |
| 12254 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12255 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12256 | wdev, |
| 12257 | #endif |
| 12258 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12259 | type, |
| 12260 | #else |
| 12261 | type, |
| 12262 | #endif |
| 12263 | dbm); |
| 12264 | vos_ssr_unprotect(__func__); |
| 12265 | |
| 12266 | return ret; |
| 12267 | } |
| 12268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12270 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12271 | * This function is used to read the txpower |
| 12272 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12273 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12274 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12275 | struct wireless_dev *wdev, |
| 12276 | #endif |
| 12277 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12278 | { |
| 12279 | |
| 12280 | hdd_adapter_t *pAdapter; |
| 12281 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12282 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12283 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12284 | ENTER(); |
| 12285 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12286 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12287 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12288 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12289 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12290 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12291 | "%s: HDD context is not valid", __func__); |
| 12292 | *dbm = 0; |
| 12293 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12294 | } |
| 12295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12296 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12297 | if (NULL == pAdapter) |
| 12298 | { |
| 12299 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 12300 | return -ENOENT; |
| 12301 | } |
| 12302 | |
| 12303 | wlan_hdd_get_classAstats(pAdapter); |
| 12304 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 12305 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12306 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12307 | return 0; |
| 12308 | } |
| 12309 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12310 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 12311 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12312 | struct wireless_dev *wdev, |
| 12313 | #endif |
| 12314 | int *dbm) |
| 12315 | { |
| 12316 | int ret; |
| 12317 | |
| 12318 | vos_ssr_protect(__func__); |
| 12319 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 12320 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12321 | wdev, |
| 12322 | #endif |
| 12323 | dbm); |
| 12324 | vos_ssr_unprotect(__func__); |
| 12325 | |
| 12326 | return ret; |
| 12327 | } |
| 12328 | |
| 12329 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12330 | 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] | 12331 | u8* mac, struct station_info *sinfo) |
| 12332 | { |
| 12333 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 12334 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12335 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12336 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12337 | |
| 12338 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 12339 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12340 | |
| 12341 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 12342 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 12343 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 12344 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 12345 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 12346 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 12347 | tANI_U16 maxRate = 0; |
| 12348 | tANI_U16 myRate; |
| 12349 | tANI_U16 currentRate = 0; |
| 12350 | tANI_U8 maxSpeedMCS = 0; |
| 12351 | tANI_U8 maxMCSIdx = 0; |
| 12352 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12353 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 12354 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12355 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12356 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12357 | #ifdef WLAN_FEATURE_11AC |
| 12358 | tANI_U32 vht_mcs_map; |
| 12359 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 12360 | #endif /* WLAN_FEATURE_11AC */ |
| 12361 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12362 | ENTER(); |
| 12363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12364 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 12365 | (0 == ssidlen)) |
| 12366 | { |
| 12367 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 12368 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 12369 | /*To keep GUI happy*/ |
| 12370 | return 0; |
| 12371 | } |
| 12372 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 12373 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 12374 | { |
| 12375 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12376 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 12377 | return 0; |
| 12378 | } |
| 12379 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12380 | status = wlan_hdd_validate_context(pHddCtx); |
| 12381 | |
| 12382 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12383 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12384 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12385 | "%s: HDD context is not valid", __func__); |
| 12386 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12387 | } |
| 12388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12389 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 12390 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 12391 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 12392 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 12393 | wlan_hdd_get_station_stats(pAdapter); |
| 12394 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 12395 | |
| 12396 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12397 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 12398 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12399 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12400 | { |
| 12401 | rate_flags = pAdapter->maxRateFlags; |
| 12402 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12404 | //convert to the UI units of 100kbps |
| 12405 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 12406 | |
| 12407 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12408 | 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] | 12409 | sinfo->signal, |
| 12410 | pCfg->reportMaxLinkSpeed, |
| 12411 | myRate, |
| 12412 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12413 | (int) pCfg->linkSpeedRssiMid, |
| 12414 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12415 | (int) rate_flags, |
| 12416 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12417 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12418 | |
| 12419 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 12420 | { |
| 12421 | // we do not want to necessarily report the current speed |
| 12422 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 12423 | { |
| 12424 | // report the max possible speed |
| 12425 | rssidx = 0; |
| 12426 | } |
| 12427 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 12428 | { |
| 12429 | // report the max possible speed with RSSI scaling |
| 12430 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 12431 | { |
| 12432 | // report the max possible speed |
| 12433 | rssidx = 0; |
| 12434 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12435 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12436 | { |
| 12437 | // report middle speed |
| 12438 | rssidx = 1; |
| 12439 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12440 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 12441 | { |
| 12442 | // report middle speed |
| 12443 | rssidx = 2; |
| 12444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12445 | else |
| 12446 | { |
| 12447 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12448 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12449 | } |
| 12450 | } |
| 12451 | else |
| 12452 | { |
| 12453 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 12454 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12455 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 12456 | __func__, pCfg->reportMaxLinkSpeed); |
| 12457 | rssidx = 0; |
| 12458 | } |
| 12459 | |
| 12460 | maxRate = 0; |
| 12461 | |
| 12462 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12463 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 12464 | OperationalRates, &ORLeng)) |
| 12465 | { |
| 12466 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12467 | /*To keep GUI happy*/ |
| 12468 | return 0; |
| 12469 | } |
| 12470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12471 | for (i = 0; i < ORLeng; i++) |
| 12472 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12473 | 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] | 12474 | { |
| 12475 | /* Validate Rate Set */ |
| 12476 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 12477 | { |
| 12478 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 12479 | break; |
| 12480 | } |
| 12481 | } |
| 12482 | /* Update MAX rate */ |
| 12483 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 12484 | } |
| 12485 | |
| 12486 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12487 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 12488 | ExtendedRates, &ERLeng)) |
| 12489 | { |
| 12490 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12491 | /*To keep GUI happy*/ |
| 12492 | return 0; |
| 12493 | } |
| 12494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12495 | for (i = 0; i < ERLeng; i++) |
| 12496 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12497 | 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] | 12498 | { |
| 12499 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 12500 | { |
| 12501 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 12502 | break; |
| 12503 | } |
| 12504 | } |
| 12505 | /* Update MAX rate */ |
| 12506 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 12507 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12508 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 12509 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 12510 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 12511 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12512 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12514 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12515 | mode = 2; |
| 12516 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 12517 | mode = 1; |
| 12518 | else |
| 12519 | mode = 0; |
| 12520 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12521 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 12522 | MCSRates, &MCSLeng)) |
| 12523 | { |
| 12524 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12525 | /*To keep GUI happy*/ |
| 12526 | return 0; |
| 12527 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12528 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12529 | #ifdef WLAN_FEATURE_11AC |
| 12530 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12531 | 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] | 12532 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12533 | 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] | 12534 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12535 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12536 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12537 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12538 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12539 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12540 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12541 | maxMCSIdx = 7; |
| 12542 | } |
| 12543 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 12544 | { |
| 12545 | maxMCSIdx = 8; |
| 12546 | } |
| 12547 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 12548 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12549 | //VHT20 is supporting 0~8 |
| 12550 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12551 | maxMCSIdx = 8; |
| 12552 | else |
| 12553 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12554 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12555 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12556 | if (0 != rssidx)/*check for scaled */ |
| 12557 | { |
| 12558 | //get middle rate MCS index if rssi=1/2 |
| 12559 | for (i=0; i <= maxMCSIdx; i++) |
| 12560 | { |
| 12561 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12562 | { |
| 12563 | maxMCSIdx = i; |
| 12564 | break; |
| 12565 | } |
| 12566 | } |
| 12567 | } |
| 12568 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12569 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12570 | { |
| 12571 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 12572 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 12573 | } |
| 12574 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 12575 | { |
| 12576 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 12577 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 12578 | } |
| 12579 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12580 | { |
| 12581 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 12582 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 12583 | } |
| 12584 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12585 | maxSpeedMCS = 1; |
| 12586 | if (currentRate > maxRate) |
| 12587 | { |
| 12588 | maxRate = currentRate; |
| 12589 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12590 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12591 | } |
| 12592 | else |
| 12593 | #endif /* WLAN_FEATURE_11AC */ |
| 12594 | { |
| 12595 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12596 | { |
| 12597 | rateFlag |= 1; |
| 12598 | } |
| 12599 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12600 | { |
| 12601 | rateFlag |= 2; |
| 12602 | } |
| 12603 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 12604 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12605 | if (rssidx == 1 || rssidx == 2) |
| 12606 | { |
| 12607 | //get middle rate MCS index if rssi=1/2 |
| 12608 | for (i=0; i <= 7; i++) |
| 12609 | { |
| 12610 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12611 | { |
| 12612 | temp = i+1; |
| 12613 | break; |
| 12614 | } |
| 12615 | } |
| 12616 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12617 | |
| 12618 | for (i = 0; i < MCSLeng; i++) |
| 12619 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12620 | for (j = 0; j < temp; j++) |
| 12621 | { |
| 12622 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 12623 | { |
| 12624 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 12625 | break; |
| 12626 | } |
| 12627 | } |
| 12628 | if ((j < temp) && (currentRate > maxRate)) |
| 12629 | { |
| 12630 | maxRate = currentRate; |
| 12631 | maxSpeedMCS = 1; |
| 12632 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 12633 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12634 | } |
| 12635 | } |
| 12636 | } |
| 12637 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12638 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 12639 | { |
| 12640 | maxRate = myRate; |
| 12641 | maxSpeedMCS = 1; |
| 12642 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 12643 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12644 | // 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] | 12645 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12646 | { |
| 12647 | maxRate = myRate; |
| 12648 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 12649 | { |
| 12650 | maxSpeedMCS = 0; |
| 12651 | } |
| 12652 | else |
| 12653 | { |
| 12654 | maxSpeedMCS = 1; |
| 12655 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 12656 | } |
| 12657 | } |
| 12658 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12659 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12660 | { |
| 12661 | sinfo->txrate.legacy = maxRate; |
| 12662 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12663 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 12664 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12665 | } |
| 12666 | else |
| 12667 | { |
| 12668 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12669 | #ifdef WLAN_FEATURE_11AC |
| 12670 | sinfo->txrate.nss = 1; |
| 12671 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12672 | { |
| 12673 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12674 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12675 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12676 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12677 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12678 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12679 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12680 | } |
| 12681 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12682 | { |
| 12683 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12684 | } |
| 12685 | #endif /* WLAN_FEATURE_11AC */ |
| 12686 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 12687 | { |
| 12688 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 12689 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12690 | { |
| 12691 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12692 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12694 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12695 | { |
| 12696 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 12697 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12698 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12699 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12700 | pr_info("Reporting MCS rate %d flags %x\n", |
| 12701 | sinfo->txrate.mcs, |
| 12702 | sinfo->txrate.flags ); |
| 12703 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12704 | } |
| 12705 | } |
| 12706 | else |
| 12707 | { |
| 12708 | // report current rate instead of max rate |
| 12709 | |
| 12710 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 12711 | { |
| 12712 | //provide to the UI in units of 100kbps |
| 12713 | sinfo->txrate.legacy = myRate; |
| 12714 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12715 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 12716 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12717 | } |
| 12718 | else |
| 12719 | { |
| 12720 | //must be MCS |
| 12721 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12722 | #ifdef WLAN_FEATURE_11AC |
| 12723 | sinfo->txrate.nss = 1; |
| 12724 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12725 | { |
| 12726 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 12727 | } |
| 12728 | else |
| 12729 | #endif /* WLAN_FEATURE_11AC */ |
| 12730 | { |
| 12731 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 12732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12733 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12734 | { |
| 12735 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 12736 | } |
| 12737 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12738 | { |
| 12739 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 12740 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12741 | #ifdef WLAN_FEATURE_11AC |
| 12742 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12743 | { |
| 12744 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 12745 | } |
| 12746 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12747 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 12748 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 12749 | sinfo->txrate.mcs, |
| 12750 | sinfo->txrate.flags ); |
| 12751 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12752 | } |
| 12753 | } |
| 12754 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 12755 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 12756 | sinfo->tx_packets = |
| 12757 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 12758 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 12759 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 12760 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 12761 | |
| 12762 | sinfo->tx_retries = |
| 12763 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 12764 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 12765 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 12766 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 12767 | |
| 12768 | sinfo->tx_failed = |
| 12769 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 12770 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 12771 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 12772 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 12773 | |
| 12774 | sinfo->filled |= |
| 12775 | STATION_INFO_TX_PACKETS | |
| 12776 | STATION_INFO_TX_RETRIES | |
| 12777 | STATION_INFO_TX_FAILED; |
| 12778 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12779 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12780 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 12781 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 12782 | EXIT(); |
| 12783 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12784 | } |
| 12785 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12786 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 12787 | u8* mac, struct station_info *sinfo) |
| 12788 | { |
| 12789 | int ret; |
| 12790 | |
| 12791 | vos_ssr_protect(__func__); |
| 12792 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 12793 | vos_ssr_unprotect(__func__); |
| 12794 | |
| 12795 | return ret; |
| 12796 | } |
| 12797 | |
| 12798 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 12799 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12800 | { |
| 12801 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12802 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12803 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12804 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12805 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12806 | ENTER(); |
| 12807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12808 | if (NULL == pAdapter) |
| 12809 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12810 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12811 | return -ENODEV; |
| 12812 | } |
| 12813 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12814 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12815 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 12816 | pAdapter->sessionId, timeout)); |
| 12817 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12818 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12819 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12820 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12821 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12822 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12823 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12824 | "%s: HDD context is not valid", __func__); |
| 12825 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12826 | } |
| 12827 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12828 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 12829 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 12830 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 12831 | (eConnectionState_Associated == |
| 12832 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 12833 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 12834 | |
| 12835 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12836 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 12837 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12838 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 12839 | { |
| 12840 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12841 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 12842 | __func__, vos_status); |
| 12843 | } |
| 12844 | } |
| 12845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12846 | /**The get power cmd from the supplicant gets updated by the nl only |
| 12847 | *on successful execution of the function call |
| 12848 | *we are oppositely mapped w.r.t mode in the driver |
| 12849 | **/ |
| 12850 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 12851 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12852 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12853 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 12854 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12855 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12856 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12857 | return -EINVAL; |
| 12858 | } |
| 12859 | return 0; |
| 12860 | } |
| 12861 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12862 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 12863 | struct net_device *dev, bool mode, int timeout) |
| 12864 | { |
| 12865 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12866 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12867 | vos_ssr_protect(__func__); |
| 12868 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 12869 | vos_ssr_unprotect(__func__); |
| 12870 | |
| 12871 | return ret; |
| 12872 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12873 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12874 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 12875 | struct net_device *netdev, |
| 12876 | u8 key_index) |
| 12877 | { |
| 12878 | ENTER(); |
| 12879 | return 0; |
| 12880 | } |
| 12881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12882 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12883 | struct net_device *netdev, |
| 12884 | u8 key_index) |
| 12885 | { |
| 12886 | int ret; |
| 12887 | vos_ssr_protect(__func__); |
| 12888 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 12889 | vos_ssr_unprotect(__func__); |
| 12890 | return ret; |
| 12891 | } |
| 12892 | #endif //LINUX_VERSION_CODE |
| 12893 | |
| 12894 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 12895 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12896 | struct net_device *dev, |
| 12897 | struct ieee80211_txq_params *params) |
| 12898 | { |
| 12899 | ENTER(); |
| 12900 | return 0; |
| 12901 | } |
| 12902 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12903 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12904 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12905 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12906 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12907 | return 0; |
| 12908 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12909 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12910 | |
| 12911 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 12912 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12913 | struct net_device *dev, |
| 12914 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12915 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12916 | int ret; |
| 12917 | |
| 12918 | vos_ssr_protect(__func__); |
| 12919 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 12920 | vos_ssr_unprotect(__func__); |
| 12921 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12922 | } |
| 12923 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12924 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 12925 | struct ieee80211_txq_params *params) |
| 12926 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12927 | int ret; |
| 12928 | |
| 12929 | vos_ssr_protect(__func__); |
| 12930 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 12931 | vos_ssr_unprotect(__func__); |
| 12932 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12933 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12934 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12935 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 12936 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 12937 | struct net_device *dev, |
| 12938 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | { |
| 12940 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12941 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12942 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12943 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 12944 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12945 | v_CONTEXT_t pVosContext = NULL; |
| 12946 | ptSapContext pSapCtx = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12947 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12948 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12949 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12951 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12952 | return -EINVAL; |
| 12953 | } |
| 12954 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12955 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12956 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 12957 | pAdapter->sessionId, pAdapter->device_mode)); |
| 12958 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12959 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12960 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12961 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12962 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12963 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12964 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12965 | "%s: HDD context is not valid", __func__); |
| 12966 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12967 | } |
| 12968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12969 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12970 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12971 | ) |
| 12972 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12973 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 12974 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 12975 | if(pSapCtx == NULL){ |
| 12976 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12977 | FL("psapCtx is NULL")); |
| 12978 | return -ENOENT; |
| 12979 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 12980 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12981 | { |
| 12982 | v_U16_t i; |
| 12983 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 12984 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12985 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 12986 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12987 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 12988 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12989 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 12990 | ETHER_ADDR_LEN); |
| 12991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12992 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12993 | "%s: Delete STA with MAC::" |
| 12994 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 12995 | __func__, |
| 12996 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 12997 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 12998 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12999 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13000 | } |
| 13001 | } |
| 13002 | } |
| 13003 | else |
| 13004 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13005 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13006 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13007 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13008 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13009 | { |
| 13010 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13011 | "%s: Skip this DEL STA as this is not used::" |
| 13012 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13013 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13014 | return -ENOENT; |
| 13015 | } |
| 13016 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13017 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13018 | { |
| 13019 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13020 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13021 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13022 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13023 | return -ENOENT; |
| 13024 | } |
| 13025 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13026 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13027 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13028 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13029 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13030 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13031 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13032 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13033 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13034 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13035 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13036 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13037 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13038 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13039 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13040 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13041 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13042 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13043 | return -ENOENT; |
| 13044 | } |
| 13045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13046 | } |
| 13047 | } |
| 13048 | |
| 13049 | EXIT(); |
| 13050 | |
| 13051 | return 0; |
| 13052 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13053 | |
| 13054 | #ifdef CFG80211_DEL_STA_V2 |
| 13055 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13056 | struct net_device *dev, |
| 13057 | struct station_del_parameters *param) |
| 13058 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13059 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13060 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13061 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13062 | { |
| 13063 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13064 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13065 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13066 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13067 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13068 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13069 | if (NULL == param) { |
| 13070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13071 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13072 | return -EINVAL; |
| 13073 | } |
| 13074 | |
| 13075 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13076 | param->subtype, &delStaParams); |
| 13077 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13078 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13079 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13080 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13081 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13082 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13083 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13084 | vos_ssr_unprotect(__func__); |
| 13085 | |
| 13086 | return ret; |
| 13087 | } |
| 13088 | |
| 13089 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13090 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13091 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13092 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13093 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13094 | #ifdef FEATURE_WLAN_TDLS |
| 13095 | u32 mask, set; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13096 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13097 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13098 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13099 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13100 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13101 | mask = params->sta_flags_mask; |
| 13102 | |
| 13103 | set = params->sta_flags_set; |
| 13104 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13105 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 13106 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13107 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13108 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 13109 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13110 | |
| 13111 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13112 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13113 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13114 | } |
| 13115 | } |
| 13116 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13117 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | } |
| 13119 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13120 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13121 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13122 | { |
| 13123 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13124 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13125 | vos_ssr_protect(__func__); |
| 13126 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13127 | vos_ssr_unprotect(__func__); |
| 13128 | |
| 13129 | return ret; |
| 13130 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13131 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13132 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13133 | 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] | 13134 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13135 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13136 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13137 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13138 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13139 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13140 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13141 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13142 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13143 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13144 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13145 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13146 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13147 | return -EINVAL; |
| 13148 | } |
| 13149 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13150 | if (!pmksa) { |
| 13151 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13152 | return -EINVAL; |
| 13153 | } |
| 13154 | |
| 13155 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13156 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13157 | pmksa->bssid, pmksa->pmkid); |
| 13158 | return -EINVAL; |
| 13159 | } |
| 13160 | |
| 13161 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13162 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13163 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13164 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13165 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13166 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13167 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13168 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13169 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13170 | "%s: HDD context is not valid", __func__); |
| 13171 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13172 | } |
| 13173 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13174 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13175 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13176 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13177 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13178 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13179 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13180 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13181 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13182 | &pmk_id, 1, FALSE); |
| 13183 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13184 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13185 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13186 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13187 | |
| 13188 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13189 | } |
| 13190 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13191 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13192 | struct cfg80211_pmksa *pmksa) |
| 13193 | { |
| 13194 | int ret; |
| 13195 | |
| 13196 | vos_ssr_protect(__func__); |
| 13197 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13198 | vos_ssr_unprotect(__func__); |
| 13199 | |
| 13200 | return ret; |
| 13201 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13202 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13203 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13204 | 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] | 13205 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13206 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13207 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13208 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13209 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13210 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13211 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13212 | /* Validate pAdapter */ |
| 13213 | if (NULL == pAdapter) |
| 13214 | { |
| 13215 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13216 | return -EINVAL; |
| 13217 | } |
| 13218 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13219 | if (!pmksa) { |
| 13220 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13221 | return -EINVAL; |
| 13222 | } |
| 13223 | |
| 13224 | if (!pmksa->bssid) { |
| 13225 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13226 | return -EINVAL; |
| 13227 | } |
| 13228 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13229 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13230 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13231 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13232 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13233 | status = wlan_hdd_validate_context(pHddCtx); |
| 13234 | |
| 13235 | if (0 != status) |
| 13236 | { |
| 13237 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13238 | "%s: HDD context is not valid", __func__); |
| 13239 | return status; |
| 13240 | } |
| 13241 | |
| 13242 | /*Retrieve halHandle*/ |
| 13243 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13244 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13245 | /* Delete the PMKID CSR cache */ |
| 13246 | if (eHAL_STATUS_SUCCESS != |
| 13247 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13248 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13249 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13250 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13251 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13252 | } |
| 13253 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13254 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13255 | } |
| 13256 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13257 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13258 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13259 | struct cfg80211_pmksa *pmksa) |
| 13260 | { |
| 13261 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13262 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13263 | vos_ssr_protect(__func__); |
| 13264 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 13265 | vos_ssr_unprotect(__func__); |
| 13266 | |
| 13267 | return ret; |
| 13268 | |
| 13269 | } |
| 13270 | |
| 13271 | 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] | 13272 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13273 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13274 | tHalHandle halHandle; |
| 13275 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13276 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13277 | |
| 13278 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 13279 | |
| 13280 | /* Validate pAdapter */ |
| 13281 | if (NULL == pAdapter) |
| 13282 | { |
| 13283 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13284 | "%s: Invalid Adapter" ,__func__); |
| 13285 | return -EINVAL; |
| 13286 | } |
| 13287 | |
| 13288 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13289 | status = wlan_hdd_validate_context(pHddCtx); |
| 13290 | |
| 13291 | if (0 != status) |
| 13292 | { |
| 13293 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13294 | "%s: HDD context is not valid", __func__); |
| 13295 | return status; |
| 13296 | } |
| 13297 | |
| 13298 | /*Retrieve halHandle*/ |
| 13299 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13300 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13301 | /* Flush the PMKID cache in CSR */ |
| 13302 | if (eHAL_STATUS_SUCCESS != |
| 13303 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 13304 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 13305 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13306 | } |
| 13307 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13308 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13309 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13310 | |
| 13311 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 13312 | { |
| 13313 | int ret; |
| 13314 | |
| 13315 | vos_ssr_protect(__func__); |
| 13316 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 13317 | vos_ssr_unprotect(__func__); |
| 13318 | |
| 13319 | return ret; |
| 13320 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13321 | #endif |
| 13322 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13323 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13324 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13325 | struct net_device *dev, |
| 13326 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13327 | { |
| 13328 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13329 | hdd_station_ctx_t *pHddStaCtx; |
| 13330 | |
| 13331 | if (NULL == pAdapter) |
| 13332 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13333 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13334 | return -ENODEV; |
| 13335 | } |
| 13336 | |
| 13337 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13338 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13339 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13340 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 13341 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13342 | // Added for debug on reception of Re-assoc Req. |
| 13343 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 13344 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13345 | 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] | 13346 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13347 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13348 | } |
| 13349 | |
| 13350 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13351 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13352 | ftie->ie_len); |
| 13353 | #endif |
| 13354 | |
| 13355 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13356 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 13357 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13358 | ftie->ie_len); |
| 13359 | return 0; |
| 13360 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13361 | |
| 13362 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13363 | struct net_device *dev, |
| 13364 | struct cfg80211_update_ft_ies_params *ftie) |
| 13365 | { |
| 13366 | int ret; |
| 13367 | |
| 13368 | vos_ssr_protect(__func__); |
| 13369 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 13370 | vos_ssr_unprotect(__func__); |
| 13371 | |
| 13372 | return ret; |
| 13373 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13374 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13375 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13376 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 13377 | |
| 13378 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 13379 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 13380 | { |
| 13381 | int ret; |
| 13382 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 13383 | hdd_context_t *pHddCtx; |
| 13384 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13385 | ENTER(); |
| 13386 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13387 | if (NULL == pAdapter) |
| 13388 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13389 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13390 | "%s: HDD adapter is Null", __func__); |
| 13391 | return ; |
| 13392 | } |
| 13393 | |
| 13394 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13395 | if (NULL == pHddCtx) |
| 13396 | { |
| 13397 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13398 | "%s: HDD context is Null!!!", __func__); |
| 13399 | return ; |
| 13400 | } |
| 13401 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13402 | spin_lock(&pHddCtx->schedScan_lock); |
| 13403 | if (TRUE == pHddCtx->isWiphySuspended) |
| 13404 | { |
| 13405 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 13406 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13407 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13408 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 13409 | return ; |
| 13410 | } |
| 13411 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13412 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13413 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 13414 | |
| 13415 | if (0 > ret) |
| 13416 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 13417 | |
| 13418 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13419 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13420 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13421 | } |
| 13422 | |
| 13423 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13424 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13425 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13426 | */ |
| 13427 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 13428 | { |
| 13429 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 13430 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13431 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13432 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13433 | int status = 0; |
| 13434 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 13435 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13436 | /* The current firmware design does not allow PNO during any |
| 13437 | * active sessions. Hence, determine the active sessions |
| 13438 | * and return a failure. |
| 13439 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13440 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 13441 | { |
| 13442 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13443 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13444 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13445 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 13446 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 13447 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 13448 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 13449 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 13450 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13451 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13452 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13453 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13454 | } |
| 13455 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 13456 | pAdapterNode = pNext; |
| 13457 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13458 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13459 | } |
| 13460 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13461 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 13462 | { |
| 13463 | hdd_adapter_t *pAdapter = callbackContext; |
| 13464 | hdd_context_t *pHddCtx; |
| 13465 | |
| 13466 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 13467 | { |
| 13468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13469 | FL("Invalid adapter or adapter has invalid magic")); |
| 13470 | return; |
| 13471 | } |
| 13472 | |
| 13473 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13474 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 13475 | { |
| 13476 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13477 | FL("HDD context is not valid")); |
| 13478 | return; |
| 13479 | } |
| 13480 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 13481 | if (VOS_STATUS_SUCCESS != status) |
| 13482 | { |
| 13483 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13484 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 13485 | pHddCtx->isPnoEnable = FALSE; |
| 13486 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13487 | |
| 13488 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 13489 | complete(&pAdapter->pno_comp_var); |
| 13490 | } |
| 13491 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13492 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13493 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 13494 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13495 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13496 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13497 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 13498 | { |
| 13499 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13500 | tpSirPNOScanReq pPnoRequest = NULL; |
| 13501 | hdd_context_t *pHddCtx; |
| 13502 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 13503 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 13504 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 13505 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13506 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 13507 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13508 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13509 | hdd_config_t *pConfig = NULL; |
| 13510 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13511 | |
| 13512 | if (NULL == pAdapter) |
| 13513 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13514 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13515 | "%s: HDD adapter is Null", __func__); |
| 13516 | return -ENODEV; |
| 13517 | } |
| 13518 | |
| 13519 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13520 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13521 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13522 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13523 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13524 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13525 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13526 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13527 | } |
| 13528 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13529 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13530 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13531 | if (NULL == hHal) |
| 13532 | { |
| 13533 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13534 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13535 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13536 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 13537 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 13538 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 13539 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 13540 | { |
| 13541 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13542 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 13543 | return -EBUSY; |
| 13544 | } |
| 13545 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13546 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13547 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13549 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13550 | return -EBUSY; |
| 13551 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13552 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13553 | if (TRUE == pHddCtx->isPnoEnable) |
| 13554 | { |
| 13555 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13556 | FL("already PNO is enabled")); |
| 13557 | return -EBUSY; |
| 13558 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 13559 | |
| 13560 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 13561 | { |
| 13562 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13563 | "%s: abort ROC failed ", __func__); |
| 13564 | return -EBUSY; |
| 13565 | } |
| 13566 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13567 | pHddCtx->isPnoEnable = TRUE; |
| 13568 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13569 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 13570 | if (NULL == pPnoRequest) |
| 13571 | { |
| 13572 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13573 | "%s: vos_mem_malloc failed", __func__); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13574 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13575 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13576 | } |
| 13577 | |
Madan Mohan Koyyalamudi | c3f0435 | 2013-09-26 19:21:48 +0530 | [diff] [blame] | 13578 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13579 | pPnoRequest->enable = 1; /*Enable PNO */ |
| 13580 | pPnoRequest->ucNetworksCount = request->n_match_sets; |
| 13581 | |
| 13582 | if (( !pPnoRequest->ucNetworksCount ) || |
| 13583 | ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 13584 | { |
| 13585 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 13586 | "%s: Network input is not correct %d Max Network supported is %d", |
| 13587 | __func__, pPnoRequest->ucNetworksCount, |
| 13588 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13589 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13590 | goto error; |
| 13591 | } |
| 13592 | |
| 13593 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 13594 | { |
| 13595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13596 | "%s: Incorrect number of channels %d", |
| 13597 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13598 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13599 | goto error; |
| 13600 | } |
| 13601 | |
| 13602 | /* Framework provides one set of channels(all) |
| 13603 | * common for all saved profile */ |
| 13604 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 13605 | channels_allowed, &num_channels_allowed)) |
| 13606 | { |
| 13607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13608 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13609 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13610 | goto error; |
| 13611 | } |
| 13612 | /* Checking each channel against allowed channel list */ |
| 13613 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13614 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13615 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13616 | char chList [(request->n_channels*5)+1]; |
| 13617 | int len; |
| 13618 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13619 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13620 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13621 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13622 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 13623 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13624 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 13625 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 13626 | { |
| 13627 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13628 | "%s : Dropping DFS channel : %d", |
| 13629 | __func__,channels_allowed[indx]); |
| 13630 | num_ignore_dfs_ch++; |
| 13631 | break; |
| 13632 | } |
| 13633 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13634 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 13635 | len += snprintf(chList+len, 5, "%d ", |
| 13636 | request->channels[i]->hw_value); |
| 13637 | break ; |
| 13638 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13639 | } |
| 13640 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13641 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13642 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13643 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 13644 | if (num_ignore_dfs_ch == request->n_channels) |
| 13645 | { |
| 13646 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13647 | "%s : All requested channels are DFS channels", __func__); |
| 13648 | ret = -EINVAL; |
| 13649 | goto error; |
| 13650 | } |
| 13651 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13652 | /* Filling per profile params */ |
| 13653 | for (i = 0; i < pPnoRequest->ucNetworksCount; i++) |
| 13654 | { |
| 13655 | pPnoRequest->aNetworks[i].ssId.length = |
| 13656 | request->match_sets[i].ssid.ssid_len; |
| 13657 | |
| 13658 | if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) || |
| 13659 | ( pPnoRequest->aNetworks[i].ssId.length > 32 ) ) |
| 13660 | { |
| 13661 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13662 | "%s: SSID Len %d is not correct for network %d", |
| 13663 | __func__, pPnoRequest->aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13664 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13665 | goto error; |
| 13666 | } |
| 13667 | |
| 13668 | memcpy(pPnoRequest->aNetworks[i].ssId.ssId, |
| 13669 | request->match_sets[i].ssid.ssid, |
| 13670 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 13671 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13672 | "%s: SSID of network %d is %s ", __func__, |
| 13673 | i, pPnoRequest->aNetworks[i].ssId.ssId); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13674 | pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 13675 | pPnoRequest->aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 13676 | pPnoRequest->aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
| 13677 | |
| 13678 | /*Copying list of valid channel into request */ |
| 13679 | memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch); |
| 13680 | pPnoRequest->aNetworks[i].ucChannelCount = num_ch; |
| 13681 | |
| 13682 | pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value |
| 13683 | } |
| 13684 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 13685 | for (i = 0; i < request->n_ssids; i++) |
| 13686 | { |
| 13687 | j = 0; |
| 13688 | while (j < pPnoRequest->ucNetworksCount) |
| 13689 | { |
| 13690 | if ((pPnoRequest->aNetworks[j].ssId.length == |
| 13691 | request->ssids[i].ssid_len) && |
| 13692 | (0 == memcmp(pPnoRequest->aNetworks[j].ssId.ssId, |
| 13693 | request->ssids[i].ssid, |
| 13694 | pPnoRequest->aNetworks[j].ssId.length))) |
| 13695 | { |
| 13696 | pPnoRequest->aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
| 13697 | break; |
| 13698 | } |
| 13699 | j++; |
| 13700 | } |
| 13701 | } |
| 13702 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13703 | "Number of hidden networks being Configured = %d", |
| 13704 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 13705 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 13706 | "request->ie_len = %zu", request->ie_len); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 13707 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 13708 | { |
| 13709 | pPnoRequest->us24GProbeTemplateLen = request->ie_len; |
| 13710 | memcpy(&pPnoRequest->p24GProbeTemplate, request->ie, |
| 13711 | pPnoRequest->us24GProbeTemplateLen); |
| 13712 | |
| 13713 | pPnoRequest->us5GProbeTemplateLen = request->ie_len; |
| 13714 | memcpy(&pPnoRequest->p5GProbeTemplate, request->ie, |
| 13715 | pPnoRequest->us5GProbeTemplateLen); |
| 13716 | } |
| 13717 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 13718 | /* Driver gets only one time interval which is hardcoded in |
| 13719 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 13720 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 13721 | * 80,160,320 secs. And number of scan cycle for each timer |
| 13722 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 13723 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 13724 | * will be repeated after each interval specified by supplicant |
| 13725 | * till PNO is disabled. |
| 13726 | */ |
| 13727 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
| 13728 | pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 13729 | else |
| 13730 | pPnoRequest->scanTimers.ucScanTimersCount = |
| 13731 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 13732 | |
| 13733 | tempInterval = (request->interval)/1000; |
| 13734 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13735 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 13736 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
| 13737 | for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) |
| 13738 | { |
| 13739 | pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = |
| 13740 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
| 13741 | pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
| 13742 | tempInterval *= 2; |
| 13743 | } |
| 13744 | //Repeat last timer until pno disabled. |
| 13745 | pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
| 13746 | |
Madan Mohan Koyyalamudi | d206c7b | 2013-09-26 22:54:51 +0530 | [diff] [blame] | 13747 | pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13748 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13749 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 13750 | pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 13751 | pPnoRequest->callbackContext = pAdapter; |
| 13752 | pAdapter->pno_req_status = 0; |
| 13753 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13755 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
| 13756 | pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO, |
| 13757 | pPnoRequest->scanTimers.ucScanTimersCount); |
| 13758 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13759 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13760 | pPnoRequest, pAdapter->sessionId, |
| 13761 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 13762 | if (eHAL_STATUS_SUCCESS != status) |
| 13763 | { |
| 13764 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13765 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13766 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13767 | goto error; |
| 13768 | } |
| 13769 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13770 | ret = wait_for_completion_timeout( |
| 13771 | &pAdapter->pno_comp_var, |
| 13772 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 13773 | if (0 >= ret) |
| 13774 | { |
| 13775 | // Did not receive the response for PNO enable in time. |
| 13776 | // Assuming the PNO enable was success. |
| 13777 | // Returning error from here, because we timeout, results |
| 13778 | // in side effect of Wifi (Wifi Setting) not to work. |
| 13779 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13780 | FL("Timed out waiting for PNO to be Enabled")); |
| 13781 | ret = 0; |
| 13782 | goto error; |
| 13783 | } |
| 13784 | |
c_hpothu | 3c986b2 | 2014-07-09 14:45:09 +0530 | [diff] [blame] | 13785 | vos_mem_free(pPnoRequest); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13786 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13787 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13788 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13789 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13791 | FL("PNO scanRequest offloaded ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13792 | vos_mem_free(pPnoRequest); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13793 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13794 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13795 | } |
| 13796 | |
| 13797 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13798 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 13799 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13800 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13801 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 13802 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 13803 | { |
| 13804 | int ret; |
| 13805 | |
| 13806 | vos_ssr_protect(__func__); |
| 13807 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 13808 | vos_ssr_unprotect(__func__); |
| 13809 | |
| 13810 | return ret; |
| 13811 | } |
| 13812 | |
| 13813 | /* |
| 13814 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 13815 | * Function to disable PNO |
| 13816 | */ |
| 13817 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13818 | struct net_device *dev) |
| 13819 | { |
| 13820 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13821 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13822 | hdd_context_t *pHddCtx; |
| 13823 | tHalHandle hHal; |
| 13824 | tpSirPNOScanReq pPnoRequest = NULL; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13825 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13826 | |
| 13827 | ENTER(); |
| 13828 | |
| 13829 | if (NULL == pAdapter) |
| 13830 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13831 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13832 | "%s: HDD adapter is Null", __func__); |
| 13833 | return -ENODEV; |
| 13834 | } |
| 13835 | |
| 13836 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13837 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13838 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13839 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13840 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13841 | "%s: HDD context is Null", __func__); |
| 13842 | return -ENODEV; |
| 13843 | } |
| 13844 | |
| 13845 | /* The return 0 is intentional when isLogpInProgress and |
| 13846 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 13847 | * failure in sched_scan_stop , especially for a case where the unload |
| 13848 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 13849 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 13850 | * success. If it returns a failure , then its next invocation due to the |
| 13851 | * clean up of the second interface will have the dev pointer corresponding |
| 13852 | * to the first one leading to a crash. |
| 13853 | */ |
| 13854 | if (pHddCtx->isLogpInProgress) |
| 13855 | { |
| 13856 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13857 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 13858 | return ret; |
| 13859 | } |
| 13860 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 13861 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13862 | { |
| 13863 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13864 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 13865 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13866 | } |
| 13867 | |
| 13868 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13869 | if (NULL == hHal) |
| 13870 | { |
| 13871 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13872 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13873 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13874 | } |
| 13875 | |
| 13876 | pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq)); |
| 13877 | if (NULL == pPnoRequest) |
| 13878 | { |
| 13879 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13880 | "%s: vos_mem_malloc failed", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13881 | return -ENOMEM; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13882 | } |
| 13883 | |
| 13884 | memset(pPnoRequest, 0, sizeof (tSirPNOScanReq)); |
| 13885 | pPnoRequest->enable = 0; /* Disable PNO */ |
| 13886 | pPnoRequest->ucNetworksCount = 0; |
| 13887 | |
| 13888 | status = sme_SetPreferredNetworkList(hHal, pPnoRequest, |
| 13889 | pAdapter->sessionId, |
| 13890 | NULL, pAdapter); |
| 13891 | if (eHAL_STATUS_SUCCESS != status) |
| 13892 | { |
| 13893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13894 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13895 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13896 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13897 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13898 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13899 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13900 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13901 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13902 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13903 | vos_mem_free(pPnoRequest); |
| 13904 | |
| 13905 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13906 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13907 | } |
| 13908 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13909 | /* |
| 13910 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 13911 | * NL interface to disable PNO |
| 13912 | */ |
| 13913 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 13914 | struct net_device *dev) |
| 13915 | { |
| 13916 | int ret; |
| 13917 | |
| 13918 | vos_ssr_protect(__func__); |
| 13919 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 13920 | vos_ssr_unprotect(__func__); |
| 13921 | |
| 13922 | return ret; |
| 13923 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13924 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 13925 | |
| 13926 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13927 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13928 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13929 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13930 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13931 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 13932 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13933 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13934 | u8 *peer, u8 action_code, u8 dialog_token, |
| 13935 | u16 status_code, const u8 *buf, size_t len) |
| 13936 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13937 | { |
| 13938 | |
| 13939 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13940 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13941 | u8 peerMac[6]; |
| 13942 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13943 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 13944 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 13945 | long rc; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 13946 | #if !(TDLS_MGMT_VERSION2) |
| 13947 | u32 peer_capability = 0; |
| 13948 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 13949 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13950 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13951 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13952 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 13953 | pAdapter->sessionId, action_code)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13954 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13955 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13956 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13957 | "Invalid arguments"); |
| 13958 | return -EINVAL; |
| 13959 | } |
| 13960 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13961 | if (pHddCtx->isLogpInProgress) |
| 13962 | { |
| 13963 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13964 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13965 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 13966 | peer, |
| 13967 | eTDLS_LINK_IDLE, |
| 13968 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 13969 | return -EBUSY; |
| 13970 | } |
| 13971 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13972 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13973 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13974 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13975 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 13976 | MAC_ADDRESS_STR " action %d declined.", |
| 13977 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13978 | return -ENOTSUPP; |
| 13979 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 13980 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13981 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 13982 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 13983 | { |
| 13984 | /* if tdls_mode is disabled to respond to peer's request */ |
| 13985 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 13986 | { |
| 13987 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 13988 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13989 | " TDLS mode is disabled. action %d declined.", |
| 13990 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 13991 | |
| 13992 | return -ENOTSUPP; |
| 13993 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 13994 | |
| 13995 | if (vos_max_concurrent_connections_reached()) |
| 13996 | { |
| 13997 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 13998 | return -EINVAL; |
| 13999 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14000 | } |
| 14001 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14002 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14003 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14004 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14005 | { |
| 14006 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14007 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14008 | " TDLS setup is ongoing. action %d declined.", |
| 14009 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14010 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14011 | } |
| 14012 | } |
| 14013 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14014 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14015 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14016 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14017 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14018 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14019 | { |
| 14020 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14021 | we return error code at 'add_station()'. Hence we have this |
| 14022 | check again in addtion to add_station(). |
| 14023 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14024 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14025 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14026 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14027 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14028 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14029 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14030 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14031 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14032 | } |
| 14033 | else |
| 14034 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14035 | /* maximum reached. tweak to send error code to peer and return |
| 14036 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14037 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14038 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14039 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14040 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14041 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14042 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14043 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14044 | /* fall through to send setup resp with failure status |
| 14045 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14046 | } |
| 14047 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14048 | else |
| 14049 | { |
| 14050 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14051 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14052 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14053 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14054 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14055 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14056 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14057 | return -EPERM; |
| 14058 | } |
| 14059 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14060 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14061 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14062 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14063 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 14064 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14065 | "%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] | 14066 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14067 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14068 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14069 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14070 | /*Except teardown responder will not be used so just make 0*/ |
| 14071 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14072 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14073 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14074 | |
| 14075 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14076 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14077 | |
| 14078 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14079 | responder = pTdlsPeer->is_responder; |
| 14080 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14081 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14082 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14083 | "%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] | 14084 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14085 | dialog_token, status_code, len); |
| 14086 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14087 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14088 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14089 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14090 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14091 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14092 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14093 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14094 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14095 | { |
| 14096 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14097 | { |
| 14098 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14099 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14100 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14101 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14102 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 14103 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14104 | } |
| 14105 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14106 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14107 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14108 | { |
| 14109 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14110 | "%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] | 14111 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14112 | return -EBUSY; |
| 14113 | } |
| 14114 | |
| 14115 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14116 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14117 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14118 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14119 | 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] | 14120 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14121 | if (VOS_STATUS_SUCCESS != status) |
| 14122 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14124 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14125 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14126 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14127 | return -EINVAL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14128 | } |
| 14129 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14130 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14131 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14132 | |
| 14133 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14134 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14135 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14136 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14137 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14138 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14139 | |
| 14140 | if (pHddCtx->isLogpInProgress) |
| 14141 | { |
| 14142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14143 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14144 | return -EAGAIN; |
| 14145 | } |
| 14146 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14147 | wlan_hdd_tdls_check_bmps(pAdapter); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14148 | return -EINVAL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14149 | } |
| 14150 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14151 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14152 | { |
| 14153 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14154 | return max_sta_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14155 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14156 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14157 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14158 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14159 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14160 | } |
| 14161 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14162 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14163 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14164 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14165 | |
| 14166 | return 0; |
| 14167 | } |
| 14168 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14169 | #if TDLS_MGMT_VERSION2 |
| 14170 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14171 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14172 | u16 status_code, u32 peer_capability, |
| 14173 | const u8 *buf, size_t len) |
| 14174 | #else |
| 14175 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14176 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14177 | u16 status_code, const u8 *buf, size_t len) |
| 14178 | #endif |
| 14179 | { |
| 14180 | int ret; |
| 14181 | |
| 14182 | vos_ssr_protect(__func__); |
| 14183 | #if TDLS_MGMT_VERSION2 |
| 14184 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14185 | status_code, peer_capability, buf, len); |
| 14186 | #else |
| 14187 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14188 | status_code, buf, len); |
| 14189 | #endif |
| 14190 | vos_ssr_unprotect(__func__); |
| 14191 | |
| 14192 | return ret; |
| 14193 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14194 | |
| 14195 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 14196 | u8 *peer, |
| 14197 | cfg80211_exttdls_callback callback) |
| 14198 | { |
| 14199 | |
| 14200 | hddTdlsPeer_t *pTdlsPeer; |
| 14201 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14202 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14203 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 14204 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14205 | |
| 14206 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14207 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14208 | |
| 14209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14210 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 14211 | __func__); |
| 14212 | return -ENOTSUPP; |
| 14213 | } |
| 14214 | |
| 14215 | /* To cater the requirement of establishing the TDLS link |
| 14216 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 14217 | */ |
| 14218 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 14219 | if (pTdlsPeer == NULL) { |
| 14220 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14221 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 14222 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14223 | return -EINVAL; |
| 14224 | } |
| 14225 | |
| 14226 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 14227 | |
| 14228 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14229 | " %s TDLS Add Force Peer Failed", |
| 14230 | __func__); |
| 14231 | return -EINVAL; |
| 14232 | } |
| 14233 | /*EXT TDLS*/ |
| 14234 | |
| 14235 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 14236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14237 | " %s TDLS set callback Failed", |
| 14238 | __func__); |
| 14239 | return -EINVAL; |
| 14240 | } |
| 14241 | |
| 14242 | return(0); |
| 14243 | |
| 14244 | } |
| 14245 | |
| 14246 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 14247 | { |
| 14248 | |
| 14249 | hddTdlsPeer_t *pTdlsPeer; |
| 14250 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14251 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14252 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 14253 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14254 | |
| 14255 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14256 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14257 | |
| 14258 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14259 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 14260 | __func__); |
| 14261 | return -ENOTSUPP; |
| 14262 | } |
| 14263 | |
| 14264 | |
| 14265 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 14266 | |
| 14267 | if ( NULL == pTdlsPeer ) { |
| 14268 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 14269 | " peer not exsting", |
| 14270 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14271 | return -EINVAL; |
| 14272 | } |
| 14273 | else { |
| 14274 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 14275 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 14276 | } |
| 14277 | |
| 14278 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 14279 | return -EINVAL; |
| 14280 | |
| 14281 | /*EXT TDLS*/ |
| 14282 | |
| 14283 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 14284 | |
| 14285 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14286 | " %s TDLS set callback Failed", |
| 14287 | __func__); |
| 14288 | return -EINVAL; |
| 14289 | } |
| 14290 | return(0); |
| 14291 | |
| 14292 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14293 | 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] | 14294 | u8 *peer, enum nl80211_tdls_operation oper) |
| 14295 | { |
| 14296 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14297 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14298 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14299 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14300 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14301 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14302 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 14303 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14304 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14305 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14306 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14307 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14308 | return -EINVAL; |
| 14309 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14310 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14311 | status = wlan_hdd_validate_context(pHddCtx); |
| 14312 | |
| 14313 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14314 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14315 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14316 | "%s: HDD context is not valid", __func__); |
| 14317 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14318 | } |
| 14319 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14320 | |
| 14321 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14322 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14323 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14324 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14325 | "TDLS Disabled in INI OR not enabled in FW. " |
| 14326 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14327 | return -ENOTSUPP; |
| 14328 | } |
| 14329 | |
| 14330 | switch (oper) { |
| 14331 | case NL80211_TDLS_ENABLE_LINK: |
| 14332 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14333 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14334 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14335 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14336 | WLAN_STADescType staDesc; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14337 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14338 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14339 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14340 | if ( NULL == pTdlsPeer ) { |
| 14341 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 14342 | " (oper %d) not exsting. ignored", |
| 14343 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 14344 | return -EINVAL; |
| 14345 | } |
| 14346 | |
| 14347 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14348 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 14349 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 14350 | "NL80211_TDLS_ENABLE_LINK"); |
| 14351 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 14352 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 14353 | { |
| 14354 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 14355 | MAC_ADDRESS_STR " failed", |
| 14356 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 14357 | return -EINVAL; |
| 14358 | } |
| 14359 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14360 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14361 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14362 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 14363 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14364 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 14365 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 14366 | return -EINVAL; |
| 14367 | } |
| 14368 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14369 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14370 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14371 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 14372 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 14373 | * register with the TL on after the response for this operation |
| 14374 | * is received . |
| 14375 | */ |
| 14376 | ret = wait_for_completion_interruptible_timeout( |
| 14377 | &pAdapter->tdls_link_establish_req_comp, |
| 14378 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 14379 | if (ret <= 0) |
| 14380 | { |
| 14381 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14382 | "%s: Link Establish Request Faled Status %ld", |
| 14383 | __func__, ret); |
| 14384 | return -EINVAL; |
| 14385 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14386 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14387 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 14388 | eTDLS_LINK_CONNECTED, |
| 14389 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14390 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 14391 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
| 14392 | WLANTL_UpdateTdlsSTAClient(pHddCtx->pvosContext, |
| 14393 | &staDesc); |
| 14394 | |
| 14395 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 14396 | /* Mark TDLS client Authenticated .*/ |
| 14397 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 14398 | pTdlsPeer->staId, |
| 14399 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 14400 | if (VOS_STATUS_SUCCESS == status) |
| 14401 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14402 | if (pTdlsPeer->is_responder == 0) |
| 14403 | { |
| 14404 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 14405 | |
| 14406 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 14407 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 14408 | WAIT_TIME_TDLS_INITIATOR); |
| 14409 | /* suspend initiator TX until it receives direct packet from the |
| 14410 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 14411 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 14412 | &staId, NULL); |
| 14413 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 14414 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
| 14415 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14416 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14417 | |
| 14418 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 14419 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 14420 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14421 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 14422 | int ac; |
| 14423 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 14424 | WLANTL_AC_VI, |
| 14425 | WLANTL_AC_BK, |
| 14426 | WLANTL_AC_BE }; |
| 14427 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 14428 | for(ac=0; ac < 4; ac++) |
| 14429 | { |
| 14430 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 14431 | pTdlsPeer->staId, ucAc[ac], |
| 14432 | tlTid[ac], tlTid[ac], 0, 0, |
| 14433 | WLANTL_BI_DIR ); |
| 14434 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14435 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14436 | } |
| 14437 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14438 | } |
| 14439 | break; |
| 14440 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14441 | { |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14442 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 14443 | |
| 14444 | if ( NULL == pTdlsPeer ) { |
| 14445 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 14446 | " (oper %d) not exsting. ignored", |
| 14447 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 14448 | return -EINVAL; |
| 14449 | } |
| 14450 | |
| 14451 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14452 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 14453 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 14454 | "NL80211_TDLS_DISABLE_LINK"); |
| 14455 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14456 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14457 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14458 | long status; |
| 14459 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 14460 | |
| 14461 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 14462 | eTDLS_LINK_TEARING, |
| 14463 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 14464 | eTDLS_LINK_UNSPECIFIED: |
| 14465 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14466 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 14467 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14468 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14469 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14470 | |
| 14471 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 14472 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 14473 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 14474 | eTDLS_LINK_IDLE, |
| 14475 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14476 | if (status <= 0) |
| 14477 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14478 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14479 | "%s: Del station failed status %ld", |
| 14480 | __func__, status); |
| 14481 | return -EPERM; |
| 14482 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14483 | } |
| 14484 | else |
| 14485 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14486 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14487 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14488 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14489 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14490 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14491 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14492 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14493 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14494 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14495 | if (0 != status) |
| 14496 | { |
| 14497 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14498 | "%s: Error in TDLS Teardown", __func__); |
| 14499 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14500 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14501 | break; |
| 14502 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14503 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14504 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14505 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 14506 | peer, |
| 14507 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14508 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14509 | if (0 != status) |
| 14510 | { |
| 14511 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14512 | "%s: Error in TDLS Setup", __func__); |
| 14513 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 14514 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 14515 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14516 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14517 | case NL80211_TDLS_DISCOVERY_REQ: |
| 14518 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14520 | "%s: We don't support in-driver setup/teardown/discovery " |
| 14521 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14522 | return -ENOTSUPP; |
| 14523 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14524 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14525 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14526 | return -ENOTSUPP; |
| 14527 | } |
| 14528 | return 0; |
| 14529 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 14530 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14531 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 14532 | u8 *peer, enum nl80211_tdls_operation oper) |
| 14533 | { |
| 14534 | int ret; |
| 14535 | |
| 14536 | vos_ssr_protect(__func__); |
| 14537 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 14538 | vos_ssr_unprotect(__func__); |
| 14539 | |
| 14540 | return ret; |
| 14541 | } |
| 14542 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 14543 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 14544 | struct net_device *dev, u8 *peer) |
| 14545 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 14546 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14547 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 14548 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 14549 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14550 | #if TDLS_MGMT_VERSION2 |
| 14551 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 14552 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 14553 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 14554 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 14555 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14556 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 14557 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14558 | #endif |
| 14559 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14560 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 14561 | /* |
| 14562 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 14563 | * Callback rountine called upon receiving response for |
| 14564 | * get offload info |
| 14565 | */ |
| 14566 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 14567 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 14568 | { |
| 14569 | |
| 14570 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14571 | tANI_U8 tempReplayCounter[8]; |
| 14572 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14573 | |
| 14574 | ENTER(); |
| 14575 | |
| 14576 | if (NULL == pAdapter) |
| 14577 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14578 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14579 | "%s: HDD adapter is Null", __func__); |
| 14580 | return ; |
| 14581 | } |
| 14582 | |
| 14583 | if (NULL == pGtkOffloadGetInfoRsp) |
| 14584 | { |
| 14585 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14586 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 14587 | return ; |
| 14588 | } |
| 14589 | |
| 14590 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 14591 | { |
| 14592 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14593 | "%s: wlan Failed to get replay counter value", |
| 14594 | __func__); |
| 14595 | return ; |
| 14596 | } |
| 14597 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14598 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14599 | /* Update replay counter */ |
| 14600 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 14601 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 14602 | |
| 14603 | { |
| 14604 | /* changing from little to big endian since supplicant |
| 14605 | * works on big endian format |
| 14606 | */ |
| 14607 | int i; |
| 14608 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 14609 | |
| 14610 | for (i = 0; i < 8; i++) |
| 14611 | { |
| 14612 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 14613 | } |
| 14614 | } |
| 14615 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14616 | /* Update replay counter to NL */ |
| 14617 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14618 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14619 | } |
| 14620 | |
| 14621 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14622 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14623 | * This function is used to offload GTK rekeying job to the firmware. |
| 14624 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14625 | 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] | 14626 | struct cfg80211_gtk_rekey_data *data) |
| 14627 | { |
| 14628 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14629 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 14630 | hdd_station_ctx_t *pHddStaCtx; |
| 14631 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14632 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14633 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14634 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14635 | |
| 14636 | ENTER(); |
| 14637 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14638 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14639 | if (NULL == pAdapter) |
| 14640 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14641 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14642 | "%s: HDD adapter is Null", __func__); |
| 14643 | return -ENODEV; |
| 14644 | } |
| 14645 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14646 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14647 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 14648 | pAdapter->sessionId, pAdapter->device_mode)); |
| 14649 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14650 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14651 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14652 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14653 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14654 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14655 | "%s: HDD context is not valid", __func__); |
| 14656 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14657 | } |
| 14658 | |
| 14659 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14660 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14661 | if (NULL == hHal) |
| 14662 | { |
| 14663 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14664 | "%s: HAL context is Null!!!", __func__); |
| 14665 | return -EAGAIN; |
| 14666 | } |
| 14667 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14668 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 14669 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 14670 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 14671 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14672 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14673 | { |
| 14674 | /* changing from big to little endian since driver |
| 14675 | * works on little endian format |
| 14676 | */ |
| 14677 | tANI_U8 *p = |
| 14678 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 14679 | int i; |
| 14680 | |
| 14681 | for (i = 0; i < 8; i++) |
| 14682 | { |
| 14683 | p[7-i] = data->replay_ctr[i]; |
| 14684 | } |
| 14685 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14686 | |
| 14687 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 14688 | { |
| 14689 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14690 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 14691 | sizeof (tSirGtkOffloadParams)); |
| 14692 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14693 | pAdapter->sessionId); |
| 14694 | |
| 14695 | if (eHAL_STATUS_SUCCESS != status) |
| 14696 | { |
| 14697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14698 | "%s: sme_SetGTKOffload failed, returned %d", |
| 14699 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 14700 | |
| 14701 | /* Need to clear any trace of key value in the memory. |
| 14702 | * Thus zero out the memory even though it is local |
| 14703 | * variable. |
| 14704 | */ |
| 14705 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 14706 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14707 | return status; |
| 14708 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14709 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14710 | "%s: sme_SetGTKOffload successfull", __func__); |
| 14711 | } |
| 14712 | else |
| 14713 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14714 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14715 | "%s: wlan not suspended GTKOffload request is stored", |
| 14716 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14717 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14718 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 14719 | /* Need to clear any trace of key value in the memory. |
| 14720 | * Thus zero out the memory even though it is local |
| 14721 | * variable. |
| 14722 | */ |
| 14723 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 14724 | sizeof(hddGtkOffloadReqParams)); |
| 14725 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14726 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14727 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14728 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14729 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 14730 | struct cfg80211_gtk_rekey_data *data) |
| 14731 | { |
| 14732 | int ret; |
| 14733 | |
| 14734 | vos_ssr_protect(__func__); |
| 14735 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 14736 | vos_ssr_unprotect(__func__); |
| 14737 | |
| 14738 | return ret; |
| 14739 | } |
| 14740 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14741 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14742 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14743 | * This function is used to set access control policy |
| 14744 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14745 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 14746 | struct net_device *dev, |
| 14747 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14748 | { |
| 14749 | int i; |
| 14750 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14751 | hdd_hostapd_state_t *pHostapdState; |
| 14752 | tsap_Config_t *pConfig; |
| 14753 | v_CONTEXT_t pVosContext = NULL; |
| 14754 | hdd_context_t *pHddCtx; |
| 14755 | int status; |
| 14756 | |
| 14757 | ENTER(); |
| 14758 | |
| 14759 | if (NULL == pAdapter) |
| 14760 | { |
| 14761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14762 | "%s: HDD adapter is Null", __func__); |
| 14763 | return -ENODEV; |
| 14764 | } |
| 14765 | |
| 14766 | if (NULL == params) |
| 14767 | { |
| 14768 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14769 | "%s: params is Null", __func__); |
| 14770 | return -EINVAL; |
| 14771 | } |
| 14772 | |
| 14773 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14774 | status = wlan_hdd_validate_context(pHddCtx); |
| 14775 | |
| 14776 | if (0 != status) |
| 14777 | { |
| 14778 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14779 | "%s: HDD context is not valid", __func__); |
| 14780 | return status; |
| 14781 | } |
| 14782 | |
| 14783 | pVosContext = pHddCtx->pvosContext; |
| 14784 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 14785 | |
| 14786 | if (NULL == pHostapdState) |
| 14787 | { |
| 14788 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14789 | "%s: pHostapdState is Null", __func__); |
| 14790 | return -EINVAL; |
| 14791 | } |
| 14792 | |
| 14793 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 14794 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 14795 | |
| 14796 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 14797 | { |
| 14798 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 14799 | |
| 14800 | /* default value */ |
| 14801 | pConfig->num_accept_mac = 0; |
| 14802 | pConfig->num_deny_mac = 0; |
| 14803 | |
| 14804 | /** |
| 14805 | * access control policy |
| 14806 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 14807 | * listed in hostapd.deny file. |
| 14808 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 14809 | * listed in hostapd.accept file. |
| 14810 | */ |
| 14811 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 14812 | { |
| 14813 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 14814 | } |
| 14815 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 14816 | { |
| 14817 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 14818 | } |
| 14819 | else |
| 14820 | { |
| 14821 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14822 | "%s:Acl Policy : %d is not supported", |
| 14823 | __func__, params->acl_policy); |
| 14824 | return -ENOTSUPP; |
| 14825 | } |
| 14826 | |
| 14827 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 14828 | { |
| 14829 | pConfig->num_accept_mac = params->n_acl_entries; |
| 14830 | for (i = 0; i < params->n_acl_entries; i++) |
| 14831 | { |
| 14832 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14833 | "** Add ACL MAC entry %i in WhiletList :" |
| 14834 | MAC_ADDRESS_STR, i, |
| 14835 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 14836 | |
| 14837 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 14838 | sizeof(qcmacaddr)); |
| 14839 | } |
| 14840 | } |
| 14841 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 14842 | { |
| 14843 | pConfig->num_deny_mac = params->n_acl_entries; |
| 14844 | for (i = 0; i < params->n_acl_entries; i++) |
| 14845 | { |
| 14846 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14847 | "** Add ACL MAC entry %i in BlackList :" |
| 14848 | MAC_ADDRESS_STR, i, |
| 14849 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 14850 | |
| 14851 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 14852 | sizeof(qcmacaddr)); |
| 14853 | } |
| 14854 | } |
| 14855 | |
| 14856 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 14857 | { |
| 14858 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14859 | "%s: SAP Set Mac Acl fail", __func__); |
| 14860 | return -EINVAL; |
| 14861 | } |
| 14862 | } |
| 14863 | else |
| 14864 | { |
| 14865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14866 | "%s: Invalid device_mode = %s (%d)", |
| 14867 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 14868 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14869 | return -EINVAL; |
| 14870 | } |
| 14871 | |
| 14872 | return 0; |
| 14873 | } |
| 14874 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14875 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 14876 | struct net_device *dev, |
| 14877 | const struct cfg80211_acl_data *params) |
| 14878 | { |
| 14879 | int ret; |
| 14880 | vos_ssr_protect(__func__); |
| 14881 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 14882 | vos_ssr_unprotect(__func__); |
| 14883 | |
| 14884 | return ret; |
| 14885 | } |
| 14886 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14887 | #ifdef WLAN_NL80211_TESTMODE |
| 14888 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14889 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14890 | ( |
| 14891 | void *pAdapter, |
| 14892 | void *indCont |
| 14893 | ) |
| 14894 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14895 | tSirLPHBInd *lphbInd; |
| 14896 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14897 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14898 | |
| 14899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14900 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14901 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14902 | if (pAdapter == NULL) |
| 14903 | { |
| 14904 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14905 | "%s: pAdapter is NULL\n",__func__); |
| 14906 | return; |
| 14907 | } |
| 14908 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14909 | if (NULL == indCont) |
| 14910 | { |
| 14911 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14912 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14913 | return; |
| 14914 | } |
| 14915 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14916 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14917 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14918 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 14919 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14920 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14921 | GFP_ATOMIC); |
| 14922 | if (!skb) |
| 14923 | { |
| 14924 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14925 | "LPHB timeout, NL buffer alloc fail"); |
| 14926 | return; |
| 14927 | } |
| 14928 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14929 | 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] | 14930 | { |
| 14931 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14932 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 14933 | goto nla_put_failure; |
| 14934 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14935 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14936 | { |
| 14937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14938 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 14939 | goto nla_put_failure; |
| 14940 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 14941 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14942 | sizeof(tSirLPHBInd), lphbInd)) |
| 14943 | { |
| 14944 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14945 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 14946 | goto nla_put_failure; |
| 14947 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14948 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 14949 | return; |
| 14950 | |
| 14951 | nla_put_failure: |
| 14952 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14953 | "NLA Put fail"); |
| 14954 | kfree_skb(skb); |
| 14955 | |
| 14956 | return; |
| 14957 | } |
| 14958 | #endif /* FEATURE_WLAN_LPHB */ |
| 14959 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14960 | 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] | 14961 | { |
| 14962 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 14963 | int err = 0; |
| 14964 | #ifdef FEATURE_WLAN_LPHB |
| 14965 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 14966 | eHalStatus smeStatus; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14967 | #endif /* FEATURE_WLAN_LPHB */ |
| 14968 | |
| 14969 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 14970 | if (err) |
| 14971 | { |
| 14972 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14973 | "%s Testmode INV ATTR", __func__); |
| 14974 | return err; |
| 14975 | } |
| 14976 | |
| 14977 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 14978 | { |
| 14979 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14980 | "%s Testmode INV CMD", __func__); |
| 14981 | return -EINVAL; |
| 14982 | } |
| 14983 | |
| 14984 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 14985 | { |
| 14986 | #ifdef FEATURE_WLAN_LPHB |
| 14987 | /* Low Power Heartbeat configuration request */ |
| 14988 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 14989 | { |
| 14990 | int buf_len; |
| 14991 | void *buf; |
| 14992 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 14993 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 14994 | |
| 14995 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 14996 | { |
| 14997 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14998 | "%s Testmode INV DATA", __func__); |
| 14999 | return -EINVAL; |
| 15000 | } |
| 15001 | |
| 15002 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 15003 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15004 | |
| 15005 | hb_params_temp =(tSirLPHBReq *)buf; |
| 15006 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 15007 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 15008 | return -EINVAL; |
| 15009 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15010 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 15011 | if (NULL == hb_params) |
| 15012 | { |
| 15013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15014 | "%s Request Buffer Alloc Fail", __func__); |
| 15015 | return -EINVAL; |
| 15016 | } |
| 15017 | |
| 15018 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15019 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 15020 | hb_params, |
| 15021 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 15022 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15023 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15024 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15025 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15026 | vos_mem_free(hb_params); |
| 15027 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15028 | return 0; |
| 15029 | } |
| 15030 | #endif /* FEATURE_WLAN_LPHB */ |
| 15031 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15032 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15033 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15034 | return -EOPNOTSUPP; |
| 15035 | } |
| 15036 | |
| 15037 | return err; |
| 15038 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15039 | |
| 15040 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 15041 | { |
| 15042 | int ret; |
| 15043 | |
| 15044 | vos_ssr_protect(__func__); |
| 15045 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 15046 | vos_ssr_unprotect(__func__); |
| 15047 | |
| 15048 | return ret; |
| 15049 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15050 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 15051 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15052 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15053 | struct net_device *dev, |
| 15054 | int idx, struct survey_info *survey) |
| 15055 | { |
| 15056 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15057 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15058 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15059 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15060 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15061 | v_S7_t snr,rssi; |
| 15062 | int status, i, j, filled = 0; |
| 15063 | |
| 15064 | ENTER(); |
| 15065 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15066 | if (NULL == pAdapter) |
| 15067 | { |
| 15068 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15069 | "%s: HDD adapter is Null", __func__); |
| 15070 | return -ENODEV; |
| 15071 | } |
| 15072 | |
| 15073 | if (NULL == wiphy) |
| 15074 | { |
| 15075 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15076 | "%s: wiphy is Null", __func__); |
| 15077 | return -ENODEV; |
| 15078 | } |
| 15079 | |
| 15080 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15081 | status = wlan_hdd_validate_context(pHddCtx); |
| 15082 | |
| 15083 | if (0 != status) |
| 15084 | { |
| 15085 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15086 | "%s: HDD context is not valid", __func__); |
| 15087 | return status; |
| 15088 | } |
| 15089 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15090 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15091 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15092 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15093 | 0 != pAdapter->survey_idx || |
| 15094 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15095 | { |
| 15096 | /* The survey dump ops when implemented completely is expected to |
| 15097 | * return a survey of all channels and the ops is called by the |
| 15098 | * kernel with incremental values of the argument 'idx' till it |
| 15099 | * returns -ENONET. But we can only support the survey for the |
| 15100 | * operating channel for now. survey_idx is used to track |
| 15101 | * that the ops is called only once and then return -ENONET for |
| 15102 | * the next iteration |
| 15103 | */ |
| 15104 | pAdapter->survey_idx = 0; |
| 15105 | return -ENONET; |
| 15106 | } |
| 15107 | |
| 15108 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15109 | |
| 15110 | wlan_hdd_get_snr(pAdapter, &snr); |
| 15111 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 15112 | |
| 15113 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 15114 | hdd_wlan_get_freq(channel, &freq); |
| 15115 | |
| 15116 | |
| 15117 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 15118 | { |
| 15119 | if (NULL == wiphy->bands[i]) |
| 15120 | { |
| 15121 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 15122 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 15123 | continue; |
| 15124 | } |
| 15125 | |
| 15126 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 15127 | { |
| 15128 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 15129 | |
| 15130 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 15131 | { |
| 15132 | survey->channel = &band->channels[j]; |
| 15133 | /* The Rx BDs contain SNR values in dB for the received frames |
| 15134 | * while the supplicant expects noise. So we calculate and |
| 15135 | * return the value of noise (dBm) |
| 15136 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 15137 | */ |
| 15138 | survey->noise = rssi - snr; |
| 15139 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 15140 | filled = 1; |
| 15141 | } |
| 15142 | } |
| 15143 | } |
| 15144 | |
| 15145 | if (filled) |
| 15146 | pAdapter->survey_idx = 1; |
| 15147 | else |
| 15148 | { |
| 15149 | pAdapter->survey_idx = 0; |
| 15150 | return -ENONET; |
| 15151 | } |
| 15152 | |
| 15153 | return 0; |
| 15154 | } |
| 15155 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15156 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 15157 | struct net_device *dev, |
| 15158 | int idx, struct survey_info *survey) |
| 15159 | { |
| 15160 | int ret; |
| 15161 | |
| 15162 | vos_ssr_protect(__func__); |
| 15163 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 15164 | vos_ssr_unprotect(__func__); |
| 15165 | |
| 15166 | return ret; |
| 15167 | } |
| 15168 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15169 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15170 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15171 | * this is called when cfg80211 driver resume |
| 15172 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 15173 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15174 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15175 | { |
| 15176 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15177 | hdd_adapter_t *pAdapter; |
| 15178 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 15179 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 15180 | |
| 15181 | ENTER(); |
| 15182 | |
| 15183 | if ( NULL == pHddCtx ) |
| 15184 | { |
| 15185 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15186 | "%s: HddCtx validation failed", __func__); |
| 15187 | return 0; |
| 15188 | } |
| 15189 | |
| 15190 | if (pHddCtx->isLogpInProgress) |
| 15191 | { |
| 15192 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15193 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 15194 | return 0; |
| 15195 | } |
| 15196 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 15197 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15198 | { |
| 15199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15200 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 15201 | return 0; |
| 15202 | } |
| 15203 | |
| 15204 | spin_lock(&pHddCtx->schedScan_lock); |
| 15205 | pHddCtx->isWiphySuspended = FALSE; |
| 15206 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 15207 | { |
| 15208 | spin_unlock(&pHddCtx->schedScan_lock); |
| 15209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15210 | "%s: Return resume is not due to PNO indication", __func__); |
| 15211 | return 0; |
| 15212 | } |
| 15213 | // Reset flag to avoid updatating cfg80211 data old results again |
| 15214 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 15215 | spin_unlock(&pHddCtx->schedScan_lock); |
| 15216 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15217 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15218 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 15219 | |
| 15220 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 15221 | { |
| 15222 | pAdapter = pAdapterNode->pAdapter; |
| 15223 | if ( (NULL != pAdapter) && |
| 15224 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 15225 | { |
| 15226 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15227 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15228 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15229 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15230 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15231 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15232 | { |
| 15233 | /* Acquire wakelock to handle the case where APP's tries to |
| 15234 | * suspend immediately after updating the scan results. Whis |
| 15235 | * results in app's is in suspended state and not able to |
| 15236 | * process the connect request to AP |
| 15237 | */ |
| 15238 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15239 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15240 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15241 | |
| 15242 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15243 | "%s : cfg80211 scan result database updated", __func__); |
| 15244 | |
| 15245 | return 0; |
| 15246 | |
| 15247 | } |
| 15248 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 15249 | pAdapterNode = pNext; |
| 15250 | } |
| 15251 | |
| 15252 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15253 | "%s: Failed to find Adapter", __func__); |
| 15254 | return 0; |
| 15255 | } |
| 15256 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15257 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 15258 | { |
| 15259 | int ret; |
| 15260 | |
| 15261 | vos_ssr_protect(__func__); |
| 15262 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 15263 | vos_ssr_unprotect(__func__); |
| 15264 | |
| 15265 | return ret; |
| 15266 | } |
| 15267 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15268 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15269 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15270 | * this is called when cfg80211 driver suspends |
| 15271 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15272 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15273 | struct cfg80211_wowlan *wow) |
| 15274 | { |
| 15275 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15276 | |
| 15277 | ENTER(); |
| 15278 | if (NULL == pHddCtx) |
| 15279 | { |
| 15280 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15281 | "%s: HddCtx validation failed", __func__); |
| 15282 | return 0; |
| 15283 | } |
| 15284 | |
| 15285 | pHddCtx->isWiphySuspended = TRUE; |
| 15286 | |
| 15287 | EXIT(); |
| 15288 | |
| 15289 | return 0; |
| 15290 | } |
| 15291 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15292 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 15293 | struct cfg80211_wowlan *wow) |
| 15294 | { |
| 15295 | int ret; |
| 15296 | |
| 15297 | vos_ssr_protect(__func__); |
| 15298 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 15299 | vos_ssr_unprotect(__func__); |
| 15300 | |
| 15301 | return ret; |
| 15302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15303 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15304 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15305 | { |
| 15306 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 15307 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 15308 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 15309 | .change_station = wlan_hdd_change_station, |
| 15310 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 15311 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 15312 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 15313 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15314 | #else |
| 15315 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 15316 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 15317 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15318 | #endif |
| 15319 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 15320 | .add_key = wlan_hdd_cfg80211_add_key, |
| 15321 | .get_key = wlan_hdd_cfg80211_get_key, |
| 15322 | .del_key = wlan_hdd_cfg80211_del_key, |
| 15323 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 15324 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15325 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 15326 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15327 | .scan = wlan_hdd_cfg80211_scan, |
| 15328 | .connect = wlan_hdd_cfg80211_connect, |
| 15329 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 15330 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 15331 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 15332 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 15333 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 15334 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15335 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 15336 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 15337 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15338 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 15339 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 15340 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 15341 | .set_txq_params = wlan_hdd_set_txq_params, |
| 15342 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15343 | .get_station = wlan_hdd_cfg80211_get_station, |
| 15344 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 15345 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15346 | .add_station = wlan_hdd_cfg80211_add_station, |
| 15347 | #ifdef FEATURE_WLAN_LFR |
| 15348 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 15349 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 15350 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 15351 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 15352 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 15353 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 15354 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15355 | #ifdef FEATURE_WLAN_TDLS |
| 15356 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 15357 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 15358 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15359 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15360 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 15361 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15362 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 15363 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 15364 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 15365 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15366 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 15367 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15368 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15369 | #ifdef WLAN_NL80211_TESTMODE |
| 15370 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 15371 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15372 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15373 | }; |
| 15374 | |